System setting about
This commit is contained in:
@@ -12,52 +12,62 @@
|
||||
#include "ui_tabformwidget.h"
|
||||
#include <QLabel>
|
||||
#include "UserOperationLogForm.h"
|
||||
#include "generalform.h"
|
||||
#include <QPushButton>
|
||||
#include "systemsettingform.h"
|
||||
|
||||
AdminSettingForm::AdminSettingForm(QWidget *parent, Qt::WindowFlags f) : TabFormWidget(parent) {
|
||||
AdminSettingForm::AdminSettingForm(QWidget* parent, Qt::WindowFlags f) : TabFormWidget(parent) {
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
this->ui->contentWidget->setLayout(layout);
|
||||
QListWidget* widget = new QListWidget(this);
|
||||
widget->setFixedWidth(250);
|
||||
QStringList menus;
|
||||
menus<<tr("Account Manage")<<tr("System Setting")<<tr("System Information")<<tr("Operation Log")<<tr("About");
|
||||
widget->addItems(menus);
|
||||
widget->setSpacing(3);
|
||||
for (int i = 0; i < menus.count(); ++i) {
|
||||
widget->item(i)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
layout->addWidget(widget);
|
||||
QStackedWidget* stackedWidget = new QStackedWidget(this);
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
this->ui->contentWidget->setLayout(layout);
|
||||
QListWidget* widget = new QListWidget(this);
|
||||
widget->setFixedWidth(250);
|
||||
QStringList menus;
|
||||
menus << tr("General") << tr("Account Manage") << tr("System Setting") << tr("System Information") << tr("Operation Log") << tr("About");
|
||||
widget->addItems(menus);
|
||||
widget->setSpacing(3);
|
||||
for (int i = 0; i < menus.count(); ++i) {
|
||||
widget->item(i)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
layout->addWidget(widget);
|
||||
QStackedWidget* stackedWidget = new QStackedWidget(this);
|
||||
|
||||
QWidget* spacerLine2= new QWidget(this);
|
||||
spacerLine2->setFixedWidth(2);
|
||||
spacerLine2->setObjectName("verSpaceLine");
|
||||
layout->addWidget(spacerLine2);
|
||||
layout->addWidget(stackedWidget);
|
||||
this->ui->commandWidget->hide();
|
||||
QLabel* acc = new QLabel(this);
|
||||
acc->setText("Account Manage");
|
||||
stackedWidget->addWidget(acc);
|
||||
QWidget* spacerLine2 = new QWidget(this);
|
||||
spacerLine2->setFixedWidth(2);
|
||||
spacerLine2->setObjectName("verSpaceLine");
|
||||
layout->addWidget(spacerLine2);
|
||||
layout->addWidget(stackedWidget);
|
||||
this->ui->commandWidget->hide();
|
||||
|
||||
QLabel* systemSetting = new QLabel(this);
|
||||
systemSetting->setText("systemSetting");
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
GeneralForm* generalForm = new GeneralForm(this);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
|
||||
QLabel* Info = new QLabel(this);
|
||||
Info->setText("info");
|
||||
stackedWidget->addWidget(Info);
|
||||
QLabel* acc = new QLabel(this);
|
||||
acc->setText("Account Manage");
|
||||
stackedWidget->addWidget(acc);
|
||||
|
||||
UserOperationLogForm* operationLogForm = new UserOperationLogForm(this);
|
||||
systemSettingForm* systemSetting = new systemSettingForm(this);
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
|
||||
stackedWidget->addWidget(operationLogForm);
|
||||
//QLabel* systemSetting = new QLabel(this);
|
||||
//systemSetting->setText("systemSetting");
|
||||
//stackedWidget->addWidget(systemSetting);
|
||||
|
||||
QLabel* about = new QLabel(this);
|
||||
about->setText("About");
|
||||
stackedWidget->addWidget(about);
|
||||
widget->setCurrentRow(0);
|
||||
connect(widget,&QListWidget::currentRowChanged,[=](int rowindex){
|
||||
stackedWidget->setCurrentIndex(rowindex);
|
||||
});
|
||||
QLabel* Info = new QLabel(this);
|
||||
Info->setText("info");
|
||||
stackedWidget->addWidget(Info);
|
||||
|
||||
UserOperationLogForm* operationLogForm = new UserOperationLogForm(this);
|
||||
|
||||
stackedWidget->addWidget(operationLogForm);
|
||||
|
||||
QLabel* about = new QLabel(this);
|
||||
about->setText("About");
|
||||
stackedWidget->addWidget(about);
|
||||
widget->setCurrentRow(0);
|
||||
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
|
||||
stackedWidget->setCurrentIndex(rowindex);
|
||||
});
|
||||
}
|
||||
|
||||
AdminSettingForm::~AdminSettingForm() {
|
||||
|
||||
76
src/systemsettingform.cpp
Normal file
76
src/systemsettingform.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "systemsettingform.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QEvent>
|
||||
|
||||
#include "json/jsonobject.h"
|
||||
#include "SelectDialog.h"
|
||||
|
||||
systemSettingForm::systemSettingForm(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
|
||||
QWidget* protocalHeader = new QWidget(this);
|
||||
layout->addWidget(protocalHeader);
|
||||
QHBoxLayout* protocalHeaderLayout = new QHBoxLayout(protocalHeader);
|
||||
protocalHeaderLayout->addWidget(new QLabel(tr("Default Protocal")));
|
||||
QPushButton* btnPro = new QPushButton(protocalHeader);
|
||||
protocalHeaderLayout->addWidget(btnPro);
|
||||
protocalHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
|
||||
QWidget* filterHeader = new QWidget(this);
|
||||
layout->addWidget(filterHeader);
|
||||
QHBoxLayout* filterHeaderLayout = new QHBoxLayout(filterHeader);
|
||||
filterHeaderLayout->addWidget(new QLabel(tr("Default Worklist Filter")));
|
||||
QPushButton* btnFlt = new QPushButton(filterHeader);
|
||||
filterHeaderLayout->addWidget(btnFlt);
|
||||
filterHeaderLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
||||
|
||||
|
||||
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
||||
|
||||
//init
|
||||
btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
||||
btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
||||
|
||||
|
||||
connect(btnPro, &QPushButton::clicked, [=]() {
|
||||
if (!protocal) {
|
||||
protocal = new SelectDialog(this);
|
||||
protocal->setWindowModality(Qt::WindowModal);
|
||||
}
|
||||
protocal->setAvailableDates(JsonObject::Instance()->protocals());
|
||||
protocal->setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
||||
if (protocal->exec() == QDialog::Accepted)
|
||||
{
|
||||
QString pro = protocal->getSelectedValue();
|
||||
//take effect
|
||||
JsonObject::Instance()->setDefaultProtocal(pro);
|
||||
btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
||||
}
|
||||
});
|
||||
|
||||
connect(btnFlt, &QPushButton::clicked, [=]() {
|
||||
if (!protocal) {
|
||||
filter = new SelectDialog(this);
|
||||
filter->setWindowModality(Qt::WindowModal);
|
||||
}
|
||||
filter->setAvailableDates(JsonObject::Instance()->worklistFilters());
|
||||
filter->setSelectedValue(JsonObject::Instance()->defaultFilter());
|
||||
if (filter->exec() == QDialog::Accepted)
|
||||
{
|
||||
QString pro = filter->getSelectedValue();
|
||||
//take effect
|
||||
JsonObject::Instance()->setDefaultFilter(pro);
|
||||
btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
25
src/systemsettingform.h
Normal file
25
src/systemsettingform.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef SYSTEMSETTINGFORM_H
|
||||
#define SYSTEMSETTINGFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
class QPushButton;
|
||||
class QVBoxLayout;
|
||||
class SelectDialog;
|
||||
|
||||
class systemSettingForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit systemSettingForm(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QVBoxLayout* layout = nullptr;
|
||||
SelectDialog* protocal = nullptr;
|
||||
SelectDialog* filter = nullptr;
|
||||
};
|
||||
|
||||
#endif // SYSTEMSETTINGFORM_H
|
||||
Reference in New Issue
Block a user