Add turnoff button to login dialog
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user