From eb29c7198102d3f9858ee9eeacd23c82f30c8248 Mon Sep 17 00:00:00 2001 From: crowning- Date: Mon, 28 Sep 2015 21:58:59 +0200 Subject: [PATCH 1/2] Edit masternode.conf from within the wallet --- src/qt/bitcoingui.cpp | 5 +++++ src/qt/bitcoingui.h | 1 + src/qt/guiutil.cpp | 9 +++++++++ src/qt/guiutil.h | 5 ++++- src/qt/rpcconsole.cpp | 6 ++++++ src/qt/rpcconsole.h | 4 +++- 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 9bc5ef10ad483..4e46e3703cb16 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -222,6 +222,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : connect(openPeersAction, SIGNAL(triggered()), rpcConsole, SLOT(showPeers())); connect(openRepairAction, SIGNAL(triggered()), rpcConsole, SLOT(showRepair())); connect(openConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showConfEditor())); + connect(openMNConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showMNConfEditor())); connect(showBackupsAction, SIGNAL(triggered()), rpcConsole, SLOT(showBackups())); connect(labelConnectionsIcon, SIGNAL(clicked()), rpcConsole, SLOT(showPeers())); @@ -364,6 +365,8 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) openRepairAction->setStatusTip(tr("Show wallet repair options")); openConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open &Configuration File"), this); openConfEditorAction->setStatusTip(tr("Open configuration file")); + openMNConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open &MN-Config-File"), this); + openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file")); showBackupsAction = new QAction(QIcon(":/icons/" + theme + "/browse"), tr("Show Automatic &Backups"), this); showBackupsAction->setStatusTip(tr("Show automatically created wallet backups")); @@ -448,6 +451,7 @@ void BitcoinGUI::createMenuBar() tools->addAction(openRepairAction); tools->addSeparator(); tools->addAction(openConfEditorAction); + tools->addAction(openMNConfEditorAction); tools->addAction(showBackupsAction); } @@ -616,6 +620,7 @@ void BitcoinGUI::createTrayIconMenu() trayIconMenu->addAction(openRepairAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(openConfEditorAction); + trayIconMenu->addAction(openMNConfEditorAction); trayIconMenu->addAction(showBackupsAction); #ifndef Q_OS_MAC // This is built-in on Mac trayIconMenu->addSeparator(); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index d58c87cf77639..5696fc5b54f41 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -111,6 +111,7 @@ class BitcoinGUI : public QMainWindow QAction *openPeersAction; QAction *openRepairAction; QAction *openConfEditorAction; + QAction *openMNConfEditorAction; QAction *showBackupsAction; QAction *openAction; QAction *showHelpMessageAction; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index fcb449ee35766..92a3d4f7ac3dd 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -397,6 +397,15 @@ void openConfigfile() QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); } +void openMNConfigfile() +{ + boost::filesystem::path pathConfig = GetMasternodeConfigFile(); + + /* Open masternode.conf with the associated application */ + if (boost::filesystem::exists(pathConfig)) + QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); +} + void showBackups() { boost::filesystem::path pathBackups = GetDataDir() / "backups"; diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 8882ee74d45f6..66b60af6fd107 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -108,7 +108,10 @@ namespace GUIUtil // Open dash.conf void openConfigfile(); - + + // Open masternode.conf + void openMNConfigfile(); + // Browse backup folder void showBackups(); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 9a51b12fd64b8..742f2772527fd 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -641,6 +641,12 @@ void RPCConsole::showConfEditor() { GUIUtil::openConfigfile(); } + +void RPCConsole::showMNConfEditor() +{ + GUIUtil::openMNConfigfile(); +} + void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected) { Q_UNUSED(deselected); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 07281c35a33bf..26ee2c5ee3872 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -91,7 +91,9 @@ public slots: /** Switch to wallet-repair tab and show */ void showRepair(); /** Open external (default) editor with dash.conf */ - void showConfEditor(); + void showConfEditor(); + /** Open external (default) editor with masternode.conf */ + void showMNConfEditor(); /** Handle selection of peer in peers list */ void peerSelected(const QItemSelection &selected, const QItemSelection &deselected); /** Handle updated peer information */ From 115bb174ca1a74838c15dc74bd1b883cf1c33de8 Mon Sep 17 00:00:00 2001 From: crowning- Date: Mon, 28 Sep 2015 22:08:07 +0200 Subject: [PATCH 2/2] Edit masternode.conf from within the wallet (Menu adjusted) --- src/qt/bitcoingui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4e46e3703cb16..489f9f52b5224 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -363,9 +363,9 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) openPeersAction->setStatusTip(tr("Show peers info")); openRepairAction = new QAction(QIcon(":/icons/" + theme + "/options"), tr("Wallet &Repair"), this); openRepairAction->setStatusTip(tr("Show wallet repair options")); - openConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open &Configuration File"), this); + openConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open Wallet &Configuration File"), this); openConfEditorAction->setStatusTip(tr("Open configuration file")); - openMNConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open &MN-Config-File"), this); + openMNConfEditorAction = new QAction(QIcon(":/icons/" + theme + "/edit"), tr("Open &Masternode Configuration File"), this); openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file")); showBackupsAction = new QAction(QIcon(":/icons/" + theme + "/browse"), tr("Show Automatic &Backups"), this); showBackupsAction->setStatusTip(tr("Show automatically created wallet backups"));