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;
QPushButton* pBtnHelp;
QLabel* pCompanyCopyRight;
QLabel* pGuiVer;
QLabel* pMainVer;
QLabel* pEmbededSoftVer;
QLabel* pFEBVer;
QLabel* pQtVer;
@@ -90,12 +90,12 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing);
pGuiVer = new QLabel(this);
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pMainLayout->addWidget(pGuiVer);
pMainVer = new QLabel(this);
pMainVer->setText(QString(tr("USCT Software V0.1.0")));
pMainLayout->addWidget(pMainVer);
pEmbededSoftVer = new QLabel(this);
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pEmbededSoftVer->setText(DeviceManager::Default()->getSoftwareVersion());
pMainLayout->addWidget(pEmbededSoftVer);
@@ -104,7 +104,7 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing);
pFEBVer = new QLabel(this);
pFEBVer->setText(tr("FEB Information"));
pFEBVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
pMainLayout->addWidget(pFEBVer);
pMainLayout->addSpacing(subContentSpacing);
@@ -113,12 +113,12 @@ void AboutForm::initUiWidget()
pMainLayout->addSpacing(subContentSpacing);
pSUSEVer = new QLabel(this);
pSUSEVer->setText(tr("Loading..."));
pSUSEVer->setText(tr("Operation System Information Loading..."));
pMainLayout->addWidget(pSUSEVer);
pMainLayout->addSpacing(subContentSpacing);
pDcmtkVer = new QLabel(this);
pDcmtkVer->setText(tr("Loading..."));
pDcmtkVer->setText(tr("DICOM Library Information Loading..."));
pMainLayout->addWidget(pDcmtkVer);
pDcmtkCopyright = new QLabel(this);
pDcmtkCopyright->setObjectName("normal");
@@ -151,7 +151,7 @@ void AboutForm::initUiWidget()
pProductVer->setText(tr("HJ-USCT-01 V1.0"));
pBtnHelp->setText(tr("?"));
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()));
mReconSotfVer->setText(tr("Reconstruction Software V1.2"));
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/radio_check.png</file>
<file>icons/radio_uncheck.png</file>
<file>icons/turnoff.png</file>
</qresource>
</RCC>

View File

@@ -260,6 +260,11 @@ QFrame#loginFrame {
stop: 1.0 darkgray);
}
QFrame#TurnoffFrame {
max-height: 100px;
min-height: 100px;
}
QDialog#loginForm {
background-color: #3c3c3c;
color: white;
@@ -307,6 +312,16 @@ QDialog#loginForm QToolButton#btnlogin {
QDialog#loginForm QToolButton#btnlogin:hover {
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------------------------------------------------------------------*/

View File

@@ -7,6 +7,7 @@
#include <QtWidgets/QLabel>
#include "event/EventCenter.h"
#include "dialogs/DialogManager.h"
#include "models/User.h"
#include "log/UserOperationLog.h"
#include "json/jsonobject.h"
@@ -17,6 +18,7 @@ LoginDialog::LoginDialog(QWidget* aParent)
, mVMainLayout(new QVBoxLayout(this))
, mDialogTitle(new QLabel(this))
, mDialogFrame(new QFrame(this))
, mTurnoffFrame(new QFrame(this))
, mDialogContentsLayout(new QVBoxLayout(mDialogFrame))
, mAccountEdit(new ULineEdit(mDialogFrame))
, mPasswordEdit(new ULineEdit(mDialogFrame))
@@ -55,7 +57,21 @@ void LoginDialog::initializeLayout()
mVMainLayout->addWidget(mDialogTitle, 0, Qt::AlignCenter);
mVMainLayout->addWidget(mDialogFrame, 0, Qt::AlignCenter);
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->setContentsMargins(20, 60, 20, 20);
}

View File

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