Custom sites reimplemented

This commit is contained in:
pokamest 2021-05-27 22:18:36 +03:00
parent 97e918ae72
commit 6c74f30d79
23 changed files with 833 additions and 312 deletions

36
client/ui/sites_model.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef SITESMODEL_H
#define SITESMODEL_H
#include <QAbstractTableModel>
#include "settings.h"
class SitesModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit SitesModel(Settings::RouteMode mode, QObject *parent = nullptr);
void resetCache();
// Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) 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