Add APP settings page

This commit is contained in:
2026-04-11 09:05:20 +08:00
parent fd40dad20c
commit cf27fae386
2 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
#include "APP/AppSettingsPage.h"
#include "APP/AppTheme.h"
#include <QtWidgets/QFrame>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
namespace APP
{
App_SettingsPage::App_SettingsPage(QWidget* p_Parent)
: QWidget(p_Parent)
{
QVBoxLayout* const p_RootLayout = new QVBoxLayout(this);
p_RootLayout->setContentsMargins(0, 0, 0, 0);
p_RootLayout->setSpacing(12);
QFrame* const p_Card = new QFrame(this);
p_Card->setStyleSheet(App_Theme_BuildCardStyleSheet());
p_RootLayout->addWidget(p_Card);
QVBoxLayout* const p_CardLayout = new QVBoxLayout(p_Card);
p_CardLayout->setContentsMargins(20, 20, 20, 20);
p_CardLayout->setSpacing(14);
QLabel* const p_Title = new QLabel(QStringLiteral("Settings"), p_Card);
p_Title->setProperty("role", "title");
p_CardLayout->addWidget(p_Title);
QLabel* const p_Body = new QLabel(
QStringLiteral("Use this page to present transport status and the latest function result."),
p_Card);
p_Body->setProperty("role", "body");
p_Body->setWordWrap(true);
p_CardLayout->addWidget(p_Body);
QFormLayout* const p_FormLayout = new QFormLayout();
p_FormLayout->setHorizontalSpacing(12);
p_FormLayout->setVerticalSpacing(12);
p_CardLayout->addLayout(p_FormLayout);
appConnectionLabel = new QLabel(QStringLiteral("Disconnected"), p_Card);
appLastActionLabel = new QLabel(QStringLiteral("Idle"), p_Card);
p_FormLayout->addRow(QStringLiteral("Transport"), appConnectionLabel);
p_FormLayout->addRow(QStringLiteral("Last Action"), appLastActionLabel);
}
void App_SettingsPage::App_Func_SetConnectionText(const QString& Text)
{
appConnectionLabel->setText(Text.trimmed().isEmpty() ? QStringLiteral("Disconnected") : Text.trimmed());
}
void App_SettingsPage::App_Func_SetLastActionText(const QString& Text)
{
appLastActionLabel->setText(Text.trimmed().isEmpty() ? QStringLiteral("Idle") : Text.trimmed());
}
} // namespace APP

View File

@@ -0,0 +1,23 @@
#pragma once
#include <QtWidgets/QWidget>
class QLabel;
namespace APP
{
class App_SettingsPage : public QWidget
{
public:
explicit App_SettingsPage(QWidget* p_Parent = nullptr);
void App_Func_SetConnectionText(const QString& Text);
void App_Func_SetLastActionText(const QString& Text);
private:
QLabel* appConnectionLabel = nullptr;
QLabel* appLastActionLabel = nullptr;
};
} // namespace APP