mirror of
https://github.com/amnezia-vpn/DefaultVPN.git
synced 2026-05-17 08:36:37 +03:00
feature/api-controller-improvements (#567)
* added error handler for api controller * while downloading the config from the api, the Connecting status is now displayed * added a button to delete container config for api servers * added crc check to avoid re-import of api configs * fixed currentIndex of serversMenuContent after DefaultServerIndexChanged * added closing the import window after re-importing the config from api
This commit is contained in:
@@ -25,6 +25,11 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
|
||||
|
||||
void ConnectionController::openConnection()
|
||||
{
|
||||
if (!m_containersModel->isAnyContainerInstalled()) {
|
||||
emit noInstalledContainers();
|
||||
return;
|
||||
}
|
||||
|
||||
int serverIndex = m_serversModel->getDefaultServerIndex();
|
||||
ServerCredentials credentials = m_serversModel->getServerCredentials(serverIndex);
|
||||
|
||||
@@ -129,6 +134,17 @@ QString ConnectionController::connectionStateText() const
|
||||
return m_connectionStateText;
|
||||
}
|
||||
|
||||
void ConnectionController::toggleConnection(bool skipConnectionInProgressCheck)
|
||||
{
|
||||
if (!skipConnectionInProgressCheck && isConnectionInProgress()) {
|
||||
closeConnection();
|
||||
} else if (isConnected()) {
|
||||
closeConnection();
|
||||
} else {
|
||||
openConnection();
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionController::isConnectionInProgress() const
|
||||
{
|
||||
return m_isConnectionInProgress;
|
||||
|
||||
Reference in New Issue
Block a user