mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
wowlet: local/remote node toggle in Settings -> Network. Checkbox 'Run your own Wownero node (much recommended)' + doge-y copy on privacy/network-health; toggling live-starts/stops the embedded wownerod and reconnects (autoConnect honours runLocalNode: local when on, chosen remote when off); remote list greys out while the built-in node is active
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
#include "utils/WebsocketNotifier.h"
|
#include "utils/WebsocketNotifier.h"
|
||||||
#include "widgets/NetworkProxyWidget.h"
|
#include "widgets/NetworkProxyWidget.h"
|
||||||
#include "utils/ColorScheme.h"
|
#include "utils/ColorScheme.h"
|
||||||
|
#include "utils/DaemonManager.h"
|
||||||
|
|
||||||
Settings::Settings(Nodes *nodes, QWidget *parent)
|
Settings::Settings(Nodes *nodes, QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
@@ -169,6 +170,15 @@ void Settings::setupNetworkTab() {
|
|||||||
ui->nodeWidget->setupUI(m_nodes);
|
ui->nodeWidget->setupUI(m_nodes);
|
||||||
connect(ui->nodeWidget, &NodeWidget::nodeSourceChanged, m_nodes, &Nodes::onNodeSourceChanged);
|
connect(ui->nodeWidget, &NodeWidget::nodeSourceChanged, m_nodes, &Nodes::onNodeSourceChanged);
|
||||||
connect(ui->nodeWidget, &NodeWidget::connectToNode, m_nodes, QOverload<const FeatherNode&>::of(&Nodes::connectToNode));
|
connect(ui->nodeWidget, &NodeWidget::connectToNode, m_nodes, QOverload<const FeatherNode&>::of(&Nodes::connectToNode));
|
||||||
|
// wowlet: built-in node on/off — start/stop the embedded wownerod, then reconnect (autoConnect
|
||||||
|
// honours Config::runLocalNode: local 127.0.0.1 when on, the selected remote when off).
|
||||||
|
connect(ui->nodeWidget, &NodeWidget::localNodeToggled, this, [this](bool enabled){
|
||||||
|
if (enabled)
|
||||||
|
daemonManager()->start();
|
||||||
|
else
|
||||||
|
daemonManager()->stop();
|
||||||
|
m_nodes->autoConnect(true);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
m_nodes = new Nodes(this, nullptr);
|
m_nodes = new Nodes(this, nullptr);
|
||||||
ui->nodeWidget->setupUI(m_nodes);
|
ui->nodeWidget->setupUI(m_nodes);
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
#include "ui_NodeWidget.h"
|
#include "ui_NodeWidget.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QLabel>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "model/NodeModel.h"
|
#include "model/NodeModel.h"
|
||||||
#include "utils/Icons.h"
|
#include "utils/Icons.h"
|
||||||
@@ -52,6 +55,36 @@ NodeWidget::NodeWidget(QWidget *parent)
|
|||||||
ui->frame_addCustomNodes->setVisible(index);
|
ui->frame_addCustomNodes->setVisible(index);
|
||||||
|
|
||||||
this->onWebsocketStatusChanged();
|
this->onWebsocketStatusChanged();
|
||||||
|
|
||||||
|
// wowlet: built-in node toggle + the "why run your own node" messaging. Running your own node is
|
||||||
|
// a privacy win (no remote operator sees your wallet) AND it strengthens the Wownero network by
|
||||||
|
// adding a peer — a deliberate differentiator we surface clearly here.
|
||||||
|
m_localNodeCheck = new QCheckBox(tr("Run your own Wownero node (much recommended)"), this);
|
||||||
|
m_localNodeCheck->setChecked(conf()->get(Config::runLocalNode).toBool());
|
||||||
|
auto *localNodeInfo = new QLabel(
|
||||||
|
tr("wowlet bundles its own node so you can be your own boss — and every node keeps the Wownero "
|
||||||
|
"network strong + decentralized. 🐕 Uncheck to use a remote node instead."), this);
|
||||||
|
localNodeInfo->setWordWrap(true);
|
||||||
|
localNodeInfo->setStyleSheet("color: gray;");
|
||||||
|
|
||||||
|
if (auto *vlayout = qobject_cast<QVBoxLayout*>(this->layout())) {
|
||||||
|
vlayout->insertWidget(0, localNodeInfo);
|
||||||
|
vlayout->insertWidget(0, m_localNodeCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto applyLocalNodeState = [this](bool on) {
|
||||||
|
// When the built-in node is on, the remote list is overridden — grey it out so it's obvious.
|
||||||
|
ui->stackedWidget->setEnabled(!on);
|
||||||
|
ui->checkBox_websocketList->setEnabled(!on);
|
||||||
|
ui->frame_addCustomNodes->setEnabled(!on);
|
||||||
|
};
|
||||||
|
applyLocalNodeState(m_localNodeCheck->isChecked());
|
||||||
|
|
||||||
|
connect(m_localNodeCheck, &QCheckBox::toggled, this, [this, applyLocalNodeState](bool checked){
|
||||||
|
conf()->set(Config::runLocalNode, checked);
|
||||||
|
applyLocalNodeState(checked);
|
||||||
|
emit localNodeToggled(checked);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeWidget::onShowWSContextMenu(const QPoint &pos) {
|
void NodeWidget::onShowWSContextMenu(const QPoint &pos) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class NodeModel;
|
class NodeModel;
|
||||||
|
class QCheckBox;
|
||||||
class NodeWidget : public QWidget
|
class NodeWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -44,12 +45,14 @@ private slots:
|
|||||||
signals:
|
signals:
|
||||||
void connectToNode(FeatherNode node);
|
void connectToNode(FeatherNode node);
|
||||||
void nodeSourceChanged(NodeSource nodeSource);
|
void nodeSourceChanged(NodeSource nodeSource);
|
||||||
|
void localNodeToggled(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showContextMenu(const QPoint &pos, const FeatherNode &node);
|
void showContextMenu(const QPoint &pos, const FeatherNode &node);
|
||||||
FeatherNode selectedNode();
|
FeatherNode selectedNode();
|
||||||
|
|
||||||
QScopedPointer<Ui::NodeWidget> ui;
|
QScopedPointer<Ui::NodeWidget> ui;
|
||||||
|
QCheckBox *m_localNodeCheck = nullptr;
|
||||||
Nodes *m_nodes;
|
Nodes *m_nodes;
|
||||||
NodeModel *m_customModel;
|
NodeModel *m_customModel;
|
||||||
NodeModel *m_wsModel;
|
NodeModel *m_wsModel;
|
||||||
|
|||||||
Reference in New Issue
Block a user