amnezia-client/client/ui/models/containers_model.h
vladimir.kuznetsov 4f36349630 changed the way to create qml pages, now the page is created when you go to it
- added PageSetupWizardConfigSource, PageSetupWizardInstalling, PageSetupWizardProtocolSettings, PageSetupWizardTextKey
2023-05-03 19:06:16 +03:00

43 lines
1.1 KiB
C++

#ifndef CONTAINERS_MODEL_H
#define CONTAINERS_MODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include <vector>
#include <utility>
#include "settings.h"
#include "containers/containers_defs.h"
class ContainersModel : public QAbstractListModel
{
Q_OBJECT
public:
ContainersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
public:
enum SiteRoles {
NameRole = Qt::UserRole + 1,
DescRole,
DefaultRole,
ServiceTypeRole,
IsInstalledRole
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Q_INVOKABLE void setSelectedServerIndex(int index);
Q_INVOKABLE void setCurrentlyInstalledContainerIndex(int index);
Q_INVOKABLE QString getCurrentlyInstalledContainerName();
protected:
QHash<int, QByteArray> roleNames() const override;
private:
int m_selectedServerIndex;
QModelIndex m_currentlyInstalledContainerIndex;
std::shared_ptr<Settings> m_settings;
};
#endif // CONTAINERS_MODEL_H