Skip to content

Commit

Permalink
Merge pull request #628 from crowning-/v0.12.1.x
Browse files Browse the repository at this point in the history
GUI: Edit masternode.conf from within the wallet
  • Loading branch information
evan82 committed Oct 2, 2015
2 parents 7c288e1 + 115bb17 commit 0c0cdb3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -362,8 +363,10 @@ 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 &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"));

Expand Down Expand Up @@ -448,6 +451,7 @@ void BitcoinGUI::createMenuBar()
tools->addAction(openRepairAction);
tools->addSeparator();
tools->addAction(openConfEditorAction);
tools->addAction(openMNConfEditorAction);
tools->addAction(showBackupsAction);
}

Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class BitcoinGUI : public QMainWindow
QAction *openPeersAction;
QAction *openRepairAction;
QAction *openConfEditorAction;
QAction *openMNConfEditorAction;
QAction *showBackupsAction;
QAction *openAction;
QAction *showHelpMessageAction;
Expand Down
9 changes: 9 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 4 additions & 1 deletion src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ namespace GUIUtil

// Open dash.conf
void openConfigfile();


// Open masternode.conf
void openMNConfigfile();

// Browse backup folder
void showBackups();

Expand Down
6 changes: 6 additions & 0 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/qt/rpcconsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0c0cdb3

Please sign in to comment.