diff --git a/sources/awdebug.cpp b/sources/awdebug.cpp
index 2046e6a..a568db4 100644
--- a/sources/awdebug.cpp
+++ b/sources/awdebug.cpp
@@ -67,7 +67,7 @@ QString AWDebug::getAboutText(const QString &_type)
translator = QString("
%1").arg(translator);
text = i18n("Translators:") + "" + translatorList.join("") + "
";
} else if (_type == "3rdparty") {
- QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(';', QString::SkipEmptyParts);
+ QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(';', Qt::SkipEmptyParts);
for (int i = 0; i < trdPartyList.count(); i++)
trdPartyList[i] = QString("%1 (%2 license)")
.arg(trdPartyList.at(i).split(',')[0])
@@ -75,7 +75,7 @@ QString AWDebug::getAboutText(const QString &_type)
.arg(trdPartyList.at(i).split(',')[2]);
text = i18n("This software uses:") + "" + trdPartyList.join("") + "
";
} else if (_type == "thanks") {
- QStringList thanks = QString(SPECIAL_THANKS).split(';', QString::SkipEmptyParts);
+ QStringList thanks = QString(SPECIAL_THANKS).split(';', Qt::SkipEmptyParts);
for (int i = 0; i < thanks.count(); i++)
thanks[i] = QString("%1")
.arg(thanks.at(i).split(',')[0])
diff --git a/sources/awesome-widget/plugin/awdataenginemapper.cpp b/sources/awesome-widget/plugin/awdataenginemapper.cpp
index 82f1554..7357198 100644
--- a/sources/awesome-widget/plugin/awdataenginemapper.cpp
+++ b/sources/awesome-widget/plugin/awdataenginemapper.cpp
@@ -94,53 +94,53 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
if (_source == "battery/ac") {
// AC
- m_map[_source] = "ac";
+ m_map.insert(_source, "ac");
m_formatter["ac"] = AWKeysAggregator::FormatterType::ACFormat;
} else if (_source.startsWith("battery/")) {
// battery stats
QString key = _source;
key.remove("battery/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = _source.contains("rate") ? AWKeysAggregator::FormatterType::Float
: AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source == "cpu/system/TotalLoad") {
// cpu
- m_map[_source] = "cpu";
+ m_map.insert(_source, "cpu");
m_formatter["cpu"] = AWKeysAggregator::FormatterType::Float;
} else if (_source.contains(cpuRegExp)) {
// cpus
QString key = _source;
key.remove("cpu/").remove("/TotalLoad");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Float;
} else if (_source == "cpu/system/AverageClock") {
// cpucl
- m_map[_source] = "cpucl";
+ m_map.insert(_source, "cpucl");
m_formatter["cpucl"] = AWKeysAggregator::FormatterType::Integer;
} else if (_source.contains(cpuclRegExp)) {
// cpucls
QString key = _source;
key.remove("cpu/cpu").remove("/clock");
key = QString("cpucl%1").arg(key);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
} else if (_source.startsWith("custom")) {
// custom
QString key = _source;
key.remove("custom/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/current/name") {
// current desktop name
- m_map[_source] = "desktop";
+ m_map.insert(_source, "desktop");
m_formatter["desktop"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/current/number") {
// current desktop number
- m_map[_source] = "ndesktop";
+ m_map.insert(_source, "ndesktop");
m_formatter["ndesktop"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "desktop/total/number") {
// desktop count
- m_map[_source] = "tdesktops";
+ m_map.insert(_source, "tdesktops");
m_formatter["tdesktops"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.contains(hddrRegExp)) {
// read speed
@@ -149,7 +149,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddr%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
}
} else if (_source.contains(hddwRegExp)) {
@@ -159,16 +159,16 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
int index = m_devices["disk"].indexOf(device);
if (index > -1) {
QString key = QString("hddw%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
}
} else if (_source == "gpu/load") {
// gpu load
- m_map[_source] = "gpu";
+ m_map.insert(_source, "gpu");
m_formatter["gpu"] = AWKeysAggregator::FormatterType::Float;
} else if (_source == "gpu/temperature") {
// gpu temperature
- m_map[_source] = "gputemp";
+ m_map.insert(_source, "gputemp");
m_formatter["gputemp"] = AWKeysAggregator::FormatterType::Temperature;
} else if (_source.contains(mountFillRegExp)) {
// fill level
@@ -177,7 +177,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
int index = m_devices["mount"].indexOf(device);
if (index > -1) {
QString key = QString("hdd%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Float;
// additional keys
m_formatter[QString("hddtotmb%1").arg(index)]
@@ -193,11 +193,11 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
if (index > -1) {
// mb
QString key = QString("hddfreemb%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
key = QString("hddfreegb%1").arg(index);
- m_map.insertMulti(_source, key);
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemGBFormat;
}
} else if (_source.contains(mountUsedRegExp)) {
@@ -208,11 +208,11 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
if (index > -1) {
// mb
QString key = QString("hddmb%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
key = QString("hddgb%1").arg(index);
- m_map.insertMulti(_source, key);
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemGBFormat;
}
} else if (_source.startsWith("hdd/temperature")) {
@@ -222,7 +222,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
int index = m_devices["hdd"].indexOf(device);
if (index > -1) {
QString key = QString("hddtemp%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
}
} else if (_source.startsWith("cpu/system/loadavg")) {
@@ -230,45 +230,45 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
QString time = _source;
time.remove("cpu/system/loadavg");
QString key = QString("la%1").arg(time);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::FloatTwoSymbols;
} else if (_source == "mem/physical/application") {
// app memory
// mb
- m_map[_source] = "memmb";
+ m_map.insert(_source, "memmb");
m_formatter["memmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
- m_map.insertMulti(_source, "memgb");
+ m_map.insert(_source, "memgb");
m_formatter["memgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/free") {
// free memory
// mb
- m_map[_source] = "memfreemb";
+ m_map.insert(_source, "memfreemb");
m_formatter["memfreemb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
- m_map.insertMulti(_source, "memfreegb");
+ m_map.insert(_source, "memfreegb");
m_formatter["memfreegb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/physical/used") {
// used memory
// mb
- m_map[_source] = "memusedmb";
+ m_map.insert(_source, "memusedmb");
m_formatter["memusedmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
- m_map.insertMulti(_source, "memusedgb");
+ m_map.insert(_source, "memusedgb");
m_formatter["memusedgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "network/current/name") {
// network device
- m_map[_source] = "netdev";
+ m_map.insert(_source, "netdev");
m_formatter["netdev"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "network/current/ssid") {
// current ssid
- m_map[_source] = "ssid";
+ m_map.insert(_source, "ssid");
m_formatter["ssid"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("network/response")) {
// network response
QString key = _source;
key.remove("network/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.contains(netRegExp)) {
// network speed
@@ -277,15 +277,15 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
if (index > -1) {
// kb
QString key = QString("%1kb%2").arg(type).arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
// smart
key = QString("%1%2").arg(type).arg(index);
- m_map.insertMulti(_source, key);
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NetSmartFormat;
// units
key = QString("%1units%2").arg(type).arg(index);
- m_map.insertMulti(_source, key);
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NetSmartUnits;
}
} else if (_source.contains(netTotalRegExp)) {
@@ -295,58 +295,58 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
if (index > -1) {
// kb
QString key = QString("%1totkb%2").arg(type).arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Integer;
// mb
key = QString("%1tot%2").arg(type).arg(index);
- m_map.insertMulti(_source, key);
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::MemMBFormat;
}
} else if (_source.startsWith("upgrade")) {
// package manager
QString key = _source;
key.remove("upgrade/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source.startsWith("player")) {
// player
QString key = _source;
key.remove("player/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "ps/running/count") {
// running processes count
- m_map[_source] = "pscount";
+ m_map.insert(_source, "pscount");
m_formatter["pscount"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source == "ps/running/list") {
// list of running processes
- m_map[_source] = "ps";
+ m_map.insert(_source, "ps");
m_formatter["ps"] = AWKeysAggregator::FormatterType::List;
} else if (_source == "ps/total/count") {
// total processes count
- m_map[_source] = "pstot";
+ m_map.insert(_source, "pstot");
m_formatter["pstot"] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("quotes")) {
// quotes
QString key = _source;
key.remove("quotes/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Quotes;
} else if (_source == "mem/swap/free") {
// free swap
// mb
- m_map[_source] = "swapfreemb";
+ m_map.insert(_source, "swapfreemb");
m_formatter["swapfreemb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
- m_map.insertMulti(_source, "swapfreegb");
+ m_map.insert(_source, "swapfreegb");
m_formatter["swapfreegb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source == "mem/swap/used") {
// used swap
// mb
- m_map[_source] = "swapmb";
+ m_map.insert(_source, "swapmb");
m_formatter["swapmb"] = AWKeysAggregator::FormatterType::MemMBFormat;
// gb
- m_map.insertMulti(_source, "swapgb");
+ m_map.insert(_source, "swapgb");
m_formatter["swapgb"] = AWKeysAggregator::FormatterType::MemGBFormat;
} else if (_source.startsWith("lmsensors/")) {
// temperature
@@ -356,59 +356,59 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const QSt
return QStringList({QString("temp%1").arg(index)});
if (index > -1) {
QString key = QString("temp%1").arg(index);
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = _units == "°C" ? AWKeysAggregator::FormatterType::Temperature
: AWKeysAggregator::FormatterType::Integer;
}
} else if (_source == "Local") {
// time
- m_map[_source] = "time";
+ m_map.insert(_source, "time");
m_formatter["time"] = AWKeysAggregator::FormatterType::Time;
// custom time
- m_map.insertMulti(_source, "ctime");
+ m_map.insert(_source, "ctime");
m_formatter["ctime"] = AWKeysAggregator::FormatterType::TimeCustom;
// ISO time
- m_map.insertMulti(_source, "isotime");
+ m_map.insert(_source, "isotime");
m_formatter["isotime"] = AWKeysAggregator::FormatterType::TimeISO;
// long time
- m_map.insertMulti(_source, "longtime");
+ m_map.insert(_source, "longtime");
m_formatter["longtime"] = AWKeysAggregator::FormatterType::TimeLong;
// short time
- m_map.insertMulti(_source, "shorttime");
+ m_map.insert(_source, "shorttime");
m_formatter["shorttime"] = AWKeysAggregator::FormatterType::TimeShort;
// timestamp
- m_map.insertMulti(_source, "tstime");
+ m_map.insert(_source, "tstime");
m_formatter["tstime"] = AWKeysAggregator::FormatterType::Timestamp;
} else if (_source == "system/brightness") {
- m_map[_source] = "brightness";
+ m_map.insert(_source, "brightness");
m_formatter["brightness"] = AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source == "system/volume") {
- m_map[_source] = "volume";
+ m_map.insert(_source, "volume");
m_formatter["volume"] = AWKeysAggregator::FormatterType::IntegerThree;
} else if (_source == "system/uptime") {
// uptime
- m_map[_source] = "uptime";
+ m_map.insert(_source, "uptime");
m_formatter["uptime"] = AWKeysAggregator::FormatterType::Uptime;
// custom uptime
- m_map.insertMulti(_source, "cuptime");
+ m_map.insert(_source, "cuptime");
m_formatter["cuptime"] = AWKeysAggregator::FormatterType::UptimeCustom;
} else if (_source.startsWith("weather/temperature")) {
// temperature
QString key = _source;
key.remove("weather/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
} else if (_source.startsWith("weather/")) {
// other weather
QString key = _source;
key.remove("weather/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::NoFormat;
} else if (_source.startsWith("load/load")) {
// load source
QString key = _source;
key.remove("load/");
- m_map[_source] = key;
+ m_map.insert(_source, key);
m_formatter[key] = AWKeysAggregator::FormatterType::Temperature;
}
diff --git a/sources/awesome-widget/plugin/awdataenginemapper.h b/sources/awesome-widget/plugin/awdataenginemapper.h
index c088a93..2d5adde 100644
--- a/sources/awesome-widget/plugin/awdataenginemapper.h
+++ b/sources/awesome-widget/plugin/awdataenginemapper.h
@@ -19,7 +19,7 @@
#ifndef AWDATAENGINEMAPPER_H
#define AWDATAENGINEMAPPER_H
-#include
+#include
#include
#include "awkeysaggregator.h"
@@ -47,7 +47,7 @@ private:
// variables
QHash m_devices;
QHash m_formatter;
- QHash m_map;
+ QMultiHash m_map;
};
diff --git a/sources/awesomewidgets/abstractextitem.cpp b/sources/awesomewidgets/abstractextitem.cpp
index 44a55f7..98e80a9 100644
--- a/sources/awesomewidgets/abstractextitem.cpp
+++ b/sources/awesomewidgets/abstractextitem.cpp
@@ -19,9 +19,9 @@
#include
#include
+#include
#include
#include
-#include
#include "abstractextitemaggregator.h"
#include "qcronscheduler.h"
@@ -241,8 +241,7 @@ void AbstractExtItem::setNumber(int _number)
_number = []() {
qCWarning(LOG_LIB) << "Number is empty, generate new one";
// we suppose that currentTIme().msec() is always valid time
- qsrand(static_cast(QTime::currentTime().msec()));
- int n = qrand() % 1000;
+ int n = QRandomGenerator::global()->generate() % 1000;
qCInfo(LOG_LIB) << "Generated number is" << n;
return n;
}();
diff --git a/sources/awesomewidgets/awjsonformatter.cpp b/sources/awesomewidgets/awjsonformatter.cpp
index d59963f..7d0fc3a 100644
--- a/sources/awesomewidgets/awjsonformatter.cpp
+++ b/sources/awesomewidgets/awjsonformatter.cpp
@@ -178,7 +178,7 @@ QVariant AWJsonFormatter::getFromMap(const QVariant &_value, const QString &_key
void AWJsonFormatter::initPath()
{
m_splittedPath.clear();
- QStringList splittedByDot = m_path.split('.', QString::SkipEmptyParts);
+ QStringList splittedByDot = m_path.split('.', Qt::SkipEmptyParts);
for (auto &element : splittedByDot) {
bool ok;
diff --git a/sources/awesomewidgets/extscript.cpp b/sources/awesomewidgets/extscript.cpp
index e38a4a0..8e0ee5f 100644
--- a/sources/awesomewidgets/extscript.cpp
+++ b/sources/awesomewidgets/extscript.cpp
@@ -235,7 +235,7 @@ void ExtScript::readConfiguration()
setStrRedirect(settings.value("X-AW-Redirect", strRedirect()).toString());
// api == 3
setFilters(
- settings.value("X-AW-Filters", filters()).toString().split(',', QString::SkipEmptyParts));
+ settings.value("X-AW-Filters", filters()).toString().split(',', Qt::SkipEmptyParts));
settings.endGroup();
bumpApi(AW_EXTSCRIPT_API);
diff --git a/sources/awesomewidgets/extupgrade.cpp b/sources/awesomewidgets/extupgrade.cpp
index 3461f8c..53da8f1 100644
--- a/sources/awesomewidgets/extupgrade.cpp
+++ b/sources/awesomewidgets/extupgrade.cpp
@@ -220,8 +220,8 @@ void ExtUpgrade::updateValue()
= QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
m_values[tag("pkgcount")] = [this](const QString &output) {
return filter().isEmpty()
- ? output.split('\n', QString::SkipEmptyParts).count() - null()
- : output.split('\n', QString::SkipEmptyParts).filter(QRegExp(filter())).count();
+ ? output.split('\n', Qt::SkipEmptyParts).count() - null()
+ : output.split('\n', Qt::SkipEmptyParts).filter(QRegExp(filter())).count();
}(qoutput);
emit(dataReceived(m_values));
diff --git a/sources/awesomewidgets/extweather.cpp b/sources/awesomewidgets/extweather.cpp
index 4853fa6..99232c9 100644
--- a/sources/awesomewidgets/extweather.cpp
+++ b/sources/awesomewidgets/extweather.cpp
@@ -367,14 +367,8 @@ void ExtWeather::initProvider()
{
delete m_providerObject;
- switch (m_provider) {
- case Provider::OWM:
- m_providerObject = new OWMWeatherProvider(this);
- break;
- case Provider::Yahoo:
- m_providerObject = new YahooWeatherProvider(this);
- break;
- }
+ // in the future release it is possible to change provider here
+ m_providerObject = new OWMWeatherProvider(this);
return m_providerObject->initUrl(city(), country(), ts());
}
diff --git a/sources/awesomewidgets/qcronscheduler.cpp b/sources/awesomewidgets/qcronscheduler.cpp
index c72abc9..6f67590 100644
--- a/sources/awesomewidgets/qcronscheduler.cpp
+++ b/sources/awesomewidgets/qcronscheduler.cpp
@@ -87,7 +87,7 @@ QList QCronScheduler::parseField(const QString &_value, const int _min, con
parsedField.fromRange(field.split('/').first(), _min, _max);
if (field.contains('/')) {
bool status;
- parsedField.div = field.split('/', QString::SkipEmptyParts).at(1).toInt(&status);
+ parsedField.div = field.split('/', Qt::SkipEmptyParts).at(1).toInt(&status);
if (!status)
parsedField.div = 1;
}
@@ -107,7 +107,7 @@ void QCronScheduler::QCronField::fromRange(const QString &_range, const int _min
minValue = _min;
maxValue = _max;
} else if (_range.contains("-")) {
- auto interval = _range.split('-', QString::SkipEmptyParts);
+ auto interval = _range.split('-', Qt::SkipEmptyParts);
if (interval.count() != 2)
return;
bool status;
diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp
index 65a8f1f..17f56fc 100644
--- a/sources/extsysmon/extsysmon.cpp
+++ b/sources/extsysmon/extsysmon.cpp
@@ -127,7 +127,7 @@ ExtendedSysMon::updateConfiguration(QHash _rawConfig) const
} else if (_rawConfig["HDDDEV"] == "disable") {
_rawConfig["HDDDEV"] = "";
} else {
- QStringList deviceList = _rawConfig["HDDDEV"].split(',', QString::SkipEmptyParts);
+ QStringList deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts);
QStringList devices;
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
for (auto &device : deviceList)
diff --git a/sources/extsysmonsources/gpuloadsource.cpp b/sources/extsysmonsources/gpuloadsource.cpp
index ef59396..816cc8c 100644
--- a/sources/extsysmonsources/gpuloadsource.cpp
+++ b/sources/extsysmonsources/gpuloadsource.cpp
@@ -131,7 +131,7 @@ void GPULoadSource::updateValue()
qCInfo(LOG_ESS) << "Output" << qoutput;
if (m_device == "nvidia") {
- for (auto &str : qoutput.split('\n', QString::SkipEmptyParts)) {
+ for (auto &str : qoutput.split('\n', Qt::SkipEmptyParts)) {
if (!str.contains(""))
continue;
auto load = str.remove("").remove("").remove('%');
@@ -139,10 +139,10 @@ void GPULoadSource::updateValue()
break;
}
} else if (m_device == "ati") {
- for (auto &str : qoutput.split('\n', QString::SkipEmptyParts)) {
+ for (auto &str : qoutput.split('\n', Qt::SkipEmptyParts)) {
if (!str.contains("load"))
continue;
- QString load = str.split(' ', QString::SkipEmptyParts)[3].remove('%');
+ QString load = str.split(' ', Qt::SkipEmptyParts)[3].remove('%');
m_values["gpu/load"] = load.toFloat();
break;
}
diff --git a/sources/extsysmonsources/gputempsource.cpp b/sources/extsysmonsources/gputempsource.cpp
index efd7dcb..dbf654b 100644
--- a/sources/extsysmonsources/gputempsource.cpp
+++ b/sources/extsysmonsources/gputempsource.cpp
@@ -110,7 +110,7 @@ void GPUTemperatureSource::updateValue()
qCInfo(LOG_ESS) << "Output" << qoutput;
if (m_device == "nvidia") {
- for (auto &str : qoutput.split('\n', QString::SkipEmptyParts)) {
+ for (auto &str : qoutput.split('\n', Qt::SkipEmptyParts)) {
if (!str.contains(""))
continue;
QString temp = str.remove("").remove("C");
@@ -118,10 +118,10 @@ void GPUTemperatureSource::updateValue()
break;
}
} else if (m_device == "ati") {
- for (auto &str : qoutput.split('\n', QString::SkipEmptyParts)) {
+ for (auto &str : qoutput.split('\n', Qt::SkipEmptyParts)) {
if (!str.contains("Temperature"))
continue;
- QString temp = str.split(' ', QString::SkipEmptyParts).at(4);
+ QString temp = str.split(' ', Qt::SkipEmptyParts).at(4);
m_values["gpu/temperature"] = temp.toFloat();
break;
}
diff --git a/sources/extsysmonsources/hddtempsource.cpp b/sources/extsysmonsources/hddtempsource.cpp
index 4d45a97..35c9cb7 100644
--- a/sources/extsysmonsources/hddtempsource.cpp
+++ b/sources/extsysmonsources/hddtempsource.cpp
@@ -31,7 +31,7 @@ HDDTemperatureSource::HDDTemperatureSource(QObject *_parent, const QStringList &
Q_ASSERT(_args.count() == 2);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
- m_devices = _args.at(0).split(',', QString::SkipEmptyParts);
+ m_devices = _args.at(0).split(',', Qt::SkipEmptyParts);
m_cmd = _args.at(1);
m_smartctl = m_cmd.contains("smartctl");
@@ -127,17 +127,17 @@ void HDDTemperatureSource::updateValue(const QString &_device)
// parse
if (m_smartctl) {
- QStringList lines = qoutput.split('\n', QString::SkipEmptyParts);
+ QStringList lines = qoutput.split('\n', Qt::SkipEmptyParts);
for (auto &str : lines) {
if (!str.startsWith("194"))
continue;
- if (str.split(' ', QString::SkipEmptyParts).count() < 9)
+ if (str.split(' ', Qt::SkipEmptyParts).count() < 9)
continue;
- m_values[_device] = str.split(' ', QString::SkipEmptyParts).at(9).toFloat();
+ m_values[_device] = str.split(' ', Qt::SkipEmptyParts).at(9).toFloat();
break;
}
} else {
- QStringList lines = qoutput.split(':', QString::SkipEmptyParts);
+ QStringList lines = qoutput.split(':', Qt::SkipEmptyParts);
if (lines.count() >= 3) {
QString temp = lines.at(2);
temp.remove(QChar(0260)).remove('C');
diff --git a/sources/extsysmonsources/loadsource.cpp b/sources/extsysmonsources/loadsource.cpp
index 49547ef..958a3c0 100644
--- a/sources/extsysmonsources/loadsource.cpp
+++ b/sources/extsysmonsources/loadsource.cpp
@@ -18,7 +18,7 @@
#include "loadsource.h"
-#include
+#include
#include "awdebug.h"
@@ -28,8 +28,6 @@ LoadSource::LoadSource(QObject *_parent, const QStringList &_args)
{
Q_ASSERT(_args.count() == 0);
qCDebug(LOG_ESS) << __PRETTY_FUNCTION__;
-
- qsrand(static_cast(QTime::currentTime().msec()));
}
@@ -43,7 +41,7 @@ QVariant LoadSource::data(const QString &_source)
{
qCDebug(LOG_ESS) << "Source" << _source;
- return qrand();
+ return QRandomGenerator::global()->generate();
}
diff --git a/sources/extsysmonsources/playersource.cpp b/sources/extsysmonsources/playersource.cpp
index da0fd5a..6700138 100644
--- a/sources/extsysmonsources/playersource.cpp
+++ b/sources/extsysmonsources/playersource.cpp
@@ -256,11 +256,11 @@ void PlayerSource::mpdSocketReadyRead()
qCInfo(LOG_ESS) << "Output" << qoutput;
// parse
- for (auto &str : qoutput.split('\n', QString::SkipEmptyParts)) {
- if (str.split(": ", QString::SkipEmptyParts).count() == 2) {
+ for (auto &str : qoutput.split('\n', Qt::SkipEmptyParts)) {
+ if (str.split(": ", Qt::SkipEmptyParts).count() == 2) {
// "Metadata: data"
- QString metadata = str.split(": ", QString::SkipEmptyParts).first().toLower();
- QString data = str.split(": ", QString::SkipEmptyParts).last().trimmed();
+ QString metadata = str.split(": ", Qt::SkipEmptyParts).first().toLower();
+ QString data = str.split(": ", Qt::SkipEmptyParts).last().trimmed();
// there are one more time...
if ((metadata == "time") && (data.contains(':'))) {
QStringList times = data.split(':');
diff --git a/sources/test/awtestlibrary.cpp b/sources/test/awtestlibrary.cpp
index ec6ddda..f702381 100644
--- a/sources/test/awtestlibrary.cpp
+++ b/sources/test/awtestlibrary.cpp
@@ -22,13 +22,12 @@
#include
#include
#include
-#include
+#include
#include
void AWTestLibrary::init()
{
- qsrand(static_cast(QTime::currentTime().msec()));
}
@@ -47,13 +46,7 @@ bool AWTestLibrary::isKWinActive()
char AWTestLibrary::randomChar()
{
- return 'A' + (qrand() % static_cast('Z' - 'A'));
-}
-
-
-double AWTestLibrary::randomDouble()
-{
- return static_cast(qrand()) / static_cast(RAND_MAX);
+ return 'A' + (QRandomGenerator::global()->generate() % static_cast('Z' - 'A'));
}
@@ -75,7 +68,7 @@ QPair AWTestLibrary::randomFilenames()
int AWTestLibrary::randomInt(const int _max)
{
- return qrand() % _max;
+ return QRandomGenerator::global()->generate() % _max;
}
@@ -113,5 +106,5 @@ QStringList AWTestLibrary::randomSelect(const QStringList &_available)
output << _available.at(index);
}
- return output.toList();
+ return output.values();
}
diff --git a/sources/test/awtestlibrary.h b/sources/test/awtestlibrary.h
index 87499ae..97b569f 100644
--- a/sources/test/awtestlibrary.h
+++ b/sources/test/awtestlibrary.h
@@ -28,7 +28,6 @@ namespace AWTestLibrary
void init();
bool isKWinActive();
char randomChar();
-double randomDouble();
QPair randomFilenames();
int randomInt(const int _max = 100);
QString randomString(const int _min = 1, const int _max = 100);
diff --git a/sources/test/testextweather.cpp b/sources/test/testextweather.cpp
index 531f068..0ba8a21 100644
--- a/sources/test/testextweather.cpp
+++ b/sources/test/testextweather.cpp
@@ -60,14 +60,6 @@ void TestExtWeather::test_runOWM()
}
-void TestExtWeather::test_runYahoo()
-{
- extWeather->setProvider(ExtWeather::Provider::Yahoo);
- run();
- extWeather->setProvider(ExtWeather::Provider::OWM);
-}
-
-
void TestExtWeather::test_ts()
{
extWeather->setTs(1);
diff --git a/sources/test/testextweather.h b/sources/test/testextweather.h
index 9e179f7..fa6d07a 100644
--- a/sources/test/testextweather.h
+++ b/sources/test/testextweather.h
@@ -36,7 +36,6 @@ private slots:
// test
void test_values();
void test_runOWM();
- void test_runYahoo();
void test_ts();
void test_image();
void test_copy();
diff --git a/sources/test/testfloatformatter.cpp b/sources/test/testfloatformatter.cpp
index b1c90b4..24abf6d 100644
--- a/sources/test/testfloatformatter.cpp
+++ b/sources/test/testfloatformatter.cpp
@@ -19,6 +19,7 @@
#include "testfloatformatter.h"
#include
+#include
#include "awfloatformatter.h"
#include "awtestlibrary.h"
@@ -48,7 +49,7 @@ void TestAWFloatFormatter::test_count()
QCOMPARE(formatter->count(), count);
// test
- QString output = formatter->convert(AWTestLibrary::randomDouble());
+ QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
QCOMPARE(output.count(), count);
// reset
@@ -83,7 +84,7 @@ void TestAWFloatFormatter::test_forceWidth()
QCOMPARE(formatter->forceWidth(), true);
// test
- QString output = formatter->convert(AWTestLibrary::randomDouble());
+ QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
QCOMPARE(output.count(), count);
// reset
@@ -102,7 +103,7 @@ void TestAWFloatFormatter::test_format()
QCOMPARE(formatter->format(), 'e');
// test
- QString output = formatter->convert(AWTestLibrary::randomDouble());
+ QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
QVERIFY(output.contains('e'));
// reset
@@ -118,7 +119,7 @@ void TestAWFloatFormatter::test_precision()
QCOMPARE(formatter->precision(), precision);
// test
- QString output = formatter->convert(AWTestLibrary::randomDouble());
+ QString output = formatter->convert(QRandomGenerator::global()->generateDouble());
output.remove("0.");
QCOMPARE(output.count(), precision);
@@ -132,12 +133,12 @@ void TestAWFloatFormatter::test_multiplier()
formatter->setPrecision(6);
// assign
- double multiplier = AWTestLibrary::randomDouble();
+ double multiplier = QRandomGenerator::global()->generateDouble();
formatter->setMultiplier(multiplier);
QCOMPARE(formatter->multiplier(), multiplier);
// test
- double value = AWTestLibrary::randomDouble();
+ double value = QRandomGenerator::global()->generateDouble();
QCOMPARE(formatter->convert(value), QString::number(value * multiplier, 'f', 6));
// reset
@@ -148,12 +149,12 @@ void TestAWFloatFormatter::test_multiplier()
void TestAWFloatFormatter::test_summand()
{
// assign
- double summand = AWTestLibrary::randomDouble();
+ double summand = QRandomGenerator::global()->generateDouble();
formatter->setSummand(summand);
QCOMPARE(formatter->summand(), summand);
// test
- double value = AWTestLibrary::randomDouble();
+ double value = QRandomGenerator::global()->generateDouble();
QCOMPARE(formatter->convert(value), QString::number(value + summand, 'f', 6));
// reset
@@ -185,9 +186,9 @@ void TestAWFloatFormatter::doRandom()
formatter->setFillChar(AWTestLibrary::randomChar());
formatter->setForceWidth(AWTestLibrary::randomInt() % 2);
formatter->setFormat(AWTestLibrary::randomChar());
- formatter->setMultiplier(AWTestLibrary::randomDouble());
+ formatter->setMultiplier(QRandomGenerator::global()->generateDouble());
formatter->setPrecision(AWTestLibrary::randomInt());
- formatter->setSummand(AWTestLibrary::randomDouble());
+ formatter->setSummand(QRandomGenerator::global()->generateDouble());
}
diff --git a/sources/test/testnetworksource.cpp b/sources/test/testnetworksource.cpp
index 878e258..ee3a7db 100644
--- a/sources/test/testnetworksource.cpp
+++ b/sources/test/testnetworksource.cpp
@@ -39,7 +39,7 @@ void TestNetworkSource::cleanupTestCase()
void TestNetworkSource::test_sources()
{
- QCOMPARE(source->sources(), QStringList() << src);
+ QCOMPARE(source->sources(), QStringList() << src << "network/current/ssid");
}