NewServerSettings qml rework
This commit is contained in:
parent
3175bc1e48
commit
40fa2d6779
34 changed files with 644 additions and 255 deletions
41
client/ui/models/sites_model.h
Normal file
41
client/ui/models/sites_model.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef SITESMODEL_H
|
||||
#define SITESMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
class SitesModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum SiteRoles {
|
||||
UrlRole = Qt::UserRole + 1,
|
||||
IpRole
|
||||
};
|
||||
|
||||
explicit SitesModel(Settings::RouteMode mode, QObject *parent = nullptr);
|
||||
void resetCache();
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant data(int row, int column);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
private:
|
||||
void genCache() const;
|
||||
|
||||
private:
|
||||
Settings::RouteMode m_mode;
|
||||
Settings m_settings;
|
||||
|
||||
mutable QVector<QPair<QString, QString>> m_ipsCache;
|
||||
mutable bool m_cacheReady = false;
|
||||
};
|
||||
|
||||
#endif // SITESMODEL_H
|
Loading…
Add table
Add a link
Reference in a new issue