mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 22:59:57 +00:00
newest qt fixes
This commit is contained in:
@ -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("<gpu_util>"))
|
||||
continue;
|
||||
auto load = str.remove("<gpu_util>").remove("</gpu_util>").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;
|
||||
}
|
||||
|
@ -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("<gpu_temp>"))
|
||||
continue;
|
||||
QString temp = str.remove("<gpu_temp>").remove("C</gpu_temp>");
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "loadsource.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#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<uint>(QTime::currentTime().msec()));
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +41,7 @@ QVariant LoadSource::data(const QString &_source)
|
||||
{
|
||||
qCDebug(LOG_ESS) << "Source" << _source;
|
||||
|
||||
return qrand();
|
||||
return QRandomGenerator::global()->generate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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(':');
|
||||
|
Reference in New Issue
Block a user