serversModel cleanup (#599)
This commit is contained in:
parent
a32952fde6
commit
b3943ae5e3
32 changed files with 255 additions and 240 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -131,3 +131,6 @@ client/3rd/ShadowSocks/ss_ios.xcconfig
|
||||||
|
|
||||||
# UML generated pics
|
# UML generated pics
|
||||||
out/
|
out/
|
||||||
|
|
||||||
|
# CMake files
|
||||||
|
CMakeFiles/
|
|
@ -286,10 +286,16 @@ void AmneziaApplication::initModels()
|
||||||
m_containersModel.reset(new ContainersModel(this));
|
m_containersModel.reset(new ContainersModel(this));
|
||||||
m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get());
|
m_engine->rootContext()->setContextProperty("ContainersModel", m_containersModel.get());
|
||||||
|
|
||||||
|
m_defaultServerContainersModel.reset(new ContainersModel(this));
|
||||||
|
m_engine->rootContext()->setContextProperty("DefaultServerContainersModel", m_defaultServerContainersModel.get());
|
||||||
|
|
||||||
m_serversModel.reset(new ServersModel(m_settings, this));
|
m_serversModel.reset(new ServersModel(m_settings, this));
|
||||||
m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get());
|
m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get());
|
||||||
connect(m_serversModel.get(), &ServersModel::containersUpdated, m_containersModel.get(),
|
connect(m_serversModel.get(), &ServersModel::containersUpdated, m_containersModel.get(),
|
||||||
&ContainersModel::updateModel);
|
&ContainersModel::updateModel);
|
||||||
|
connect(m_serversModel.get(), &ServersModel::defaultServerContainersUpdated, m_defaultServerContainersModel.get(),
|
||||||
|
&ContainersModel::updateModel);
|
||||||
|
m_serversModel->resetModel();
|
||||||
|
|
||||||
m_languageModel.reset(new LanguageModel(m_settings, this));
|
m_languageModel.reset(new LanguageModel(m_settings, this));
|
||||||
m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get());
|
m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get());
|
||||||
|
@ -333,7 +339,7 @@ void AmneziaApplication::initModels()
|
||||||
connect(m_configurator.get(), &VpnConfigurator::newVpnConfigCreated, this,
|
connect(m_configurator.get(), &VpnConfigurator::newVpnConfigCreated, this,
|
||||||
[this](const QString &clientId, const QString &clientName, const DockerContainer container,
|
[this](const QString &clientId, const QString &clientName, const DockerContainer container,
|
||||||
ServerCredentials credentials) {
|
ServerCredentials credentials) {
|
||||||
m_serversModel->reloadContainerConfig();
|
m_serversModel->reloadDefaultServerContainerConfig();
|
||||||
m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
|
m_clientManagementModel->appendClient(clientId, clientName, container, credentials);
|
||||||
emit m_configurator->clientModelUpdated();
|
emit m_configurator->clientModelUpdated();
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,6 +92,7 @@ private:
|
||||||
QCommandLineParser m_parser;
|
QCommandLineParser m_parser;
|
||||||
|
|
||||||
QSharedPointer<ContainersModel> m_containersModel;
|
QSharedPointer<ContainersModel> m_containersModel;
|
||||||
|
QSharedPointer<ContainersModel> m_defaultServerContainersModel;
|
||||||
QSharedPointer<ServersModel> m_serversModel;
|
QSharedPointer<ServersModel> m_serversModel;
|
||||||
QSharedPointer<LanguageModel> m_languageModel;
|
QSharedPointer<LanguageModel> m_languageModel;
|
||||||
QSharedPointer<ProtocolsModel> m_protocolsModel;
|
QSharedPointer<ProtocolsModel> m_protocolsModel;
|
||||||
|
|
|
@ -136,8 +136,7 @@ void ApiController::updateServerConfigFromApi()
|
||||||
|
|
||||||
auto defaultContainer = apiConfig.value(config_key::defaultContainer).toString();
|
auto defaultContainer = apiConfig.value(config_key::defaultContainer).toString();
|
||||||
serverConfig.insert(config_key::defaultContainer, defaultContainer);
|
serverConfig.insert(config_key::defaultContainer, defaultContainer);
|
||||||
m_serversModel->editServer(serverConfig);
|
m_serversModel->editServer(serverConfig, m_serversModel->getDefaultServerIndex());
|
||||||
emit m_serversModel->defaultContainerChanged(ContainerProps::containerFromString(defaultContainer));
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << reply->error();
|
qDebug() << reply->error();
|
||||||
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||||
|
@ -164,5 +163,5 @@ void ApiController::clearApiConfig()
|
||||||
|
|
||||||
serverConfig.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
|
serverConfig.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
|
||||||
|
|
||||||
m_serversModel->editServer(serverConfig);
|
m_serversModel->editServer(serverConfig, m_serversModel->getDefaultServerIndex());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void ConnectionController::openConnection()
|
||||||
int serverIndex = m_serversModel->getDefaultServerIndex();
|
int serverIndex = m_serversModel->getDefaultServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = m_serversModel->getDefaultContainer(serverIndex);
|
DockerContainer container = qvariant_cast<DockerContainer>(m_serversModel->data(serverIndex, ServersModel::Roles::DefaultContainerRole));
|
||||||
const QJsonObject &containerConfig = m_containersModel->getContainerConfig(container);
|
const QJsonObject &containerConfig = m_containersModel->getContainerConfig(container);
|
||||||
|
|
||||||
if (container == DockerContainer::None) {
|
if (container == DockerContainer::None) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ void ExportController::generateFullAccessConfig()
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
QJsonObject config = m_settings->server(serverIndex);
|
QJsonObject config = m_settings->server(serverIndex);
|
||||||
|
|
||||||
QJsonArray containers = config.value(config_key::containers).toArray();
|
QJsonArray containers = config.value(config_key::containers).toArray();
|
||||||
|
@ -99,7 +99,7 @@ void ExportController::generateConnectionConfig(const QString &clientName)
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
||||||
|
@ -155,7 +155,7 @@ void ExportController::generateOpenVpnConfig(const QString &clientName)
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
||||||
|
@ -193,7 +193,7 @@ void ExportController::generateWireGuardConfig(const QString &clientName)
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
||||||
|
@ -232,7 +232,7 @@ void ExportController::generateShadowSocksConfig()
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
||||||
|
@ -268,7 +268,7 @@ void ExportController::generateCloakConfig()
|
||||||
{
|
{
|
||||||
clearPreviousConfig();
|
clearPreviousConfig();
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||||
|
|
||||||
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
DockerContainer container = static_cast<DockerContainer>(m_containersModel->getCurrentlyProcessedContainerIndex());
|
||||||
|
@ -328,7 +328,7 @@ void ExportController::updateClientManagementModel(const DockerContainer contain
|
||||||
void ExportController::revokeConfig(const int row, const DockerContainer container, ServerCredentials credentials)
|
void ExportController::revokeConfig(const int row, const DockerContainer container, ServerCredentials credentials)
|
||||||
{
|
{
|
||||||
ErrorCode errorCode = m_clientManagementModel->revokeClient(row, container, credentials,
|
ErrorCode errorCode = m_clientManagementModel->revokeClient(row, container, credentials,
|
||||||
m_serversModel->getCurrentlyProcessedServerIndex());
|
m_serversModel->getProcessedServerIndex());
|
||||||
if (errorCode != ErrorCode::NoError) {
|
if (errorCode != ErrorCode::NoError) {
|
||||||
emit exportErrorOccurred(errorString(errorCode));
|
emit exportErrorOccurred(errorString(errorCode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ void InstallController::installServer(DockerContainer container, QJsonObject &co
|
||||||
|
|
||||||
void InstallController::installContainer(DockerContainer container, QJsonObject &config)
|
void InstallController::installContainer(DockerContainer container, QJsonObject &config)
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials serverCredentials =
|
ServerCredentials serverCredentials =
|
||||||
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ bool InstallController::isServerAlreadyExists()
|
||||||
|
|
||||||
void InstallController::scanServerForInstalledContainers()
|
void InstallController::scanServerForInstalledContainers()
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials serverCredentials =
|
ServerCredentials serverCredentials =
|
||||||
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ void InstallController::scanServerForInstalledContainers()
|
||||||
|
|
||||||
void InstallController::updateContainer(QJsonObject config)
|
void InstallController::updateContainer(QJsonObject config)
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials serverCredentials =
|
ServerCredentials serverCredentials =
|
||||||
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
||||||
|
|
||||||
|
@ -283,8 +283,8 @@ void InstallController::updateContainer(QJsonObject config)
|
||||||
m_serversModel->updateContainerConfig(container, config);
|
m_serversModel->updateContainerConfig(container, config);
|
||||||
m_protocolModel->updateModel(config);
|
m_protocolModel->updateModel(config);
|
||||||
|
|
||||||
if ((serverIndex == m_serversModel->getDefaultServerIndex())
|
auto defaultContainer = qvariant_cast<DockerContainer>(m_serversModel->data(serverIndex, ServersModel::Roles::DefaultContainerRole));
|
||||||
&& (container == m_serversModel->getDefaultContainer(serverIndex))) {
|
if ((serverIndex == m_serversModel->getDefaultServerIndex()) && (container == defaultContainer)) {
|
||||||
emit currentContainerUpdated();
|
emit currentContainerUpdated();
|
||||||
} else {
|
} else {
|
||||||
emit updateContainerFinished(tr("Settings updated successfully"));
|
emit updateContainerFinished(tr("Settings updated successfully"));
|
||||||
|
@ -296,27 +296,27 @@ void InstallController::updateContainer(QJsonObject config)
|
||||||
emit installationErrorOccurred(errorString(errorCode));
|
emit installationErrorOccurred(errorString(errorCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallController::rebootCurrentlyProcessedServer()
|
void InstallController::rebootProcessedServer()
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
||||||
|
|
||||||
m_serversModel->rebootServer();
|
m_serversModel->rebootServer();
|
||||||
emit rebootCurrentlyProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
|
emit rebootProcessedServerFinished(tr("Server '%1' was rebooted").arg(serverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallController::removeCurrentlyProcessedServer()
|
void InstallController::removeProcessedServer()
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
||||||
|
|
||||||
m_serversModel->removeServer();
|
m_serversModel->removeServer();
|
||||||
emit removeCurrentlyProcessedServerFinished(tr("Server '%1' was removed").arg(serverName));
|
emit removeProcessedServerFinished(tr("Server '%1' was removed").arg(serverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallController::removeAllContainers()
|
void InstallController::removeAllContainers()
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
||||||
|
|
||||||
ErrorCode errorCode = m_serversModel->removeAllContainers();
|
ErrorCode errorCode = m_serversModel->removeAllContainers();
|
||||||
|
@ -329,7 +329,7 @@ void InstallController::removeAllContainers()
|
||||||
|
|
||||||
void InstallController::removeCurrentlyProcessedContainer()
|
void InstallController::removeCurrentlyProcessedContainer()
|
||||||
{
|
{
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
QString serverName = m_serversModel->data(serverIndex, ServersModel::Roles::NameRole).toString();
|
||||||
|
|
||||||
int container = m_containersModel->getCurrentlyProcessedContainerIndex();
|
int container = m_containersModel->getCurrentlyProcessedContainerIndex();
|
||||||
|
@ -377,7 +377,7 @@ void InstallController::mountSftpDrive(const QString &port, const QString &passw
|
||||||
QString mountPath;
|
QString mountPath;
|
||||||
QString cmd;
|
QString cmd;
|
||||||
|
|
||||||
int serverIndex = m_serversModel->getCurrentlyProcessedServerIndex();
|
int serverIndex = m_serversModel->getProcessedServerIndex();
|
||||||
ServerCredentials serverCredentials =
|
ServerCredentials serverCredentials =
|
||||||
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
qvariant_cast<ServerCredentials>(m_serversModel->data(serverIndex, ServersModel::Roles::CredentialsRole));
|
||||||
QString hostname = serverCredentials.hostName;
|
QString hostname = serverCredentials.hostName;
|
||||||
|
|
|
@ -30,8 +30,8 @@ public slots:
|
||||||
|
|
||||||
void updateContainer(QJsonObject config);
|
void updateContainer(QJsonObject config);
|
||||||
|
|
||||||
void removeCurrentlyProcessedServer();
|
void removeProcessedServer();
|
||||||
void rebootCurrentlyProcessedServer();
|
void rebootProcessedServer();
|
||||||
void removeAllContainers();
|
void removeAllContainers();
|
||||||
void removeCurrentlyProcessedContainer();
|
void removeCurrentlyProcessedContainer();
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ signals:
|
||||||
|
|
||||||
void scanServerFinished(bool isInstalledContainerFound);
|
void scanServerFinished(bool isInstalledContainerFound);
|
||||||
|
|
||||||
void rebootCurrentlyProcessedServerFinished(const QString &finishedMessage);
|
void rebootProcessedServerFinished(const QString &finishedMessage);
|
||||||
void removeCurrentlyProcessedServerFinished(const QString &finishedMessage);
|
void removeProcessedServerFinished(const QString &finishedMessage);
|
||||||
void removeAllContainersFinished(const QString &finishedMessage);
|
void removeAllContainersFinished(const QString &finishedMessage);
|
||||||
void removeCurrentlyProcessedContainerFinished(const QString &finishedMessage);
|
void removeCurrentlyProcessedContainerFinished(const QString &finishedMessage);
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,13 @@
|
||||||
ServersModel::ServersModel(std::shared_ptr<Settings> settings, QObject *parent)
|
ServersModel::ServersModel(std::shared_ptr<Settings> settings, QObject *parent)
|
||||||
: m_settings(settings), QAbstractListModel(parent)
|
: m_settings(settings), QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
m_servers = m_settings->serversArray();
|
|
||||||
m_defaultServerIndex = m_settings->defaultServerIndex();
|
|
||||||
m_currentlyProcessedServerIndex = m_defaultServerIndex;
|
|
||||||
|
|
||||||
connect(this, &ServersModel::defaultServerIndexChanged, this, &ServersModel::defaultServerNameChanged);
|
connect(this, &ServersModel::defaultServerIndexChanged, this, &ServersModel::defaultServerNameChanged);
|
||||||
connect(this, &ServersModel::defaultContainerChanged, this, &ServersModel::defaultServerDescriptionChanged);
|
|
||||||
connect(this, &ServersModel::defaultServerIndexChanged, this, [this](const int serverIndex) {
|
connect(this, &ServersModel::defaultServerIndexChanged, this, [this](const int serverIndex) {
|
||||||
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
|
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
|
||||||
emit ServersModel::defaultContainerChanged(defaultContainer);
|
emit ServersModel::defaultServerDefaultContainerChanged(defaultContainer);
|
||||||
});
|
emit ServersModel::defaultServerNameChanged();
|
||||||
connect(this, &ServersModel::currentlyProcessedServerIndexChanged, this, [this](const int serverIndex) {
|
updateDefaultServerContainersModel();
|
||||||
auto defaultContainer = ContainerProps::containerFromString(m_servers.at(serverIndex).toObject().value(config_key::defaultContainer).toString());
|
|
||||||
emit ServersModel::defaultContainerChanged(defaultContainer);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,16 +68,14 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
case ServerDescriptionRole: {
|
case ServerDescriptionRole: {
|
||||||
if (configVersion) {
|
auto description = getServerDescription(server, index.row());
|
||||||
return server.value(config_key::description).toString();
|
return configVersion ? description : description + server.value(config_key::hostName).toString();
|
||||||
}
|
|
||||||
return server.value(config_key::hostName).toString();
|
|
||||||
}
|
}
|
||||||
case HostNameRole: return server.value(config_key::hostName).toString();
|
case HostNameRole: return server.value(config_key::hostName).toString();
|
||||||
case CredentialsRole: return QVariant::fromValue(serverCredentials(index.row()));
|
case CredentialsRole: return QVariant::fromValue(serverCredentials(index.row()));
|
||||||
case CredentialsLoginRole: return serverCredentials(index.row()).userName;
|
case CredentialsLoginRole: return serverCredentials(index.row()).userName;
|
||||||
case IsDefaultRole: return index.row() == m_defaultServerIndex;
|
case IsDefaultRole: return index.row() == m_defaultServerIndex;
|
||||||
case IsCurrentlyProcessedRole: return index.row() == m_currentlyProcessedServerIndex;
|
case IsCurrentlyProcessedRole: return index.row() == m_processedServerIndex;
|
||||||
case HasWriteAccessRole: {
|
case HasWriteAccessRole: {
|
||||||
auto credentials = serverCredentials(index.row());
|
auto credentials = serverCredentials(index.row());
|
||||||
return (!credentials.userName.isEmpty() && !credentials.secretData.isEmpty());
|
return (!credentials.userName.isEmpty() && !credentials.secretData.isEmpty());
|
||||||
|
@ -95,6 +87,13 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
|
||||||
case DefaultContainerRole: {
|
case DefaultContainerRole: {
|
||||||
return ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
|
return ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
|
||||||
}
|
}
|
||||||
|
case IsServerFromApiRole: {
|
||||||
|
return server.value(config_key::configVersion).toInt();
|
||||||
|
}
|
||||||
|
case HasAmneziaDns: {
|
||||||
|
QString primaryDns = server.value(config_key::dns1).toString();
|
||||||
|
return primaryDns == protocols::dns::amneziaDnsIp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -111,8 +110,9 @@ void ServersModel::resetModel()
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_servers = m_settings->serversArray();
|
m_servers = m_settings->serversArray();
|
||||||
m_defaultServerIndex = m_settings->defaultServerIndex();
|
m_defaultServerIndex = m_settings->defaultServerIndex();
|
||||||
m_currentlyProcessedServerIndex = m_defaultServerIndex;
|
m_processedServerIndex = m_defaultServerIndex;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
emit defaultServerIndexChanged(m_defaultServerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::setDefaultServerIndex(const int index)
|
void ServersModel::setDefaultServerIndex(const int index)
|
||||||
|
@ -132,12 +132,7 @@ const QString ServersModel::getDefaultServerName()
|
||||||
return qvariant_cast<QString>(data(m_defaultServerIndex, NameRole));
|
return qvariant_cast<QString>(data(m_defaultServerIndex, NameRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString ServersModel::getDefaultServerHostName()
|
QString ServersModel::getServerDescription(const QJsonObject &server, const int index) const
|
||||||
{
|
|
||||||
return qvariant_cast<QString>(data(m_defaultServerIndex, HostNameRole));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ServersModel::getDefaultServerDescription(const QJsonObject &server)
|
|
||||||
{
|
{
|
||||||
const auto configVersion = server.value(config_key::configVersion).toInt();
|
const auto configVersion = server.value(config_key::configVersion).toInt();
|
||||||
|
|
||||||
|
@ -145,13 +140,12 @@ QString ServersModel::getDefaultServerDescription(const QJsonObject &server)
|
||||||
|
|
||||||
if (configVersion) {
|
if (configVersion) {
|
||||||
return server.value(config_key::description).toString();
|
return server.value(config_key::description).toString();
|
||||||
} else if (isDefaultServerHasWriteAccess()) {
|
} else if (data(index, HasWriteAccessRole).toBool()) {
|
||||||
if (m_isAmneziaDnsEnabled
|
if (m_isAmneziaDnsEnabled && isAmneziaDnsContainerInstalled(index)) {
|
||||||
&& isAmneziaDnsContainerInstalled(m_defaultServerIndex)) {
|
|
||||||
description += "Amnezia DNS | ";
|
description += "Amnezia DNS | ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isDefaultServerConfigContainsAmneziaDns()) {
|
if (data(index, HasAmneziaDns).toBool()) {
|
||||||
description += "Amnezia DNS | ";
|
description += "Amnezia DNS | ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +156,7 @@ const QString ServersModel::getDefaultServerDescriptionCollapsed()
|
||||||
{
|
{
|
||||||
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
||||||
const auto configVersion = server.value(config_key::configVersion).toInt();
|
const auto configVersion = server.value(config_key::configVersion).toInt();
|
||||||
auto description = getDefaultServerDescription(server);
|
auto description = getServerDescription(server, m_defaultServerIndex);
|
||||||
if (configVersion) {
|
if (configVersion) {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +170,7 @@ const QString ServersModel::getDefaultServerDescriptionExpanded()
|
||||||
{
|
{
|
||||||
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
||||||
const auto configVersion = server.value(config_key::configVersion).toInt();
|
const auto configVersion = server.value(config_key::configVersion).toInt();
|
||||||
auto description = getDefaultServerDescription(server);
|
auto description = getServerDescription(server, m_defaultServerIndex);
|
||||||
if (configVersion) {
|
if (configVersion) {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
@ -199,26 +193,21 @@ bool ServersModel::hasServerWithWriteAccess()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::setCurrentlyProcessedServerIndex(const int index)
|
void ServersModel::setProcessedServerIndex(const int index)
|
||||||
{
|
{
|
||||||
m_currentlyProcessedServerIndex = index;
|
m_processedServerIndex = index;
|
||||||
updateContainersModel();
|
updateContainersModel();
|
||||||
emit currentlyProcessedServerIndexChanged(m_currentlyProcessedServerIndex);
|
emit processedServerIndexChanged(m_processedServerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServersModel::getCurrentlyProcessedServerIndex()
|
int ServersModel::getProcessedServerIndex()
|
||||||
{
|
{
|
||||||
return m_currentlyProcessedServerIndex;
|
return m_processedServerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ServersModel::getCurrentlyProcessedServerHostName()
|
const ServerCredentials ServersModel::getProcessedServerCredentials()
|
||||||
{
|
{
|
||||||
return qvariant_cast<QString>(data(m_currentlyProcessedServerIndex, HostNameRole));
|
return serverCredentials(m_processedServerIndex);
|
||||||
}
|
|
||||||
|
|
||||||
const ServerCredentials ServersModel::getCurrentlyProcessedServerCredentials()
|
|
||||||
{
|
|
||||||
return serverCredentials(m_currentlyProcessedServerIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ServerCredentials ServersModel::getServerCredentials(const int index)
|
const ServerCredentials ServersModel::getServerCredentials(const int index)
|
||||||
|
@ -228,12 +217,12 @@ const ServerCredentials ServersModel::getServerCredentials(const int index)
|
||||||
|
|
||||||
bool ServersModel::isDefaultServerCurrentlyProcessed()
|
bool ServersModel::isDefaultServerCurrentlyProcessed()
|
||||||
{
|
{
|
||||||
return m_defaultServerIndex == m_currentlyProcessedServerIndex;
|
return m_defaultServerIndex == m_processedServerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServersModel::isCurrentlyProcessedServerHasWriteAccess()
|
bool ServersModel::isProcessedServerHasWriteAccess()
|
||||||
{
|
{
|
||||||
return qvariant_cast<bool>(data(m_currentlyProcessedServerIndex, HasWriteAccessRole));
|
return qvariant_cast<bool>(data(m_processedServerIndex, HasWriteAccessRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServersModel::isDefaultServerHasWriteAccess()
|
bool ServersModel::isDefaultServerHasWriteAccess()
|
||||||
|
@ -249,40 +238,42 @@ void ServersModel::addServer(const QJsonObject &server)
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::editServer(const QJsonObject &server)
|
void ServersModel::editServer(const QJsonObject &server, const int serverIndex)
|
||||||
{
|
{
|
||||||
m_settings->editServer(m_currentlyProcessedServerIndex, server);
|
m_settings->editServer(serverIndex, server);
|
||||||
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->serversArray().at(m_currentlyProcessedServerIndex));
|
m_servers.replace(serverIndex, m_settings->serversArray().at(serverIndex));
|
||||||
emit dataChanged(index(m_currentlyProcessedServerIndex, 0), index(m_currentlyProcessedServerIndex, 0));
|
emit dataChanged(index(serverIndex, 0), index(serverIndex, 0));
|
||||||
|
|
||||||
|
if (serverIndex == m_defaultServerIndex) {
|
||||||
|
updateDefaultServerContainersModel();
|
||||||
|
}
|
||||||
updateContainersModel();
|
updateContainersModel();
|
||||||
|
|
||||||
|
if (isDefaultServerCurrentlyProcessed()) {
|
||||||
|
auto defaultContainer = qvariant_cast<DockerContainer>(getDefaultServerData("defaultContainer"));
|
||||||
|
emit defaultServerDefaultContainerChanged(defaultContainer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::removeServer()
|
void ServersModel::removeServer()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_settings->removeServer(m_currentlyProcessedServerIndex);
|
m_settings->removeServer(m_processedServerIndex);
|
||||||
m_servers = m_settings->serversArray();
|
m_servers = m_settings->serversArray();
|
||||||
|
|
||||||
if (m_settings->defaultServerIndex() == m_currentlyProcessedServerIndex) {
|
if (m_settings->defaultServerIndex() == m_processedServerIndex) {
|
||||||
setDefaultServerIndex(0);
|
setDefaultServerIndex(0);
|
||||||
} else if (m_settings->defaultServerIndex() > m_currentlyProcessedServerIndex) {
|
} else if (m_settings->defaultServerIndex() > m_processedServerIndex) {
|
||||||
setDefaultServerIndex(m_settings->defaultServerIndex() - 1);
|
setDefaultServerIndex(m_settings->defaultServerIndex() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_settings->serversCount() == 0) {
|
if (m_settings->serversCount() == 0) {
|
||||||
setDefaultServerIndex(-1);
|
setDefaultServerIndex(-1);
|
||||||
}
|
}
|
||||||
setCurrentlyProcessedServerIndex(m_defaultServerIndex);
|
setProcessedServerIndex(m_defaultServerIndex);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServersModel::isDefaultServerConfigContainsAmneziaDns()
|
|
||||||
{
|
|
||||||
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
|
||||||
QString primaryDns = server.value(config_key::dns1).toString();
|
|
||||||
return primaryDns == protocols::dns::amneziaDnsIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<int, QByteArray> ServersModel::roleNames() const
|
QHash<int, QByteArray> ServersModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
|
@ -290,6 +281,8 @@ QHash<int, QByteArray> ServersModel::roleNames() const
|
||||||
roles[NameRole] = "serverName";
|
roles[NameRole] = "serverName";
|
||||||
roles[NameRole] = "name";
|
roles[NameRole] = "name";
|
||||||
roles[ServerDescriptionRole] = "serverDescription";
|
roles[ServerDescriptionRole] = "serverDescription";
|
||||||
|
roles[CollapsedServerDescriptionRole] = "collapsedServerDescription";
|
||||||
|
roles[ExpandedServerDescriptionRole] = "expandedServerDescription";
|
||||||
|
|
||||||
roles[HostNameRole] = "hostName";
|
roles[HostNameRole] = "hostName";
|
||||||
|
|
||||||
|
@ -304,6 +297,8 @@ QHash<int, QByteArray> ServersModel::roleNames() const
|
||||||
roles[ContainsAmneziaDnsRole] = "containsAmneziaDns";
|
roles[ContainsAmneziaDnsRole] = "containsAmneziaDns";
|
||||||
|
|
||||||
roles[DefaultContainerRole] = "defaultContainer";
|
roles[DefaultContainerRole] = "defaultContainer";
|
||||||
|
|
||||||
|
roles[IsServerFromApiRole] = "isServerFromApi";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,28 +317,29 @@ ServerCredentials ServersModel::serverCredentials(int index) const
|
||||||
|
|
||||||
void ServersModel::updateContainersModel()
|
void ServersModel::updateContainersModel()
|
||||||
{
|
{
|
||||||
auto containers = m_servers.at(m_currentlyProcessedServerIndex).toObject().value(config_key::containers).toArray();
|
auto containers = m_servers.at(m_processedServerIndex).toObject().value(config_key::containers).toArray();
|
||||||
emit containersUpdated(containers);
|
emit containersUpdated(containers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServersModel::updateDefaultServerContainersModel()
|
||||||
|
{
|
||||||
|
auto containers = m_servers.at(m_defaultServerIndex).toObject().value(config_key::containers).toArray();
|
||||||
|
emit defaultServerContainersUpdated(containers);
|
||||||
|
}
|
||||||
|
|
||||||
QJsonObject ServersModel::getDefaultServerConfig()
|
QJsonObject ServersModel::getDefaultServerConfig()
|
||||||
{
|
{
|
||||||
return m_servers.at(m_defaultServerIndex).toObject();
|
return m_servers.at(m_defaultServerIndex).toObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject ServersModel::getCurrentlyProcessedServerConfig()
|
void ServersModel::reloadDefaultServerContainerConfig()
|
||||||
{
|
{
|
||||||
return m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
||||||
}
|
|
||||||
|
|
||||||
void ServersModel::reloadContainerConfig()
|
|
||||||
{
|
|
||||||
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
|
||||||
auto container = ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
|
auto container = ContainerProps::containerFromString(server.value(config_key::defaultContainer).toString());
|
||||||
|
|
||||||
auto containers = server.value(config_key::containers).toArray();
|
auto containers = server.value(config_key::containers).toArray();
|
||||||
|
|
||||||
auto config = m_settings->containerConfig(m_currentlyProcessedServerIndex, container);
|
auto config = m_settings->containerConfig(m_defaultServerIndex, container);
|
||||||
for (auto i = 0; i < containers.size(); i++) {
|
for (auto i = 0; i < containers.size(); i++) {
|
||||||
auto c = ContainerProps::containerFromString(containers.at(i).toObject().value(config_key::container).toString());
|
auto c = ContainerProps::containerFromString(containers.at(i).toObject().value(config_key::container).toString());
|
||||||
if (c == container) {
|
if (c == container) {
|
||||||
|
@ -353,13 +349,13 @@ void ServersModel::reloadContainerConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
server.insert(config_key::containers, containers);
|
server.insert(config_key::containers, containers);
|
||||||
editServer(server);
|
editServer(server, m_defaultServerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::updateContainerConfig(const int containerIndex, const QJsonObject config)
|
void ServersModel::updateContainerConfig(const int containerIndex, const QJsonObject config)
|
||||||
{
|
{
|
||||||
auto container = static_cast<DockerContainer>(containerIndex);
|
auto container = static_cast<DockerContainer>(containerIndex);
|
||||||
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
|
||||||
|
|
||||||
auto containers = server.value(config_key::containers).toArray();
|
auto containers = server.value(config_key::containers).toArray();
|
||||||
for (auto i = 0; i < containers.size(); i++) {
|
for (auto i = 0; i < containers.size(); i++) {
|
||||||
|
@ -377,30 +373,25 @@ void ServersModel::updateContainerConfig(const int containerIndex, const QJsonOb
|
||||||
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
editServer(server);
|
editServer(server, m_processedServerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::addContainerConfig(const int containerIndex, const QJsonObject config)
|
void ServersModel::addContainerConfig(const int containerIndex, const QJsonObject config)
|
||||||
{
|
{
|
||||||
auto container = static_cast<DockerContainer>(containerIndex);
|
auto container = static_cast<DockerContainer>(containerIndex);
|
||||||
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
|
||||||
|
|
||||||
auto containers = server.value(config_key::containers).toArray();
|
auto containers = server.value(config_key::containers).toArray();
|
||||||
containers.push_back(config);
|
containers.push_back(config);
|
||||||
|
|
||||||
server.insert(config_key::containers, containers);
|
server.insert(config_key::containers, containers);
|
||||||
|
|
||||||
bool isDefaultContainerChanged = false;
|
|
||||||
auto defaultContainer = server.value(config_key::defaultContainer).toString();
|
auto defaultContainer = server.value(config_key::defaultContainer).toString();
|
||||||
if ((ContainerProps::containerFromString(defaultContainer) == DockerContainer::None || ContainerProps::containerService(container) != ServiceType::Other)) {
|
if ((ContainerProps::containerFromString(defaultContainer) == DockerContainer::None || ContainerProps::containerService(container) != ServiceType::Other)) {
|
||||||
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||||
isDefaultContainerChanged = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editServer(server);
|
editServer(server, m_processedServerIndex);
|
||||||
if (isDefaultContainerChanged) {
|
|
||||||
emit defaultContainerChanged(container);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::setDefaultContainer(const int serverIndex, const int containerIndex)
|
void ServersModel::setDefaultContainer(const int serverIndex, const int containerIndex)
|
||||||
|
@ -408,18 +399,12 @@ void ServersModel::setDefaultContainer(const int serverIndex, const int containe
|
||||||
auto container = static_cast<DockerContainer>(containerIndex);
|
auto container = static_cast<DockerContainer>(containerIndex);
|
||||||
QJsonObject s = m_servers.at(serverIndex).toObject();
|
QJsonObject s = m_servers.at(serverIndex).toObject();
|
||||||
s.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
s.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||||
editServer(s); //check
|
editServer(s, serverIndex); //check
|
||||||
emit defaultContainerChanged(container);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DockerContainer ServersModel::getDefaultContainer(const int serverIndex)
|
const QString ServersModel::getDefaultServerDefaultContainerName()
|
||||||
{
|
{
|
||||||
return qvariant_cast<DockerContainer>(data(serverIndex, DefaultContainerRole));
|
auto defaultContainer = qvariant_cast<DockerContainer>(getDefaultServerData("defaultContainer"));
|
||||||
}
|
|
||||||
|
|
||||||
const QString ServersModel::getDefaultContainerName()
|
|
||||||
{
|
|
||||||
auto defaultContainer = getDefaultContainer(m_defaultServerIndex);
|
|
||||||
return ContainerProps::containerHumanNames().value(defaultContainer);
|
return ContainerProps::containerHumanNames().value(defaultContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,15 +412,14 @@ ErrorCode ServersModel::removeAllContainers()
|
||||||
{
|
{
|
||||||
ServerController serverController(m_settings);
|
ServerController serverController(m_settings);
|
||||||
ErrorCode errorCode =
|
ErrorCode errorCode =
|
||||||
serverController.removeAllContainers(m_settings->serverCredentials(m_currentlyProcessedServerIndex));
|
serverController.removeAllContainers(m_settings->serverCredentials(m_processedServerIndex));
|
||||||
|
|
||||||
if (errorCode == ErrorCode::NoError) {
|
if (errorCode == ErrorCode::NoError) {
|
||||||
QJsonObject s = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
QJsonObject s = m_servers.at(m_processedServerIndex).toObject();
|
||||||
s.insert(config_key::containers, {});
|
s.insert(config_key::containers, {});
|
||||||
s.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
|
s.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None));
|
||||||
|
|
||||||
editServer(s);
|
editServer(s, m_processedServerIndex);
|
||||||
emit defaultContainerChanged(DockerContainer::None);
|
|
||||||
}
|
}
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
@ -443,7 +427,7 @@ ErrorCode ServersModel::removeAllContainers()
|
||||||
ErrorCode ServersModel::rebootServer()
|
ErrorCode ServersModel::rebootServer()
|
||||||
{
|
{
|
||||||
ServerController serverController(m_settings);
|
ServerController serverController(m_settings);
|
||||||
auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex);
|
auto credentials = m_settings->serverCredentials(m_processedServerIndex);
|
||||||
|
|
||||||
ErrorCode errorCode = serverController.rebootServer(credentials);
|
ErrorCode errorCode = serverController.rebootServer(credentials);
|
||||||
return errorCode;
|
return errorCode;
|
||||||
|
@ -452,13 +436,13 @@ ErrorCode ServersModel::rebootServer()
|
||||||
ErrorCode ServersModel::removeContainer(const int containerIndex)
|
ErrorCode ServersModel::removeContainer(const int containerIndex)
|
||||||
{
|
{
|
||||||
ServerController serverController(m_settings);
|
ServerController serverController(m_settings);
|
||||||
auto credentials = m_settings->serverCredentials(m_currentlyProcessedServerIndex);
|
auto credentials = m_settings->serverCredentials(m_processedServerIndex);
|
||||||
auto dockerContainer = static_cast<DockerContainer>(containerIndex);
|
auto dockerContainer = static_cast<DockerContainer>(containerIndex);
|
||||||
|
|
||||||
ErrorCode errorCode = serverController.removeContainer(credentials, dockerContainer);
|
ErrorCode errorCode = serverController.removeContainer(credentials, dockerContainer);
|
||||||
|
|
||||||
if (errorCode == ErrorCode::NoError) {
|
if (errorCode == ErrorCode::NoError) {
|
||||||
QJsonObject server = m_servers.at(m_currentlyProcessedServerIndex).toObject();
|
QJsonObject server = m_servers.at(m_processedServerIndex).toObject();
|
||||||
|
|
||||||
auto containers = server.value(config_key::containers).toArray();
|
auto containers = server.value(config_key::containers).toArray();
|
||||||
for (auto it = containers.begin(); it != containers.end(); it++) {
|
for (auto it = containers.begin(); it != containers.end(); it++) {
|
||||||
|
@ -480,32 +464,37 @@ ErrorCode ServersModel::removeContainer(const int containerIndex)
|
||||||
server.insert(config_key::defaultContainer, ContainerProps::containerToString(defaultContainer));
|
server.insert(config_key::defaultContainer, ContainerProps::containerToString(defaultContainer));
|
||||||
}
|
}
|
||||||
|
|
||||||
editServer(server);
|
editServer(server, m_processedServerIndex);
|
||||||
emit defaultContainerChanged(defaultContainer);
|
|
||||||
}
|
}
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::clearCachedProfiles()
|
void ServersModel::clearCachedProfiles()
|
||||||
{
|
{
|
||||||
const auto &containers = m_settings->containers(m_currentlyProcessedServerIndex);
|
const auto &containers = m_settings->containers(m_processedServerIndex);
|
||||||
for (DockerContainer container : containers.keys()) {
|
for (DockerContainer container : containers.keys()) {
|
||||||
m_settings->clearLastConnectionConfig(m_currentlyProcessedServerIndex, container);
|
m_settings->clearLastConnectionConfig(m_processedServerIndex, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->server(m_currentlyProcessedServerIndex));
|
m_servers.replace(m_processedServerIndex, m_settings->server(m_processedServerIndex));
|
||||||
|
if (m_processedServerIndex == m_defaultServerIndex) {
|
||||||
|
updateDefaultServerContainersModel();
|
||||||
|
}
|
||||||
updateContainersModel();
|
updateContainersModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::clearCachedProfile(const DockerContainer container)
|
void ServersModel::clearCachedProfile(const DockerContainer container)
|
||||||
{
|
{
|
||||||
m_settings->clearLastConnectionConfig(m_currentlyProcessedServerIndex, container);
|
m_settings->clearLastConnectionConfig(m_processedServerIndex, container);
|
||||||
|
|
||||||
m_servers.replace(m_currentlyProcessedServerIndex, m_settings->server(m_currentlyProcessedServerIndex));
|
m_servers.replace(m_processedServerIndex, m_settings->server(m_processedServerIndex));
|
||||||
|
if (m_processedServerIndex == m_defaultServerIndex) {
|
||||||
|
updateDefaultServerContainersModel();
|
||||||
|
}
|
||||||
updateContainersModel();
|
updateContainersModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServersModel::isAmneziaDnsContainerInstalled(const int serverIndex)
|
bool ServersModel::isAmneziaDnsContainerInstalled(const int serverIndex) const
|
||||||
{
|
{
|
||||||
QJsonObject server = m_servers.at(serverIndex).toObject();
|
QJsonObject server = m_servers.at(serverIndex).toObject();
|
||||||
auto containers = server.value(config_key::containers).toArray();
|
auto containers = server.value(config_key::containers).toArray();
|
||||||
|
@ -544,16 +533,6 @@ void ServersModel::toggleAmneziaDns(bool enabled)
|
||||||
emit defaultServerDescriptionChanged();
|
emit defaultServerDescriptionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServersModel::isDefaultServerFromApi()
|
|
||||||
{
|
|
||||||
return m_settings->server(m_defaultServerIndex).value(config_key::configVersion).toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ServersModel::isCurrentlyProcessedServerFromApi()
|
|
||||||
{
|
|
||||||
return m_settings->server(m_currentlyProcessedServerIndex).value(config_key::configVersion).toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ServersModel::isServerFromApiAlreadyExists(const quint16 crc)
|
bool ServersModel::isServerFromApiAlreadyExists(const quint16 crc)
|
||||||
{
|
{
|
||||||
for (const auto &server : qAsConst(m_servers)) {
|
for (const auto &server : qAsConst(m_servers)) {
|
||||||
|
@ -564,3 +543,37 @@ bool ServersModel::isServerFromApiAlreadyExists(const quint16 crc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant ServersModel::getDefaultServerData(const QString roleString)
|
||||||
|
{
|
||||||
|
auto roles = roleNames();
|
||||||
|
for (auto it = roles.begin(); it != roles.end(); it++) {
|
||||||
|
if (QString(it.value()) == roleString) {
|
||||||
|
return data(m_defaultServerIndex, it.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServersModel::setDefaultServerData(const QString roleString, const QVariant &value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant ServersModel::getProcessedServerData(const QString roleString)
|
||||||
|
{
|
||||||
|
auto roles = roleNames();
|
||||||
|
for (auto it = roles.begin(); it != roles.end(); it++) {
|
||||||
|
if (QString(it.value()) == roleString) {
|
||||||
|
return data(m_processedServerIndex, it.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServersModel::setProcessedServerData(const QString roleString, const QVariant &value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ public:
|
||||||
enum Roles {
|
enum Roles {
|
||||||
NameRole = Qt::UserRole + 1,
|
NameRole = Qt::UserRole + 1,
|
||||||
ServerDescriptionRole,
|
ServerDescriptionRole,
|
||||||
|
CollapsedServerDescriptionRole,
|
||||||
|
ExpandedServerDescriptionRole,
|
||||||
HostNameRole,
|
HostNameRole,
|
||||||
|
|
||||||
CredentialsRole,
|
CredentialsRole,
|
||||||
|
@ -25,7 +26,11 @@ public:
|
||||||
|
|
||||||
ContainsAmneziaDnsRole,
|
ContainsAmneziaDnsRole,
|
||||||
|
|
||||||
DefaultContainerRole
|
DefaultContainerRole,
|
||||||
|
|
||||||
|
IsServerFromApiRole,
|
||||||
|
|
||||||
|
HasAmneziaDns
|
||||||
};
|
};
|
||||||
|
|
||||||
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
||||||
|
@ -40,47 +45,40 @@ public:
|
||||||
|
|
||||||
Q_PROPERTY(int defaultIndex READ getDefaultServerIndex WRITE setDefaultServerIndex NOTIFY defaultServerIndexChanged)
|
Q_PROPERTY(int defaultIndex READ getDefaultServerIndex WRITE setDefaultServerIndex NOTIFY defaultServerIndexChanged)
|
||||||
Q_PROPERTY(QString defaultServerName READ getDefaultServerName NOTIFY defaultServerNameChanged)
|
Q_PROPERTY(QString defaultServerName READ getDefaultServerName NOTIFY defaultServerNameChanged)
|
||||||
Q_PROPERTY(QString defaultServerHostName READ getDefaultServerHostName NOTIFY defaultServerIndexChanged)
|
Q_PROPERTY(QString defaultServerDefaultContainerName READ getDefaultServerDefaultContainerName NOTIFY defaultServerDefaultContainerChanged)
|
||||||
Q_PROPERTY(QString defaultContainerName READ getDefaultContainerName NOTIFY defaultContainerChanged)
|
Q_PROPERTY(QString defaultServerDescriptionCollapsed READ getDefaultServerDescriptionCollapsed NOTIFY defaultServerDefaultContainerChanged)
|
||||||
Q_PROPERTY(QString defaultServerDescriptionCollapsed READ getDefaultServerDescriptionCollapsed NOTIFY defaultServerDescriptionChanged)
|
Q_PROPERTY(QString defaultServerDescriptionExpanded READ getDefaultServerDescriptionExpanded NOTIFY defaultServerDefaultContainerChanged)
|
||||||
Q_PROPERTY(QString defaultServerDescriptionExpanded READ getDefaultServerDescriptionExpanded NOTIFY defaultServerDescriptionChanged)
|
|
||||||
|
|
||||||
Q_PROPERTY(int currentlyProcessedIndex READ getCurrentlyProcessedServerIndex WRITE setCurrentlyProcessedServerIndex
|
Q_PROPERTY(int processedIndex READ getProcessedServerIndex WRITE setProcessedServerIndex NOTIFY processedServerIndexChanged)
|
||||||
NOTIFY currentlyProcessedServerIndexChanged)
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setDefaultServerIndex(const int index);
|
void setDefaultServerIndex(const int index);
|
||||||
const int getDefaultServerIndex();
|
const int getDefaultServerIndex();
|
||||||
const QString getDefaultServerName();
|
const QString getDefaultServerName();
|
||||||
const QString getDefaultServerHostName();
|
|
||||||
const QString getDefaultServerDescriptionCollapsed();
|
const QString getDefaultServerDescriptionCollapsed();
|
||||||
const QString getDefaultServerDescriptionExpanded();
|
const QString getDefaultServerDescriptionExpanded();
|
||||||
|
const QString getDefaultServerDefaultContainerName();
|
||||||
bool isDefaultServerCurrentlyProcessed();
|
bool isDefaultServerCurrentlyProcessed();
|
||||||
|
|
||||||
bool isCurrentlyProcessedServerHasWriteAccess();
|
bool isProcessedServerHasWriteAccess();
|
||||||
bool isDefaultServerHasWriteAccess();
|
bool isDefaultServerHasWriteAccess();
|
||||||
bool hasServerWithWriteAccess();
|
bool hasServerWithWriteAccess();
|
||||||
|
|
||||||
const int getServersCount();
|
const int getServersCount();
|
||||||
|
|
||||||
void setCurrentlyProcessedServerIndex(const int index);
|
void setProcessedServerIndex(const int index);
|
||||||
int getCurrentlyProcessedServerIndex();
|
int getProcessedServerIndex();
|
||||||
|
|
||||||
QString getCurrentlyProcessedServerHostName();
|
const ServerCredentials getProcessedServerCredentials();
|
||||||
const ServerCredentials getCurrentlyProcessedServerCredentials();
|
|
||||||
const ServerCredentials getServerCredentials(const int index);
|
const ServerCredentials getServerCredentials(const int index);
|
||||||
|
|
||||||
void addServer(const QJsonObject &server);
|
void addServer(const QJsonObject &server);
|
||||||
void editServer(const QJsonObject &server);
|
void editServer(const QJsonObject &server, const int serverIndex);
|
||||||
void removeServer();
|
void removeServer();
|
||||||
|
|
||||||
bool isDefaultServerConfigContainsAmneziaDns();
|
|
||||||
bool isAmneziaDnsContainerInstalled(const int serverIndex);
|
|
||||||
|
|
||||||
QJsonObject getDefaultServerConfig();
|
QJsonObject getDefaultServerConfig();
|
||||||
QJsonObject getCurrentlyProcessedServerConfig();
|
|
||||||
|
|
||||||
void reloadContainerConfig();
|
void reloadDefaultServerContainerConfig();
|
||||||
void updateContainerConfig(const int containerIndex, const QJsonObject config);
|
void updateContainerConfig(const int containerIndex, const QJsonObject config);
|
||||||
void addContainerConfig(const int containerIndex, const QJsonObject config);
|
void addContainerConfig(const int containerIndex, const QJsonObject config);
|
||||||
|
|
||||||
|
@ -92,42 +90,47 @@ public slots:
|
||||||
ErrorCode rebootServer();
|
ErrorCode rebootServer();
|
||||||
|
|
||||||
void setDefaultContainer(const int serverIndex, const int containerIndex);
|
void setDefaultContainer(const int serverIndex, const int containerIndex);
|
||||||
DockerContainer getDefaultContainer(const int serverIndex);
|
|
||||||
const QString getDefaultContainerName();
|
|
||||||
|
|
||||||
QStringList getAllInstalledServicesName(const int serverIndex);
|
QStringList getAllInstalledServicesName(const int serverIndex);
|
||||||
|
|
||||||
void toggleAmneziaDns(bool enabled);
|
void toggleAmneziaDns(bool enabled);
|
||||||
|
|
||||||
bool isDefaultServerFromApi();
|
|
||||||
bool isCurrentlyProcessedServerFromApi();
|
|
||||||
|
|
||||||
bool isServerFromApiAlreadyExists(const quint16 crc);
|
bool isServerFromApiAlreadyExists(const quint16 crc);
|
||||||
|
|
||||||
|
QVariant getDefaultServerData(const QString roleString);
|
||||||
|
void setDefaultServerData(const QString roleString, const QVariant &value);
|
||||||
|
|
||||||
|
QVariant getProcessedServerData(const QString roleString);
|
||||||
|
void setProcessedServerData(const QString roleString, const QVariant &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentlyProcessedServerIndexChanged(const int index);
|
void processedServerIndexChanged(const int index);
|
||||||
void defaultServerIndexChanged(const int index);
|
void defaultServerIndexChanged(const int index);
|
||||||
void defaultServerNameChanged();
|
void defaultServerNameChanged();
|
||||||
void defaultServerDescriptionChanged();
|
void defaultServerDescriptionChanged();
|
||||||
|
|
||||||
void containersUpdated(const QJsonArray &containers);
|
void containersUpdated(const QJsonArray &containers);
|
||||||
void defaultContainerChanged(const int containerIndex);
|
void defaultServerContainersUpdated(const QJsonArray &containers);
|
||||||
|
void defaultServerDefaultContainerChanged(const int containerIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ServerCredentials serverCredentials(int index) const;
|
ServerCredentials serverCredentials(int index) const;
|
||||||
void updateContainersModel();
|
void updateContainersModel();
|
||||||
|
void updateDefaultServerContainersModel();
|
||||||
|
|
||||||
QString getDefaultServerDescription(const QJsonObject &server);
|
QString getServerDescription(const QJsonObject &server, const int index) const;
|
||||||
|
|
||||||
|
bool isAmneziaDnsContainerInstalled(const int serverIndex) const;
|
||||||
|
|
||||||
QJsonArray m_servers;
|
QJsonArray m_servers;
|
||||||
|
|
||||||
std::shared_ptr<Settings> m_settings;
|
std::shared_ptr<Settings> m_settings;
|
||||||
|
|
||||||
int m_defaultServerIndex;
|
int m_defaultServerIndex;
|
||||||
int m_currentlyProcessedServerIndex;
|
int m_processedServerIndex;
|
||||||
|
|
||||||
bool m_isAmneziaDnsEnabled = m_settings->useAmneziaDns();
|
bool m_isAmneziaDnsEnabled = m_settings->useAmneziaDns();
|
||||||
};
|
};
|
||||||
|
|
|
@ -138,7 +138,7 @@ Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ServersModel.setCurrentlyProcessedServerIndex(ServersModel.defaultIndex)
|
ServersModel.setProcessedServerIndex(ServersModel.defaultIndex)
|
||||||
ApiController.updateServerConfigFromApi()
|
ApiController.updateServerConfigFromApi()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ ListView {
|
||||||
id: menuContent
|
id: menuContent
|
||||||
|
|
||||||
property var rootWidth
|
property var rootWidth
|
||||||
|
property var selectedText
|
||||||
|
|
||||||
width: rootWidth
|
width: rootWidth
|
||||||
height: menuContent.contentItem.height
|
height: menuContent.contentItem.height
|
||||||
|
@ -51,7 +52,7 @@ ListView {
|
||||||
showImage: !isInstalled
|
showImage: !isInstalled
|
||||||
|
|
||||||
checkable: isInstalled && !ConnectionController.isConnected && isSupported
|
checkable: isInstalled && !ConnectionController.isConnected && isSupported
|
||||||
checked: proxyContainersModel.mapToSource(index) === ServersModel.getDefaultContainer(ServersModel.defaultIndex)
|
checked: proxyDefaultServerContainersModel.mapToSource(index) === ServersModel.getDefaultServerData("defaultContainer")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (ConnectionController.isConnected && isInstalled) {
|
if (ConnectionController.isConnected && isInstalled) {
|
||||||
|
@ -61,14 +62,14 @@ ListView {
|
||||||
|
|
||||||
if (checked) {
|
if (checked) {
|
||||||
containersDropDown.close()
|
containersDropDown.close()
|
||||||
ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyContainersModel.mapToSource(index))
|
ServersModel.setDefaultContainer(ServersModel.defaultIndex, proxyDefaultServerContainersModel.mapToSource(index))
|
||||||
} else {
|
} else {
|
||||||
if (!isSupported && isInstalled) {
|
if (!isSupported && isInstalled) {
|
||||||
PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform"))
|
PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index))
|
ContainersModel.setCurrentlyProcessedContainerIndex(proxyDefaultServerContainersModel.mapToSource(index))
|
||||||
InstallController.setShouldCreateServer(false)
|
InstallController.setShouldCreateServer(false)
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
||||||
containersDropDown.close()
|
containersDropDown.close()
|
||||||
|
|
|
@ -179,13 +179,12 @@ PageType {
|
||||||
rootButtonTextTopMargin: 8
|
rootButtonTextTopMargin: 8
|
||||||
rootButtonTextBottomMargin: 8
|
rootButtonTextBottomMargin: 8
|
||||||
|
|
||||||
text: ServersModel.defaultContainerName
|
text: ServersModel.defaultServerDefaultContainerName
|
||||||
textColor: "#0E0E11"
|
textColor: "#0E0E11"
|
||||||
headerText: qsTr("VPN protocol")
|
headerText: qsTr("VPN protocol")
|
||||||
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||||
|
|
||||||
rootButtonClickedFunction: function() {
|
rootButtonClickedFunction: function() {
|
||||||
ServersModel.currentlyProcessedIndex = serversMenuContent.currentIndex
|
|
||||||
containersDropDown.open()
|
containersDropDown.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,22 +196,23 @@ PageType {
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onDefaultServerIndexChanged() {
|
||||||
updateContainersModelFilters()
|
updateContainersModelFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateContainersModelFilters() {
|
function updateContainersModelFilters() {
|
||||||
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
|
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
||||||
} else {
|
} else {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
model: SortFilterProxyModel {
|
||||||
id: proxyContainersModel
|
id: proxyDefaultServerContainersModel
|
||||||
sourceModel: ContainersModel
|
sourceModel: DefaultServerContainersModel
|
||||||
|
|
||||||
sorters: [
|
sorters: [
|
||||||
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
|
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
|
||||||
]
|
]
|
||||||
|
@ -308,21 +308,7 @@ PageType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: name
|
text: name
|
||||||
descriptionText: {
|
descriptionText: serverDescription
|
||||||
var fullDescription = ""
|
|
||||||
if (hasWriteAccess) {
|
|
||||||
if (SettingsController.isAmneziaDnsEnabled()
|
|
||||||
&& ServersModel.isAmneziaDnsContainerInstalled(index)) {
|
|
||||||
fullDescription += "Amnezia DNS | "
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (containsAmneziaDns) {
|
|
||||||
fullDescription += "Amnezia DNS | "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullDescription += serverDescription
|
|
||||||
}
|
|
||||||
|
|
||||||
checked: index === serversMenuContent.currentIndex
|
checked: index === serversMenuContent.currentIndex
|
||||||
checkable: !ConnectionController.isConnected
|
checkable: !ConnectionController.isConnected
|
||||||
|
@ -337,7 +323,6 @@ PageType {
|
||||||
|
|
||||||
serversMenuContent.currentIndex = index
|
serversMenuContent.currentIndex = index
|
||||||
|
|
||||||
ServersModel.currentlyProcessedIndex = index
|
|
||||||
ServersModel.defaultIndex = index
|
ServersModel.defaultIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +343,7 @@ PageType {
|
||||||
z: 1
|
z: 1
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
ServersModel.currentlyProcessedIndex = index
|
ServersModel.processedIndex = index
|
||||||
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
||||||
drawer.close()
|
drawer.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: listview
|
id: listview
|
||||||
|
|
|
@ -44,7 +44,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: listview
|
id: listview
|
||||||
|
|
|
@ -175,7 +175,7 @@ PageType {
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
visible: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
|
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
|
||||||
textColor: "#EB5757"
|
textColor: "#EB5757"
|
||||||
|
|
|
@ -43,7 +43,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: listview
|
id: listview
|
||||||
|
|
|
@ -49,7 +49,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
enabled: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
enabled: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: listview
|
id: listview
|
||||||
|
@ -88,7 +88,7 @@ PageType {
|
||||||
Layout.topMargin: 32
|
Layout.topMargin: 32
|
||||||
|
|
||||||
text: qsTr("Host")
|
text: qsTr("Host")
|
||||||
descriptionText: ServersModel.getCurrentlyProcessedServerHostName()
|
descriptionText: ServersModel.getProcessedServerData("HostName")
|
||||||
|
|
||||||
descriptionOnTop: true
|
descriptionOnTop: true
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,12 @@ PageType {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
contentHeight: content.height
|
contentHeight: content.height
|
||||||
|
|
||||||
enabled: !ServersModel.isDefaultServerFromApi()
|
property var isServerFromApi: ServersModel.getDefaultServerData("isServerFromApi")
|
||||||
|
|
||||||
|
enabled: !isServerFromApi
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (ServersModel.isDefaultServerFromApi()) {
|
if (isServerFromApi) {
|
||||||
PageController.showNotificationMessage(qsTr("Default server does not support custom dns"))
|
PageController.showNotificationMessage(qsTr("Default server does not support custom dns"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ PageType {
|
||||||
PageController.showErrorMessage(message)
|
PageController.showErrorMessage(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRemoveCurrentlyProcessedServerFinished(finishedMessage) {
|
function onRemoveProcessedServerFinished(finishedMessage) {
|
||||||
if (!ServersModel.getServersCount()) {
|
if (!ServersModel.getServersCount()) {
|
||||||
PageController.replaceStartPage()
|
PageController.replaceStartPage()
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,7 +38,7 @@ PageType {
|
||||||
PageController.showNotificationMessage(finishedMessage)
|
PageController.showNotificationMessage(finishedMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRebootCurrentlyProcessedServerFinished(finishedMessage) {
|
function onRebootProcessedServerFinished(finishedMessage) {
|
||||||
PageController.showNotificationMessage(finishedMessage)
|
PageController.showNotificationMessage(finishedMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ PageType {
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onProcessedServerIndexChanged() {
|
||||||
content.isServerWithWriteAccess = ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
content.isServerWithWriteAccess = ServersModel.isProcessedServerHasWriteAccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
property bool isServerWithWriteAccess: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
property bool isServerWithWriteAccess: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
visible: content.isServerWithWriteAccess
|
visible: content.isServerWithWriteAccess
|
||||||
|
@ -149,7 +149,7 @@ PageType {
|
||||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||||
ConnectionController.closeConnection()
|
ConnectionController.closeConnection()
|
||||||
}
|
}
|
||||||
InstallController.rebootCurrentlyProcessedServer()
|
InstallController.rebootProcessedServer()
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
}
|
}
|
||||||
var noButtonFunction = function() {
|
var noButtonFunction = function() {
|
||||||
|
@ -180,7 +180,7 @@ PageType {
|
||||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||||
ConnectionController.closeConnection()
|
ConnectionController.closeConnection()
|
||||||
}
|
}
|
||||||
InstallController.removeCurrentlyProcessedServer()
|
InstallController.removeProcessedServer()
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
}
|
}
|
||||||
var noButtonFunction = function() {
|
var noButtonFunction = function() {
|
||||||
|
@ -224,7 +224,7 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
visible: ServersModel.isCurrentlyProcessedServerFromApi()
|
visible: ServersModel.getProcessedServerData("isServerFromApi")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("Reset API config")
|
text: qsTr("Reset API config")
|
||||||
|
@ -249,7 +249,7 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
visible: ServersModel.isCurrentlyProcessedServerFromApi()
|
visible: ServersModel.getProcessedServerData("isServerFromApi")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ PageType {
|
||||||
|
|
||||||
headerText: name
|
headerText: name
|
||||||
descriptionText: {
|
descriptionText: {
|
||||||
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
|
if (ServersModel.isProcessedServerHasWriteAccess()) {
|
||||||
return credentialsLogin + " · " + hostName
|
return credentialsLogin + " · " + hostName
|
||||||
} else {
|
} else {
|
||||||
return hostName
|
return hostName
|
||||||
|
|
|
@ -107,7 +107,7 @@ PageType {
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
visible: ServersModel.isProcessedServerHasWriteAccess()
|
||||||
|
|
||||||
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
|
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
|
||||||
textColor: "#EB5757"
|
textColor: "#EB5757"
|
||||||
|
|
|
@ -38,13 +38,13 @@ PageType {
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onProcessedServerIndexChanged() {
|
||||||
settingsContainersListView.updateContainersModelFilters()
|
settingsContainersListView.updateContainersModelFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateContainersModelFilters() {
|
function updateContainersModelFilters() {
|
||||||
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
|
if (ServersModel.isProcessedServerHasWriteAccess()) {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
||||||
} else {
|
} else {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
||||||
|
|
|
@ -38,13 +38,13 @@ PageType {
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onProcessedServerIndexChanged() {
|
||||||
settingsContainersListView.updateContainersModelFilters()
|
settingsContainersListView.updateContainersModelFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateContainersModelFilters() {
|
function updateContainersModelFilters() {
|
||||||
if (ServersModel.isCurrentlyProcessedServerHasWriteAccess()) {
|
if (ServersModel.isProcessedServerHasWriteAccess()) {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessServicesListFilters()
|
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessServicesListFilters()
|
||||||
} else {
|
} else {
|
||||||
proxyContainersModel.filters = ContainersModelFilters.getReadAccessServicesListFilters()
|
proxyContainersModel.filters = ContainersModelFilters.getReadAccessServicesListFilters()
|
||||||
|
|
|
@ -87,7 +87,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
ServersModel.currentlyProcessedIndex = index
|
ServersModel.processedIndex = index
|
||||||
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,16 @@ import "../Components"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property var isServerFromApi: ServersModel.getDefaultServerData("isServerFromApi")
|
||||||
|
|
||||||
defaultActiveFocusItem: website_ip_field.textField
|
defaultActiveFocusItem: website_ip_field.textField
|
||||||
|
|
||||||
property bool pageEnabled: {
|
property bool pageEnabled: {
|
||||||
return !ConnectionController.isConnected && !ServersModel.isDefaultServerFromApi()
|
return !ConnectionController.isConnected && !isServerFromApi
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (ServersModel.isDefaultServerFromApi()) {
|
if (isServerFromApi) {
|
||||||
PageController.showNotificationMessage(qsTr("Default server does not support split tunneling function"))
|
PageController.showNotificationMessage(qsTr("Default server does not support split tunneling function"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ PageType {
|
||||||
|
|
||||||
function onInstallContainerFinished(finishedMessage, isServiceInstall) {
|
function onInstallContainerFinished(finishedMessage, isServiceInstall) {
|
||||||
if (!ConnectionController.isConnected && !isServiceInstall) {
|
if (!ConnectionController.isConnected && !isServiceInstall) {
|
||||||
ServersModel.setDefaultContainer(ServersModel.currentlyProcessedIndex, ContainersModel.getCurrentlyProcessedContainerIndex())
|
ServersModel.setDefaultContainer(ServersModel.processedIndex, ContainersModel.getCurrentlyProcessedContainerIndex())
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.closePage() // close installing page
|
PageController.closePage() // close installing page
|
||||||
|
@ -42,7 +42,7 @@ PageType {
|
||||||
function onInstallServerFinished(finishedMessage) {
|
function onInstallServerFinished(finishedMessage) {
|
||||||
if (!ConnectionController.isConnected) {
|
if (!ConnectionController.isConnected) {
|
||||||
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.goToStartPage()
|
PageController.goToStartPage()
|
||||||
|
@ -55,7 +55,7 @@ PageType {
|
||||||
|
|
||||||
function onServerAlreadyExists(serverIndex) {
|
function onServerAlreadyExists(serverIndex) {
|
||||||
PageController.goToStartPage()
|
PageController.goToStartPage()
|
||||||
ServersModel.currentlyProcessedIndex = serverIndex
|
ServersModel.processedIndex = serverIndex
|
||||||
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
|
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
|
||||||
|
|
||||||
PageController.showErrorMessage(qsTr("The server has already been added to the application"))
|
PageController.showErrorMessage(qsTr("The server has already been added to the application"))
|
||||||
|
|
|
@ -30,7 +30,7 @@ PageType {
|
||||||
function onImportFinished() {
|
function onImportFinished() {
|
||||||
if (!ConnectionController.isConnected) {
|
if (!ConnectionController.isConnected) {
|
||||||
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.goToStartPage()
|
PageController.goToStartPage()
|
||||||
|
|
|
@ -31,7 +31,7 @@ PageType {
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
ExportController.revokeConfig(index,
|
ExportController.revokeConfig(index,
|
||||||
ContainersModel.getCurrentlyProcessedContainerIndex(),
|
ContainersModel.getCurrentlyProcessedContainerIndex(),
|
||||||
ServersModel.getCurrentlyProcessedServerCredentials())
|
ServersModel.getProcessedServerCredentials())
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
PageController.showNotificationMessage(qsTr("Config revoked"))
|
PageController.showNotificationMessage(qsTr("Config revoked"))
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ PageType {
|
||||||
accessTypeSelector.currentIndex = 1
|
accessTypeSelector.currentIndex = 1
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
|
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
|
||||||
ServersModel.getCurrentlyProcessedServerCredentials())
|
ServersModel.getProcessedServerCredentials())
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ PageType {
|
||||||
|
|
||||||
function handler() {
|
function handler() {
|
||||||
serverSelector.text = selectedText
|
serverSelector.text = selectedText
|
||||||
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
|
ServersModel.processedIndex = proxyServersModel.mapToSource(currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ PageType {
|
||||||
target: serverSelector
|
target: serverSelector
|
||||||
|
|
||||||
function onSeverSelectorIndexChanged() {
|
function onSeverSelectorIndexChanged() {
|
||||||
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getDefaultContainer(ServersModel.currentlyProcessedIndex))
|
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
|
||||||
protocolSelectorListView.currentIndex = defaultContainer
|
protocolSelectorListView.currentIndex = defaultContainer
|
||||||
protocolSelectorListView.triggerCurrentItem()
|
protocolSelectorListView.triggerCurrentItem()
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ PageType {
|
||||||
if (accessTypeSelector.currentIndex === 1) {
|
if (accessTypeSelector.currentIndex === 1) {
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
|
ExportController.updateClientManagementModel(ContainersModel.getCurrentlyProcessedContainerIndex(),
|
||||||
ServersModel.getCurrentlyProcessedServerCredentials())
|
ServersModel.getProcessedServerCredentials())
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ PageType {
|
||||||
ExportController.renameClient(index,
|
ExportController.renameClient(index,
|
||||||
clientNameEditor.textFieldText,
|
clientNameEditor.textFieldText,
|
||||||
ContainersModel.getCurrentlyProcessedContainerIndex(),
|
ContainersModel.getCurrentlyProcessedContainerIndex(),
|
||||||
ServersModel.getCurrentlyProcessedServerCredentials())
|
ServersModel.getProcessedServerCredentials())
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
clientNameEditDrawer.close()
|
clientNameEditDrawer.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ PageType {
|
||||||
|
|
||||||
function handler() {
|
function handler() {
|
||||||
serverSelector.text = selectedText
|
serverSelector.text = selectedText
|
||||||
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
|
ServersModel.processedIndex = proxyServersModel.mapToSource(currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ PageType {
|
||||||
function onNoInstalledContainers() {
|
function onNoInstalledContainers() {
|
||||||
PageController.setTriggeredBtConnectButton(true)
|
PageController.setTriggeredBtConnectButton(true)
|
||||||
|
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.getDefaultServerIndex()
|
ServersModel.processedIndex = ServersModel.getDefaultServerIndex()
|
||||||
InstallController.setShouldCreateServer(false)
|
InstallController.setShouldCreateServer(false)
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardEasy)
|
PageController.goToPage(PageEnum.PageSetupWizardEasy)
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ PageType {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var pagePath = PageController.getPagePath(PageEnum.PageHome)
|
var pagePath = PageController.getPagePath(PageEnum.PageHome)
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||||
tabBarStackView.push(pagePath, { "objectName" : pagePath })
|
tabBarStackView.push(pagePath, { "objectName" : pagePath })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ PageType {
|
||||||
image: "qrc:/images/controls/home.svg"
|
image: "qrc:/images/controls/home.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
ServersModel.processedIndex = ServersModel.defaultIndex
|
||||||
tabBar.previousIndex = 0
|
tabBar.previousIndex = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue