Files
GUI/src/forms/settings/AdminSettingForm.cpp

74 lines
2.1 KiB
C++
Raw Normal View History

//
// Created by Krad on 2021/11/22.
//
#include "AdminSettingForm.h"
#include <QHBoxLayout>
#include <QStackedWidget>
#include <QStringListModel>
#include <QListWidget>
#include "ui_tabformwidget.h"
2021-11-23 13:22:00 +08:00
#include "UserOperationLogForm.h"
2021-12-07 14:13:55 +08:00
#include "generalform.h"
#include "systemsettingform.h"
2021-12-08 15:10:56 +08:00
#include "AccountTableForm.h"
2021-12-21 16:06:21 +08:00
#include "event/EventCenter.h"
2022-01-04 17:10:14 +08:00
#include "aboutwidget.h"
2021-12-07 14:13:55 +08:00
AdminSettingForm::AdminSettingForm(QWidget* parent, Qt::WindowFlags f) : TabFormWidget(parent) {
2021-12-07 14:13:55 +08:00
QHBoxLayout* layout = new QHBoxLayout(this);
2021-12-28 11:49:07 +08:00
layout->setMargin(0);
layout->setContentsMargins(0, 8, 0, 8);
2021-12-07 14:13:55 +08:00
this->ui->contentWidget->setLayout(layout);
2022-02-14 11:06:28 +08:00
this->ui->contentWidget->setObjectName("contentWidgetWithBBorder");
2021-12-07 14:13:55 +08:00
QListWidget* widget = new QListWidget(this);
widget->setFixedWidth(250);
QStringList menus;
2021-12-28 18:23:02 +08:00
//menus << tr("General") << tr("Account") << tr("System") << tr("Information") << tr("Log") << tr("About");
2022-01-04 17:10:14 +08:00
menus << tr("General") << tr("Account") << tr("System") << tr("About");
2021-12-07 14:13:55 +08:00
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);
addVerticalLine(layout);
2021-12-07 14:13:55 +08:00
layout->addWidget(stackedWidget);
this->ui->commandWidget->hide();
2021-12-07 14:13:55 +08:00
GeneralForm* generalForm = new GeneralForm(this);
stackedWidget->addWidget(generalForm);
2021-12-28 11:49:07 +08:00
AccountTableForm* acc = new AccountTableForm(this);
2021-12-08 15:10:56 +08:00
2021-12-07 14:13:55 +08:00
stackedWidget->addWidget(acc);
2021-12-07 14:13:55 +08:00
systemSettingForm* systemSetting = new systemSettingForm(this);
stackedWidget->addWidget(systemSetting);
2021-11-23 13:22:00 +08:00
2022-01-04 17:10:14 +08:00
AboutWidget* about = new AboutWidget(this);
2021-12-07 14:13:55 +08:00
stackedWidget->addWidget(about);
2022-01-04 17:10:14 +08:00
2021-12-07 14:13:55 +08:00
widget->setCurrentRow(0);
connect(widget, &QListWidget::currentRowChanged, [=](int rowindex) {
stackedWidget->setCurrentIndex(rowindex);
2021-12-28 11:49:07 +08:00
});
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
QStringList menus2;
2022-01-04 17:10:14 +08:00
menus2 << tr("General") << tr("Account") << tr("System") << tr("About");
2021-12-28 11:49:07 +08:00
widget->clear();
widget->addItems(menus2);
for (int i = 0; i < menus.count(); ++i) {
widget->item(i)->setTextAlignment(Qt::AlignCenter);
}
});
}
AdminSettingForm::~AdminSettingForm() {
}