Refactor tools menu signals/slots, add more shortcuts

This commit is contained in:
UdjinM6 2016-02-15 22:02:55 +03:00
parent fd747bae01
commit 0d387900c5
4 changed files with 81 additions and 81 deletions

View File

@ -370,8 +370,8 @@ void BitcoinGUI::createActions()
openInfoAction->setStatusTip(tr("Show diagnostic information"));
openRPCConsoleAction = new QAction(QIcon(":/icons/" + theme + "/debugwindow"), tr("&Debug console"), this);
openRPCConsoleAction->setStatusTip(tr("Open debugging console"));
openNetworkAction = new QAction(QIcon(":/icons/" + theme + "/connect_4"), tr("&Network Monitor"), this);
openNetworkAction->setStatusTip(tr("Show network monitor"));
openGraphAction = new QAction(QIcon(":/icons/" + theme + "/connect_4"), tr("&Network Monitor"), this);
openGraphAction->setStatusTip(tr("Show network monitor"));
openPeersAction = new QAction(QIcon(":/icons/" + theme + "/connect_4"), tr("&Peers list"), this);
openPeersAction->setStatusTip(tr("Show peers info"));
openRepairAction = new QAction(QIcon(":/icons/" + theme + "/options"), tr("Wallet &Repair"), this);
@ -401,16 +401,21 @@ void BitcoinGUI::createActions()
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden()));
connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
// Jump directly to tabs in RPC-console
connect(openInfoAction, SIGNAL(triggered()), rpcConsole, SLOT(showInfo()));
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(showConsole()));
connect(openNetworkAction, SIGNAL(triggered()), rpcConsole, SLOT(showNetwork()));
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()));
connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showConsole()));
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(showBackupsAction, SIGNAL(triggered()), this, SLOT(showBackups()));
// Jump to peers tab by clicking on connections icon
connect(labelConnectionsIcon, SIGNAL(clicked()), this, SLOT(showPeers()));
// Get restart command-line parameters and handle restart
connect(rpcConsole, SIGNAL(handleRestart(QStringList)), this, SLOT(handleRestart(QStringList)));
@ -434,8 +439,11 @@ void BitcoinGUI::createActions()
}
#endif // ENABLE_WALLET
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showDebugWindowActivateConsole()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this, SLOT(showDebugWindow()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I), this, SLOT(showInfo()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showConsole()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G), this, SLOT(showGraph()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P), this, SLOT(showPeers()));
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R), this, SLOT(showRepair()));
}
void BitcoinGUI::createMenuBar()
@ -479,7 +487,7 @@ void BitcoinGUI::createMenuBar()
QMenu *tools = appMenuBar->addMenu(tr("&Tools"));
tools->addAction(openInfoAction);
tools->addAction(openRPCConsoleAction);
tools->addAction(openNetworkAction);
tools->addAction(openGraphAction);
tools->addAction(openPeersAction);
tools->addAction(openRepairAction);
tools->addSeparator();
@ -650,7 +658,7 @@ void BitcoinGUI::createTrayIconMenu()
trayIconMenu->addAction(optionsAction);
trayIconMenu->addAction(openInfoAction);
trayIconMenu->addAction(openRPCConsoleAction);
trayIconMenu->addAction(openNetworkAction);
trayIconMenu->addAction(openGraphAction);
trayIconMenu->addAction(openPeersAction);
trayIconMenu->addAction(openRepairAction);
trayIconMenu->addSeparator();
@ -701,12 +709,51 @@ void BitcoinGUI::showDebugWindow()
rpcConsole->activateWindow();
}
void BitcoinGUI::showDebugWindowActivateConsole()
void BitcoinGUI::showInfo()
{
rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
showDebugWindow();
}
void BitcoinGUI::showConsole()
{
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
showDebugWindow();
}
void BitcoinGUI::showGraph()
{
rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
showDebugWindow();
}
void BitcoinGUI::showPeers()
{
rpcConsole->setTabFocus(RPCConsole::TAB_PEERS);
showDebugWindow();
}
void BitcoinGUI::showRepair()
{
rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR);
showDebugWindow();
}
void BitcoinGUI::showConfEditor()
{
GUIUtil::openConfigfile();
}
void BitcoinGUI::showMNConfEditor()
{
GUIUtil::openMNConfigfile();
}
void BitcoinGUI::showBackups()
{
GUIUtil::showBackups();
}
void BitcoinGUI::showHelpMessageClicked()
{
helpMessageDialog->show();

View File

@ -112,7 +112,7 @@ private:
QAction *aboutQtAction;
QAction *openInfoAction;
QAction *openRPCConsoleAction;
QAction *openNetworkAction;
QAction *openGraphAction;
QAction *openPeersAction;
QAction *openRepairAction;
QAction *openConfEditorAction;
@ -213,8 +213,21 @@ private Q_SLOTS:
void aboutClicked();
/** Show debug window */
void showDebugWindow();
/** Show debug window and set focus to the console */
void showDebugWindowActivateConsole();
/** 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 dash.conf */
void showConfEditor();
/** Open external (default) editor with masternode.conf */
void showMNConfEditor();
/** Show folder with wallet backups in default file browser */
void showBackups();
/** Show help message dialog */
void showHelpMessageClicked();
#ifndef Q_OS_MAC

View File

@ -746,46 +746,6 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
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();
}
void RPCConsole::showPeers()
{
ui->tabWidget->setCurrentIndex(3);
show();
}
void RPCConsole::showRepair()
{
ui->tabWidget->setCurrentIndex(4);
show();
}
void RPCConsole::showConfEditor()
{
GUIUtil::openConfigfile();
}
void RPCConsole::showMNConfEditor()
{
GUIUtil::openMNConfigfile();
}
void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
{
Q_UNUSED(deselected);
@ -927,11 +887,6 @@ void RPCConsole::hideEvent(QHideEvent *event)
clientModel->getPeerTableModel()->stopAutoRefresh();
}
void RPCConsole::showBackups()
{
GUIUtil::showBackups();
}
void RPCConsole::showPeersTableContextMenu(const QPoint& point)
{
QModelIndex index = ui->peerWidget->indexAt(point);

View File

@ -48,7 +48,8 @@ public:
TAB_INFO = 0,
TAB_CONSOLE = 1,
TAB_GRAPH = 2,
TAB_PEERS = 3
TAB_PEERS = 3,
TAB_REPAIR = 4
};
protected:
@ -101,26 +102,10 @@ public Q_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();
/** Switch to peers tab and show */
void showPeers();
/** Switch to wallet-repair tab and show */
void showRepair();
/** Open external (default) editor with dash.conf */
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 */
void peerLayoutChanged();
/** Show folder with wallet backups in default browser */
void showBackups();
/** Disconnect a selected node on the Peers tab */
void disconnectSelectedNode();
/** Ban a selected node on the Peers tab */