-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef QML_AUTH_SETTING_FIELD_H | ||
#define QML_AUTH_SETTING_FIELD_H | ||
|
||
#include <QObject> | ||
#include <QString> | ||
#include "auth/auth.h" | ||
|
||
|
||
class QmlAuthSettingField : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
Q_PROPERTY(QString id READ id CONSTANT) | ||
Q_PROPERTY(QString def READ def CONSTANT) | ||
Q_PROPERTY(bool isPassword READ isPassword CONSTANT) | ||
|
||
public: | ||
explicit QmlAuthSettingField(const AuthSettingField &field, QObject *parent = nullptr) | ||
: QObject(parent), m_id(field.id), m_def(field.def), m_isPassword(field.isPassword) {} | ||
|
||
QString id() const { return m_id; } | ||
QString def() const { return m_def; } | ||
bool isPassword() const { return m_isPassword; } | ||
|
||
private: | ||
QString m_id; | ||
QString m_def; | ||
bool m_isPassword; | ||
}; | ||
|
||
#endif // QML_AUTH_SETTING_FIELD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef QML_AUTH_H | ||
#define QML_AUTH_H | ||
|
||
#include <QList> | ||
#include <QObject> | ||
#include <QString> | ||
#include "auth/auth.h" | ||
#include "models/qml-auth-setting-field.h" | ||
|
||
|
||
class QmlAuth : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
Q_PROPERTY(QString type READ type CONSTANT) | ||
Q_PROPERTY(QList<QmlAuthSettingField*> fields READ fields CONSTANT) | ||
|
||
public: | ||
explicit QmlAuth(Auth *auth, QObject *parent = nullptr) | ||
: QObject(parent), m_type(auth->type()) | ||
{ | ||
for (const auto &field : auth->settingFields()) { | ||
m_fields.append(new QmlAuthSettingField(field, this)); | ||
} | ||
} | ||
|
||
QString type() const { return m_type; } | ||
QList<QmlAuthSettingField*> fields() const { return m_fields; } | ||
|
||
private: | ||
QString m_type; | ||
QList<QmlAuthSettingField*> m_fields; | ||
}; | ||
|
||
#endif // QML_AUTH_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters