Reworked the interaction between models. Now only serversModel directly interacts with server config
This commit is contained in:
parent
f3f98a50ed
commit
b4c89ad58f
19 changed files with 412 additions and 290 deletions
|
|
@ -7,13 +7,12 @@
|
|||
#include <vector>
|
||||
|
||||
#include "containers/containers_defs.h"
|
||||
#include "settings.h"
|
||||
|
||||
class ContainersModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ContainersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
||||
ContainersModel(QObject *parent = nullptr);
|
||||
|
||||
enum Roles {
|
||||
NameRole = Qt::UserRole + 1,
|
||||
|
|
@ -37,37 +36,24 @@ public:
|
|||
|
||||
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;
|
||||
QVariant data(const int index, int role) const;
|
||||
|
||||
Q_PROPERTY(QString defaultContainerName READ getDefaultContainerName NOTIFY defaultContainerChanged)
|
||||
|
||||
public slots:
|
||||
void updateModel(QJsonArray &containers);
|
||||
|
||||
DockerContainer getDefaultContainer();
|
||||
QString getDefaultContainerName();
|
||||
void setDefaultContainer(int index);
|
||||
void setDefaultContainer(const int containerIndex);
|
||||
|
||||
void setCurrentlyProcessedServerIndex(const int index);
|
||||
|
||||
void setCurrentlyProcessedContainerIndex(int index);
|
||||
void setCurrentlyProcessedContainerIndex(int containerIndex);
|
||||
int getCurrentlyProcessedContainerIndex();
|
||||
|
||||
QString getCurrentlyProcessedContainerName();
|
||||
QJsonObject getCurrentlyProcessedContainerConfig();
|
||||
QStringList getAllInstalledServicesName(const int serverIndex);
|
||||
|
||||
ErrorCode removeAllContainers();
|
||||
ErrorCode removeCurrentlyProcessedContainer();
|
||||
void clearCachedProfiles();
|
||||
|
||||
bool isAmneziaDnsContainerInstalled();
|
||||
bool isAmneziaDnsContainerInstalled(const int serverIndex);
|
||||
QJsonObject getContainerConfig(const int containerIndex);
|
||||
|
||||
bool isAnyContainerInstalled();
|
||||
|
||||
void updateContainersConfig();
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
|
|
@ -78,11 +64,8 @@ signals:
|
|||
private:
|
||||
QMap<DockerContainer, QJsonObject> m_containers;
|
||||
|
||||
int m_currentlyProcessedServerIndex;
|
||||
int m_currentlyProcessedContainerIndex;
|
||||
DockerContainer m_defaultContainerIndex;
|
||||
|
||||
std::shared_ptr<Settings> m_settings;
|
||||
};
|
||||
|
||||
#endif // CONTAINERS_MODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue