New start page and AmneziaFree support (#865)
New start page and AmneziaFree support
This commit is contained in:
parent
01413e5a4c
commit
843156cf1b
443 changed files with 11759 additions and 2758 deletions
42
client/ui/models/apiCountryModel.h
Normal file
42
client/ui/models/apiCountryModel.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef APICOUNTRYMODEL_H
|
||||
#define APICOUNTRYMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QJsonArray>
|
||||
|
||||
class ApiCountryModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Roles {
|
||||
CountryNameRole = Qt::UserRole + 1,
|
||||
CountryCodeRole
|
||||
};
|
||||
|
||||
explicit ApiCountryModel(QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Q_PROPERTY(int currentIndex READ getCurrentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
||||
|
||||
public slots:
|
||||
void updateModel(const QJsonArray &data, const QString ¤tCountryCode);
|
||||
|
||||
int getCurrentIndex();
|
||||
void setCurrentIndex(const int i);
|
||||
|
||||
signals:
|
||||
void currentIndexChanged(const int index);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
private:
|
||||
QJsonArray m_countries;
|
||||
int m_currentIndex;
|
||||
};
|
||||
|
||||
#endif // APICOUNTRYMODEL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue