From f08141dd7ce392044c057c349d3f233955173752 Mon Sep 17 00:00:00 2001
From: Unsigned <>
Date: Wed, 24 Oct 2018 20:35:12 +0100
Subject: [PATCH] Add tools bar
Fix disabled options
Connect debug window button to debug window tab
Add debug + fix conf open
Just in case
Fix icons
Text fixes en+ja
Remove debug window from Help menu (b/c duplicate in Tools menu)
---
src/qt/guiutil.cpp | 18 +++++++
src/qt/guiutil.h | 6 +++
src/qt/locale/shield_ja.ts | 48 ++++++++++++++++-
src/qt/shieldgui.cpp | 105 ++++++++++++++++++++++++++++++++++---
src/qt/shieldgui.h | 21 ++++++++
5 files changed, 190 insertions(+), 8 deletions(-)
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 5bf2caf..dd6e942 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -418,6 +418,24 @@ bool openSHIELDConf()
return 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 showDatadir()
+{
+ boost::filesystem::path dataDir = GetDataDir();
+
+ /* Open folder with default browser */
+ if (boost::filesystem::exists(dataDir))
+ QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(dataDir)));
+}
+
void SubstituteFonts(const QString& language)
{
#if defined(Q_OS_MAC)
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 1da8dd7..75d10dc 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -121,6 +121,12 @@ namespace GUIUtil
// Open the config file
bool openSHIELDConf();
+ // Open masternode.conf
+ // void openMNConfigfile();
+
+ // Browse data folder
+ void showDatadir();
+
// Replace invalid default fonts with known good ones
void SubstituteFonts(const QString& language);
diff --git a/src/qt/locale/shield_ja.ts b/src/qt/locale/shield_ja.ts
index ed18719..ed8aa76 100644
--- a/src/qt/locale/shield_ja.ts
+++ b/src/qt/locale/shield_ja.ts
@@ -353,10 +353,50 @@
ウォレット暗号化用パスフレーズの変更
+
+
+ 診断情報 (&I)
+
+
+
+ 診断情報を表示
+
デバッグ ウインドウ (&D)
+
+
+ ネットワークモニター(&N)
+
+
+
+ ネットワークモニターを表示
+
+
+
+ ピアリスト (&P)
+
+
+
+ ピア情報を表示
+
+
+
+ %1の設定ファイルをワーキングディレクトリから開く
+
+
+
+ 設定ファイルを開く (&C)
+
+
+
+ データフォルダーを開く (&F)
+
+
+
+ %1 ワーキングディレクトリを開く
+
デバッグと診断コンソールを開く
@@ -409,6 +449,10 @@
設定(&S)
+
+
+ ツール(&T)
+
ヘルプ(&H)
@@ -1570,7 +1614,7 @@
- 情報 (&I)
+ 診断情報 (&I)
@@ -1582,7 +1626,7 @@
- 使用中のBerkleyDBバージョン
+ 使用中のBerkeleyDBバージョン
diff --git a/src/qt/shieldgui.cpp b/src/qt/shieldgui.cpp
index f00135a..b666bb9 100644
--- a/src/qt/shieldgui.cpp
+++ b/src/qt/shieldgui.cpp
@@ -380,15 +380,33 @@ void SHIELDGUI::createActions()
openRPCConsoleAction = new QAction(platformStyle->TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
- // initially disable the debug window menu item
+ openInfoAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Information"), this);
+ openInfoAction->setStatusTip(tr("Show diagnostic information"));
+ openGraphAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this);
+ openGraphAction->setStatusTip(tr("Show network monitor"));
+ openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this);
+ openPeersAction->setStatusTip(tr("Show peers info"));
+ // openRepairAction = new QAction(QIcon(":/icons/tx_mined"), tr("Wallet &Repair"), this);
+ // openRepairAction->setStatusTip(tr("Show wallet repair options"));
+ openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Configuration File"), this);
+ openConfEditorAction->setStatusTip(tr("Open the %1 configuration file from the working directory").arg(tr(PACKAGE_NAME)));
+ // openMNConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Masternode Configuration File"), this);
+ // openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file"));
+ showDatadirAction = new QAction(QIcon(":/icons/open"), tr("Open Data &Folder"), this);
+ showDatadirAction->setStatusTip(tr("Open the %1 working directory").arg(tr(PACKAGE_NAME)));
+ // initially disable the debug window menu items
+ openInfoAction->setEnabled(false);
openRPCConsoleAction->setEnabled(false);
+ openGraphAction->setEnabled(false);
+ openPeersAction->setEnabled(false);
+ // openRepairAction->setEnabled(false);
usedSendingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this);
usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
usedReceivingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this);
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
- openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), tr("Open &URI..."), this);
+ openAction = new QAction(platformStyle->TextColorIcon(":/icons/editpaste"), tr("Open &URI..."), this);
openAction->setStatusTip(tr("Open a shield: URI or payment request"));
showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this);
@@ -401,7 +419,18 @@ void SHIELDGUI::createActions()
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
- connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow()));
+ connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showConsole()));
+
+ // Jump directly to tabs in RPC-console
+ connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
+ connect(openGraphAction, SIGNAL(triggered()), this, SLOT(showGraph()));
+ connect(openPeersAction, SIGNAL(triggered()), this, SLOT(showPeers()));
+ // connect(openRepairAction, SIGNAL(triggered()), this, SLOT(showRepair()));
+
+ // Open configs and backup folder from menu
+ connect(openConfEditorAction, SIGNAL(triggered()), this, SLOT(showConfEditor()));
+ // connect(openMNConfEditorAction, SIGNAL(triggered()), this, SLOT(showMNConfEditor()));
+ connect(showDatadirAction, SIGNAL(triggered()), this, SLOT(showDatadir()));
// prevents an open debug window from becoming stuck/unusable on client shutdown
connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));
@@ -457,11 +486,21 @@ void SHIELDGUI::createMenuBar()
}
settings->addAction(optionsAction);
- QMenu *help = appMenuBar->addMenu(tr("&Help"));
if(walletFrame)
{
- help->addAction(openRPCConsoleAction);
+ QMenu *tools = appMenuBar->addMenu(tr("&Tools"));
+ tools->addAction(openInfoAction);
+ tools->addAction(openRPCConsoleAction);
+ tools->addAction(openGraphAction);
+ tools->addAction(openPeersAction);
+ // tools->addAction(openRepairAction);
+ tools->addSeparator();
+ tools->addAction(openConfEditorAction);
+ // tools->addAction(openMNConfEditorAction);
+ tools->addAction(showDatadirAction);
}
+
+ QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(showHelpMessageAction);
help->addSeparator();
help->addAction(aboutAction);
@@ -760,6 +799,55 @@ void SHIELDGUI::gotoVerifyMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
}
+
+
+void SHIELDGUI::showInfo()
+{
+ rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
+ showDebugWindow();
+}
+
+void SHIELDGUI::showConsole()
+{
+ rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
+ showDebugWindow();
+}
+
+void SHIELDGUI::showGraph()
+{
+ rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
+ showDebugWindow();
+}
+
+void SHIELDGUI::showPeers()
+{
+ rpcConsole->setTabFocus(RPCConsole::TAB_PEERS);
+ showDebugWindow();
+}
+
+// void SHIELDGUI::showRepair()
+// {
+// rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR);
+// showDebugWindow();
+// }
+
+void SHIELDGUI::showConfEditor()
+{
+ if (!GUIUtil::openSHIELDConf()){
+ QMessageBox::critical(this, tr("Error"), tr("The configuration file could not be opened."));
+ }
+}
+
+// void SHIELDGUI::showMNConfEditor()
+// {
+// GUIUtil::openMNConfigfile();
+// }
+
+void SHIELDGUI::showDatadir()
+{
+ GUIUtil::showDatadir();
+}
+
#endif // ENABLE_WALLET
void SHIELDGUI::updateNetworkState()
@@ -1031,10 +1119,15 @@ void SHIELDGUI::closeEvent(QCloseEvent *event)
void SHIELDGUI::showEvent(QShowEvent *event)
{
- // enable the debug window when the main window shows up
+ // enable the debug windows when the main window shows up
openRPCConsoleAction->setEnabled(true);
aboutAction->setEnabled(true);
optionsAction->setEnabled(true);
+ openInfoAction->setEnabled(true);
+ openGraphAction->setEnabled(true);
+ openPeersAction->setEnabled(true);
+ openConfEditorAction->setEnabled(true);
+ // openRepairAction->setEnabled(true);
}
#ifdef ENABLE_WALLET
diff --git a/src/qt/shieldgui.h b/src/qt/shieldgui.h
index 65e4343..d3f20ed 100644
--- a/src/qt/shieldgui.h
+++ b/src/qt/shieldgui.h
@@ -120,6 +120,13 @@ class SHIELDGUI : public QMainWindow
QAction *backupWalletAction;
QAction *changePassphraseAction;
QAction *aboutQtAction;
+ QAction *openInfoAction;
+ QAction *openGraphAction;
+ QAction *openPeersAction;
+ // QAction *openRepairAction;
+ QAction *openConfEditorAction;
+ // QAction *openMNConfEditorAction;
+ QAction *showDatadirAction;
QAction *openRPCConsoleAction;
QAction *openAction;
QAction *showHelpMessageAction;
@@ -241,6 +248,20 @@ private Q_SLOTS:
void aboutClicked();
/** Show debug window */
void showDebugWindow();
+ /** Show debug window and set focus to the appropriate tab */
+ void showInfo();
+ void showConsole();
+ void showGraph();
+ void showPeers();
+ // void showRepair();
+
+ /** Open external (default) editor with the config file */
+ void showConfEditor();
+ /** Open external (default) editor with masternode.conf */
+ // void showMNConfEditor();
+ /** Show folder with wallet backups in default file browser */
+ void showDatadir();
+
/** Show debug window and set focus to the console */
void showDebugWindowActivateConsole();
/** Show help message dialog */