mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge #17105: gui: Make RPCConsole::TabTypes an enum class
8019b6b150
gui: Make RPCConsole::TabTypes an enum class (João Barbosa) Pull request description: This change makes the compiler emit a warning/error if a missing enum value is not handled. See also #17134. ACKs for top commit: MarcoFalke: unsigned ACK8019b6b150
hebasto: re-ACK8019b6b150
fanquake: ACK8019b6b150
Tree-SHA512: 329161097f4d079f48d5fb33bf3a07e314fbb2ac325cafb08bafa9e76229ecff0f9010fe3c1c15ccd02d4539b5c93839c846b42bfeaffa897a917cea599bf811
This commit is contained in:
commit
eb292af309
@ -796,7 +796,7 @@ void BitcoinGUI::showDebugWindow()
|
||||
|
||||
void BitcoinGUI::showDebugWindowActivateConsole()
|
||||
{
|
||||
rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
|
||||
rpcConsole->setTabFocus(RPCConsole::TabTypes::CONSOLE);
|
||||
showDebugWindow();
|
||||
}
|
||||
|
||||
|
@ -1268,22 +1268,24 @@ void RPCConsole::showOrHideBanTableIfRequired()
|
||||
|
||||
void RPCConsole::setTabFocus(enum TabTypes tabType)
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(tabType);
|
||||
ui->tabWidget->setCurrentIndex(int(tabType));
|
||||
}
|
||||
|
||||
QString RPCConsole::tabTitle(TabTypes tab_type) const
|
||||
{
|
||||
return ui->tabWidget->tabText(tab_type);
|
||||
return ui->tabWidget->tabText(int(tab_type));
|
||||
}
|
||||
|
||||
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
|
||||
{
|
||||
switch (tab_type) {
|
||||
case TAB_INFO: return QKeySequence(Qt::CTRL + Qt::Key_I);
|
||||
case TAB_CONSOLE: return QKeySequence(Qt::CTRL + Qt::Key_T);
|
||||
case TAB_GRAPH: return QKeySequence(Qt::CTRL + Qt::Key_N);
|
||||
case TAB_PEERS: return QKeySequence(Qt::CTRL + Qt::Key_P);
|
||||
}
|
||||
case TabTypes::INFO: return QKeySequence(Qt::CTRL + Qt::Key_I);
|
||||
case TabTypes::CONSOLE: return QKeySequence(Qt::CTRL + Qt::Key_T);
|
||||
case TabTypes::GRAPH: return QKeySequence(Qt::CTRL + Qt::Key_N);
|
||||
case TabTypes::PEERS: return QKeySequence(Qt::CTRL + Qt::Key_P);
|
||||
} // no default case, so the compiler can warn about missing cases
|
||||
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void RPCConsole::updateAlerts(const QString& warnings)
|
||||
|
@ -58,14 +58,14 @@ public:
|
||||
CMD_ERROR
|
||||
};
|
||||
|
||||
enum TabTypes {
|
||||
TAB_INFO = 0,
|
||||
TAB_CONSOLE = 1,
|
||||
TAB_GRAPH = 2,
|
||||
TAB_PEERS = 3
|
||||
enum class TabTypes {
|
||||
INFO,
|
||||
CONSOLE,
|
||||
GRAPH,
|
||||
PEERS
|
||||
};
|
||||
|
||||
std::vector<TabTypes> tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS}; }
|
||||
std::vector<TabTypes> tabs() const { return {TabTypes::INFO, TabTypes::CONSOLE, TabTypes::GRAPH, TabTypes::PEERS}; }
|
||||
|
||||
QString tabTitle(TabTypes tab_type) const;
|
||||
QKeySequence tabShortcut(TabTypes tab_type) const;
|
||||
|
Loading…
Reference in New Issue
Block a user