From 333d5ae7819e4592cd94dc73f3ec50f31c86c362 Mon Sep 17 00:00:00 2001 From: vertoe Date: Fri, 16 Jan 2015 10:55:24 +0100 Subject: [PATCH] Creat a tools menu with info, console and network items. --- src/qt/bitcoingui.cpp | 23 ++++++++++++++++++----- src/qt/bitcoingui.h | 2 ++ src/qt/rpcconsole.cpp | 18 ++++++++++++++++++ src/qt/rpcconsole.h | 6 ++++++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index df55dd4575..924d425a9e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -187,7 +187,10 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); - connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); + connect(openInfoAction, SIGNAL(triggered()), rpcConsole, SLOT(showInfo())); + connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(showConsole())); + connect(openNetworkAction, SIGNAL(triggered()), rpcConsole, SLOT(showNetwork())); + // prevents an oben debug window from becoming stuck/unusable on client shutdown connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); @@ -300,8 +303,12 @@ void BitcoinGUI::createActions(bool fIsTestnet) verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Darkcoin addresses")); - openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); - openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); + openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this); + openInfoAction->setStatusTip(tr("Show diagnostic information")); + openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug console"), this); + openRPCConsoleAction->setStatusTip(tr("Open debugging console")); + openNetworkAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this); + openNetworkAction->setStatusTip(tr("Show network monitor")); usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); @@ -373,11 +380,15 @@ void BitcoinGUI::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(openNetworkAction); } + + QMenu *help = appMenuBar->addMenu(tr("&Help")); help->addAction(showHelpMessageAction); help->addSeparator(); help->addAction(aboutAction); @@ -520,7 +531,9 @@ void BitcoinGUI::createTrayIconMenu() trayIconMenu->addAction(verifyMessageAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(optionsAction); + trayIconMenu->addAction(openInfoAction); trayIconMenu->addAction(openRPCConsoleAction); + trayIconMenu->addAction(openNetworkAction); #ifndef Q_OS_MAC // This is built-in on Mac trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 720fbff445..1a90d2f410 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -93,7 +93,9 @@ private: QAction *unlockWalletAction; QAction *lockWalletAction; QAction *aboutQtAction; + QAction *openInfoAction; QAction *openRPCConsoleAction; + QAction *openNetworkAction; QAction *openAction; QAction *showHelpMessageAction; diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 260e457098..5591d4c4a7 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -499,3 +499,21 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut) ui->lblBytesIn->setText(FormatBytes(totalBytesIn)); ui->lblBytesOut->setText(FormatBytes(totalBytesOut)); } + +void RPCConsole::showInfo() +{ + ui->tabWidget->setCurrentIndex(0); + show(); +} + +void RPCConsole::showConsole() +{ + ui->tabWidget->setCurrentIndex(1); + show(); +} + +void RPCConsole::showNetwork() +{ + ui->tabWidget->setCurrentIndex(2); + show(); +} diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 091a6d294f..4bac774d6e 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -57,6 +57,12 @@ public slots: void browseHistory(int offset); /** Scroll console view to end */ void scrollToEnd(); + /** Switch to info tab and show */ + void showInfo(); + /** Switch to console tab and show */ + void showConsole(); + /** Switch to network tab and show */ + void showNetwork(); signals: // For RPC command executor