parent
a416d03614
commit
92fbbd4812
11 changed files with 15 additions and 53 deletions
|
|
@ -39,7 +39,6 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
|
|||
case EasySetupOrderRole: return ContainerProps::easySetupOrder(container);
|
||||
case IsInstalledRole: return m_containers.contains(container);
|
||||
case IsCurrentlyProcessedRole: return container == static_cast<DockerContainer>(m_currentlyProcessedContainerIndex);
|
||||
case IsDefaultRole: return container == m_defaultContainerIndex;
|
||||
case IsSupportedRole: return ContainerProps::isSupportedByCurrentPlatform(container);
|
||||
case IsShareableRole: return ContainerProps::isShareable(container);
|
||||
}
|
||||
|
|
@ -64,18 +63,6 @@ void ContainersModel::updateModel(const QJsonArray &containers)
|
|||
endResetModel();
|
||||
}
|
||||
|
||||
void ContainersModel::setDefaultContainer(const int containerIndex)
|
||||
{
|
||||
m_defaultContainerIndex = static_cast<DockerContainer>(containerIndex);
|
||||
emit dataChanged(index(containerIndex, 0), index(containerIndex, 0));
|
||||
}
|
||||
|
||||
|
||||
DockerContainer ContainersModel::getDefaultContainer()
|
||||
{
|
||||
return m_defaultContainerIndex;
|
||||
}
|
||||
|
||||
void ContainersModel::setCurrentlyProcessedContainerIndex(int index)
|
||||
{
|
||||
m_currentlyProcessedContainerIndex = index;
|
||||
|
|
@ -127,7 +114,6 @@ QHash<int, QByteArray> ContainersModel::roleNames() const
|
|||
|
||||
roles[IsInstalledRole] = "isInstalled";
|
||||
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
||||
roles[IsDefaultRole] = "isDefault";
|
||||
roles[IsSupportedRole] = "isSupported";
|
||||
roles[IsShareableRole] = "isShareable";
|
||||
return roles;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,6 @@ public:
|
|||
public slots:
|
||||
void updateModel(const QJsonArray &containers);
|
||||
|
||||
DockerContainer getDefaultContainer();
|
||||
void setDefaultContainer(const int containerIndex);
|
||||
|
||||
void setCurrentlyProcessedContainerIndex(int containerIndex);
|
||||
int getCurrentlyProcessedContainerIndex();
|
||||
|
||||
|
|
@ -58,14 +55,12 @@ protected:
|
|||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
signals:
|
||||
void defaultContainerChanged();
|
||||
void containersModelUpdated();
|
||||
|
||||
private:
|
||||
QMap<DockerContainer, QJsonObject> m_containers;
|
||||
|
||||
int m_currentlyProcessedContainerIndex;
|
||||
DockerContainer m_defaultContainerIndex;
|
||||
};
|
||||
|
||||
#endif // CONTAINERS_MODEL_H
|
||||
|
|
|
|||
|
|
@ -403,23 +403,23 @@ void ServersModel::addContainerConfig(const int containerIndex, const QJsonObjec
|
|||
}
|
||||
}
|
||||
|
||||
void ServersModel::setDefaultContainer(const int containerIndex)
|
||||
void ServersModel::setDefaultContainer(const int serverIndex, const int containerIndex)
|
||||
{
|
||||
auto container = static_cast<DockerContainer>(containerIndex);
|
||||
QJsonObject s = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
||||
QJsonObject s = m_servers.at(serverIndex).toObject();
|
||||
s.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||
editServer(s); //check
|
||||
emit defaultContainerChanged(container);
|
||||
}
|
||||
|
||||
DockerContainer ServersModel::getDefaultContainer()
|
||||
DockerContainer ServersModel::getDefaultContainer(const int serverIndex)
|
||||
{
|
||||
return qvariant_cast<DockerContainer>(data(m_currentlyProcessedServerIndex, DefaultContainerRole));
|
||||
return qvariant_cast<DockerContainer>(data(serverIndex, DefaultContainerRole));
|
||||
}
|
||||
|
||||
const QString ServersModel::getDefaultContainerName()
|
||||
{
|
||||
auto defaultContainer = getDefaultContainer();
|
||||
auto defaultContainer = getDefaultContainer(m_defaultServerIndex);
|
||||
return ContainerProps::containerHumanNames().value(defaultContainer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ public slots:
|
|||
ErrorCode removeAllContainers();
|
||||
ErrorCode rebootServer();
|
||||
|
||||
void setDefaultContainer(const int containerIndex);
|
||||
DockerContainer getDefaultContainer();
|
||||
void setDefaultContainer(const int serverIndex, const int containerIndex);
|
||||
DockerContainer getDefaultContainer(const int serverIndex);
|
||||
const QString getDefaultContainerName();
|
||||
|
||||
QStringList getAllInstalledServicesName(const int serverIndex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue