2021-11-11 14:10:41 +08:00
|
|
|
#ifndef GUI_ACCOUNTFORMDIALOG_H
|
|
|
|
|
#define GUI_ACCOUNTFORMDIALOG_H
|
2021-12-10 10:17:45 +08:00
|
|
|
class QLabel;
|
2022-06-14 14:03:19 +08:00
|
|
|
class ULineEdit;
|
2022-01-14 14:24:07 +08:00
|
|
|
class QToolButton;
|
2021-12-10 10:17:45 +08:00
|
|
|
class QSqlTableModel;
|
2022-06-13 11:21:44 +08:00
|
|
|
|
|
|
|
|
#include <QtWidgets/QVBoxLayout>
|
2021-11-11 14:10:41 +08:00
|
|
|
#include "GUIFormBaseDialog.h"
|
2021-12-10 10:17:45 +08:00
|
|
|
|
2022-06-14 14:03:19 +08:00
|
|
|
enum AccountEditMode {
|
2021-12-10 10:17:45 +08:00
|
|
|
Self, Admin, New
|
|
|
|
|
};
|
2022-06-14 14:03:19 +08:00
|
|
|
class AccountFormDialog :public GUIFormBaseDialog {
|
2021-11-11 14:10:41 +08:00
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2022-06-14 14:03:19 +08:00
|
|
|
explicit AccountFormDialog(QWidget* parent = nullptr, AccountEditMode mode = Self, Qt::WindowFlags f = Qt::WindowFlags());
|
2022-06-13 11:21:44 +08:00
|
|
|
~AccountFormDialog() override = default;
|
2022-06-14 14:03:19 +08:00
|
|
|
void setAccountInformation(const QMap<QString, QVariant>& values);
|
|
|
|
|
void setReferenceModel(QSqlTableModel* model)
|
|
|
|
|
{
|
2022-06-13 11:21:44 +08:00
|
|
|
mRefModel = model;
|
2021-12-10 10:17:45 +08:00
|
|
|
}
|
2021-11-11 14:10:41 +08:00
|
|
|
protected:
|
|
|
|
|
bool updateReferenceData() override;
|
2022-06-13 11:21:44 +08:00
|
|
|
void warn(const QString& msg);
|
2021-12-10 10:17:45 +08:00
|
|
|
void hideWarn();
|
2021-11-11 14:10:41 +08:00
|
|
|
private:
|
2022-06-14 14:03:19 +08:00
|
|
|
void addEndLine(QVBoxLayout* layout);
|
|
|
|
|
void addNewModeUI(QVBoxLayout* layout);
|
|
|
|
|
void addSelfModeUI(QHBoxLayout* layout);
|
|
|
|
|
void addTitleLabel(QVBoxLayout* layout);
|
|
|
|
|
void initUserCodeUI(QVBoxLayout* layout);
|
|
|
|
|
void initUserNameUI(QVBoxLayout* layout);
|
|
|
|
|
void addCommentLabel(QVBoxLayout* layout);
|
|
|
|
|
void addWarnLabel(QVBoxLayout* layout);
|
|
|
|
|
void addButtonPwd(QHBoxLayout* layout);
|
2022-06-13 11:21:44 +08:00
|
|
|
void changeSelfPassword();
|
|
|
|
|
void resetUserPassword();
|
|
|
|
|
QString mUserID;
|
|
|
|
|
QString mUserPwd;
|
|
|
|
|
QString mRoleID;
|
|
|
|
|
QString mNewUserName;
|
|
|
|
|
bool mUserNameChanged;
|
|
|
|
|
bool mCommentChanged;
|
|
|
|
|
bool mRoleChanged;
|
|
|
|
|
AccountEditMode mMode;
|
2022-06-14 14:03:19 +08:00
|
|
|
ULineEdit* mLeUserCode;
|
|
|
|
|
ULineEdit* mLeUserName;
|
|
|
|
|
ULineEdit* mLeComment;
|
|
|
|
|
ULineEdit* mLePwd;
|
2024-05-07 13:45:47 +08:00
|
|
|
ULineEdit* mConfirmPwd;
|
2022-06-13 11:21:44 +08:00
|
|
|
QToolButton* mBtnPwd;
|
|
|
|
|
|
|
|
|
|
QLabel* mLblError;
|
|
|
|
|
QSqlTableModel* mRefModel;
|
2022-01-14 14:24:07 +08:00
|
|
|
|
2021-11-11 14:10:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GUI_ACCOUNTFORMDIALOG_H
|