diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2021-10-24 01:11:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-24 01:11:52 +0200 |
commit | 98887911c15dc407e797998cf04e0b90b6aa09ae (patch) | |
tree | facb2499050ec9c6efe915987930441ae328edfc /launcher/MainWindow.cpp | |
parent | ddf98c59f5d92c07c3cbed8bd7a1eda3b6aec439 (diff) | |
parent | 5bc6dd8f970249c8279d6302f8df56910c599514 (diff) | |
download | PrismLauncher-98887911c15dc407e797998cf04e0b90b6aa09ae.tar.gz PrismLauncher-98887911c15dc407e797998cf04e0b90b6aa09ae.tar.bz2 PrismLauncher-98887911c15dc407e797998cf04e0b90b6aa09ae.zip |
Merge pull request #4173 from jamierocks/common-time-duration-format
NOISSUE Use common duration format for global and instances
Diffstat (limited to 'launcher/MainWindow.cpp')
-rw-r--r-- | launcher/MainWindow.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/launcher/MainWindow.cpp b/launcher/MainWindow.cpp index c3cc6b8d..33d9c7f4 100644 --- a/launcher/MainWindow.cpp +++ b/launcher/MainWindow.cpp @@ -88,6 +88,7 @@ #include "UpdateController.h" #include "KonamiCode.h" #include <InstanceCopyTask.h> +#include "MMCTime.h" namespace { QString profileInUseFilter(const QString & profile, bool used) @@ -747,7 +748,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow connect(LAUNCHER, &Launcher::globalSettingsClosed, this, &MainWindow::globalSettingsClosed); m_statusLeft = new QLabel(tr("No instance selected"), this); - m_statusCenter = new QLabel(tr("Total playtime: 0s."), this); + m_statusCenter = new QLabel(tr("Total playtime: 0s"), this); statusBar()->addPermanentWidget(m_statusLeft, 1); statusBar()->addPermanentWidget(m_statusCenter, 0); @@ -1926,15 +1927,8 @@ void MainWindow::checkInstancePathForProblems() void MainWindow::updateStatusCenter() { - int timeplayed = LAUNCHER->instances()->getTotalPlayTime(); - int minutesTotal = timeplayed / 60; - int seconds = timeplayed % 60; - int minutes = minutesTotal % 60; - int hours = minutesTotal / 60; - if(hours != 0) - m_statusCenter->setText(tr("Total playtime: %1h %2m %3s").arg(hours).arg(minutes).arg(seconds)); - else if(minutes != 0) - m_statusCenter->setText(tr("Total playtime: %1m %2s").arg(minutes).arg(seconds)); - else if(seconds != 0) - m_statusCenter->setText(tr("Total playtime: %1s").arg(seconds)); + int timePlayed = LAUNCHER->instances()->getTotalPlayTime(); + if (timePlayed > 0) { + m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed))); + } } |