From 423db567816bb3b71ae907195d4a92b9c293e5e9 Mon Sep 17 00:00:00 2001 From: AL <26797547+Al12rs@users.noreply.github.com> Date: Sat, 15 Feb 2020 23:02:49 +0100 Subject: Change Qtime to QElapsedtimer in some palaces to remove the warnings. --- src/downloadmanager.cpp | 2 +- src/downloadmanager.h | 3 ++- src/modlist.h | 2 +- src/pluginlist.h | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 7b416d50..1fc7e184 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -2027,7 +2027,7 @@ void DownloadManager::downloadFinished(int index) foreach (const QVariant &server, info->m_FileInfo->userData["downloadMap"].toList()) { QVariantMap serverMap = server.toMap(); if (serverMap["URI"].toString() == url) { - int deltaTime = info->m_StartTime.secsTo(QTime::currentTime()); + int deltaTime = info->m_StartTime.elapsed() / 1000; if (deltaTime > 5) { emit downloadSpeed(serverMap["short_name"].toString(), (info->m_TotalSize - info->m_PreResumeSize) / deltaTime); } // no division by zero please! Also, if the download is shorter than a few seconds, the result is way to inprecise diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 4fc61cad..140970b8 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include @@ -77,7 +78,7 @@ private: QString m_FileName; QFile m_Output; QNetworkReply *m_Reply; - QTime m_StartTime; + QElapsedTimer m_StartTime; qint64 m_PreResumeSize; std::pair m_Progress; std::tuple m_SpeedDiff; diff --git a/src/modlist.h b/src/modlist.h index 3626c50c..9a44b761 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -363,7 +363,7 @@ private: std::map > m_ContentIcons; - QTime m_LastCheck; + QElapsedTimer m_LastCheck; PluginContainer *m_PluginContainer; diff --git a/src/pluginlist.h b/src/pluginlist.h index 004b1590..fb6d0543 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -31,6 +31,7 @@ namespace MOBase { class IPluginGame; } #include #include #include +#include #include #pragma warning(push) @@ -381,7 +382,7 @@ private: QTemporaryFile m_TempFile; - QTime m_LastCheck; + QElapsedTimer m_LastCheck; const MOBase::IPluginGame *m_GamePlugin; -- cgit v1.3.1