Skip to content

Commit f08141d

Browse files
Unsignedzakurai
authored andcommitted
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)
1 parent 58ecf75 commit f08141d

5 files changed

Lines changed: 190 additions & 8 deletions

File tree

src/qt/guiutil.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,24 @@ bool openSHIELDConf()
418418
return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)));
419419
}
420420

421+
// void openMNConfigfile()
422+
// {
423+
// boost::filesystem::path pathConfig = GetMasternodeConfigFile();
424+
425+
// /* Open masternode.conf with the associated application */
426+
// if (boost::filesystem::exists(pathConfig))
427+
// QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)));
428+
// }
429+
430+
void showDatadir()
431+
{
432+
boost::filesystem::path dataDir = GetDataDir();
433+
434+
/* Open folder with default browser */
435+
if (boost::filesystem::exists(dataDir))
436+
QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(dataDir)));
437+
}
438+
421439
void SubstituteFonts(const QString& language)
422440
{
423441
#if defined(Q_OS_MAC)

src/qt/guiutil.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ namespace GUIUtil
121121
// Open the config file
122122
bool openSHIELDConf();
123123

124+
// Open masternode.conf
125+
// void openMNConfigfile();
126+
127+
// Browse data folder
128+
void showDatadir();
129+
124130
// Replace invalid default fonts with known good ones
125131
void SubstituteFonts(const QString& language);
126132

src/qt/locale/shield_ja.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,50 @@
353353
<source>Change the passphrase used for wallet encryption</source>
354354
<translation>ウォレット暗号化用パスフレーズの変更</translation>
355355
</message>
356+
<message>
357+
<source>&amp;Information</source>
358+
<translation>診断情報 (&amp;I)</translation>
359+
</message>
360+
<message>
361+
<source>Show diagnostic information</source>
362+
<translation>診断情報を表示</translation>
363+
</message>
356364
<message>
357365
<source>&amp;Debug window</source>
358366
<translation>デバッグ ウインドウ (&amp;D)</translation>
359367
</message>
368+
<message>
369+
<source>&amp;Network Monitor</source>
370+
<translation>ネットワークモニター(&amp;N)</translation>
371+
</message>
372+
<message>
373+
<source>Show network monitor</source>
374+
<translation>ネットワークモニターを表示</translation>
375+
</message>
376+
<message>
377+
<source>&amp;Peers list</source>
378+
<translation>ピアリスト (&amp;P)</translation>
379+
</message>
380+
<message>
381+
<source>Show peers info</source>
382+
<translation>ピア情報を表示</translation>
383+
</message>
384+
<message>
385+
<source>Open the %1 configuration file from the working directory</source>
386+
<translation>%1の設定ファイルをワーキングディレクトリから開く</translation>
387+
</message>
388+
<message>
389+
<source>Open &amp;Configuration File</source>
390+
<translation>設定ファイルを開く (&amp;C)</translation>
391+
</message>
392+
<message>
393+
<source>Open Data &amp;Folder</source>
394+
<translation>データフォルダーを開く (&amp;F)</translation>
395+
</message>
396+
<message>
397+
<source>Open the %1 working directory</source>
398+
<translation>%1 ワーキングディレクトリを開く</translation>
399+
</message>
360400
<message>
361401
<source>Open debugging and diagnostic console</source>
362402
<translation>デバッグと診断コンソールを開く</translation>
@@ -409,6 +449,10 @@
409449
<source>&amp;Settings</source>
410450
<translation>設定(&amp;S)</translation>
411451
</message>
452+
<message>
453+
<source>&amp;Tools</source>
454+
<translation>ツール(&amp;T)</translation>
455+
</message>
412456
<message>
413457
<source>&amp;Help</source>
414458
<translation>ヘルプ(&amp;H)</translation>
@@ -1570,7 +1614,7 @@
15701614
</message>
15711615
<message>
15721616
<source>&amp;Information</source>
1573-
<translation>情報 (&amp;I)</translation>
1617+
<translation>診断情報 (&amp;I)</translation>
15741618
</message>
15751619
<message>
15761620
<source>Debug window</source>
@@ -1582,7 +1626,7 @@
15821626
</message>
15831627
<message>
15841628
<source>Using BerkeleyDB version</source>
1585-
<translation>使用中のBerkleyDBバージョン</translation>
1629+
<translation>使用中のBerkeleyDBバージョン</translation>
15861630
</message>
15871631
<message>
15881632
<source>Datadir</source>

src/qt/shieldgui.cpp

Lines changed: 99 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,33 @@ void SHIELDGUI::createActions()
380380

381381
openRPCConsoleAction = new QAction(platformStyle->TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this);
382382
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
383-
// initially disable the debug window menu item
383+
openInfoAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Information"), this);
384+
openInfoAction->setStatusTip(tr("Show diagnostic information"));
385+
openGraphAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this);
386+
openGraphAction->setStatusTip(tr("Show network monitor"));
387+
openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this);
388+
openPeersAction->setStatusTip(tr("Show peers info"));
389+
// openRepairAction = new QAction(QIcon(":/icons/tx_mined"), tr("Wallet &Repair"), this);
390+
// openRepairAction->setStatusTip(tr("Show wallet repair options"));
391+
openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Configuration File"), this);
392+
openConfEditorAction->setStatusTip(tr("Open the %1 configuration file from the working directory").arg(tr(PACKAGE_NAME)));
393+
// openMNConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Masternode Configuration File"), this);
394+
// openMNConfEditorAction->setStatusTip(tr("Open Masternode configuration file"));
395+
showDatadirAction = new QAction(QIcon(":/icons/open"), tr("Open Data &Folder"), this);
396+
showDatadirAction->setStatusTip(tr("Open the %1 working directory").arg(tr(PACKAGE_NAME)));
397+
// initially disable the debug window menu items
398+
openInfoAction->setEnabled(false);
384399
openRPCConsoleAction->setEnabled(false);
400+
openGraphAction->setEnabled(false);
401+
openPeersAction->setEnabled(false);
402+
// openRepairAction->setEnabled(false);
385403

386404
usedSendingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this);
387405
usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
388406
usedReceivingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this);
389407
usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
390408

391-
openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), tr("Open &URI..."), this);
409+
openAction = new QAction(platformStyle->TextColorIcon(":/icons/editpaste"), tr("Open &URI..."), this);
392410
openAction->setStatusTip(tr("Open a shield: URI or payment request"));
393411

394412
showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this);
@@ -401,7 +419,18 @@ void SHIELDGUI::createActions()
401419
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
402420
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
403421
connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
404-
connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow()));
422+
connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showConsole()));
423+
424+
// Jump directly to tabs in RPC-console
425+
connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
426+
connect(openGraphAction, SIGNAL(triggered()), this, SLOT(showGraph()));
427+
connect(openPeersAction, SIGNAL(triggered()), this, SLOT(showPeers()));
428+
// connect(openRepairAction, SIGNAL(triggered()), this, SLOT(showRepair()));
429+
430+
// Open configs and backup folder from menu
431+
connect(openConfEditorAction, SIGNAL(triggered()), this, SLOT(showConfEditor()));
432+
// connect(openMNConfEditorAction, SIGNAL(triggered()), this, SLOT(showMNConfEditor()));
433+
connect(showDatadirAction, SIGNAL(triggered()), this, SLOT(showDatadir()));
405434
// prevents an open debug window from becoming stuck/unusable on client shutdown
406435
connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));
407436

@@ -457,11 +486,21 @@ void SHIELDGUI::createMenuBar()
457486
}
458487
settings->addAction(optionsAction);
459488

460-
QMenu *help = appMenuBar->addMenu(tr("&Help"));
461489
if(walletFrame)
462490
{
463-
help->addAction(openRPCConsoleAction);
491+
QMenu *tools = appMenuBar->addMenu(tr("&Tools"));
492+
tools->addAction(openInfoAction);
493+
tools->addAction(openRPCConsoleAction);
494+
tools->addAction(openGraphAction);
495+
tools->addAction(openPeersAction);
496+
// tools->addAction(openRepairAction);
497+
tools->addSeparator();
498+
tools->addAction(openConfEditorAction);
499+
// tools->addAction(openMNConfEditorAction);
500+
tools->addAction(showDatadirAction);
464501
}
502+
503+
QMenu *help = appMenuBar->addMenu(tr("&Help"));
465504
help->addAction(showHelpMessageAction);
466505
help->addSeparator();
467506
help->addAction(aboutAction);
@@ -760,6 +799,55 @@ void SHIELDGUI::gotoVerifyMessageTab(QString addr)
760799
{
761800
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
762801
}
802+
803+
804+
void SHIELDGUI::showInfo()
805+
{
806+
rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
807+
showDebugWindow();
808+
}
809+
810+
void SHIELDGUI::showConsole()
811+
{
812+
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
813+
showDebugWindow();
814+
}
815+
816+
void SHIELDGUI::showGraph()
817+
{
818+
rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
819+
showDebugWindow();
820+
}
821+
822+
void SHIELDGUI::showPeers()
823+
{
824+
rpcConsole->setTabFocus(RPCConsole::TAB_PEERS);
825+
showDebugWindow();
826+
}
827+
828+
// void SHIELDGUI::showRepair()
829+
// {
830+
// rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR);
831+
// showDebugWindow();
832+
// }
833+
834+
void SHIELDGUI::showConfEditor()
835+
{
836+
if (!GUIUtil::openSHIELDConf()){
837+
QMessageBox::critical(this, tr("Error"), tr("The configuration file could not be opened."));
838+
}
839+
}
840+
841+
// void SHIELDGUI::showMNConfEditor()
842+
// {
843+
// GUIUtil::openMNConfigfile();
844+
// }
845+
846+
void SHIELDGUI::showDatadir()
847+
{
848+
GUIUtil::showDatadir();
849+
}
850+
763851
#endif // ENABLE_WALLET
764852

765853
void SHIELDGUI::updateNetworkState()
@@ -1031,10 +1119,15 @@ void SHIELDGUI::closeEvent(QCloseEvent *event)
10311119

10321120
void SHIELDGUI::showEvent(QShowEvent *event)
10331121
{
1034-
// enable the debug window when the main window shows up
1122+
// enable the debug windows when the main window shows up
10351123
openRPCConsoleAction->setEnabled(true);
10361124
aboutAction->setEnabled(true);
10371125
optionsAction->setEnabled(true);
1126+
openInfoAction->setEnabled(true);
1127+
openGraphAction->setEnabled(true);
1128+
openPeersAction->setEnabled(true);
1129+
openConfEditorAction->setEnabled(true);
1130+
// openRepairAction->setEnabled(true);
10381131
}
10391132

10401133
#ifdef ENABLE_WALLET

src/qt/shieldgui.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ class SHIELDGUI : public QMainWindow
120120
QAction *backupWalletAction;
121121
QAction *changePassphraseAction;
122122
QAction *aboutQtAction;
123+
QAction *openInfoAction;
124+
QAction *openGraphAction;
125+
QAction *openPeersAction;
126+
// QAction *openRepairAction;
127+
QAction *openConfEditorAction;
128+
// QAction *openMNConfEditorAction;
129+
QAction *showDatadirAction;
123130
QAction *openRPCConsoleAction;
124131
QAction *openAction;
125132
QAction *showHelpMessageAction;
@@ -241,6 +248,20 @@ private Q_SLOTS:
241248
void aboutClicked();
242249
/** Show debug window */
243250
void showDebugWindow();
251+
/** Show debug window and set focus to the appropriate tab */
252+
void showInfo();
253+
void showConsole();
254+
void showGraph();
255+
void showPeers();
256+
// void showRepair();
257+
258+
/** Open external (default) editor with the config file */
259+
void showConfEditor();
260+
/** Open external (default) editor with masternode.conf */
261+
// void showMNConfEditor();
262+
/** Show folder with wallet backups in default file browser */
263+
void showDatadir();
264+
244265
/** Show debug window and set focus to the console */
245266
void showDebugWindowActivateConsole();
246267
/** Show help message dialog */

0 commit comments

Comments
 (0)