bugfix/default-container-index (#578)

fixed get/set DefaultContainer
This commit is contained in:
Nethius 2024-02-13 20:20:13 +05:00 committed by GitHub
parent a416d03614
commit 92fbbd4812
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 15 additions and 53 deletions

View file

@ -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);
}