Skip to content

Commit

Permalink
Add tools bar
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Unsigned authored and zakurai committed Oct 25, 2018
1 parent 58ecf75 commit f08141d
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 8 deletions.
18 changes: 18 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
48 changes: 46 additions & 2 deletions src/qt/locale/shield_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,50 @@
<source>Change the passphrase used for wallet encryption</source>
<translation>ウォレット暗号化用パスフレーズの変更</translation>
</message>
<message>
<source>&amp;Information</source>
<translation>診断情報 (&amp;I)</translation>
</message>
<message>
<source>Show diagnostic information</source>
<translation>診断情報を表示</translation>
</message>
<message>
<source>&amp;Debug window</source>
<translation>デバッグ ウインドウ (&amp;D)</translation>
</message>
<message>
<source>&amp;Network Monitor</source>
<translation>ネットワークモニター(&amp;N)</translation>
</message>
<message>
<source>Show network monitor</source>
<translation>ネットワークモニターを表示</translation>
</message>
<message>
<source>&amp;Peers list</source>
<translation>ピアリスト (&amp;P)</translation>
</message>
<message>
<source>Show peers info</source>
<translation>ピア情報を表示</translation>
</message>
<message>
<source>Open the %1 configuration file from the working directory</source>
<translation>%1の設定ファイルをワーキングディレクトリから開く</translation>
</message>
<message>
<source>Open &amp;Configuration File</source>
<translation>設定ファイルを開く (&amp;C)</translation>
</message>
<message>
<source>Open Data &amp;Folder</source>
<translation>データフォルダーを開く (&amp;F)</translation>
</message>
<message>
<source>Open the %1 working directory</source>
<translation>%1 ワーキングディレクトリを開く</translation>
</message>
<message>
<source>Open debugging and diagnostic console</source>
<translation>デバッグと診断コンソールを開く</translation>
Expand Down Expand Up @@ -409,6 +449,10 @@
<source>&amp;Settings</source>
<translation>設定(&amp;S)</translation>
</message>
<message>
<source>&amp;Tools</source>
<translation>ツール(&amp;T)</translation>
</message>
<message>
<source>&amp;Help</source>
<translation>ヘルプ(&amp;H)</translation>
Expand Down Expand Up @@ -1570,7 +1614,7 @@
</message>
<message>
<source>&amp;Information</source>
<translation>情報 (&amp;I)</translation>
<translation>診断情報 (&amp;I)</translation>
</message>
<message>
<source>Debug window</source>
Expand All @@ -1582,7 +1626,7 @@
</message>
<message>
<source>Using BerkeleyDB version</source>
<translation>使用中のBerkleyDBバージョン</translation>
<translation>使用中のBerkeleyDBバージョン</translation>
</message>
<message>
<source>Datadir</source>
Expand Down
105 changes: 99 additions & 6 deletions src/qt/shieldgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()));

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions src/qt/shieldgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit f08141d

Please sign in to comment.