#ifndef CONTAINERS_MODEL_H #define CONTAINERS_MODEL_H #include #include #include #include #include "settings.h" #include "containers/containers_defs.h" class ContainersModel : public QAbstractListModel { Q_OBJECT public: ContainersModel(std::shared_ptr settings, QObject *parent = nullptr); public: enum ContainersModelRoles { NameRole = Qt::UserRole + 1, DescRole, ServiceTypeRole, ConfigRole, IsInstalledRole, IsDefaultRole }; int rowCount(const QModelIndex &parent = QModelIndex()) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) 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(); public slots: DockerContainer getDefaultContainer(); protected: QHash roleNames() const override; private: int m_selectedServerIndex; QModelIndex m_currentlyInstalledContainerIndex; std::shared_ptr m_settings; }; #endif // CONTAINERS_MODEL_H