Add turnoff button to login dialog

This commit is contained in:
kradchen
2023-09-08 10:20:10 +08:00
parent 662c02bdf9
commit 64bac0e960
6 changed files with 43 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ void AboutForm::initUiWidget()
QLabel* pProductVer; QLabel* pProductVer;
QPushButton* pBtnHelp; QPushButton* pBtnHelp;
QLabel* pCompanyCopyRight; QLabel* pCompanyCopyRight;
QLabel* pGuiVer; QLabel* pMainVer;
QLabel* pEmbededSoftVer; QLabel* pEmbededSoftVer;
QLabel* pFEBVer; QLabel* pFEBVer;
QLabel* pQtVer; QLabel* pQtVer;
@@ -90,12 +90,12 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
pGuiVer = new QLabel(this); pMainVer = new QLabel(this);
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion())); pMainVer->setText(QString(tr("USCT Software V0.1.0")));
pMainLayout->addWidget(pGuiVer); pMainLayout->addWidget(pMainVer);
pEmbededSoftVer = new QLabel(this); pEmbededSoftVer = new QLabel(this);
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion())); pEmbededSoftVer->setText(DeviceManager::Default()->getSoftwareVersion());
pMainLayout->addWidget(pEmbededSoftVer); pMainLayout->addWidget(pEmbededSoftVer);
@@ -104,7 +104,7 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
pFEBVer = new QLabel(this); pFEBVer = new QLabel(this);
pFEBVer->setText(tr("FEB Information")); pFEBVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pMainLayout->addWidget(pFEBVer); pMainLayout->addWidget(pFEBVer);
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
@@ -113,12 +113,12 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
pSUSEVer = new QLabel(this); pSUSEVer = new QLabel(this);
pSUSEVer->setText(tr("Loading...")); pSUSEVer->setText(tr("Operation System Information Loading..."));
pMainLayout->addWidget(pSUSEVer); pMainLayout->addWidget(pSUSEVer);
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
pDcmtkVer = new QLabel(this); pDcmtkVer = new QLabel(this);
pDcmtkVer->setText(tr("Loading...")); pDcmtkVer->setText(tr("DICOM Library Information Loading..."));
pMainLayout->addWidget(pDcmtkVer); pMainLayout->addWidget(pDcmtkVer);
pDcmtkCopyright = new QLabel(this); pDcmtkCopyright = new QLabel(this);
pDcmtkCopyright->setObjectName("normal"); pDcmtkCopyright->setObjectName("normal");
@@ -151,7 +151,7 @@ void AboutForm::initUiWidget()
pProductVer->setText(tr("HJ-USCT-01 V1.0")); pProductVer->setText(tr("HJ-USCT-01 V1.0"));
pBtnHelp->setText(tr("?")); pBtnHelp->setText(tr("?"));
pCompanyCopyRight->setText(tr("Copyright © 2017-2020 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed")); pCompanyCopyRight->setText(tr("Copyright © 2017-2020 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed"));
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion())); pMainVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion())); pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
mReconSotfVer->setText(tr("Reconstruction Software V1.2")); mReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pFEBVer->setText(tr("FEB Information")); pFEBVer->setText(tr("FEB Information"));

BIN
src/icons/turnoff.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -57,5 +57,6 @@
<file>icons/query.png</file> <file>icons/query.png</file>
<file>icons/radio_check.png</file> <file>icons/radio_check.png</file>
<file>icons/radio_uncheck.png</file> <file>icons/radio_uncheck.png</file>
<file>icons/turnoff.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -260,6 +260,11 @@ QFrame#loginFrame {
stop: 1.0 darkgray); stop: 1.0 darkgray);
} }
QFrame#TurnoffFrame {
max-height: 100px;
min-height: 100px;
}
QDialog#loginForm { QDialog#loginForm {
background-color: #3c3c3c; background-color: #3c3c3c;
color: white; color: white;
@@ -307,6 +312,16 @@ QDialog#loginForm QToolButton#btnlogin {
QDialog#loginForm QToolButton#btnlogin:hover { QDialog#loginForm QToolButton#btnlogin:hover {
background: #505050; background: #505050;
} }
QToolButton#TurnoffBtn {
border: 1px solid #0078d8;
min-height:80px;
max-height:80px;
min-width:80px;
max-width:80px;
qproperty-icon:url(":/icons/turnoff.png");
qproperty-iconSize:60px 60px;
qproperty-toolButtonStyle:ToolButtonIconOnly;
}
/*------MainWindow------------------------------------------------------------------*/ /*------MainWindow------------------------------------------------------------------*/

View File

@@ -7,6 +7,7 @@
#include <QtWidgets/QLabel> #include <QtWidgets/QLabel>
#include "event/EventCenter.h" #include "event/EventCenter.h"
#include "dialogs/DialogManager.h"
#include "models/User.h" #include "models/User.h"
#include "log/UserOperationLog.h" #include "log/UserOperationLog.h"
#include "json/jsonobject.h" #include "json/jsonobject.h"
@@ -17,6 +18,7 @@ LoginDialog::LoginDialog(QWidget* aParent)
, mVMainLayout(new QVBoxLayout(this)) , mVMainLayout(new QVBoxLayout(this))
, mDialogTitle(new QLabel(this)) , mDialogTitle(new QLabel(this))
, mDialogFrame(new QFrame(this)) , mDialogFrame(new QFrame(this))
, mTurnoffFrame(new QFrame(this))
, mDialogContentsLayout(new QVBoxLayout(mDialogFrame)) , mDialogContentsLayout(new QVBoxLayout(mDialogFrame))
, mAccountEdit(new ULineEdit(mDialogFrame)) , mAccountEdit(new ULineEdit(mDialogFrame))
, mPasswordEdit(new ULineEdit(mDialogFrame)) , mPasswordEdit(new ULineEdit(mDialogFrame))
@@ -55,7 +57,21 @@ void LoginDialog::initializeLayout()
mVMainLayout->addWidget(mDialogTitle, 0, Qt::AlignCenter); mVMainLayout->addWidget(mDialogTitle, 0, Qt::AlignCenter);
mVMainLayout->addWidget(mDialogFrame, 0, Qt::AlignCenter); mVMainLayout->addWidget(mDialogFrame, 0, Qt::AlignCenter);
mVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding)); mVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
mTurnoffFrame->setObjectName("TurnoffFrame");
mVMainLayout->addWidget(mTurnoffFrame, 0, Qt::AlignRight);
QHBoxLayout * hLayout = new QHBoxLayout(mTurnoffFrame);
hLayout->setDirection(QBoxLayout::RightToLeft);
QToolButton * turnOffBtn = new QToolButton(mTurnoffFrame);
turnOffBtn->setObjectName("TurnoffBtn");
hLayout->addWidget(turnOffBtn);
connect(turnOffBtn, &QToolButton::clicked, []()
{
if(DialogManager::Default()->requestAlertMessage(QString(tr("Shut down now ?")), DialogButtonMode::OkAndCancel,tr("Shut Down")) == QDialog::Accepted)
{
LOG_USER_OPERATION("Shut Down")
EventCenter::Default()->triggerEvent(GUIEvents::RequestShutdown, nullptr, nullptr);
}
});
mDialogContentsLayout->setSpacing(30); mDialogContentsLayout->setSpacing(30);
mDialogContentsLayout->setContentsMargins(20, 60, 20, 20); mDialogContentsLayout->setContentsMargins(20, 60, 20, 20);
} }

View File

@@ -47,6 +47,7 @@ private:
QVBoxLayout* mVMainLayout; QVBoxLayout* mVMainLayout;
QLabel* mDialogTitle; QLabel* mDialogTitle;
QFrame* mDialogFrame; QFrame* mDialogFrame;
QFrame* mTurnoffFrame;
QVBoxLayout* mDialogContentsLayout; QVBoxLayout* mDialogContentsLayout;
ULineEdit* mAccountEdit; ULineEdit* mAccountEdit;
ULineEdit* mPasswordEdit; ULineEdit* mPasswordEdit;