Merge remote-tracking branch 'remotes/origin/dev' into feature/qt6-libssh-support

This commit is contained in:
vladimir.kuznetsov 2023-04-03 17:48:55 +03:00
commit 4aba34c18b
28 changed files with 594 additions and 264 deletions

View file

@ -45,7 +45,6 @@ void AdvancedServerSettingsLogic::onPushButtonClearServerClicked()
}
ErrorCode e = m_serverController->removeAllContainers(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
m_serverController->disconnectFromHost(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
if (e) {
emit uiLogic()->showWarningMessage(tr("Error occurred while cleaning the server.") + "\n" +
tr("Error message: ") + errorString(e) + "\n" +

View file

@ -13,7 +13,7 @@ GeneralSettingsLogic::GeneralSettingsLogic(UiLogic *logic, QObject *parent):
void GeneralSettingsLogic::onUpdatePage()
{
uiLogic()->m_selectedServerIndex = m_settings->defaultServerIndex();
set_existsAnyServer(uiLogic()->m_selectedServerIndex >= 0);
set_existsAnyServer(m_settings->serversCount() > 0);
uiLogic()->m_selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
set_pushButtonGeneralSettingsShareConnectionEnable(m_settings->haveAuthData(m_settings->defaultServerIndex()));

View file

@ -31,6 +31,7 @@ void ServerContainersLogic::onUpdatePage()
p_model->setSelectedServerIndex(uiLogic()->m_selectedServerIndex);
set_isManagedServer(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
uiLogic()->m_installCredentials = m_settings->serverCredentials(uiLogic()->m_selectedServerIndex);
emit updatePage();
}

View file

@ -21,7 +21,6 @@ void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
{
uiLogic()->m_selectedServerIndex = index;
uiLogic()->m_installCredentials = m_settings->serverCredentials(index);
uiLogic()->goToPage(Page::ServerSettings);
}

View file

@ -181,14 +181,7 @@ void StartPageLogic::onPushButtonImportOpenFile()
file.open(QIODevice::ReadOnly);
QByteArray data = file.readAll();
auto configFormat = checkConfigFormat(QString(data));
if (configFormat == ConfigTypes::OpenVpn) {
importConnectionFromOpenVpnConfig(QString(data));
} else if (configFormat == ConfigTypes::WireGuard) {
importConnectionFromWireguardConfig(QString(data));
} else {
importConnectionFromCode(QString(data));
}
selectConfigFormat(QString(data));
}
#ifdef Q_OS_ANDROID
@ -198,6 +191,18 @@ void StartPageLogic::startQrDecoder()
}
#endif
void StartPageLogic::selectConfigFormat(QString configData)
{
auto configFormat = checkConfigFormat(configData);
if (configFormat == ConfigTypes::OpenVpn) {
importConnectionFromOpenVpnConfig(configData);
} else if (configFormat == ConfigTypes::WireGuard) {
importConnectionFromWireguardConfig(configData);
} else {
importConnectionFromCode(configData);
}
}
bool StartPageLogic::importConnection(const QJsonObject &profile)
{
ServerCredentials credentials;

View file

@ -35,6 +35,8 @@ public:
Q_INVOKABLE void startQrDecoder();
#endif
void selectConfigFormat(QString configData);
bool importConnection(const QJsonObject &profile);
bool importConnectionFromCode(QString code);
bool importConnectionFromQr(const QByteArray &data);