Added display of a notification about the inclusion of logging on the main screen

This commit is contained in:
vladimir.kuznetsov 2022-12-28 06:50:46 +03:00
parent 3f257af7a9
commit ce4ca5c4d5
4 changed files with 26 additions and 1 deletions

View file

@ -68,7 +68,7 @@ public:
void setStartMinimized(bool enabled) { m_settings.setValue("Conf/startMinimized", enabled); } void setStartMinimized(bool enabled) { m_settings.setValue("Conf/startMinimized", enabled); }
bool isSaveLogs() const { return m_settings.value("Conf/saveLogs", false).toBool(); } 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 { enum RouteMode {
VpnAllSites, VpnAllSites,
@ -113,6 +113,9 @@ public:
QByteArray backupAppConfig() const { return m_settings.backupAppConfig(); } QByteArray backupAppConfig() const { return m_settings.backupAppConfig(); }
bool restoreAppConfig(const QByteArray &cfg) { return m_settings.restoreAppConfig(cfg); } bool restoreAppConfig(const QByteArray &cfg) { return m_settings.restoreAppConfig(cfg); }
signals:
void updateVpnPage();
private: private:
SecureQSettings m_settings; SecureQSettings m_settings;

View file

@ -33,6 +33,8 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
connect(this, &VpnLogic::connectToVpn, uiLogic()->m_vpnConnection, &VpnConnection::connectToVpn, Qt::QueuedConnection); connect(this, &VpnLogic::connectToVpn, uiLogic()->m_vpnConnection, &VpnConnection::connectToVpn, Qt::QueuedConnection);
connect(this, &VpnLogic::disconnectFromVpn, uiLogic()->m_vpnConnection, &VpnConnection::disconnectFromVpn, 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) { if (m_settings->isAutoConnect() && m_settings->defaultServerIndex() >= 0) {
QTimer::singleShot(1000, this, [this](){ QTimer::singleShot(1000, this, [this](){
set_pushButtonConnectEnabled(false); set_pushButtonConnectEnabled(false);
@ -88,6 +90,8 @@ void VpnLogic::onUpdatePage()
} }
QString ver = QString("v. %2").arg(QString(APP_MAJOR_VERSION)); QString ver = QString("v. %2").arg(QString(APP_MAJOR_VERSION));
set_labelVersionText(ver); set_labelVersionText(ver);
set_labelLogEnabledVisible(m_settings->isSaveLogs());
} }

View file

@ -34,6 +34,8 @@ class VpnLogic : public PageLogicBase
AUTO_PROPERTY(bool, radioButtonVpnModeForwardSitesChecked) AUTO_PROPERTY(bool, radioButtonVpnModeForwardSitesChecked)
AUTO_PROPERTY(bool, radioButtonVpnModeExceptSitesChecked) AUTO_PROPERTY(bool, radioButtonVpnModeExceptSitesChecked)
AUTO_PROPERTY(bool, labelLogEnabledVisible)
public: public:
Q_INVOKABLE void onUpdatePage() override; Q_INVOKABLE void onUpdatePage() override;

View file

@ -31,6 +31,7 @@ PageBase {
} }
BasicButtonType { BasicButtonType {
id: button_donate
y: 10 y: 10
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: 21 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 { AnimatedImage {
id: connect_anim id: connect_anim
source: "qrc:/images/animation.gif" source: "qrc:/images/animation.gif"