mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-07 18:31:09 +02:00
gui: create GUIUtil::NetworkToQString() utility function
This commit is contained in:
parent
af9103cc79
commit
0d5613f9de
@ -749,6 +749,21 @@ QString boostPathToQString(const fs::path &path)
|
|||||||
return QString::fromStdString(path.string());
|
return QString::fromStdString(path.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString NetworkToQString(Network net)
|
||||||
|
{
|
||||||
|
switch (net) {
|
||||||
|
case NET_UNROUTABLE: return QObject::tr("Unroutable");
|
||||||
|
case NET_IPV4: return "IPv4";
|
||||||
|
case NET_IPV6: return "IPv6";
|
||||||
|
case NET_ONION: return "Onion";
|
||||||
|
case NET_I2P: return "I2P";
|
||||||
|
case NET_CJDNS: return "CJDNS";
|
||||||
|
case NET_INTERNAL: return QObject::tr("Internal");
|
||||||
|
case NET_MAX: assert(false);
|
||||||
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
QString formatDurationStr(int secs)
|
QString formatDurationStr(int secs)
|
||||||
{
|
{
|
||||||
QStringList strList;
|
QStringList strList;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <amount.h>
|
#include <amount.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
#include <netaddress.h>
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
@ -224,6 +225,9 @@ namespace GUIUtil
|
|||||||
/* Convert OS specific boost path to QString through UTF-8 */
|
/* Convert OS specific boost path to QString through UTF-8 */
|
||||||
QString boostPathToQString(const fs::path &path);
|
QString boostPathToQString(const fs::path &path);
|
||||||
|
|
||||||
|
/** Convert enum Network to QString */
|
||||||
|
QString NetworkToQString(Network net);
|
||||||
|
|
||||||
/* Convert seconds into a QString with days, hours, mins, secs */
|
/* Convert seconds into a QString with days, hours, mins, secs */
|
||||||
QString formatDurationStr(int secs);
|
QString formatDurationStr(int secs);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user