Add AdminSPwd Dialog
This commit is contained in:
26
src/dialogs/AdminSPwdDialog.cpp
Normal file
26
src/dialogs/AdminSPwdDialog.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "AdminSPwdDialog.h"
|
||||
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
|
||||
AdminSPwdDialog::AdminSPwdDialog(QWidget *parent, Qt::WindowFlags f)
|
||||
: GUIFormBaseDialog(parent, f)
|
||||
{
|
||||
this->setMinimumHeight(300);
|
||||
this->setMinimumWidth(200);
|
||||
mFormWidget->setObjectName("Adminform");
|
||||
auto layout = new QVBoxLayout(mFormWidget);
|
||||
layout->setSpacing(0);
|
||||
QLabel* lblMsg = new QLabel(mFormWidget);
|
||||
lblMsg->setObjectName("Notice");
|
||||
lblMsg->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||
lblMsg->setWordWrap(true);
|
||||
lblMsg->setText(tr("Please give this code to producer for getting the SP Code to reset admininistrator's password to\"123456\"!"));
|
||||
layout->addWidget(lblMsg, Qt::AlignHCenter);
|
||||
QLabel* lblSCode = new QLabel(mFormWidget);
|
||||
lblSCode->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
|
||||
layout->addWidget(lblSCode, Qt::AlignHCenter);
|
||||
lblSCode->setObjectName("resetCode");
|
||||
lblSCode->setText("U S C T");
|
||||
lblSCode->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
16
src/dialogs/AdminSPwdDialog.h
Normal file
16
src/dialogs/AdminSPwdDialog.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef CF2CD71D_5155_4FC5_B382_331CBD884F97
|
||||
#define CF2CD71D_5155_4FC5_B382_331CBD884F97
|
||||
#include "GUIFormBaseDialog.h"
|
||||
class AdminSPwdDialog :public GUIFormBaseDialog{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AdminSPwdDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
~AdminSPwdDialog() override = default;
|
||||
protected:
|
||||
bool updateReferenceData() override{return true;}
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* CF2CD71D_5155_4FC5_B382_331CBD884F97 */
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "dialogs/SelectDialog.h"
|
||||
#include "dialogs/GetWorkListDialog.h"
|
||||
#include "dialogs/PatientConfirmDialog.h"
|
||||
#include "dialogs/AdminSPwdDialog.h"
|
||||
|
||||
#include "network/DicomCfgDialog.h"
|
||||
#include "network/GetAdminPsw.h"
|
||||
@@ -118,6 +119,16 @@ void DialogManager::requestScreenSaverStop(bool aIsStopLocker)
|
||||
mScreenSaverWindow->stop(aIsStopLocker);
|
||||
}
|
||||
|
||||
int DialogManager::requestResetAdminPwd()
|
||||
{
|
||||
AdminSPwdDialog dialog(mTopWidget);
|
||||
setTopWidget(&dialog);
|
||||
dialog.setWindowModality(Qt::WindowModal);
|
||||
int ret = dialog.exec();
|
||||
releaseTopWidget(&dialog);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DialogManager::requestAddAccount(QSqlTableModel* model) {
|
||||
AccountFormDialog dialog(mTopWidget, New);
|
||||
setTopWidget(&dialog);
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
void requestLogin(QWidget* aParent);
|
||||
void requestScreenSaverPlay();
|
||||
void requestScreenSaverStop(bool aIsStopLocker = false);
|
||||
int requestResetAdminPwd();
|
||||
int requestAddAccount(QSqlTableModel* model);
|
||||
int requestEditSelfAccount();
|
||||
int requestEditAdminAccount(const QMap<QString, QVariant>& values);
|
||||
|
||||
@@ -18,6 +18,7 @@ LoginDialog::LoginDialog(QWidget* aParent)
|
||||
, mVMainLayout(new QVBoxLayout(this))
|
||||
, mDialogTitle(new QLabel(this))
|
||||
, mDialogFrame(new QFrame(this))
|
||||
, mHideFrame(new QFrame(this))
|
||||
, mTurnoffFrame(new QFrame(this))
|
||||
, mDialogContentsLayout(new QVBoxLayout(mDialogFrame))
|
||||
, mAccountEdit(new ULineEdit(mDialogFrame))
|
||||
@@ -25,6 +26,7 @@ LoginDialog::LoginDialog(QWidget* aParent)
|
||||
, mLoginButton(nullptr)
|
||||
, mErrorMessage(new QLabel(this))
|
||||
, mIsRunning(false)
|
||||
, mHideClickCount(0)
|
||||
{
|
||||
initializeAllWidget();
|
||||
setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint| Qt::BypassWindowManagerHint);
|
||||
@@ -53,6 +55,20 @@ void LoginDialog::initializeLayout()
|
||||
{
|
||||
mVMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mVMainLayout->setSpacing(0);
|
||||
mVMainLayout->addWidget(mHideFrame, 0, Qt::AlignLeft);
|
||||
QHBoxLayout * hLayout1 = new QHBoxLayout(mHideFrame);
|
||||
hLayout1->setDirection(QBoxLayout::RightToLeft);
|
||||
QToolButton * hideBtn = new QToolButton(mHideFrame);
|
||||
hideBtn->setObjectName("HideBtn");
|
||||
hLayout1->addWidget(hideBtn);
|
||||
connect(hideBtn, &QToolButton::clicked, [=]()
|
||||
{
|
||||
mHideClickCount++;
|
||||
if (mHideClickCount == 5){
|
||||
mHideClickCount = 0;
|
||||
DialogManager::Default()->requestResetAdminPwd();
|
||||
}
|
||||
});
|
||||
mVMainLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
mVMainLayout->addWidget(mDialogTitle, 0, Qt::AlignCenter);
|
||||
mVMainLayout->addWidget(mDialogFrame, 0, Qt::AlignCenter);
|
||||
@@ -78,7 +94,7 @@ void LoginDialog::initializeLayout()
|
||||
|
||||
void LoginDialog::initializeTitle()
|
||||
{
|
||||
mDialogTitle->setObjectName("title");
|
||||
mDialogTitle->setObjectName("loginTitle");
|
||||
mDialogTitle->setText(tr("U S C T"));
|
||||
}
|
||||
|
||||
@@ -142,7 +158,7 @@ void LoginDialog::doLogin()
|
||||
accept();
|
||||
LOG_USER_OPERATION("Login Sucessful");
|
||||
JsonObject::Instance()->setDefaultUser(strUserCode);
|
||||
|
||||
mHideClickCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
QVBoxLayout* mVMainLayout;
|
||||
QLabel* mDialogTitle;
|
||||
QFrame* mDialogFrame;
|
||||
QFrame* mHideFrame;
|
||||
QFrame* mTurnoffFrame;
|
||||
QVBoxLayout* mDialogContentsLayout;
|
||||
ULineEdit* mAccountEdit;
|
||||
@@ -54,6 +55,7 @@ private:
|
||||
QToolButton* mLoginButton;
|
||||
QLabel* mErrorMessage;
|
||||
bool mIsRunning;
|
||||
int mHideClickCount;
|
||||
};
|
||||
|
||||
#endif // LOGINDIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user