Merge pull request #325 from amnezia-vpn/bugfix/reconnectvpn_when_dc_changed
auto reconection when current-server's defaul container hase been cha…
This commit is contained in:
commit
32dda9b904
10 changed files with 36 additions and 26 deletions
|
@ -118,6 +118,14 @@ void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
|||
emit connectionStateChanged();
|
||||
}
|
||||
|
||||
void ConnectionController::onCurrentContainerUpdated()
|
||||
{
|
||||
if (m_isConnected || m_isConnectionInProgress) {
|
||||
emit reconnectWithUpdatedContainer(tr("Settings updated successfully, Reconnnection..."));
|
||||
openConnection();
|
||||
}
|
||||
}
|
||||
|
||||
QString ConnectionController::connectionStateText() const
|
||||
{
|
||||
return m_connectionStateText;
|
||||
|
|
|
@ -32,6 +32,8 @@ public slots:
|
|||
QString getLastConnectionError();
|
||||
void onConnectionStateChanged(Vpn::ConnectionState state);
|
||||
|
||||
void onCurrentContainerUpdated();
|
||||
|
||||
signals:
|
||||
void connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
||||
const QJsonObject &containerConfig);
|
||||
|
@ -39,6 +41,7 @@ signals:
|
|||
void connectionStateChanged();
|
||||
|
||||
void connectionErrorOccurred(const QString &errorMessage);
|
||||
void reconnectWithUpdatedContainer(const QString &message);
|
||||
|
||||
private:
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
|
|
|
@ -259,7 +259,13 @@ void InstallController::updateContainer(QJsonObject config)
|
|||
m_containersModel->setData(modelIndex, config, ContainersModel::Roles::ConfigRole);
|
||||
m_protocolModel->updateModel(config);
|
||||
|
||||
emit updateContainerFinished();
|
||||
if ((serverIndex == m_serversModel->getDefaultServerIndex())
|
||||
&& (container == m_containersModel->getDefaultContainer())) {
|
||||
emit currentContainerUpdated();
|
||||
} else {
|
||||
emit updateContainerFinished(tr("Settings updated successfully"));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ signals:
|
|||
void installContainerFinished(const QString &finishMessage, bool isServiceInstall);
|
||||
void installServerFinished(const QString &finishMessage);
|
||||
|
||||
void updateContainerFinished();
|
||||
void updateContainerFinished(const QString& message);
|
||||
|
||||
void scanServerFinished(bool isInstalledContainerFound);
|
||||
|
||||
|
@ -66,6 +66,8 @@ signals:
|
|||
|
||||
void serverIsBusy(const bool isBusy);
|
||||
|
||||
void currentContainerUpdated();
|
||||
|
||||
private:
|
||||
void installServer(DockerContainer container, QJsonObject &config);
|
||||
void installContainer(DockerContainer container, QJsonObject &config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue