mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-18 16:54:33 +00:00
Wizard: add websocket toggle page
This commit is contained in:
parent
1c14e9789a
commit
cf46f1fe58
8 changed files with 153 additions and 13 deletions
|
@ -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]
|
||||
|
|
|
@ -264,14 +264,14 @@
|
|||
<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>
|
||||
|
|
|
@ -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() {
|
||||
|
|
29
src/wizard/PageNetworkWebsocket.cpp
Normal file
29
src/wizard/PageNetworkWebsocket.cpp
Normal file
|
@ -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;
|
||||
}
|
31
src/wizard/PageNetworkWebsocket.h
Normal file
31
src/wizard/PageNetworkWebsocket.h
Normal file
|
@ -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
|
74
src/wizard/PageNetworkWebsocket.ui
Normal file
74
src/wizard/PageNetworkWebsocket.ui
Normal file
|
@ -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><html><head/><body><p>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.</p><p>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.</p><p>If you opt to disable this connection some wallet functionality will be disabled. You can re-enable it at any time.</p></body></html></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>
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ public:
|
|||
Page_WalletRestoreKeys,
|
||||
Page_SetRestoreHeight,
|
||||
Page_HardwareDevice,
|
||||
Page_NetworkTor
|
||||
Page_NetworkTor,
|
||||
Page_NetworkWebsocket
|
||||
};
|
||||
|
||||
explicit WalletWizard(QWidget *parent = nullptr);
|
||||
|
|
Loading…
Reference in a new issue