Refactor system page in GUI Alpha.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QStackedWidget>
|
||||
#include <QStringListModel>
|
||||
#include <QListWidgetItem>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "ui_TabFormWidget.h"
|
||||
@@ -18,6 +19,8 @@
|
||||
#include "json/jsonobject.h"
|
||||
#include "AboutForm.h"
|
||||
#include "UserOperationLogForm.h"
|
||||
#include "SystemCorrectionForm.h"
|
||||
#include "HelpForm.h"
|
||||
|
||||
SettingFormWidget::SettingFormWidget(QWidget* aParent, Qt::WindowFlags f)
|
||||
: TabFormWidget(aParent)
|
||||
@@ -30,7 +33,7 @@ SettingFormWidget::SettingFormWidget(QWidget* aParent, Qt::WindowFlags f)
|
||||
widget->setObjectName("LeftBtnBar");
|
||||
widget->setFixedWidth(250);
|
||||
QStringList menus;
|
||||
menus << tr("General") << tr("Account") << tr("System") << tr("About") << tr("Operation Log");
|
||||
menus << tr("System Correction") << tr("Network Settings") << tr("General") << tr("Operation Log") << tr("Account") << tr("About") << tr("Help");
|
||||
widget->addItems(menus);
|
||||
widget->setSpacing(3);
|
||||
for (int i = 0; i < menus.count(); ++i)
|
||||
@@ -39,7 +42,7 @@ SettingFormWidget::SettingFormWidget(QWidget* aParent, Qt::WindowFlags f)
|
||||
}
|
||||
layout->addWidget(widget);
|
||||
//reset visible for AnonymousMode
|
||||
widget->item(4)->setHidden(JsonObject::Instance()->getAnonymousMode());
|
||||
widget->item(3)->setHidden(JsonObject::Instance()->getAnonymousMode());
|
||||
QStackedWidget* stackedWidget = new QStackedWidget(ui->contentWidget);
|
||||
|
||||
QWidget* spacerLine = new QWidget(this);
|
||||
@@ -48,38 +51,51 @@ SettingFormWidget::SettingFormWidget(QWidget* aParent, Qt::WindowFlags f)
|
||||
layout->addWidget(stackedWidget);
|
||||
ui->commandWidget->hide();
|
||||
|
||||
GeneralForm* generalForm = new GeneralForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
|
||||
AccountTableForm* acc = new AccountTableForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(acc);
|
||||
SystemCorrectionForm* systemCorrectionForm = new SystemCorrectionForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(systemCorrectionForm);
|
||||
|
||||
SystemSettingForm* systemSetting = new SystemSettingForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
|
||||
AboutForm* about = new AboutForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(about);
|
||||
GeneralForm* generalForm = new GeneralForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
|
||||
UserOperationLogForm* operationLog = new UserOperationLogForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(operationLog);
|
||||
|
||||
AccountTableForm* acc = new AccountTableForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(acc);
|
||||
|
||||
AboutForm* about = new AboutForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(about);
|
||||
|
||||
//HelpForm* help = new HelpForm(ui->commandWidget);
|
||||
//stackedWidget->addWidget(help);
|
||||
|
||||
widget->setCurrentRow(0);
|
||||
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
|
||||
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex)
|
||||
{
|
||||
if(widget->item(rowindex)->text() == tr("Help") && stackedWidget->widget(rowindex) == nullptr)
|
||||
{
|
||||
stackedWidget->addWidget(new HelpForm(ui->commandWidget));
|
||||
}
|
||||
stackedWidget->setCurrentIndex(rowindex);
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, [=]() {
|
||||
widget->item(4)->setHidden(JsonObject::Instance()->getAnonymousMode());
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, [=]()
|
||||
{
|
||||
widget->item(3)->setHidden(JsonObject::Instance()->getAnonymousMode());
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]()
|
||||
{
|
||||
QStringList menus;
|
||||
menus << tr("General") << tr("Account") << tr("System") << tr("About") << tr("Operation Log");
|
||||
menus << tr("System Correction") << tr("Network Settings") << tr("General") << tr("Operation Log") << tr("Account") << tr("About") << tr("Help") ;
|
||||
widget->clear();
|
||||
widget->addItems(menus);
|
||||
for (int i = 0; i < menus.count(); ++i)
|
||||
{
|
||||
widget->item(i)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
SettingFormWidget::~SettingFormWidget()
|
||||
|
||||
Reference in New Issue
Block a user