Rename AdminSettingForm to SettingFormWidget.
This commit is contained in:
77
src/forms/settings/SettingFormWidget.cpp
Normal file
77
src/forms/settings/SettingFormWidget.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// Created by Krad on 2021/11/22.
|
||||
//
|
||||
|
||||
#include "SettingFormWidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QStackedWidget>
|
||||
#include <QStringListModel>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "ui_tabformwidget.h"
|
||||
#include "UserOperationLogForm.h"
|
||||
#include "generalform.h"
|
||||
#include "SystemSettingform.h"
|
||||
#include "AccountTableForm.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "AboutWidget.h"
|
||||
|
||||
SettingFormWidget::SettingFormWidget(QWidget* aParent, Qt::WindowFlags f)
|
||||
: TabFormWidget(aParent)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(ui->contentWidget);
|
||||
// layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->contentWidget->setObjectName("settingContentWidget");
|
||||
QListWidget* widget = new QListWidget(ui->contentWidget);
|
||||
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(ui->contentWidget);
|
||||
|
||||
QWidget* spacerLine = new QWidget(this);
|
||||
spacerLine->setObjectName("verSpaceLine");
|
||||
layout->addWidget(spacerLine);
|
||||
layout->addWidget(stackedWidget);
|
||||
ui->commandWidget->hide();
|
||||
|
||||
GeneralForm* generalForm = new GeneralForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(generalForm);
|
||||
|
||||
AccountTableForm* acc = new AccountTableForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(acc);
|
||||
|
||||
SystemSettingForm* systemSetting = new SystemSettingForm(ui->commandWidget);
|
||||
stackedWidget->addWidget(systemSetting);
|
||||
|
||||
AboutWidget* about = new AboutWidget(ui->commandWidget);
|
||||
stackedWidget->addWidget(about);
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SettingFormWidget::~SettingFormWidget()
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user