diff --git a/client/resources.qrc b/client/resources.qrc
index 7955a8f1..0f64386f 100644
--- a/client/resources.qrc
+++ b/client/resources.qrc
@@ -75,7 +75,7 @@
ui/qml/Pages/PageProtoCloak.qml
ui/qml/Pages/PageProtoOpenVPN.qml
ui/qml/Pages/PageProtoShadowSock.qml
- ui/qml/Pages/PageServer.qml
+ ui/qml/Pages/PageServerList.qml
ui/qml/Pages/PageServerProtocols.qml
ui/qml/Pages/PageServerSetting.qml
ui/qml/Pages/PageSetupWizard.qml
diff --git a/client/ui/pages_logic/ServerListLogic.cpp b/client/ui/pages_logic/ServerListLogic.cpp
index fda632f4..093e6832 100644
--- a/client/ui/pages_logic/ServerListLogic.cpp
+++ b/client/ui/pages_logic/ServerListLogic.cpp
@@ -38,9 +38,7 @@
#include "vpnconnection.h"
#include
-#if defined Q_OS_MAC || defined Q_OS_LINUX
-#include "ui/macos_util.h"
-#endif
+#include "../uilogic.h"
using namespace amnezia;
using namespace PageEnumNS;
@@ -48,7 +46,44 @@ using namespace PageEnumNS;
ServerListLogic::ServerListLogic(UiLogic *uiLogic, QObject *parent):
QObject(parent),
- m_uiLogic(uiLogic)
+ m_uiLogic(uiLogic),
+ m_serverListModel{new ServersModel(this)}
{
}
+
+QObject* ServerListLogic::getServerListModel() const
+{
+ return m_serverListModel;
+}
+
+void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
+{
+ m_settings.setDefaultServer(index);
+ updateServersListPage();
+}
+
+void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
+{
+ m_uiLogic->selectedServerIndex = index;
+ m_uiLogic->goToPage(Page::ServerSettings);
+}
+
+void ServerListLogic::updateServersListPage()
+{
+ const QJsonArray &servers = m_settings.serversArray();
+ int defaultServer = m_settings.defaultServerIndex();
+ std::vector serverListContent;
+ for(int i = 0; i < servers.size(); i++) {
+ ServerModelContent c;
+ auto server = servers.at(i).toObject();
+ c.desc = server.value(config_key::description).toString();
+ c.address = server.value(config_key::hostName).toString();
+ if (c.desc.isEmpty()) {
+ c.desc = c.address;
+ }
+ c.isDefault = (i == defaultServer);
+ serverListContent.push_back(c);
+ }
+ m_serverListModel->setContent(serverListContent);
+}
diff --git a/client/ui/pages_logic/ServerListLogic.h b/client/ui/pages_logic/ServerListLogic.h
index 8c13a9a9..91db1a2a 100644
--- a/client/ui/pages_logic/ServerListLogic.h
+++ b/client/ui/pages_logic/ServerListLogic.h
@@ -3,6 +3,7 @@
#include "../pages.h"
#include "settings.h"
+#include "../serversmodel.h"
class UiLogic;
@@ -10,10 +11,20 @@ class ServerListLogic : public QObject
{
Q_OBJECT
+public:
+ Q_INVOKABLE void updateServersListPage();
+
+ Q_PROPERTY(QObject* serverListModel READ getServerListModel CONSTANT)
+
+ Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
+ Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
+
public:
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ServerListLogic() = default;
+ QObject* getServerListModel() const;
+
signals:
@@ -29,6 +40,7 @@ private:
Settings m_settings;
UiLogic *m_uiLogic;
+ ServersModel* m_serverListModel;
};
#endif // SERVER_LIST_LOGIC_H
diff --git a/client/ui/pages_logic/ServerSettingsLogic.cpp b/client/ui/pages_logic/ServerSettingsLogic.cpp
index d0ce25d6..c47c4159 100644
--- a/client/ui/pages_logic/ServerSettingsLogic.cpp
+++ b/client/ui/pages_logic/ServerSettingsLogic.cpp
@@ -1,46 +1,34 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
-//#include "configurators/cloak_configurator.h"
-//#include "configurators/vpn_configurator.h"
-//#include "configurators/openvpn_configurator.h"
-//#include "configurators/shadowsocks_configurator.h"
-//#include "configurators/ssh_configurator.h"
-//#include "core/servercontroller.h"
-//#include "core/server_defs.h"
-//#include "core/errorstrings.h"
-
-//#include "protocols/protocols_defs.h"
-//#include "protocols/shadowsocksvpnprotocol.h"
-
-#include "debug.h"
#include "defines.h"
#include "ServerSettingsLogic.h"
#include "utils.h"
#include "vpnconnection.h"
#include
-#if defined Q_OS_MAC || defined Q_OS_LINUX
-#include "ui/macos_util.h"
-#endif
+#include "../uilogic.h"
+
+#include "core/errorstrings.h"
+#include
using namespace amnezia;
using namespace PageEnumNS;
@@ -48,7 +36,269 @@ using namespace PageEnumNS;
ServerSettingsLogic::ServerSettingsLogic(UiLogic *uiLogic, QObject *parent):
QObject(parent),
- m_uiLogic(uiLogic)
+ m_uiLogic(uiLogic),
+ m_pageServerSettingsEnabled{true},
+ m_labelServerSettingsWaitInfoVisible{true},
+ m_pushButtonServerSettingsClearVisible{true},
+ m_pushButtonServerSettingsClearClientCacheVisible{true},
+ m_pushButtonServerSettingsShareFullVisible{true},
+ m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")},
+ m_pushButtonServerSettingsClearClientCacheText{tr("Clear client cached profile")}
{
}
+
+void ServerSettingsLogic::updateServerSettingsPage()
+{
+ setLabelServerSettingsWaitInfoVisible(false);
+ setLabelServerSettingsWaitInfoText("");
+ setPushButtonServerSettingsClearVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
+ setPushButtonServerSettingsClearClientCacheVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
+ setPushButtonServerSettingsShareFullVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
+ QJsonObject server = m_settings.server(m_uiLogic->selectedServerIndex);
+ QString port = server.value(config_key::port).toString();
+ setLabelServerSettingsServerText(QString("%1@%2%3%4")
+ .arg(server.value(config_key::userName).toString())
+ .arg(server.value(config_key::hostName).toString())
+ .arg(port.isEmpty() ? "" : ":")
+ .arg(port));
+ setLineEditServerSettingsDescriptionText(server.value(config_key::description).toString());
+ QString selectedContainerName = m_settings.defaultContainerName(m_uiLogic->selectedServerIndex);
+ setLabelServerSettingsCurrentVpnProtocolText(tr("Protocol: ") + selectedContainerName);
+}
+
+bool ServerSettingsLogic::getPageServerSettingsEnabled() const
+{
+ return m_pageServerSettingsEnabled;
+}
+
+void ServerSettingsLogic::setPageServerSettingsEnabled(bool pageServerSettingsEnabled)
+{
+ if (m_pageServerSettingsEnabled != pageServerSettingsEnabled) {
+ m_pageServerSettingsEnabled = pageServerSettingsEnabled;
+ emit pageServerSettingsEnabledChanged();
+ }
+}
+
+
+void ServerSettingsLogic::onPushButtonServerSettingsClearServer()
+{
+ setPageServerSettingsEnabled(false);
+ setPushButtonServerSettingsClearText(tr("Uninstalling Amnezia software..."));
+
+ if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex) {
+ m_uiLogic->onDisconnect();
+ }
+
+ ErrorCode e = ServerController::removeAllContainers(m_settings.serverCredentials(m_uiLogic->selectedServerIndex));
+ ServerController::disconnectFromHost(m_settings.serverCredentials(m_uiLogic->selectedServerIndex));
+ if (e) {
+ m_uiLogic->setDialogConnectErrorText(
+ tr("Error occurred while configuring server.") + "\n" +
+ errorString(e) + "\n" +
+ tr("See logs for details."));
+ emit m_uiLogic->showConnectErrorDialog();
+ }
+ else {
+ setLabelServerSettingsWaitInfoVisible(true);
+ setLabelServerSettingsWaitInfoText(tr("Amnezia server successfully uninstalled"));
+ }
+
+ m_settings.setContainers(m_uiLogic->selectedServerIndex, {});
+ m_settings.setDefaultContainer(m_uiLogic->selectedServerIndex, DockerContainer::None);
+
+ setPageServerSettingsEnabled(true);
+ setPushButtonServerSettingsClearText(tr("Clear server from Amnezia software"));
+}
+
+void ServerSettingsLogic::onPushButtonServerSettingsForgetServer()
+{
+ if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex && m_uiLogic->m_vpnConnection->isConnected()) {
+ m_uiLogic->onDisconnect();
+ }
+ m_settings.removeServer(m_uiLogic->selectedServerIndex);
+
+ if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex) {
+ m_settings.setDefaultServer(0);
+ }
+ else if (m_settings.defaultServerIndex() > m_uiLogic->selectedServerIndex) {
+ m_settings.setDefaultServer(m_settings.defaultServerIndex() - 1);
+ }
+
+ if (m_settings.serversCount() == 0) {
+ m_settings.setDefaultServer(-1);
+ }
+
+
+ m_uiLogic->selectedServerIndex = -1;
+
+ // TODO_REFACT updateServersListPage();
+
+ if (m_settings.serversCount() == 0) {
+ m_uiLogic->setStartPage(Page::Start);
+ }
+ else {
+ m_uiLogic->closePage();
+ }
+}
+
+
+
+bool ServerSettingsLogic::getLabelServerSettingsWaitInfoVisible() const
+{
+ return m_labelServerSettingsWaitInfoVisible;
+}
+
+void ServerSettingsLogic::setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible)
+{
+ if (m_labelServerSettingsWaitInfoVisible != labelServerSettingsWaitInfoVisible) {
+ m_labelServerSettingsWaitInfoVisible = labelServerSettingsWaitInfoVisible;
+ emit labelServerSettingsWaitInfoVisibleChanged();
+ }
+}
+
+QString ServerSettingsLogic::getLabelServerSettingsWaitInfoText() const
+{
+ return m_labelServerSettingsWaitInfoText;
+}
+
+void ServerSettingsLogic::setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText)
+{
+ if (m_labelServerSettingsWaitInfoText != labelServerSettingsWaitInfoText) {
+ m_labelServerSettingsWaitInfoText = labelServerSettingsWaitInfoText;
+ emit labelServerSettingsWaitInfoTextChanged();
+ }
+}
+
+bool ServerSettingsLogic::getPushButtonServerSettingsClearVisible() const
+{
+ return m_pushButtonServerSettingsClearVisible;
+}
+
+void ServerSettingsLogic::setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible)
+{
+ if (m_pushButtonServerSettingsClearVisible != pushButtonServerSettingsClearVisible) {
+ m_pushButtonServerSettingsClearVisible = pushButtonServerSettingsClearVisible;
+ emit pushButtonServerSettingsClearVisibleChanged();
+ }
+}
+
+bool ServerSettingsLogic::getPushButtonServerSettingsClearClientCacheVisible() const
+{
+ return m_pushButtonServerSettingsClearClientCacheVisible;
+}
+
+void ServerSettingsLogic::setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible)
+{
+ if (m_pushButtonServerSettingsClearClientCacheVisible != pushButtonServerSettingsClearClientCacheVisible) {
+ m_pushButtonServerSettingsClearClientCacheVisible = pushButtonServerSettingsClearClientCacheVisible;
+ emit pushButtonServerSettingsClearClientCacheVisibleChanged();
+ }
+}
+
+bool ServerSettingsLogic::getPushButtonServerSettingsShareFullVisible() const
+{
+ return m_pushButtonServerSettingsShareFullVisible;
+}
+
+void ServerSettingsLogic::setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible)
+{
+ if (m_pushButtonServerSettingsShareFullVisible != pushButtonServerSettingsShareFullVisible) {
+ m_pushButtonServerSettingsShareFullVisible = pushButtonServerSettingsShareFullVisible;
+ emit pushButtonServerSettingsShareFullVisibleChanged();
+ }
+}
+
+QString ServerSettingsLogic::getLabelServerSettingsServerText() const
+{
+ return m_labelServerSettingsServerText;
+}
+
+void ServerSettingsLogic::setLabelServerSettingsServerText(const QString &labelServerSettingsServerText)
+{
+ if (m_labelServerSettingsServerText != labelServerSettingsServerText) {
+ m_labelServerSettingsServerText = labelServerSettingsServerText;
+ emit labelServerSettingsServerTextChanged();
+ }
+}
+
+QString ServerSettingsLogic::getLineEditServerSettingsDescriptionText() const
+{
+ return m_lineEditServerSettingsDescriptionText;
+}
+
+void ServerSettingsLogic::setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText)
+{
+ if (m_lineEditServerSettingsDescriptionText != lineEditServerSettingsDescriptionText) {
+ m_lineEditServerSettingsDescriptionText = lineEditServerSettingsDescriptionText;
+ emit lineEditServerSettingsDescriptionTextChanged();
+ }
+}
+
+QString ServerSettingsLogic::getLabelServerSettingsCurrentVpnProtocolText() const
+{
+ return m_labelServerSettingsCurrentVpnProtocolText;
+}
+
+void ServerSettingsLogic::setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText)
+{
+ if (m_labelServerSettingsCurrentVpnProtocolText != labelServerSettingsCurrentVpnProtocolText) {
+ m_labelServerSettingsCurrentVpnProtocolText = labelServerSettingsCurrentVpnProtocolText;
+ emit labelServerSettingsCurrentVpnProtocolTextChanged();
+ }
+}
+
+QString ServerSettingsLogic::getPushButtonServerSettingsClearText() const
+{
+ return m_pushButtonServerSettingsClearText;
+}
+
+void ServerSettingsLogic::setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText)
+{
+ if (m_pushButtonServerSettingsClearText != pushButtonServerSettingsClearText) {
+ m_pushButtonServerSettingsClearText = pushButtonServerSettingsClearText;
+ emit pushButtonServerSettingsClearTextChanged();
+ }
+}
+
+void ServerSettingsLogic::onPushButtonServerSettingsClearClientCacheClicked()
+{
+ setPushButtonServerSettingsClearClientCacheText(tr("Cache cleared"));
+
+ const auto &containers = m_settings.containers(m_uiLogic->selectedServerIndex);
+ for (DockerContainer container: containers.keys()) {
+ m_settings.clearLastConnectionConfig(m_uiLogic->selectedServerIndex, container);
+ }
+
+ QTimer::singleShot(3000, this, [this]() {
+ setPushButtonServerSettingsClearClientCacheText(tr("Clear client cached profile"));
+ });
+}
+
+void ServerSettingsLogic::onLineEditServerSettingsDescriptionEditingFinished()
+{
+ const QString &newText = getLineEditServerSettingsDescriptionText();
+ QJsonObject server = m_settings.server(m_uiLogic->selectedServerIndex);
+ server.insert(config_key::description, newText);
+ m_settings.editServer(m_uiLogic->selectedServerIndex, server);
+ // TODO_REFACT updateServersListPage();
+}
+
+QString ServerSettingsLogic::getPushButtonServerSettingsClearClientCacheText() const
+{
+ return m_pushButtonServerSettingsClearClientCacheText;
+}
+
+void ServerSettingsLogic::setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText)
+{
+ if (m_pushButtonServerSettingsClearClientCacheText != pushButtonServerSettingsClearClientCacheText) {
+ m_pushButtonServerSettingsClearClientCacheText = pushButtonServerSettingsClearClientCacheText;
+ emit pushButtonServerSettingsClearClientCacheTextChanged();
+ }
+}
+
+void ServerSettingsLogic::onPushButtonServerSettingsShareFullClicked()
+{
+ m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), DockerContainer::None);
+ m_uiLogic->goToPage(Page::ShareConnection);
+}
diff --git a/client/ui/pages_logic/ServerSettingsLogic.h b/client/ui/pages_logic/ServerSettingsLogic.h
index 7eaba310..57cf155e 100644
--- a/client/ui/pages_logic/ServerSettingsLogic.h
+++ b/client/ui/pages_logic/ServerSettingsLogic.h
@@ -10,13 +10,69 @@ class ServerSettingsLogic : public QObject
{
Q_OBJECT
+ Q_INVOKABLE void updateServerSettingsPage();
+
+ Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
+
+ Q_PROPERTY(bool labelServerSettingsWaitInfoVisible READ getLabelServerSettingsWaitInfoVisible WRITE setLabelServerSettingsWaitInfoVisible NOTIFY labelServerSettingsWaitInfoVisibleChanged)
+ Q_PROPERTY(QString labelServerSettingsWaitInfoText READ getLabelServerSettingsWaitInfoText WRITE setLabelServerSettingsWaitInfoText NOTIFY labelServerSettingsWaitInfoTextChanged)
+ Q_PROPERTY(QString pushButtonServerSettingsClearText READ getPushButtonServerSettingsClearText WRITE setPushButtonServerSettingsClearText NOTIFY pushButtonServerSettingsClearTextChanged)
+ Q_PROPERTY(QString pushButtonServerSettingsClearClientCacheText READ getPushButtonServerSettingsClearClientCacheText WRITE setPushButtonServerSettingsClearClientCacheText NOTIFY pushButtonServerSettingsClearClientCacheTextChanged)
+
+ Q_PROPERTY(bool pushButtonServerSettingsClearVisible READ getPushButtonServerSettingsClearVisible WRITE setPushButtonServerSettingsClearVisible NOTIFY pushButtonServerSettingsClearVisibleChanged)
+ Q_PROPERTY(bool pushButtonServerSettingsClearClientCacheVisible READ getPushButtonServerSettingsClearClientCacheVisible WRITE setPushButtonServerSettingsClearClientCacheVisible NOTIFY pushButtonServerSettingsClearClientCacheVisibleChanged)
+ Q_PROPERTY(bool pushButtonServerSettingsShareFullVisible READ getPushButtonServerSettingsShareFullVisible WRITE setPushButtonServerSettingsShareFullVisible NOTIFY pushButtonServerSettingsShareFullVisibleChanged)
+ Q_PROPERTY(QString labelServerSettingsServerText READ getLabelServerSettingsServerText WRITE setLabelServerSettingsServerText NOTIFY labelServerSettingsServerTextChanged)
+ Q_PROPERTY(QString lineEditServerSettingsDescriptionText READ getLineEditServerSettingsDescriptionText WRITE setLineEditServerSettingsDescriptionText NOTIFY lineEditServerSettingsDescriptionTextChanged)
+ Q_PROPERTY(QString labelServerSettingsCurrentVpnProtocolText READ getLabelServerSettingsCurrentVpnProtocolText WRITE setLabelServerSettingsCurrentVpnProtocolText NOTIFY labelServerSettingsCurrentVpnProtocolTextChanged)
+
+ Q_INVOKABLE void onPushButtonServerSettingsClearServer();
+ Q_INVOKABLE void onPushButtonServerSettingsForgetServer();
+ Q_INVOKABLE void onPushButtonServerSettingsShareFullClicked();
+ Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked();
+ Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished();
+
public:
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ServerSettingsLogic() = default;
+ bool getPageServerSettingsEnabled() const;
+ void setPageServerSettingsEnabled(bool pageServerSettingsEnabled);
+
+ bool getLabelServerSettingsWaitInfoVisible() const;
+ void setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible);
+ QString getLabelServerSettingsWaitInfoText() const;
+ void setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText);
+ bool getPushButtonServerSettingsClearVisible() const;
+ void setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible);
+ bool getPushButtonServerSettingsClearClientCacheVisible() const;
+ void setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible);
+ bool getPushButtonServerSettingsShareFullVisible() const;
+ void setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible);
+ QString getLabelServerSettingsServerText() const;
+ void setLabelServerSettingsServerText(const QString &labelServerSettingsServerText);
+ QString getLineEditServerSettingsDescriptionText() const;
+ void setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText);
+ QString getLabelServerSettingsCurrentVpnProtocolText() const;
+ void setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText);
+
+ QString getPushButtonServerSettingsClearText() const;
+ void setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText);
+ QString getPushButtonServerSettingsClearClientCacheText() const;
+ void setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText);
signals:
-
+ void pageServerSettingsEnabledChanged();
+ void labelServerSettingsWaitInfoVisibleChanged();
+ void labelServerSettingsWaitInfoTextChanged();
+ void pushButtonServerSettingsClearTextChanged();
+ void pushButtonServerSettingsClearVisibleChanged();
+ void pushButtonServerSettingsClearClientCacheVisibleChanged();
+ void pushButtonServerSettingsShareFullVisibleChanged();
+ void pushButtonServerSettingsClearClientCacheTextChanged();
+ void labelServerSettingsServerTextChanged();
+ void lineEditServerSettingsDescriptionTextChanged();
+ void labelServerSettingsCurrentVpnProtocolTextChanged();
private:
@@ -29,7 +85,18 @@ private:
Settings m_settings;
UiLogic *m_uiLogic;
+ bool m_pageServerSettingsEnabled;
+ bool m_labelServerSettingsWaitInfoVisible;
+ bool m_pushButtonServerSettingsClearVisible;
+ bool m_pushButtonServerSettingsClearClientCacheVisible;
+ bool m_pushButtonServerSettingsShareFullVisible;
+ QString m_lineEditServerSettingsDescriptionText;
+ QString m_labelServerSettingsCurrentVpnProtocolText;
+ QString m_labelServerSettingsServerText;
+ QString m_labelServerSettingsWaitInfoText;
+ QString m_pushButtonServerSettingsClearText;
+ QString m_pushButtonServerSettingsClearClientCacheText;
};
#endif // SERVER_SETTINGS_LOGIC_H
diff --git a/client/ui/pages_logic/SitesLogic.cpp b/client/ui/pages_logic/SitesLogic.cpp
index f41443a5..9ec7149c 100644
--- a/client/ui/pages_logic/SitesLogic.cpp
+++ b/client/ui/pages_logic/SitesLogic.cpp
@@ -1,5 +1,6 @@
#include
#include
+#include
#include
diff --git a/client/ui/qml/Pages/PageServer.qml b/client/ui/qml/Pages/PageServerList.qml
similarity index 95%
rename from client/ui/qml/Pages/PageServer.qml
rename to client/ui/qml/Pages/PageServerList.qml
index c8febe14..510381c1 100644
--- a/client/ui/qml/Pages/PageServer.qml
+++ b/client/ui/qml/Pages/PageServerList.qml
@@ -48,7 +48,7 @@ Item {
y: 90
width: 340
height: 501
- model: UiLogic.serverListModel
+ model: ServerListLogic.serverListModel
spacing: 5
delegate: Item {
height: 60
@@ -133,7 +133,7 @@ Item {
icon.source: checked ? "qrc:/images/check.png"
: "qrc:/images/uncheck.png"
onClicked: {
- UiLogic.onServerListPushbuttonDefaultClicked(index)
+ ServerListLogic.onServerListPushbuttonDefaultClicked(index)
}
checked: is_default
enabled: !is_default
@@ -146,7 +146,7 @@ Item {
height: 24
icon.source: "qrc:/images/settings.png"
onClicked: {
- UiLogic.onServerListPushbuttonSettingsClicked(index)
+ ServerListLogic.onServerListPushbuttonSettingsClicked(index)
}
OpacityAnimator {
id: mouseEnterAni
diff --git a/client/ui/qml/Pages/PageServerSetting.qml b/client/ui/qml/Pages/PageServerSetting.qml
index df5b0a94..88085a7e 100644
--- a/client/ui/qml/Pages/PageServerSetting.qml
+++ b/client/ui/qml/Pages/PageServerSetting.qml
@@ -7,7 +7,7 @@ import "../Config"
Item {
id: root
- enabled: UiLogic.pageServerSettingsEnabled
+ enabled: ServerSettingsLogic.pageServerSettingsEnabled
ImageButtonType {
id: back
@@ -47,7 +47,7 @@ Item {
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
- text: UiLogic.labelServerSettingsCurrentVpnProtocolText
+ text: ServerSettingsLogic.labelServerSettingsCurrentVpnProtocolText
}
LabelType {
anchors.horizontalCenter: parent.horizontalCenter
@@ -56,25 +56,25 @@ Item {
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
- text: UiLogic.labelServerSettingsServerText
+ text: ServerSettingsLogic.labelServerSettingsServerText
}
LabelType {
anchors.horizontalCenter: parent.horizontalCenter
y: 530
width: 301
height: 41
- text: UiLogic.labelServerSettingsWaitInfoText
- visible: UiLogic.labelServerSettingsWaitInfoVisible
+ text: ServerSettingsLogic.labelServerSettingsWaitInfoText
+ visible: ServerSettingsLogic.labelServerSettingsWaitInfoVisible
}
TextFieldType {
anchors.horizontalCenter: parent.horizontalCenter
y: 80
width: 251
height: 31
- text: UiLogic.lineEditServerSettingsDescriptionText
+ text: UiLoServerSettingsLogicgic.lineEditServerSettingsDescriptionText
onEditingFinished: {
- UiLogic.lineEditServerSettingsDescriptionText = text
- UiLogic.onLineEditServerSettingsDescriptionEditingFinished()
+ ServerSettingsLogic.lineEditServerSettingsDescriptionText = text
+ ServerSettingsLogic.onLineEditServerSettingsDescriptionEditingFinished()
}
}
BlueButtonType {
@@ -82,10 +82,10 @@ Item {
y: 410
width: 300
height: 40
- text: UiLogic.pushButtonServerSettingsClearText
- visible: UiLogic.pushButtonServerSettingsClearVisible
+ text: ServerSettingsLogic.pushButtonServerSettingsClearText
+ visible: ServerSettingsLogic.pushButtonServerSettingsClearVisible
onClicked: {
- UiLogic.onPushButtonClearServer()
+ ServerSettingsLogic.onPushButtonServerSettingsClearServer()
}
}
BlueButtonType {
@@ -93,10 +93,10 @@ Item {
y: 350
width: 300
height: 40
- text: UiLogic.pushButtonServerSettingsClearClientCacheText
- visible: UiLogic.pushButtonServerSettingsClearClientCacheVisible
+ text: ServerSettingsLogic.pushButtonServerSettingsClearClientCacheText
+ visible: ServerSettingsLogic.pushButtonServerSettingsClearClientCacheVisible
onClicked: {
- UiLogic.onPushButtonServerSettingsClearClientCacheClicked()
+ ServerSettingsLogic.onPushButtonServerSettingsClearClientCacheClicked()
}
}
BlueButtonType {
@@ -106,7 +106,7 @@ Item {
height: 40
text: qsTr("Forget this server")
onClicked: {
- UiLogic.onPushButtonForgetServer()
+ ServerSettingsLogic.onPushButtonServerSettingsForgetServer()
}
}
BlueButtonType {
@@ -116,7 +116,7 @@ Item {
height: 40
text: qsTr("VPN protocols")
onClicked: {
- UiLogic.goToPage(PageEnum.ServerVpnProtocols)
+ ServerSettingsLogic.goToPage(PageEnum.ServerVpnProtocols)
}
}
BlueButtonType {
@@ -125,9 +125,9 @@ Item {
width: 300
height: 40
text: qsTr("Share Server (FULL ACCESS)")
- visible: UiLogic.pushButtonServerSettingsShareFullVisible
+ visible: ServerSettingsLogic.pushButtonServerSettingsShareFullVisible
onClicked: {
- UiLogic.onPushButtonServerSettingsShareFullClicked()
+ ServerSettingsLogic.onPushButtonServerSettingsShareFullClicked()
}
}
}
diff --git a/client/ui/qml/main.qml b/client/ui/qml/main.qml
index 2e3c0f67..9b1883c9 100644
--- a/client/ui/qml/main.qml
+++ b/client/ui/qml/main.qml
@@ -117,7 +117,7 @@ Window {
if (item instanceof PageServerProtocols) {
return PageEnum.ServerVpnProtocols
}
- if (item instanceof PageServer) {
+ if (item instanceof PageServerList) {
return PageEnum.ServersList
}
if (item instanceof PageShareConnection) {
@@ -143,7 +143,7 @@ Window {
console.debug(pageComponent)
if (reset) {
if (page === PageEnum.ServerSettings) {
- UiLogic.updateServerPage();
+ ServerSettingsLogic.updateServerSettingsPage();
}
if (page === PageEnum.ShareConnection) {}
if (page === PageEnum.Wizard) {
@@ -159,7 +159,7 @@ Window {
GeneralSettingsLogic.updateGeneralSettingPage();
}
if (page === PageEnum.ServersList) {
- UiLogic.updateServersListPage();
+ ServerListLogic.updateServersListPage();
}
if (page === PageEnum.Start) {
UiLogic.pushButtonBackFromStartVisible = !pageLoader.empty
@@ -303,7 +303,7 @@ Window {
}
Component {
id: page_servers
- PageServer {}
+ PageServerList {}
}
Component {
id: page_app_settings
diff --git a/client/ui/uilogic.cpp b/client/ui/uilogic.cpp
index 9fd518a3..c13a89a5 100644
--- a/client/ui/uilogic.cpp
+++ b/client/ui/uilogic.cpp
@@ -81,14 +81,8 @@ UiLogic::UiLogic(QObject *parent) :
m_radioButtonVpnModeExceptSitesChecked{false},
m_pushButtonVpnAddSiteEnabled{true},
- m_labelServerSettingsWaitInfoVisible{true},
- m_labelServerSettingsWaitInfoText{},
- m_pushButtonServerSettingsClearVisible{true},
- m_pushButtonServerSettingsClearClientCacheVisible{true},
- m_pushButtonServerSettingsShareFullVisible{true},
- m_labelServerSettingsServerText{},
- m_lineEditServerSettingsDescriptionText{},
- m_labelServerSettingsCurrentVpnProtocolText{},
+
+
m_currentPageValue{0},
m_trayIconUrl{},
m_trayActionDisconnectEnabled{true},
@@ -162,8 +156,6 @@ UiLogic::UiLogic(QObject *parent) :
m_pushButtonNewServerConnectEnabled{},
m_pushButtonNewServerConnectText{tr("Connect")},
m_dialogConnectErrorText{},
- m_pageServerSettingsEnabled{true},
- m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")},
m_pageShareAmneziaVisible{true},
m_pageShareOpenvpnVisible{true},
m_pageShareShadowsocksVisible{true},
@@ -221,8 +213,6 @@ UiLogic::UiLogic(QObject *parent) :
m_labelProtoCloakInfoText{},
m_progressBarProtoCloakResetValue{0},
m_progressBarProtoCloakResetMaximium{100},
- m_serverListModel{nullptr},
- m_pushButtonServerSettingsClearClientCacheText{tr("Clear client cached profile")},
m_vpnConnection(nullptr)
{
m_vpnConnection = new VpnConnection(this);
@@ -302,7 +292,6 @@ void UiLogic::initalizeUiLogic()
- m_serverListModel = new ServersModel(this);
}
bool UiLogic::getFrameWireguardSettingsVisible() const
@@ -719,109 +708,6 @@ void UiLogic::setRadioButtonVpnModeExceptSitesChecked(bool radioButtonVpnModeExc
-bool UiLogic::getLabelServerSettingsWaitInfoVisible() const
-{
- return m_labelServerSettingsWaitInfoVisible;
-}
-
-void UiLogic::setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible)
-{
- if (m_labelServerSettingsWaitInfoVisible != labelServerSettingsWaitInfoVisible) {
- m_labelServerSettingsWaitInfoVisible = labelServerSettingsWaitInfoVisible;
- emit labelServerSettingsWaitInfoVisibleChanged();
- }
-}
-
-QString UiLogic::getLabelServerSettingsWaitInfoText() const
-{
- return m_labelServerSettingsWaitInfoText;
-}
-
-void UiLogic::setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText)
-{
- if (m_labelServerSettingsWaitInfoText != labelServerSettingsWaitInfoText) {
- m_labelServerSettingsWaitInfoText = labelServerSettingsWaitInfoText;
- emit labelServerSettingsWaitInfoTextChanged();
- }
-}
-
-bool UiLogic::getPushButtonServerSettingsClearVisible() const
-{
- return m_pushButtonServerSettingsClearVisible;
-}
-
-void UiLogic::setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible)
-{
- if (m_pushButtonServerSettingsClearVisible != pushButtonServerSettingsClearVisible) {
- m_pushButtonServerSettingsClearVisible = pushButtonServerSettingsClearVisible;
- emit pushButtonServerSettingsClearVisibleChanged();
- }
-}
-
-bool UiLogic::getPushButtonServerSettingsClearClientCacheVisible() const
-{
- return m_pushButtonServerSettingsClearClientCacheVisible;
-}
-
-void UiLogic::setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible)
-{
- if (m_pushButtonServerSettingsClearClientCacheVisible != pushButtonServerSettingsClearClientCacheVisible) {
- m_pushButtonServerSettingsClearClientCacheVisible = pushButtonServerSettingsClearClientCacheVisible;
- emit pushButtonServerSettingsClearClientCacheVisibleChanged();
- }
-}
-
-bool UiLogic::getPushButtonServerSettingsShareFullVisible() const
-{
- return m_pushButtonServerSettingsShareFullVisible;
-}
-
-void UiLogic::setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible)
-{
- if (m_pushButtonServerSettingsShareFullVisible != pushButtonServerSettingsShareFullVisible) {
- m_pushButtonServerSettingsShareFullVisible = pushButtonServerSettingsShareFullVisible;
- emit pushButtonServerSettingsShareFullVisibleChanged();
- }
-}
-
-QString UiLogic::getLabelServerSettingsServerText() const
-{
- return m_labelServerSettingsServerText;
-}
-
-void UiLogic::setLabelServerSettingsServerText(const QString &labelServerSettingsServerText)
-{
- if (m_labelServerSettingsServerText != labelServerSettingsServerText) {
- m_labelServerSettingsServerText = labelServerSettingsServerText;
- emit labelServerSettingsServerTextChanged();
- }
-}
-
-QString UiLogic::getLineEditServerSettingsDescriptionText() const
-{
- return m_lineEditServerSettingsDescriptionText;
-}
-
-void UiLogic::setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText)
-{
- if (m_lineEditServerSettingsDescriptionText != lineEditServerSettingsDescriptionText) {
- m_lineEditServerSettingsDescriptionText = lineEditServerSettingsDescriptionText;
- emit lineEditServerSettingsDescriptionTextChanged();
- }
-}
-
-QString UiLogic::getLabelServerSettingsCurrentVpnProtocolText() const
-{
- return m_labelServerSettingsCurrentVpnProtocolText;
-}
-
-void UiLogic::setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText)
-{
- if (m_labelServerSettingsCurrentVpnProtocolText != labelServerSettingsCurrentVpnProtocolText) {
- m_labelServerSettingsCurrentVpnProtocolText = labelServerSettingsCurrentVpnProtocolText;
- emit labelServerSettingsCurrentVpnProtocolTextChanged();
- }
-}
QString UiLogic::getComboBoxProtoCloakCipherText() const
{
return m_comboBoxProtoCloakCipherText;
@@ -1771,31 +1657,8 @@ void UiLogic::setDialogConnectErrorText(const QString &dialogConnectErrorText)
}
}
-bool UiLogic::getPageServerSettingsEnabled() const
-{
- return m_pageServerSettingsEnabled;
-}
-void UiLogic::setPageServerSettingsEnabled(bool pageServerSettingsEnabled)
-{
- if (m_pageServerSettingsEnabled != pageServerSettingsEnabled) {
- m_pageServerSettingsEnabled = pageServerSettingsEnabled;
- emit pageServerSettingsEnabledChanged();
- }
-}
-QString UiLogic::getPushButtonServerSettingsClearText() const
-{
- return m_pushButtonServerSettingsClearText;
-}
-
-void UiLogic::setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText)
-{
- if (m_pushButtonServerSettingsClearText != pushButtonServerSettingsClearText) {
- m_pushButtonServerSettingsClearText = pushButtonServerSettingsClearText;
- emit pushButtonServerSettingsClearTextChanged();
- }
-}
bool UiLogic::getPageShareAmneziaVisible() const
{
@@ -2534,23 +2397,7 @@ void UiLogic::setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakRes
}
}
-QString UiLogic::getPushButtonServerSettingsClearClientCacheText() const
-{
- return m_pushButtonServerSettingsClearClientCacheText;
-}
-void UiLogic::setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText)
-{
- if (m_pushButtonServerSettingsClearClientCacheText != pushButtonServerSettingsClearClientCacheText) {
- m_pushButtonServerSettingsClearClientCacheText = pushButtonServerSettingsClearClientCacheText;
- emit pushButtonServerSettingsClearClientCacheTextChanged();
- }
-}
-
-QObject* UiLogic::getServerListModel() const
-{
- return m_serverListModel;
-}
UiLogic::~UiLogic()
{
@@ -2650,23 +2497,7 @@ void UiLogic::onCloseWindow()
}
}
-void UiLogic::onServerListPushbuttonDefaultClicked(int index)
-{
- m_settings.setDefaultServer(index);
- updateServersListPage();
-}
-void UiLogic::onServerListPushbuttonSettingsClicked(int index)
-{
- selectedServerIndex = index;
- goToPage(Page::ServerSettings);
-}
-
-void UiLogic::onPushButtonServerSettingsShareFullClicked()
-{
- updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), DockerContainer::None);
- goToPage(Page::ShareConnection);
-}
//void UiLogic::showEvent(QShowEvent *event)
//{
@@ -3145,89 +2976,6 @@ ErrorCode UiLogic::doInstallAction(const std::function &action,
return ErrorCode::NoError;
}
-void UiLogic::onPushButtonClearServer()
-{
- setPageServerSettingsEnabled(false);
- setPushButtonServerSettingsClearText(tr("Uninstalling Amnezia software..."));
-
- if (m_settings.defaultServerIndex() == selectedServerIndex) {
- onDisconnect();
- }
-
- ErrorCode e = ServerController::removeAllContainers(m_settings.serverCredentials(selectedServerIndex));
- ServerController::disconnectFromHost(m_settings.serverCredentials(selectedServerIndex));
- if (e) {
- setDialogConnectErrorText(
- tr("Error occurred while configuring server.") + "\n" +
- errorString(e) + "\n" +
- tr("See logs for details."));
- emit showConnectErrorDialog();
- }
- else {
- setLabelServerSettingsWaitInfoVisible(true);
- setLabelServerSettingsWaitInfoText(tr("Amnezia server successfully uninstalled"));
- }
-
- m_settings.setContainers(selectedServerIndex, {});
- m_settings.setDefaultContainer(selectedServerIndex, DockerContainer::None);
-
- setPageServerSettingsEnabled(true);
- setPushButtonServerSettingsClearText(tr("Clear server from Amnezia software"));
-}
-
-void UiLogic::onPushButtonForgetServer()
-{
- if (m_settings.defaultServerIndex() == selectedServerIndex && m_vpnConnection->isConnected()) {
- onDisconnect();
- }
- m_settings.removeServer(selectedServerIndex);
-
- if (m_settings.defaultServerIndex() == selectedServerIndex) {
- m_settings.setDefaultServer(0);
- }
- else if (m_settings.defaultServerIndex() > selectedServerIndex) {
- m_settings.setDefaultServer(m_settings.defaultServerIndex() - 1);
- }
-
- if (m_settings.serversCount() == 0) {
- m_settings.setDefaultServer(-1);
- }
-
-
- selectedServerIndex = -1;
-
- updateServersListPage();
-
- if (m_settings.serversCount() == 0) {
- setStartPage(Page::Start);
- }
- else {
- closePage();
- }
-}
-
-void UiLogic::onPushButtonServerSettingsClearClientCacheClicked()
-{
- setPushButtonServerSettingsClearClientCacheText(tr("Cache cleared"));
-
- const auto &containers = m_settings.containers(selectedServerIndex);
- for (DockerContainer container: containers.keys()) {
- m_settings.clearLastConnectionConfig(selectedServerIndex, container);
- }
-
- QTimer::singleShot(3000, this, [this]() {
- setPushButtonServerSettingsClearClientCacheText(tr("Clear client cached profile"));
- });
-}
-
-void UiLogic::onLineEditServerSettingsDescriptionEditingFinished()
-{
- const QString &newText = getLineEditServerSettingsDescriptionText();
- QJsonObject server = m_settings.server(selectedServerIndex);
- server.insert(config_key::description, newText);
- m_settings.editServer(selectedServerIndex, server);
- updateServersListPage();
-}
void UiLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
{
@@ -3939,24 +3687,7 @@ void UiLogic::updateVpnPage()
-void UiLogic::updateServerPage()
-{
- setLabelServerSettingsWaitInfoVisible(false);
- setLabelServerSettingsWaitInfoText("");
- setPushButtonServerSettingsClearVisible(m_settings.haveAuthData(selectedServerIndex));
- setPushButtonServerSettingsClearClientCacheVisible(m_settings.haveAuthData(selectedServerIndex));
- setPushButtonServerSettingsShareFullVisible(m_settings.haveAuthData(selectedServerIndex));
- QJsonObject server = m_settings.server(selectedServerIndex);
- QString port = server.value(config_key::port).toString();
- setLabelServerSettingsServerText(QString("%1@%2%3%4")
- .arg(server.value(config_key::userName).toString())
- .arg(server.value(config_key::hostName).toString())
- .arg(port.isEmpty() ? "" : ":")
- .arg(port));
- setLineEditServerSettingsDescriptionText(server.value(config_key::description).toString());
- QString selectedContainerName = m_settings.defaultContainerName(selectedServerIndex);
- setLabelServerSettingsCurrentVpnProtocolText(tr("Protocol: ") + selectedContainerName);
-}
+
void UiLogic::onPushButtonSetupWizardVpnModeFinishClicked()
@@ -3997,24 +3728,6 @@ void UiLogic::onRadioButtonVpnModeExceptSitesToggled(bool checked)
-void UiLogic::updateServersListPage()
-{
- const QJsonArray &servers = m_settings.serversArray();
- int defaultServer = m_settings.defaultServerIndex();
- std::vector serverListContent;
- for(int i = 0; i < servers.size(); i++) {
- ServerModelContent c;
- auto server = servers.at(i).toObject();
- c.desc = server.value(config_key::description).toString();
- c.address = server.value(config_key::hostName).toString();
- if (c.desc.isEmpty()) {
- c.desc = c.address;
- }
- c.isDefault = (i == defaultServer);
- serverListContent.push_back(c);
- }
- m_serverListModel->setContent(serverListContent);
-}
void UiLogic::updateProtocolsPage()
{
diff --git a/client/ui/uilogic.h b/client/ui/uilogic.h
index 831cbfd4..2449944c 100644
--- a/client/ui/uilogic.h
+++ b/client/ui/uilogic.h
@@ -10,7 +10,6 @@
#include "protocols/vpnprotocol.h"
#include "settings.h"
-#include "serversmodel.h"
class AppSettingsLogic;
class GeneralSettingsLogic;
@@ -60,14 +59,6 @@ class UiLogic : public QObject
Q_PROPERTY(bool pushButtonBackFromStartVisible READ getPushButtonBackFromStartVisible WRITE setPushButtonBackFromStartVisible NOTIFY pushButtonBackFromStartVisibleChanged)
Q_PROPERTY(bool pushButtonNewServerConnectVisible READ getPushButtonNewServerConnectVisible WRITE setPushButtonNewServerConnectVisible NOTIFY pushButtonNewServerConnectVisibleChanged)
- Q_PROPERTY(bool labelServerSettingsWaitInfoVisible READ getLabelServerSettingsWaitInfoVisible WRITE setLabelServerSettingsWaitInfoVisible NOTIFY labelServerSettingsWaitInfoVisibleChanged)
- Q_PROPERTY(QString labelServerSettingsWaitInfoText READ getLabelServerSettingsWaitInfoText WRITE setLabelServerSettingsWaitInfoText NOTIFY labelServerSettingsWaitInfoTextChanged)
- Q_PROPERTY(bool pushButtonServerSettingsClearVisible READ getPushButtonServerSettingsClearVisible WRITE setPushButtonServerSettingsClearVisible NOTIFY pushButtonServerSettingsClearVisibleChanged)
- Q_PROPERTY(bool pushButtonServerSettingsClearClientCacheVisible READ getPushButtonServerSettingsClearClientCacheVisible WRITE setPushButtonServerSettingsClearClientCacheVisible NOTIFY pushButtonServerSettingsClearClientCacheVisibleChanged)
- Q_PROPERTY(bool pushButtonServerSettingsShareFullVisible READ getPushButtonServerSettingsShareFullVisible WRITE setPushButtonServerSettingsShareFullVisible NOTIFY pushButtonServerSettingsShareFullVisibleChanged)
- Q_PROPERTY(QString labelServerSettingsServerText READ getLabelServerSettingsServerText WRITE setLabelServerSettingsServerText NOTIFY labelServerSettingsServerTextChanged)
- Q_PROPERTY(QString lineEditServerSettingsDescriptionText READ getLineEditServerSettingsDescriptionText WRITE setLineEditServerSettingsDescriptionText NOTIFY lineEditServerSettingsDescriptionTextChanged)
- Q_PROPERTY(QString labelServerSettingsCurrentVpnProtocolText READ getLabelServerSettingsCurrentVpnProtocolText WRITE setLabelServerSettingsCurrentVpnProtocolText NOTIFY labelServerSettingsCurrentVpnProtocolTextChanged)
Q_PROPERTY(int currentPageValue READ getCurrentPageValue WRITE setCurrentPageValue NOTIFY currentPageValueChanged)
Q_PROPERTY(QString trayIconUrl READ getTrayIconUrl WRITE setTrayIconUrl NOTIFY trayIconUrlChanged)
Q_PROPERTY(bool trayActionDisconnectEnabled READ getTrayActionDisconnectEnabled WRITE setTrayActionDisconnectEnabled NOTIFY trayActionDisconnectEnabledChanged)
@@ -141,8 +132,6 @@ class UiLogic : public QObject
Q_PROPERTY(bool pushButtonNewServerConnectEnabled READ getPushButtonNewServerConnectEnabled WRITE setPushButtonNewServerConnectEnabled NOTIFY pushButtonNewServerConnectEnabledChanged)
Q_PROPERTY(QString pushButtonNewServerConnectText READ getPushButtonNewServerConnectText WRITE setPushButtonNewServerConnectText NOTIFY pushButtonNewServerConnectTextChanged)
Q_PROPERTY(QString dialogConnectErrorText READ getDialogConnectErrorText WRITE setDialogConnectErrorText NOTIFY dialogConnectErrorTextChanged)
- Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
- Q_PROPERTY(QString pushButtonServerSettingsClearText READ getPushButtonServerSettingsClearText WRITE setPushButtonServerSettingsClearText NOTIFY pushButtonServerSettingsClearTextChanged)
Q_PROPERTY(bool pageShareAmneziaVisible READ getPageShareAmneziaVisible WRITE setPageShareAmneziaVisible NOTIFY pageShareAmneziaVisibleChanged)
Q_PROPERTY(bool pageShareOpenvpnVisible READ getPageShareOpenvpnVisible WRITE setPageShareOpenvpnVisible NOTIFY pageShareOpenvpnVisibleChanged)
Q_PROPERTY(bool pageShareShadowsocksVisible READ getPageShareShadowsocksVisible WRITE setPageShareShadowsocksVisible NOTIFY pageShareShadowsocksVisibleChanged)
@@ -200,8 +189,6 @@ class UiLogic : public QObject
Q_PROPERTY(QString labelProtoCloakInfoText READ getLabelProtoCloakInfoText WRITE setLabelProtoCloakInfoText NOTIFY labelProtoCloakInfoTextChanged)
Q_PROPERTY(int progressBarProtoCloakResetValue READ getProgressBarProtoCloakResetValue WRITE setProgressBarProtoCloakResetValue NOTIFY progressBarProtoCloakResetValueChanged)
Q_PROPERTY(int progressBarProtoCloakResetMaximium READ getProgressBarProtoCloakResetMaximium WRITE setProgressBarProtoCloakResetMaximium NOTIFY progressBarProtoCloakResetMaximiumChanged)
- Q_PROPERTY(QObject* serverListModel READ getServerListModel CONSTANT)
- Q_PROPERTY(QString pushButtonServerSettingsClearClientCacheText READ getPushButtonServerSettingsClearClientCacheText WRITE setPushButtonServerSettingsClearClientCacheText NOTIFY pushButtonServerSettingsClearClientCacheTextChanged)
Q_PROPERTY(bool pushButtonVpnAddSiteEnabled READ getPushButtonVpnAddSiteEnabled WRITE setPushButtonVpnAddSiteEnabled NOTIFY pushButtonVpnAddSiteEnabledChanged)
@@ -288,22 +275,8 @@ public:
- bool getLabelServerSettingsWaitInfoVisible() const;
- void setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible);
- QString getLabelServerSettingsWaitInfoText() const;
- void setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText);
- bool getPushButtonServerSettingsClearVisible() const;
- void setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible);
- bool getPushButtonServerSettingsClearClientCacheVisible() const;
- void setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible);
- bool getPushButtonServerSettingsShareFullVisible() const;
- void setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible);
- QString getLabelServerSettingsServerText() const;
- void setLabelServerSettingsServerText(const QString &labelServerSettingsServerText);
- QString getLineEditServerSettingsDescriptionText() const;
- void setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText);
- QString getLabelServerSettingsCurrentVpnProtocolText() const;
- void setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText);
+
+
int getCurrentPageValue() const;
void setCurrentPageValue(int currentPageValue);
QString getTrayIconUrl() const;
@@ -450,10 +423,8 @@ public:
void setPushButtonNewServerConnectText(const QString &pushButtonNewServerConnectText);
QString getDialogConnectErrorText() const;
void setDialogConnectErrorText(const QString &dialogConnectErrorText);
- bool getPageServerSettingsEnabled() const;
- void setPageServerSettingsEnabled(bool pageServerSettingsEnabled);
- QString getPushButtonServerSettingsClearText() const;
- void setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText);
+
+
bool getPageShareAmneziaVisible() const;
void setPageShareAmneziaVisible(bool pageShareAmneziaVisible);
bool getPageShareOpenvpnVisible() const;
@@ -568,9 +539,6 @@ public:
void setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue);
int getProgressBarProtoCloakResetMaximium() const;
void setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium);
- QObject* getServerListModel() const;
- QString getPushButtonServerSettingsClearClientCacheText() const;
- void setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText);
bool getRadioButtonVpnModeAllSitesChecked() const;
void setRadioButtonVpnModeAllSitesChecked(bool radioButtonVpnModeAllSitesChecked);
@@ -585,7 +553,6 @@ public:
Q_INVOKABLE void updateNewServerProtocolsPage();
Q_INVOKABLE void updateStartPage();
Q_INVOKABLE void updateVpnPage();
- Q_INVOKABLE void updateServerPage();
Q_INVOKABLE void onPushButtonNewServerConnect();
Q_INVOKABLE void onPushButtonNewServerImport();
@@ -621,14 +588,11 @@ public:
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
Q_INVOKABLE void onCloseWindow();
- Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
- Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
- Q_INVOKABLE void onPushButtonServerSettingsShareFullClicked();
- Q_INVOKABLE void onPushButtonClearServer();
- Q_INVOKABLE void onPushButtonForgetServer();
- Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked();
- Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished();
- Q_INVOKABLE void updateServersListPage();
+
+
+
+
+
Q_INVOKABLE void updateProtocolsPage();
signals:
@@ -664,16 +628,8 @@ signals:
void radioButtonVpnModeExceptSitesCheckedChanged();
void pushButtonVpnAddSiteEnabledChanged();
- void labelServerSettingsWaitInfoVisibleChanged();
- void labelServerSettingsWaitInfoTextChanged();
- void pushButtonServerSettingsClearVisibleChanged();
- void pushButtonServerSettingsClearClientCacheVisibleChanged();
- void pushButtonServerSettingsShareFullVisibleChanged();
- void labelServerSettingsServerTextChanged();
- void lineEditServerSettingsDescriptionTextChanged();
- void labelServerSettingsCurrentVpnProtocolTextChanged();
void currentPageValueChanged();
void trayIconUrlChanged();
void trayActionDisconnectEnabledChanged();
@@ -747,8 +703,6 @@ signals:
void pushButtonNewServerConnectEnabledChanged();
void pushButtonNewServerConnectTextChanged();
void dialogConnectErrorTextChanged();
- void pageServerSettingsEnabledChanged();
- void pushButtonServerSettingsClearTextChanged();
void pageShareAmneziaVisibleChanged();
void pageShareOpenvpnVisibleChanged();
void pageShareShadowsocksVisibleChanged();
@@ -806,7 +760,6 @@ signals:
void labelProtoCloakInfoTextChanged();
void progressBarProtoCloakResetValueChanged();
void progressBarProtoCloakResetMaximiumChanged();
- void pushButtonServerSettingsClearClientCacheTextChanged();
void goToPage(int page, bool reset = true, bool slide = true);
void closePage();
@@ -862,14 +815,8 @@ private:
bool m_radioButtonVpnModeExceptSitesChecked;
bool m_pushButtonVpnAddSiteEnabled;
- bool m_labelServerSettingsWaitInfoVisible;
- QString m_labelServerSettingsWaitInfoText;
- bool m_pushButtonServerSettingsClearVisible;
- bool m_pushButtonServerSettingsClearClientCacheVisible;
- bool m_pushButtonServerSettingsShareFullVisible;
- QString m_labelServerSettingsServerText;
- QString m_lineEditServerSettingsDescriptionText;
- QString m_labelServerSettingsCurrentVpnProtocolText;
+
+
int m_currentPageValue;
QString m_trayIconUrl;
bool m_trayActionDisconnectEnabled;
@@ -944,8 +891,6 @@ private:
bool m_pushButtonNewServerConnectEnabled;
QString m_pushButtonNewServerConnectText;
QString m_dialogConnectErrorText;
- bool m_pageServerSettingsEnabled;
- QString m_pushButtonServerSettingsClearText;
bool m_pageShareAmneziaVisible;
bool m_pageShareOpenvpnVisible;
bool m_pageShareShadowsocksVisible;
@@ -1003,8 +948,6 @@ private:
QString m_labelProtoCloakInfoText;
int m_progressBarProtoCloakResetValue;
int m_progressBarProtoCloakResetMaximium;
- ServersModel* m_serverListModel;
- QString m_pushButtonServerSettingsClearClientCacheText;
private slots:
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);