Refactor forms/settings/ package.
This commit is contained in:
@@ -3,71 +3,78 @@
|
||||
//
|
||||
|
||||
#include "AdminSettingForm.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QStackedWidget>
|
||||
#include <QStringListModel>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "ui_tabformwidget.h"
|
||||
#include "UserOperationLogForm.h"
|
||||
#include "generalform.h"
|
||||
#include "systemsettingform.h"
|
||||
#include "SystemSettingform.h"
|
||||
#include "AccountTableForm.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "aboutwidget.h"
|
||||
#include "AboutWidget.h"
|
||||
|
||||
AdminSettingForm::AdminSettingForm(QWidget* parent, Qt::WindowFlags f) : TabFormWidget(parent) {
|
||||
AdminSettingForm::AdminSettingForm(QWidget* aParent, Qt::WindowFlags f)
|
||||
: TabFormWidget(aParent)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 8, 0, 1);
|
||||
ui->contentWidget->setLayout(layout);
|
||||
ui->contentWidget->setObjectName("contentWidgetWithBBorder");
|
||||
QListWidget* widget = new QListWidget(this);
|
||||
widget->setFixedWidth(250);
|
||||
QStringList menus;
|
||||
menus << tr("General") << tr("Account") << tr("System") << 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);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 8, 0, 8);
|
||||
this->ui->contentWidget->setLayout(layout);
|
||||
this->ui->contentWidget->setObjectName("contentWidgetWithBBorder");
|
||||
QListWidget* widget = new QListWidget(this);
|
||||
widget->setFixedWidth(250);
|
||||
QStringList menus;
|
||||
//menus << tr("General") << tr("Account") << tr("System") << tr("Information") << tr("Log") << tr("About");
|
||||
menus << tr("General") << tr("Account") << tr("System") << 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* spacerLine = new QWidget(this);
|
||||
spacerLine->setFixedWidth(2);
|
||||
spacerLine->setObjectName("verSpaceLine");
|
||||
spacerLine->setStyleSheet("margin-bottom:8px");
|
||||
layout->addWidget(spacerLine);
|
||||
layout->addWidget(stackedWidget);
|
||||
ui->commandWidget->hide();
|
||||
|
||||
addVerticalLine(layout);
|
||||
layout->addWidget(stackedWidget);
|
||||
this->ui->commandWidget->hide();
|
||||
GeneralForm* generalForm = new GeneralForm(this);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
|
||||
GeneralForm* generalForm = new GeneralForm(this);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
AccountTableForm* acc = new AccountTableForm(this);
|
||||
stackedWidget->addWidget(acc);
|
||||
|
||||
AccountTableForm* acc = new AccountTableForm(this);
|
||||
SystemSettingForm* systemSetting = new SystemSettingForm(this);
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
|
||||
stackedWidget->addWidget(acc);
|
||||
AboutWidget* about = new AboutWidget(this);
|
||||
stackedWidget->addWidget(about);
|
||||
|
||||
systemSettingForm* systemSetting = new systemSettingForm(this);
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
|
||||
AboutWidget* about = new AboutWidget(this);
|
||||
stackedWidget->addWidget(about);
|
||||
|
||||
|
||||
widget->setCurrentRow(0);
|
||||
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
|
||||
stackedWidget->setCurrentIndex(rowindex);
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
QStringList menus2;
|
||||
menus2 << tr("General") << tr("Account") << tr("System") << tr("About");
|
||||
widget->clear();
|
||||
widget->addItems(menus2);
|
||||
for (int i = 0; i < menus.count(); ++i) {
|
||||
widget->item(i)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
});
|
||||
widget->setCurrentRow(0);
|
||||
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
|
||||
stackedWidget->setCurrentIndex(rowindex);
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
QStringList menus;
|
||||
menus << tr("General") << tr("Account") << tr("System") << tr("About");
|
||||
widget->clear();
|
||||
widget->addItems(menus);
|
||||
for (int i = 0; i < menus.count(); ++i)
|
||||
{
|
||||
widget->item(i)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
AdminSettingForm::~AdminSettingForm() {
|
||||
AdminSettingForm::~AdminSettingForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user