diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -28,18 +28,18 @@ enum class BlockSource { NONE, REINDEX, DISK, NETWORK }; -enum NumConnections { - CONNECTIONS_NONE = 0, - CONNECTIONS_IN = (1U << 0), - CONNECTIONS_OUT = (1U << 1), - CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT), -}; - /** Model for Bitcoin network client. */ class ClientModel : public QObject { Q_OBJECT public: + enum NumConnections { + CONNECTIONS_NONE = 0, + CONNECTIONS_IN = (1U << 0), + CONNECTIONS_OUT = (1U << 1), + CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT), + }; + explicit ClientModel(interfaces::Node &node, OptionsModel *optionsModel, QObject *parent = 0); ~ClientModel(); @@ -50,7 +50,7 @@ BanTableModel *getBanTableModel(); //! Return number of connections, default is in- and outbound (total) - int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const; + int getNumConnections(NumConnections flags = CONNECTIONS_ALL) const; int getHeaderTipHeight() const; int64_t getHeaderTipTime() const; diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -50,7 +50,7 @@ unsubscribeFromCoreSignals(); } -int ClientModel::getNumConnections(unsigned int flags) const { +int ClientModel::getNumConnections(NumConnections flags) const { CConnman::NumConnections connections = CConnman::CONNECTIONS_NONE; if (flags == CONNECTIONS_IN) { diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -982,12 +982,14 @@ void RPCConsole::updateNetworkState() { QString connections = QString::number(clientModel->getNumConnections()) + " ("; - connections += - tr("In:") + " " + - QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; - connections += - tr("Out:") + " " + - QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; + connections += tr("In:") + " " + + QString::number(clientModel->getNumConnections( + ClientModel::CONNECTIONS_IN)) + + " / "; + connections += tr("Out:") + " " + + QString::number(clientModel->getNumConnections( + ClientModel::CONNECTIONS_OUT)) + + ")"; if (!clientModel->node().getNetworkActive()) { connections += " (" + tr("Network activity disabled") + ")";