]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
Wizard: add websocket toggle page
authortobtoht <thotbot@protonmail.com>
Wed, 22 Jun 2022 21:00:03 +0000 (23:00 +0200)
committertobtoht <thotbot@protonmail.com>
Wed, 22 Jun 2022 21:01:44 +0000 (23:01 +0200)
src/SettingsDialog.cpp
src/SettingsDialog.ui
src/wizard/PageNetworkTor.cpp
src/wizard/PageNetworkWebsocket.cpp [new file with mode: 0644]
src/wizard/PageNetworkWebsocket.h [new file with mode: 0644]
src/wizard/PageNetworkWebsocket.ui [new file with mode: 0644]
src/wizard/WalletWizard.cpp
src/wizard/WalletWizard.h

index d4f2fec8c4c65328c52b36b141d2eeba1fdfcff8..6fb4c15e3daeb56dcfd6cb90b9c4585ac0ab5ed8 100644 (file)
@@ -118,10 +118,15 @@ void Settings::setupPrivacyTab() {
     });
 
     // [Disable websocket]
-    ui->checkBox_disableWebsocket->setChecked(config()->get(Config::disableWebsocket).toBool());
-    connect(ui->checkBox_disableWebsocket, &QCheckBox::toggled, [this](bool checked){
-        config()->set(Config::disableWebsocket, checked);
-        this->enableWebsocket(!checked);
+    ui->checkBox_enableWebsocket->setChecked(!config()->get(Config::disableWebsocket).toBool());
+    connect(ui->checkBox_enableWebsocket, &QCheckBox::toggled, [this](bool checked){
+        config()->set(Config::disableWebsocket, !checked);
+        this->enableWebsocket(checked);
+    });
+    connect(ui->btn_enableWebsocket, &QPushButton::clicked, [this]{
+        QMessageBox::information(this, "Obtain third-party information", "Feather can connect to an onion service hosted by the Feather developers to obtain pricing information, a curated list of remote nodes, Home feeds, the latest version of Feather Wallet and more.\n\n"
+                                                                         "This service is only used to fetch information and can only be reached over Tor. The wallet does not send information about its state or your transactions to the server. It is not used for any telemetry or crash reports.\n\n"
+                                                                         "If you opt to disable this connection some wallet functionality will be disabled. You can re-enable it at any time.");
     });
 
     // [Do not write log files to disk]
index 36c3cd75f65d064e420237c1c2ce1173a87a46a9..d24f871210c39349704449a000dc1ccc688f27b3 100644 (file)
        <item>
         <layout class="QHBoxLayout" name="horizontalLayout_10">
          <item>
-          <widget class="QCheckBox" name="checkBox_disableWebsocket">
+          <widget class="QCheckBox" name="checkBox_enableWebsocket">
            <property name="text">
-            <string>Disable websocket</string>
+            <string>Obtain third-party data</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QPushButton" name="btn_disableWebsocket">
+          <widget class="QPushButton" name="btn_enableWebsocket">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
              <horstretch>0</horstretch>
index 9c9c96545535ee09fd1ecb1ab17289fc4993b6a3..31f06b8393c1e8b6b170f02ed951fc17d4d8019a 100644 (file)
@@ -11,9 +11,6 @@ PageNetworkTor::PageNetworkTor(QWidget *parent)
 {
     ui->setupUi(this);
 
-    this->setCommitPage(true);
-    this->setButtonText(QWizard::CommitButton, "Next");
-
     QPixmap iconAllTorExceptNode(":/assets/images/securityLevelStandard.png");
     QPixmap iconAllTorExceptInitSync(":/assets/images/securityLevelSafer.png");
     QPixmap iconAllTor(":/assets/images/securityLevelSafest.png");
@@ -46,7 +43,7 @@ void PageNetworkTor::initializePage() {
 }
 
 int PageNetworkTor::nextId() const {
-    return WalletWizard::Page_Menu;
+    return WalletWizard::Page_NetworkWebsocket;
 }
 
 bool PageNetworkTor::validatePage() {
diff --git a/src/wizard/PageNetworkWebsocket.cpp b/src/wizard/PageNetworkWebsocket.cpp
new file mode 100644 (file)
index 0000000..f2b8a8b
--- /dev/null
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2020-2022 The Monero Project
+
+#include "PageNetworkWebsocket.h"
+#include "ui_PageNetworkWebsocket.h"
+#include "WalletWizard.h"
+
+PageNetworkWebsocket::PageNetworkWebsocket(QWidget *parent)
+        : QWizardPage(parent)
+        , ui(new Ui::PageNetworkWebsocket)
+{
+    ui->setupUi(this);
+
+    this->setCommitPage(true);
+    this->setButtonText(QWizard::CommitButton, "Next");
+}
+
+int PageNetworkWebsocket::nextId() const {
+    return WalletWizard::Page_Menu;
+}
+
+bool PageNetworkWebsocket::validatePage() {
+    bool disabled = ui->btn_disable->isChecked();
+    config()->set(Config::disableWebsocket, disabled);
+
+    emit initialNetworkConfigured();
+
+    return true;
+}
\ No newline at end of file
diff --git a/src/wizard/PageNetworkWebsocket.h b/src/wizard/PageNetworkWebsocket.h
new file mode 100644 (file)
index 0000000..8428354
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2020-2022 The Monero Project
+
+#ifndef FEATHER_PAGENETWORKWEBSOCKET_H
+#define FEATHER_PAGENETWORKWEBSOCKET_H
+
+#include <QWizardPage>
+
+#include "appcontext.h"
+
+namespace Ui {
+    class PageNetworkWebsocket;
+}
+
+class PageNetworkWebsocket : public QWizardPage
+{
+Q_OBJECT
+
+public:
+    explicit PageNetworkWebsocket(QWidget *parent = nullptr);
+    bool validatePage() override;
+    int nextId() const override;
+
+signals:
+    void initialNetworkConfigured();
+
+private:
+    Ui::PageNetworkWebsocket *ui;
+};
+
+#endif //FEATHER_PAGENETWORKWEBSOCKET_H
diff --git a/src/wizard/PageNetworkWebsocket.ui b/src/wizard/PageNetworkWebsocket.ui
new file mode 100644 (file)
index 0000000..f4bebb1
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PageNetworkWebsocket</class>
+ <widget class="QWizardPage" name="PageNetworkWebsocket">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>709</width>
+    <height>432</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>Do you want to obtain third-party data?</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Feather can connect to an onion service hosted by the Feather developers to obtain pricing information, a curated list of remote nodes, Home feeds, the latest version of Feather Wallet and more.&lt;/p&gt;&lt;p&gt;This service is only used to fetch information and can only be reached over Tor. The wallet does not send information about its state or your transactions to the server. It is not used for any telemetry or crash reports.&lt;/p&gt;&lt;p&gt;If you opt to disable this connection some wallet functionality will be disabled. You can re-enable it at any time.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QRadioButton" name="btn_enable">
+     <property name="text">
+      <string>Enable</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QRadioButton" name="btn_disable">
+     <property name="text">
+      <string>Disable</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index a5c22da76106e1f853ddb893f3962c800c704dfb..5abcb841840fe6780f364443e5c152c79ce88f05 100644 (file)
@@ -16,6 +16,7 @@
 #include "PageSetSeedPassphrase.h"
 #include "PageHardwareDevice.h"
 #include "PageNetworkTor.h"
+#include "PageNetworkWebsocket.h"
 #include "constants.h"
 
 #include <QLineEdit>
@@ -33,6 +34,7 @@ WalletWizard::WalletWizard(QWidget *parent)
 
     auto networkPage = new PageNetwork(this);
     auto networkTorPage = new PageNetworkTor(this);
+    auto networkWebsocketPage = new PageNetworkWebsocket(this);
     auto menuPage = new PageMenu(&m_wizardFields, m_walletKeysFilesModel, this);
     auto openWalletPage = new PageOpenWallet(m_walletKeysFilesModel, this);
     auto createWallet = new PageWalletFile(&m_wizardFields , this);
@@ -46,6 +48,7 @@ WalletWizard::WalletWizard(QWidget *parent)
     setPage(Page_SetPasswordPage, walletSetPasswordPage);
     setPage(Page_Network, networkPage);
     setPage(Page_NetworkTor, networkTorPage);
+    setPage(Page_NetworkWebsocket, networkWebsocketPage);
     setPage(Page_WalletRestoreSeed, new PageWalletRestoreSeed(&m_wizardFields, this));
     setPage(Page_WalletRestoreKeys, new PageWalletRestoreKeys(&m_wizardFields, this));
     setPage(Page_SetRestoreHeight, new PageSetRestoreHeight(&m_wizardFields, this));
@@ -59,7 +62,7 @@ WalletWizard::WalletWizard(QWidget *parent)
     setWizardStyle(WizardStyle::ModernStyle);
     setOption(QWizard::NoBackButtonOnStartPage);
 
-    connect(networkTorPage, &PageNetworkTor::initialNetworkConfigured, [this](){
+    connect(networkWebsocketPage, &PageNetworkWebsocket::initialNetworkConfigured, [this](){
         emit initialNetworkConfigured();
     });
 
index 3e50c0b3f8eae059d9080f3945240434d0e919d4..c6da79eff3b24d7708f30ae555ac8d779aba6cba 100644 (file)
@@ -65,7 +65,8 @@ public:
         Page_WalletRestoreKeys,
         Page_SetRestoreHeight,
         Page_HardwareDevice,
-        Page_NetworkTor
+        Page_NetworkTor,
+        Page_NetworkWebsocket
     };
 
     explicit WalletWizard(QWidget *parent = nullptr);