mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
6f119cd083
* fix: fixed dns processing * fix: fixed proceesed index/id selection * refactor: stop using the server index as state * fix: fixed autostart and start minimized * fix: fixed typo * fix: add socks5 extractConfigFromContainer * fix: remove unused currentContainerUpdated * fix: fixed clear cached profile order
66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
#ifndef CONNECTIONUICONTROLLER_H
|
|
#define CONNECTIONUICONTROLLER_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "core/controllers/connectionController.h"
|
|
#include "core/utils/errorCodes.h"
|
|
#include "core/utils/routeModes.h"
|
|
#include "core/utils/commonStructs.h"
|
|
#include "core/protocols/vpnProtocol.h"
|
|
#include "core/controllers/serversController.h"
|
|
|
|
class ConnectionUiController : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Q_PROPERTY(bool isConnected READ isConnected NOTIFY connectionStateChanged)
|
|
Q_PROPERTY(bool isConnectionInProgress READ isConnectionInProgress NOTIFY connectionStateChanged)
|
|
Q_PROPERTY(QString connectionStateText READ connectionStateText NOTIFY connectionStateChanged)
|
|
|
|
explicit ConnectionUiController(ConnectionController* connectionController,
|
|
ServersController* serversController,
|
|
QObject *parent = nullptr);
|
|
|
|
~ConnectionUiController() = default;
|
|
|
|
bool isConnected() const;
|
|
bool isConnectionInProgress() const;
|
|
QString connectionStateText() const;
|
|
|
|
public slots:
|
|
void toggleConnection();
|
|
|
|
void openConnection();
|
|
void closeConnection();
|
|
|
|
ErrorCode getLastConnectionError();
|
|
void onConnectionStateChanged(Vpn::ConnectionState state);
|
|
|
|
void onTranslationsUpdated();
|
|
|
|
signals:
|
|
void connectionStateChanged();
|
|
|
|
void connectionErrorOccurred(ErrorCode errorCode);
|
|
|
|
void connectButtonClicked();
|
|
void preparingConfig();
|
|
void prepareConfig();
|
|
|
|
private:
|
|
Vpn::ConnectionState getCurrentConnectionState();
|
|
|
|
ConnectionController* m_connectionController;
|
|
ServersController* m_serversController;
|
|
|
|
bool m_isConnected = false;
|
|
bool m_isConnectionInProgress = false;
|
|
QString m_connectionStateText = tr("Connect");
|
|
|
|
Vpn::ConnectionState m_state;
|
|
};
|
|
|
|
#endif
|