From 72a05e138ec579cd567939eb0b33b0ea476820fb Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 20 Jun 2022 16:25:54 +0200 Subject: Fix deprecation warnings where possible, make remaining ones -Wno-error --- src/copythread.cpp | 9 +++++---- src/speedcheck.cpp | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/copythread.cpp b/src/copythread.cpp index 5b9710b..34d89f4 100644 --- a/src/copythread.cpp +++ b/src/copythread.cpp @@ -3,13 +3,14 @@ #include #include #include +#include // 1M read size #define BUFFER_SIZE (1000000) // 20 seconds for each test #define TEST_LENGTH (60000) -#define BIGRAND (qint64(qrand()) | (qint64(qrand()) * qint64(RAND_MAX))) +#define BIGRAND (QRandomGenerator::global()->generate64()) CopyThread::CopyThread(QFile *file, QObject *parent) : QThread(parent), @@ -40,7 +41,7 @@ void CopyThread::run() const qint64 size = _file->size() - BUFFER_SIZE; // Sequential read - emit logMessage(trUtf8("Starting sequential read test")); + emit logMessage(tr("Starting sequential read test")); if (size > 0) { _file->seek(BIGRAND % size); } @@ -56,7 +57,7 @@ void CopyThread::run() // Random read if (size > 0) { - emit logMessage(trUtf8("Starting random read test")); + emit logMessage(tr("Starting random read test")); timer.restart(); do { _file->seek(BIGRAND % size); @@ -69,7 +70,7 @@ void CopyThread::run() // All done const qint64 seqSpeed = seqSum / (seqTime * 1024 + 1); const qint64 rndSpeed = rndSum / (rndTime * 1024 + 1); - emit logMessage(trUtf8("Seq: %1MiB/s, Random: %2MiB/s - [%3s / %4s]") + emit logMessage(tr("Seq: %1MiB/s, Random: %2MiB/s - [%3s / %4s]") .arg(QString::number(seqSpeed), QString::number(rndSpeed), QString::number(seqTime / 1000), QString::number(rndTime / 1000))); delete[] buffer; diff --git a/src/speedcheck.cpp b/src/speedcheck.cpp index b4dd718..aa02d47 100644 --- a/src/speedcheck.cpp +++ b/src/speedcheck.cpp @@ -21,7 +21,6 @@ SpeedCheck::SpeedCheck(QString fileName) connect(_ui->btnQuit, SIGNAL(clicked(bool)), this, SLOT(quitClicked(bool))); _timer.setInterval(200); connect(&_timer, SIGNAL(timeout()), this, SLOT(updateTimer())); - qsrand((uint)QCoreApplication::applicationPid()); } SpeedCheck::~SpeedCheck() @@ -39,7 +38,7 @@ void SpeedCheck::startClicked(bool) { QFile *file = new QFile(_fileName); if (!file->open(QIODevice::ReadOnly)) { - QMessageBox::critical(this, trUtf8("Error"), trUtf8("Could not open %1 for reading.").arg(_fileName)); + QMessageBox::critical(this, tr("Error"), tr("Could not open %1 for reading.").arg(_fileName)); return; } _ui->picCpu->setDataSource(new CpuLoad()); -- cgit v1.2.3-55-g7522