Commit dcf50ec3 by 1139102985@qq.com

添加外卖的设置,相关修改逻辑

parent 1926f363
#include "fmp_settings.h"
#include "fmp_settings.h"
#include <QSettings>
#include <fmp_logger_i.h>
#include <ctkServiceReference.h>
......@@ -69,6 +69,7 @@ FMPSettingsPrivate::FMPSettingsPrivate(ctkPluginContext *ctx)
: _ctx(ctx),
_sets(0)
{
}
int FMPSettingsPrivate::Init()
......@@ -78,7 +79,9 @@ int FMPSettingsPrivate::Init()
}
else {
FMPSettingsWindow * set_dlg = new FMPSettingsWindow;
set_dlg->setsettings(_sets);
set_dlg->show();
connect(set_dlg,&FMPSettingsWindow::settingChanged,this,&FMPSettingsPrivate::SetValue);
}
return FMP_SUCCESS;
......
#ifndef FMP_SETTINGS_H
#ifndef FMP_SETTINGS_H
#define FMP_SETTINGS_H
#include "fmp_settings_i.h"
#include "ui./window.h"
class ctkPluginContext;
class FMPSettingsPrivate;
......@@ -40,8 +41,9 @@ class QSettings;
/**
* @brief The FMPSettingsPrivate class
*/
class FMPSettingsPrivate
class FMPSettingsPrivate:public QObject
{
Q_OBJECT
Q_DECLARE_PUBLIC(FMPSettings)
public:
explicit FMPSettingsPrivate(ctkPluginContext *ctx);
......@@ -55,6 +57,8 @@ public:
FMPSettings *q_ptr;
ctkPluginContext *_ctx;
QSettings *_sets;
private:
FMPSettingsWindow *settingwindow;
};
#endif // FMP_SETTINGS_H
......@@ -15,14 +15,24 @@
#define FMP_INIKEY_PLUGINPATH "Plugin/Path"
#define FMP_INIKEY_ANIMATION "Plugin/Animation"
#define FMP_INIKEY_EPAYTIMEOUT "Epay/Timeout"
#define FMP_INIKEY_EPAYURL "Epay/URL"
#define FMP_INIKEY_LOGPATH "Log/Path"
#define FMP_INIKEY_LOGSIZE "Log/Size"
#define FMP_INIKEY_LOGLEVEL "Log/Level"
#define FMP_INIKEY_LOGINSERVER "Home/Server"
#define FMP_INIKEY_LOGINPWD "Home/Pwd"
#define FMP_INIKEY_LOGINSTOREID "Home/StoreId"
#define FMP_INIKEY_LOGINPOSID "Home/PosId"
#define FMP_INIKEY_LOGINBUSINESS "Home/Business"
#define FMP_INIKEY_LOGINCASHIER "Home/CashierId"
#define FMP_INIKEY_LOGINPARTNERID "Home/PartnerId"
#define FMP_INIKEY_HOMEPOSITION "Home/Position"
#define FMP_INIKEY_HOMEAUTOLOGIN "Home/Autologin"
#define FMP_INIKEY_HOMEACCOUNT "Home/Account"
#define FMP_INIKEY_VIPSERVER "Vip/Server"
......@@ -30,6 +40,17 @@
#define FMP_APPNAME "非码POS"
#define FMP_INIKEY_PRINTER "Printer/printname"
#define FMP_INIKEY_PRINTERNAME "Printer/Printname"
#define FMP_INIKEY_PRINTERSIZE "Printer/Printsize"
#define FMP_INIKEY_TAKEOUTCUSTOMER "FMTAKEOOUT/Customer"
#define fmp_INIKEY_TAKEOUTDELIVER "FMTAKEOOUT/Deliver"
#define FMP_INIKEY_TAKEOUTSTORE "FMTAKEOOUT/Store"
#define FMP_INIKEY_TAKEOUTPWD "FMTAKEOOUT/Passwd"
#define fmp_INIKEY_TAKEOUTENTRYPORT "FMTAKEOOUT/Entryport"
#define FMP_INIKEY_TAKEOUTENTRYSERVER "FMTAKEOOUT/Entryurl"
#define fmp_INIKEY_TAKEOUTAUTO "FMTAKEOOUT/Autoconfirm"
#define FMP_INIKEY_TAKEOUTSERVER "FMTAKEOOUT/Url"
#define FMP_INIKEY_TAKEOUTSTOREID "FMTAKEOOUT/StoreId"
#endif // FMP_SETTINGS_DEF_H
#ifndef FMP_SETTINGS_I_H
#ifndef FMP_SETTINGS_I_H
#define FMP_SETTINGS_I_H
#include <QVariant>
......
#include "window.h"
#include "window.h"
#include "ui_window.h"
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include "fmp_settings_def.h"
#include <qDebug>
#include <QScrollBar>
FMPSettingsWindow::FMPSettingsWindow(QWidget *parent) :
FMPWindow(parent),
ui(new Ui::FMPSettingsWindow)
......@@ -13,3 +18,120 @@ FMPSettingsWindow::~FMPSettingsWindow()
{
delete ui;
}
void FMPSettingsWindow::setsettings(QSettings* set)
{
m_set=set;
ui->edt_posid->setText(m_set->value(FMP_INIKEY_LOGINPOSID).toString());
ui->edt_pwd->setText(m_set->value(FMP_INIKEY_LOGINPWD).toString());
ui->edt_pwd_2->setText(m_set->value(FMP_INIKEY_LOGINPWD).toString());
ui->edt_partnerid->setText(m_set->value(FMP_INIKEY_LOGINPARTNERID).toString());
ui->edt_account->setText(m_set->value(FMP_INIKEY_HOMEACCOUNT).toString());
ui->edt_pluginpath->setText(m_set->value(FMP_INIKEY_PLUGINPATH).toString());
ui->edt_logpath->setText(m_set->value(FMP_INIKEY_LOGPATH).toString());
ui->edt_loginsvr->setText(m_set->value(FMP_INIKEY_LOGINSERVER).toString());
ui->edt_storeid->setText(m_set->value(FMP_INIKEY_LOGINSTOREID).toString());
ui->edt_logsize->setText(m_set->value(FMP_INIKEY_LOGSIZE).toString());
ui->switch_animation->setChecked(m_set->value(FMP_INIKEY_ANIMATION).toBool());
ui->switch_autologin->setChecked(m_set->value(FMP_INIKEY_HOMEAUTOLOGIN).toBool());
ui->select_loglevel->setCurrentIndex(m_set->value(FMP_INIKEY_LOGLEVEL).toInt());
ui->select_printer->setCurrentText(m_set->value(FMP_INIKEY_PRINTERNAME).toString());
ui->select_printersize->setCurrentText(m_set->value(FMP_INIKEY_PRINTERSIZE).toString());
ui->check_autoconfirm->setChecked(m_set->value(fmp_INIKEY_TAKEOUTAUTO).toBool());
ui->check_customer->setCheckable(m_set->value(FMP_INIKEY_TAKEOUTCUSTOMER).toBool());
ui->check_deliver->setCheckable(m_set->value(fmp_INIKEY_TAKEOUTDELIVER).toBool());
ui->check_store->setCheckable(m_set->value(FMP_INIKEY_TAKEOUTSTORE).toBool());
ui->edt_orderurl->setText(m_set->value(FMP_INIKEY_TAKEOUTSERVER).toString());
ui->edt_entryport->setText(m_set->value(fmp_INIKEY_TAKEOUTENTRYPORT).toString());
ui->edt_entryurl->setText(m_set->value(FMP_INIKEY_TAKEOUTENTRYSERVER).toString());
ui->edt_storeid_2->setText(m_set->value(FMP_INIKEY_TAKEOUTSTOREID).toString());
ui->edt_cashierid->setText(m_set->value(FMP_INIKEY_LOGINCASHIER).toString());
/*--------------------------------------------------------------*/
ui->edt_posid->home(false);
ui->edt_pwd->home(false);
ui->edt_pwd_2->home(false);
ui->edt_partnerid->home(false);
ui->edt_account->home(false);
ui->edt_pluginpath->home(false);
ui->edt_logpath->home(false);
ui->edt_loginsvr->home(false);
ui->edt_storeid->home(false);
ui->edt_logsize->home(false);
ui->edt_orderurl->home(false);
ui->edt_entryport->home(false);
ui->edt_entryurl->home(false);
ui->edt_storeid_2->home(false);
ui->edt_cashierid->home(false);
}
QWidget *FMPSettingsWindow::getwidget(QString widgetname)
{
if(!widgetname.compare("general"))
{
return ui->general;
}
if(!widgetname.compare("pay"))
{
return ui->pay;
}
if(!widgetname.compare("takeout"))
{
return ui->takeout;
}
}
void FMPSettingsWindow::onSettingeditingFinished()
{
QLineEdit *edt=(QLineEdit*)sender();
edt->home(false);
qDebug()<<edt->property("key").toString()<<edt->text();
emit settingChanged(edt->property("key").toString(),edt->text());
}
void FMPSettingsWindow::onsettingcombo_currentIndex(QString content)
{
QComboBox *combox=(QComboBox*)sender();
emit settingChanged(combox->property("key").toString(),content);
}
void FMPSettingsWindow::onsettingcombo_currentIndex(int content)
{
QComboBox *combox=(QComboBox*)sender();
emit settingChanged(combox->property("key").toString(),content);
}
void FMPSettingsWindow::onSettingcheck_clicked(bool checked)
{
QCheckBox* check=(QCheckBox*)sender();
emit settingChanged(check->property("key").toString(),(int)checked);
}
//void FMPSettingsWindow::on_btn_pluginpath_clicked()
//{
// QString pluginpath = QFileDialog::getExistingDirectory(this, "路径选择",NULL, QFileDialog::ShowDirsOnly);
// if(!logpath.isEmpty())
// {
// ui->edt_pluginpath->setText(pluginpath);
// }
//
//}
void FMPSettingsWindow::on_btn_logpath_clicked()
{
QString logpath = QFileDialog::getExistingDirectory(this, "路径选择",NULL, NULL);
if(!logpath.isEmpty())
{
ui->edt_logpath->setText(logpath);
ui->edt_logpath->editingFinished();
}
}
void FMPSettingsWindow::on_btn_showwidget_clicked()
{
QPushButton* btn=(QPushButton*)sender();
QWidget *presentwidget=getwidget(btn->property("widget").toString());
ui->scrollArea->verticalScrollBar()->setValue(presentwidget->y());
}
#ifndef FMP_SETS_DLG_H
#ifndef FMP_SETS_DLG_H
#define FMP_SETS_DLG_H
#include <fmp_window.hpp>
#include <QWidget>
#include <QFileDialog>
#include <QSettings>
#include <QPushButton>
namespace Ui {
class FMPSettingsWindow;
......@@ -15,9 +18,23 @@ class FMPSettingsWindow : public FMPWindow
public:
explicit FMPSettingsWindow(QWidget *parent = 0);
~FMPSettingsWindow();
void setsettings(QSettings *set);
signals:
bool settingChanged(const QString&,QVariant);
private:
Ui::FMPSettingsWindow *ui;
QSettings *m_set;
QWidget *getwidget(QString widgetname);
private slots:
void onSettingeditingFinished();
void onSettingcheck_clicked(bool checked);
void onsettingcombo_currentIndex(QString content);
void onsettingcombo_currentIndex(int content);
//void on_btn_pluginpath_clicked();
void on_btn_logpath_clicked();
void on_btn_showwidget_clicked();
};
#endif // FMP_SETS_DLG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment