mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge bitcoin#17105: gui: Make RPCConsole::TabTypes an enum class
This commit is contained in:
parent
94c5db49ef
commit
0d34bb3be1
@ -1052,31 +1052,31 @@ void BitcoinGUI::showDebugWindow()
|
|||||||
|
|
||||||
void BitcoinGUI::showInfo()
|
void BitcoinGUI::showInfo()
|
||||||
{
|
{
|
||||||
rpcConsole->setTabFocus(RPCConsole::TAB_INFO);
|
rpcConsole->setTabFocus(RPCConsole::TabTypes::INFO);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::showConsole()
|
void BitcoinGUI::showConsole()
|
||||||
{
|
{
|
||||||
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
|
rpcConsole->setTabFocus(RPCConsole::TabTypes::CONSOLE);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::showGraph()
|
void BitcoinGUI::showGraph()
|
||||||
{
|
{
|
||||||
rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH);
|
rpcConsole->setTabFocus(RPCConsole::TabTypes::GRAPH);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::showPeers()
|
void BitcoinGUI::showPeers()
|
||||||
{
|
{
|
||||||
rpcConsole->setTabFocus(RPCConsole::TAB_PEERS);
|
rpcConsole->setTabFocus(RPCConsole::TabTypes::PEERS);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::showRepair()
|
void BitcoinGUI::showRepair()
|
||||||
{
|
{
|
||||||
rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR);
|
rpcConsole->setTabFocus(RPCConsole::TabTypes::REPAIR);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags
|
|||||||
pageButtons->addButton(ui->btnRepair, pageButtons->buttons().size());
|
pageButtons->addButton(ui->btnRepair, pageButtons->buttons().size());
|
||||||
connect(pageButtons, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &RPCConsole::showPage);
|
connect(pageButtons, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &RPCConsole::showPage);
|
||||||
|
|
||||||
showPage(TAB_INFO);
|
showPage(int(TabTypes::INFO));
|
||||||
|
|
||||||
reloadThemedWidgets();
|
reloadThemedWidgets();
|
||||||
}
|
}
|
||||||
@ -1429,21 +1429,23 @@ void RPCConsole::showOrHideBanTableIfRequired()
|
|||||||
|
|
||||||
void RPCConsole::setTabFocus(enum TabTypes tabType)
|
void RPCConsole::setTabFocus(enum TabTypes tabType)
|
||||||
{
|
{
|
||||||
showPage(tabType);
|
showPage(int(tabType));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RPCConsole::tabTitle(TabTypes tab_type) const
|
QString RPCConsole::tabTitle(TabTypes tab_type) const
|
||||||
{
|
{
|
||||||
return pageButtons->button(tab_type)->text();
|
return pageButtons->button(int(tab_type))->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
|
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
|
||||||
{
|
{
|
||||||
switch (tab_type) {
|
switch (tab_type) {
|
||||||
case TAB_INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
|
case TabTypes::INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
|
||||||
case TAB_CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
|
case TabTypes::CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
|
||||||
case TAB_GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
|
case TabTypes::GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
|
||||||
case TAB_PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P);
|
case TabTypes::PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P);
|
||||||
case TAB_REPAIR: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
|
case TabTypes::REPAIR: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
|
||||||
}
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
|
@ -59,15 +59,15 @@ public:
|
|||||||
CMD_ERROR
|
CMD_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TabTypes {
|
enum class TabTypes {
|
||||||
TAB_INFO = 0,
|
INFO,
|
||||||
TAB_CONSOLE = 1,
|
CONSOLE,
|
||||||
TAB_GRAPH = 2,
|
GRAPH,
|
||||||
TAB_PEERS = 3,
|
PEERS,
|
||||||
TAB_REPAIR = 4
|
REPAIR
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<TabTypes> tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS, TAB_REPAIR}; }
|
std::vector<TabTypes> tabs() const { return {TabTypes::INFO, TabTypes::CONSOLE, TabTypes::GRAPH, TabTypes::PEERS, TabTypes::REPAIR}; }
|
||||||
|
|
||||||
QString tabTitle(TabTypes tab_type) const;
|
QString tabTitle(TabTypes tab_type) const;
|
||||||
QKeySequence tabShortcut(TabTypes tab_type) const;
|
QKeySequence tabShortcut(TabTypes tab_type) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user