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