From ce4ca5c4d5ceb3a465e3c3038f1c7692b215f603 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Wed, 28 Dec 2022 06:50:46 +0300 Subject: [PATCH] Added display of a notification about the inclusion of logging on the main screen --- client/settings.h | 5 ++++- client/ui/pages_logic/VpnLogic.cpp | 4 ++++ client/ui/pages_logic/VpnLogic.h | 2 ++ client/ui/qml/Pages/PageVPN.qml | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/client/settings.h b/client/settings.h index c78b9a791..25f037736 100644 --- a/client/settings.h +++ b/client/settings.h @@ -68,7 +68,7 @@ public: void setStartMinimized(bool enabled) { m_settings.setValue("Conf/startMinimized", enabled); } bool isSaveLogs() const { return m_settings.value("Conf/saveLogs", false).toBool(); } - void setSaveLogs(bool enabled) { m_settings.setValue("Conf/saveLogs", enabled); } + void setSaveLogs(bool enabled); enum RouteMode { VpnAllSites, @@ -113,6 +113,9 @@ public: QByteArray backupAppConfig() const { return m_settings.backupAppConfig(); } bool restoreAppConfig(const QByteArray &cfg) { return m_settings.restoreAppConfig(cfg); } +signals: + void updateVpnPage(); + private: SecureQSettings m_settings; diff --git a/client/ui/pages_logic/VpnLogic.cpp b/client/ui/pages_logic/VpnLogic.cpp index 44a37a5ce..1fd69c6be 100644 --- a/client/ui/pages_logic/VpnLogic.cpp +++ b/client/ui/pages_logic/VpnLogic.cpp @@ -33,6 +33,8 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent): connect(this, &VpnLogic::connectToVpn, uiLogic()->m_vpnConnection, &VpnConnection::connectToVpn, Qt::QueuedConnection); connect(this, &VpnLogic::disconnectFromVpn, uiLogic()->m_vpnConnection, &VpnConnection::disconnectFromVpn, Qt::QueuedConnection); + connect(m_settings.get(), &Settings::updateVpnPage, this, &VpnLogic::onUpdatePage); + if (m_settings->isAutoConnect() && m_settings->defaultServerIndex() >= 0) { QTimer::singleShot(1000, this, [this](){ set_pushButtonConnectEnabled(false); @@ -88,6 +90,8 @@ void VpnLogic::onUpdatePage() } QString ver = QString("v. %2").arg(QString(APP_MAJOR_VERSION)); set_labelVersionText(ver); + + set_labelLogEnabledVisible(m_settings->isSaveLogs()); } diff --git a/client/ui/pages_logic/VpnLogic.h b/client/ui/pages_logic/VpnLogic.h index 5d6ef2d93..f7b21be26 100644 --- a/client/ui/pages_logic/VpnLogic.h +++ b/client/ui/pages_logic/VpnLogic.h @@ -34,6 +34,8 @@ class VpnLogic : public PageLogicBase AUTO_PROPERTY(bool, radioButtonVpnModeForwardSitesChecked) AUTO_PROPERTY(bool, radioButtonVpnModeExceptSitesChecked) + AUTO_PROPERTY(bool, labelLogEnabledVisible) + public: Q_INVOKABLE void onUpdatePage() override; diff --git a/client/ui/qml/Pages/PageVPN.qml b/client/ui/qml/Pages/PageVPN.qml index 6bf375a5e..847742e9f 100644 --- a/client/ui/qml/Pages/PageVPN.qml +++ b/client/ui/qml/Pages/PageVPN.qml @@ -31,6 +31,7 @@ PageBase { } BasicButtonType { + id: button_donate y: 10 anchors.horizontalCenter: parent.horizontalCenter height: 21 @@ -70,6 +71,21 @@ PageBase { } } + LabelType { + id: lb_log_enabled + anchors.top: button_donate.bottom + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + height: 21 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + text: "Logging enabled!" + color: "#D4D4D4" + + visible: VpnLogic.labelLogEnabledVisible + } + AnimatedImage { id: connect_anim source: "qrc:/images/animation.gif"