amnezia-client/client/ui/models/protocols_model.h
2022-08-25 12:47:02 +03:00

40 lines
1,021 B
C++

#ifndef PROTOCOLS_MODEL_H
#define PROTOCOLS_MODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include <vector>
#include <utility>
#include "settings.h"
#include "containers/containers_defs.h"
class ProtocolsModel : public QAbstractListModel
{
Q_OBJECT
public:
ProtocolsModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
public:
enum SiteRoles {
NameRole = Qt::UserRole + 1,
DescRole,
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 setSelectedDockerContainer(DockerContainer c);
protected:
QHash<int, QByteArray> roleNames() const override;
private:
int m_selectedServerIndex;
DockerContainer m_selectedDockerContainer;
std::shared_ptr<Settings> m_settings;
};
#endif // PROTOCOLS_MODEL_H