2021-11-11 14:10:41 +08:00
|
|
|
//
|
|
|
|
|
// Created by Krad on 2021/11/10.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef GUI_ACCOUNTFORMDIALOG_H
|
|
|
|
|
#define GUI_ACCOUNTFORMDIALOG_H
|
2021-12-10 10:17:45 +08:00
|
|
|
class QLabel;
|
|
|
|
|
class QLineEdit;
|
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
|
|
|
|
|
|
|
|
enum AccountEditMode{
|
|
|
|
|
Self, Admin, New
|
|
|
|
|
};
|
2021-11-11 14:10:41 +08:00
|
|
|
class AccountFormDialog:public GUIFormBaseDialog{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2021-12-10 10:17:45 +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;
|
2021-12-10 10:17:45 +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-13 11:21:44 +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);
|
|
|
|
|
void changeSelfPassword();
|
|
|
|
|
void resetUserPassword();
|
|
|
|
|
QString mUserID;
|
|
|
|
|
QString mUserPwd;
|
|
|
|
|
QString mRoleID;
|
|
|
|
|
QString mNewUserName;
|
|
|
|
|
bool mUserNameChanged;
|
|
|
|
|
bool mCommentChanged;
|
|
|
|
|
bool mRoleChanged;
|
|
|
|
|
AccountEditMode mMode;
|
|
|
|
|
QLineEdit* mLeUserCode;
|
|
|
|
|
QLineEdit* mLeUserName;
|
|
|
|
|
QLineEdit* mLeComment;
|
|
|
|
|
QLineEdit* mLePwd;
|
|
|
|
|
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
|