62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
#ifndef GUI_ACCOUNTFORMDIALOG_H
|
|
#define GUI_ACCOUNTFORMDIALOG_H
|
|
class QLabel;
|
|
class ULineEdit;
|
|
class QToolButton;
|
|
class QSqlTableModel;
|
|
|
|
#include <QtWidgets/QVBoxLayout>
|
|
#include "GUIFormBaseDialog.h"
|
|
|
|
enum AccountEditMode {
|
|
Self, Admin, New
|
|
};
|
|
class AccountFormDialog :public GUIFormBaseDialog {
|
|
Q_OBJECT
|
|
public:
|
|
explicit AccountFormDialog(QWidget* parent = nullptr, AccountEditMode mode = Self, Qt::WindowFlags f = Qt::WindowFlags());
|
|
~AccountFormDialog() override = default;
|
|
void setAccountInformation(const QMap<QString, QVariant>& values);
|
|
void setReferenceModel(QSqlTableModel* model)
|
|
{
|
|
mRefModel = model;
|
|
}
|
|
protected:
|
|
bool updateReferenceData() override;
|
|
void warn(const QString& msg);
|
|
void hideWarn();
|
|
private:
|
|
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;
|
|
ULineEdit* mLeUserCode;
|
|
ULineEdit* mLeUserName;
|
|
ULineEdit* mLeComment;
|
|
ULineEdit* mLePwd;
|
|
ULineEdit* mConfirmPwd;
|
|
QToolButton* mBtnPwd;
|
|
|
|
QLabel* mLblError;
|
|
QSqlTableModel* mRefModel;
|
|
|
|
};
|
|
|
|
|
|
#endif //GUI_ACCOUNTFORMDIALOG_H
|