mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 07:11:29 +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 "widgets/NetworkProxyWidget.h"
|
||||
#include "utils/ColorScheme.h"
|
||||
#include "utils/DaemonManager.h"
|
||||
|
||||
Settings::Settings(Nodes *nodes, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@@ -169,6 +170,15 @@ void Settings::setupNetworkTab() {
|
||||
ui->nodeWidget->setupUI(m_nodes);
|
||||
connect(ui->nodeWidget, &NodeWidget::nodeSourceChanged, m_nodes, &Nodes::onNodeSourceChanged);
|
||||
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 {
|
||||
m_nodes = new Nodes(this, nullptr);
|
||||
ui->nodeWidget->setupUI(m_nodes);
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
#include "ui_NodeWidget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QCheckBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QTableWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "model/NodeModel.h"
|
||||
#include "utils/Icons.h"
|
||||
@@ -52,6 +55,36 @@ NodeWidget::NodeWidget(QWidget *parent)
|
||||
ui->frame_addCustomNodes->setVisible(index);
|
||||
|
||||
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) {
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Ui {
|
||||
}
|
||||
|
||||
class NodeModel;
|
||||
class QCheckBox;
|
||||
class NodeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -44,12 +45,14 @@ private slots:
|
||||
signals:
|
||||
void connectToNode(FeatherNode node);
|
||||
void nodeSourceChanged(NodeSource nodeSource);
|
||||
void localNodeToggled(bool enabled);
|
||||
|
||||
private:
|
||||
void showContextMenu(const QPoint &pos, const FeatherNode &node);
|
||||
FeatherNode selectedNode();
|
||||
|
||||
QScopedPointer<Ui::NodeWidget> ui;
|
||||
QCheckBox *m_localNodeCheck = nullptr;
|
||||
Nodes *m_nodes;
|
||||
NodeModel *m_customModel;
|
||||
NodeModel *m_wsModel;
|
||||
|
||||
Reference in New Issue
Block a user