diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 92f99cb823..3be5ad39ab 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1052,31 +1052,31 @@ void BitcoinGUI::showDebugWindow() void BitcoinGUI::showInfo() { - rpcConsole->setTabFocus(RPCConsole::TAB_INFO); + rpcConsole->setTabFocus(RPCConsole::TabTypes::INFO); showDebugWindow(); } void BitcoinGUI::showConsole() { - rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE); + rpcConsole->setTabFocus(RPCConsole::TabTypes::CONSOLE); showDebugWindow(); } void BitcoinGUI::showGraph() { - rpcConsole->setTabFocus(RPCConsole::TAB_GRAPH); + rpcConsole->setTabFocus(RPCConsole::TabTypes::GRAPH); showDebugWindow(); } void BitcoinGUI::showPeers() { - rpcConsole->setTabFocus(RPCConsole::TAB_PEERS); + rpcConsole->setTabFocus(RPCConsole::TabTypes::PEERS); showDebugWindow(); } void BitcoinGUI::showRepair() { - rpcConsole->setTabFocus(RPCConsole::TAB_REPAIR); + rpcConsole->setTabFocus(RPCConsole::TabTypes::REPAIR); showDebugWindow(); } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 81019a2089..bb4ff19c59 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -529,7 +529,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags pageButtons->addButton(ui->btnRepair, pageButtons->buttons().size()); connect(pageButtons, QOverload::of(&QButtonGroup::buttonClicked), this, &RPCConsole::showPage); - showPage(TAB_INFO); + showPage(int(TabTypes::INFO)); reloadThemedWidgets(); } @@ -1429,21 +1429,23 @@ void RPCConsole::showOrHideBanTableIfRequired() void RPCConsole::setTabFocus(enum TabTypes tabType) { - showPage(tabType); + showPage(int(tabType)); } 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 { switch (tab_type) { - case TAB_INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I); - case TAB_CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C); - case TAB_GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G); - case TAB_PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P); - case TAB_REPAIR: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R); - } + case TabTypes::INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I); + case TabTypes::CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C); + case TabTypes::GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G); + case TabTypes::PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P); + 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); } diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 4307aefda0..8e290caa50 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -59,15 +59,15 @@ public: CMD_ERROR }; - enum TabTypes { - TAB_INFO = 0, - TAB_CONSOLE = 1, - TAB_GRAPH = 2, - TAB_PEERS = 3, - TAB_REPAIR = 4 + enum class TabTypes { + INFO, + CONSOLE, + GRAPH, + PEERS, + REPAIR }; - std::vector tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS, TAB_REPAIR}; } + std::vector tabs() const { return {TabTypes::INFO, TabTypes::CONSOLE, TabTypes::GRAPH, TabTypes::PEERS, TabTypes::REPAIR}; } QString tabTitle(TabTypes tab_type) const; QKeySequence tabShortcut(TabTypes tab_type) const;