From 02eec351b9a2f64de0dbb7088993f0a622c5561b Mon Sep 17 00:00:00 2001 From: selsta Date: Thu, 23 Apr 2020 03:13:13 +0200 Subject: [PATCH] src: fix qt 5.15 warnings --- src/daemon/DaemonManager.cpp | 4 ++-- src/libwalletqt/TransactionHistory.cpp | 9 +++++++++ src/model/TransactionHistorySortFilterModel.cpp | 6 ++++++ src/qt/utils.cpp | 4 +++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/daemon/DaemonManager.cpp b/src/daemon/DaemonManager.cpp index 74f1077a..4ea3da5f 100644 --- a/src/daemon/DaemonManager.cpp +++ b/src/daemon/DaemonManager.cpp @@ -200,9 +200,9 @@ bool DaemonManager::stopWatcher(NetworkType::Type nettype) const if(counter >= 5) { qDebug() << "Killing it! "; #ifdef Q_OS_WIN - QProcess::execute("taskkill /F /IM monerod.exe"); + QProcess::execute("taskkill", {"/F", "/IM", "monerod.exe"}); #else - QProcess::execute("pkill monerod"); + QProcess::execute("pkill", {"monerod"}); #endif } diff --git a/src/libwalletqt/TransactionHistory.cpp b/src/libwalletqt/TransactionHistory.cpp index 902a3417..a6740e95 100644 --- a/src/libwalletqt/TransactionHistory.cpp +++ b/src/libwalletqt/TransactionHistory.cpp @@ -34,6 +34,7 @@ #include #include #include +#include bool TransactionHistory::transaction(int index, std::function callback) @@ -58,7 +59,11 @@ bool TransactionHistory::transaction(int index, std::function= QT_VERSION_CHECK(5, 14, 0) + QDateTime firstDateTime = QDate(2014, 4, 18).startOfDay(); +#else QDateTime firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block +#endif QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones) emit refreshStarted(); @@ -143,7 +148,11 @@ bool TransactionHistory::TransactionHistory::locked() const TransactionHistory::TransactionHistory(Monero::TransactionHistory *pimpl, QObject *parent) : QObject(parent), m_pimpl(pimpl), m_minutesToUnlock(0), m_locked(false) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + m_firstDateTime = QDate(2014, 4, 18).startOfDay(); +#else m_firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block +#endif m_lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones) } diff --git a/src/model/TransactionHistorySortFilterModel.cpp b/src/model/TransactionHistorySortFilterModel.cpp index 35f03632..fd8c095a 100644 --- a/src/model/TransactionHistorySortFilterModel.cpp +++ b/src/model/TransactionHistorySortFilterModel.cpp @@ -30,6 +30,7 @@ #include "TransactionHistoryModel.h" #include +#include namespace { /** @@ -204,9 +205,14 @@ bool TransactionHistorySortFilterModel::filterAcceptsRow(int source_row, const Q break; case TransactionHistoryModel::TransactionTimeStampRole: { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QDateTime from = dateFromFilter().startOfDay(); + QDateTime to = dateToFilter().endOfDay(); +#else QDateTime from = QDateTime(dateFromFilter()); QDateTime to = QDateTime(dateToFilter()); to = to.addDays(1); // including upperbound +#endif QDateTime timestamp = data.toDateTime(); bool matchFrom = from.isNull() || timestamp.isNull() || timestamp >= from; bool matchTo = to.isNull() || timestamp.isNull() || timestamp <= to; diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index 258400c3..5d329f97 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -28,6 +28,7 @@ #include #include +#include #include "TailsOS.h" #include "utils.h" @@ -68,7 +69,8 @@ QByteArray fileOpen(QString path) { bool fileWrite(QString path, QString data) { QFile file(path); if(file.open(QIODevice::WriteOnly)){ - QTextStream out(&file); out << data << endl; + QTextStream out(&file); + out << data << '\n'; file.close(); return true; }