gui: create GUIUtil::ConnectionTypeToQString utility function

pull/826/head
Jon Atack 4 years ago
parent 9158d6f341
commit 7e2beab2d2
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

@ -764,6 +764,19 @@ QString NetworkToQString(Network net)
assert(false);
}
QString ConnectionTypeToQString(ConnectionType conn_type)
{
switch (conn_type) {
case ConnectionType::INBOUND: return QObject::tr("Inbound");
case ConnectionType::OUTBOUND_FULL_RELAY: return QObject::tr("Outbound Full Relay");
case ConnectionType::BLOCK_RELAY: return QObject::tr("Outbound Block Relay");
case ConnectionType::MANUAL: return QObject::tr("Outbound Manual");
case ConnectionType::FEELER: return QObject::tr("Outbound Feeler");
case ConnectionType::ADDR_FETCH: return QObject::tr("Outbound Address Fetch");
} // no default case, so the compiler can warn about missing cases
assert(false);
}
QString formatDurationStr(int secs)
{
QStringList strList;

@ -7,17 +7,18 @@
#include <amount.h>
#include <fs.h>
#include <net.h>
#include <netaddress.h>
#include <QEvent>
#include <QHeaderView>
#include <QItemDelegate>
#include <QLabel>
#include <QMessageBox>
#include <QObject>
#include <QProgressBar>
#include <QString>
#include <QTableView>
#include <QLabel>
class QValidatedLineEdit;
class SendCoinsRecipient;
@ -228,6 +229,9 @@ namespace GUIUtil
/** Convert enum Network to QString */
QString NetworkToQString(Network net);
/** Convert enum ConnectionType to QString */
QString ConnectionTypeToQString(ConnectionType conn_type);
/** Convert seconds into a QString with days, hours, mins, secs */
QString formatDurationStr(int secs);

Loading…
Cancel
Save