Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 881 Lines • ▼ Show 20 Lines | if (seconds || (!days && !hours && !mins)) | ||||
strList.append(QString(QObject::tr("%1 s")).arg(seconds)); | strList.append(QString(QObject::tr("%1 s")).arg(seconds)); | ||||
return strList.join(" "); | return strList.join(" "); | ||||
} | } | ||||
QString formatServicesStr(quint64 mask) { | QString formatServicesStr(quint64 mask) { | ||||
QStringList strList; | QStringList strList; | ||||
// Just scan the last 11 bits for now. | // Just scan up to NODE_NETWORK_LIMITED for now. | ||||
for (int i = 0; i < 11; i++) { | uint64_t check = 1; | ||||
Fabien: Note: I reverted the loop direction from @jasonbcox proposal, in order to keep the same display… | |||||
uint64_t check = 1 << i; | while (check <= NODE_NETWORK_LIMITED) { | ||||
deadalnixUnsubmitted Not Done Inline ActionsAdd a constant in the enum that indicate the end of the main services range. deadalnix: Add a constant in the enum that indicate the end of the main services range. | |||||
deadalnixUnsubmitted Not Done Inline ActionsWhile not for (uint64_t check = 1; check <= NODE_LAST_SERVICE_BIT; check <<= 1;) deadalnix: While not
for (uint64_t check = 1; check <= NODE_LAST_SERVICE_BIT; check <<= 1;) | |||||
if (mask & check) { | if (mask & check) { | ||||
switch (check) { | switch (check) { | ||||
case NODE_NETWORK: | case NODE_NETWORK: | ||||
strList.append("NETWORK"); | strList.append("NETWORK"); | ||||
break; | break; | ||||
case NODE_GETUTXO: | case NODE_GETUTXO: | ||||
strList.append("GETUTXO"); | strList.append("GETUTXO"); | ||||
break; | break; | ||||
case NODE_BLOOM: | case NODE_BLOOM: | ||||
strList.append("BLOOM"); | strList.append("BLOOM"); | ||||
break; | break; | ||||
case NODE_XTHIN: | case NODE_XTHIN: | ||||
strList.append("XTHIN"); | strList.append("XTHIN"); | ||||
break; | break; | ||||
case NODE_BITCOIN_CASH: | case NODE_BITCOIN_CASH: | ||||
strList.append("CASH"); | strList.append("CASH"); | ||||
break; | break; | ||||
case NODE_NETWORK_LIMITED: | case NODE_NETWORK_LIMITED: | ||||
strList.append("LIMITED"); | strList.append("LIMITED"); | ||||
break; | break; | ||||
default: | default: | ||||
strList.append(QString("%1[%2]").arg("UNKNOWN").arg(check)); | strList.append(QString("%1[%2]").arg("UNKNOWN").arg(check)); | ||||
} | } | ||||
} | } | ||||
check <<= 1; | |||||
} | } | ||||
if (strList.size()) | if (strList.size()) | ||||
return strList.join(" & "); | return strList.join(" & "); | ||||
else | else | ||||
return QObject::tr("None"); | return QObject::tr("None"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |
Note: I reverted the loop direction from @jasonbcox proposal, in order to keep the same display ordering