Add APP settings page
This commit is contained in:
61
KeyBorad/KeyBorad/APP/AppSettingsPage.cpp
Normal file
61
KeyBorad/KeyBorad/APP/AppSettingsPage.cpp
Normal 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
|
||||||
23
KeyBorad/KeyBorad/APP/AppSettingsPage.h
Normal file
23
KeyBorad/KeyBorad/APP/AppSettingsPage.h
Normal 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
|
||||||
Reference in New Issue
Block a user