Changeset View
Changeset View
Standalone View
Standalone View
src/qt/guiutil.cpp
Show First 20 Lines • Show All 994 Lines • ▼ Show 20 Lines | if (secs < 60) { | ||||
timeBehindText = QObject::tr("%1 and %2") | timeBehindText = QObject::tr("%1 and %2") | ||||
.arg(QObject::tr("%n year(s)", "", years)) | .arg(QObject::tr("%n year(s)", "", years)) | ||||
.arg(QObject::tr("%n week(s)", "", | .arg(QObject::tr("%n week(s)", "", | ||||
remainder / WEEK_IN_SECONDS)); | remainder / WEEK_IN_SECONDS)); | ||||
} | } | ||||
return timeBehindText; | return timeBehindText; | ||||
} | } | ||||
QString formatBytes(uint64_t bytes) { | |||||
if (bytes < 1024) { | |||||
return QString(QObject::tr("%1 B")).arg(bytes); | |||||
} | |||||
if (bytes < 1024 * 1024) { | |||||
return QString(QObject::tr("%1 KB")).arg(bytes / 1024); | |||||
} | |||||
if (bytes < 1024 * 1024 * 1024) { | |||||
return QString(QObject::tr("%1 MB")).arg(bytes / 1024 / 1024); | |||||
} | |||||
return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); | |||||
} | |||||
void ClickableLabel::mouseReleaseEvent(QMouseEvent *event) { | void ClickableLabel::mouseReleaseEvent(QMouseEvent *event) { | ||||
Q_EMIT clicked(event->pos()); | Q_EMIT clicked(event->pos()); | ||||
} | } | ||||
void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event) { | void ClickableProgressBar::mouseReleaseEvent(QMouseEvent *event) { | ||||
Q_EMIT clicked(event->pos()); | Q_EMIT clicked(event->pos()); | ||||
} | } | ||||
} // namespace GUIUtil | } // namespace GUIUtil |