added reconnection to vpn after changing any protocol settings
This commit is contained in:
parent
bfc8c10f3d
commit
c0cb5b96bf
11 changed files with 33 additions and 79 deletions
|
@ -118,10 +118,10 @@ void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
|||
emit connectionStateChanged();
|
||||
}
|
||||
|
||||
void ConnectionController::onCurrentContainerChanged()
|
||||
void ConnectionController::onCurrentContainerUpdated()
|
||||
{
|
||||
if(m_isConnected || m_isConnectionInProgress) {
|
||||
emit reconnectWithChangedContainer(tr("Settings updated successfully, Reconnnection..."));
|
||||
if (m_isConnected || m_isConnectionInProgress) {
|
||||
emit reconnectWithUpdatedContainer(tr("Settings updated successfully, Reconnnection..."));
|
||||
openConnection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public slots:
|
|||
QString getLastConnectionError();
|
||||
void onConnectionStateChanged(Vpn::ConnectionState state);
|
||||
|
||||
void onCurrentContainerChanged();
|
||||
void onCurrentContainerUpdated();
|
||||
|
||||
signals:
|
||||
void connectToVpn(int serverIndex, const ServerCredentials &credentials, DockerContainer container,
|
||||
|
@ -41,7 +41,7 @@ signals:
|
|||
void connectionStateChanged();
|
||||
|
||||
void connectionErrorOccurred(const QString &errorMessage);
|
||||
void reconnectWithChangedContainer(const QString &message);
|
||||
void reconnectWithUpdatedContainer(const QString &message);
|
||||
|
||||
private:
|
||||
QSharedPointer<ServersModel> m_serversModel;
|
||||
|
|
|
@ -254,22 +254,14 @@ void InstallController::updateContainer(QJsonObject config)
|
|||
ServerController serverController(m_settings);
|
||||
connect(&serverController, &ServerController::serverIsBusy, this, &InstallController::serverIsBusy);
|
||||
|
||||
bool reinstallRequired = serverController.isReinstallContainerRequired(container, oldContainerConfig, config);
|
||||
auto errorCode = serverController.updateContainer(reinstallRequired, serverCredentials, container, oldContainerConfig, config);
|
||||
auto errorCode = serverController.updateContainer(serverCredentials, container, oldContainerConfig, config);
|
||||
if (errorCode == ErrorCode::NoError) {
|
||||
m_containersModel->setData(modelIndex, config, ContainersModel::Roles::ConfigRole);
|
||||
m_protocolModel->updateModel(config);
|
||||
|
||||
bool isCurrentContainerChanged = false;
|
||||
if (reinstallRequired &&
|
||||
(serverIndex == m_serversModel->getDefaultServerIndex()) &&
|
||||
(container == m_containersModel->getDefaultContainer()) ) {
|
||||
isCurrentContainerChanged = true;
|
||||
}
|
||||
|
||||
|
||||
if (isCurrentContainerChanged) {
|
||||
emit currentContainerChanged();
|
||||
if ((serverIndex == m_serversModel->getDefaultServerIndex())
|
||||
&& (container == m_containersModel->getDefaultContainer())) {
|
||||
emit currentContainerUpdated();
|
||||
} else {
|
||||
emit updateContainerFinished(tr("Settings updated successfully"));
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ signals:
|
|||
|
||||
void serverIsBusy(const bool isBusy);
|
||||
|
||||
void currentContainerChanged();
|
||||
void currentContainerUpdated();
|
||||
|
||||
private:
|
||||
void installServer(DockerContainer container, QJsonObject &config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue