diff --git a/sources/extsysmon/sources/batterysource.cpp b/sources/extsysmon/sources/batterysource.cpp index 647b3f3..af4da45 100644 --- a/sources/extsysmon/sources/batterysource.cpp +++ b/sources/extsysmon/sources/batterysource.cpp @@ -44,9 +44,10 @@ QVariant BatterySource::data(QString source) { qCDebug(LOG_ESM) << "Source" << source; - if (source == QString("battery/ac")) + if (!values.contains(source)) run(); - return values[source]; + QVariant value = values.take(source); + return value; } diff --git a/sources/extsysmon/sources/playersource.cpp b/sources/extsysmon/sources/playersource.cpp index c580a2d..2039e25 100644 --- a/sources/extsysmon/sources/playersource.cpp +++ b/sources/extsysmon/sources/playersource.cpp @@ -52,9 +52,10 @@ QVariant PlayerSource::data(QString source) { qCDebug(LOG_ESM) << "Source" << source; - if (source == QString("player/title")) + if (!values.contains(source)) run(); - return values[source]; + QVariant value = values.take(source); + return value; } diff --git a/sources/extsysmon/sources/processessource.cpp b/sources/extsysmon/sources/processessource.cpp index 4f41cb9..a84687c 100644 --- a/sources/extsysmon/sources/processessource.cpp +++ b/sources/extsysmon/sources/processessource.cpp @@ -41,9 +41,10 @@ QVariant ProcessesSource::data(QString source) { qCDebug(LOG_ESM) << "Source" << source; - if (source == QString("ps/running/count")) + if (!values.contains(source)) run(); - return values[source]; + QVariant value = values.take(source); + return value; } diff --git a/sources/extsysmon/sources/quotessource.cpp b/sources/extsysmon/sources/quotessource.cpp index a9d8129..fff4473 100644 --- a/sources/extsysmon/sources/quotessource.cpp +++ b/sources/extsysmon/sources/quotessource.cpp @@ -45,13 +45,15 @@ QVariant QuotesSource::data(QString source) { qCDebug(LOG_ESM) << "Source" << source; - if (source.startsWith(QString("quotes/percpricechg"))) { - QVariantHash data = extQuotes->itemByTagNumber(index(source))->run(); + int ind = index(source); + source.remove(QString("quotes/")); + if (!values.contains(source)) { + QVariantHash data = extQuotes->itemByTagNumber(ind)->run(); for (auto key : data.keys()) values[key] = data[key]; } - QString key = QString(source).remove(QString("quotes/")); - return values[key]; + QVariant value = values.take(source); + return value; } diff --git a/sources/extsysmon/sources/weathersource.cpp b/sources/extsysmon/sources/weathersource.cpp index 9a57851..13a1fc6 100644 --- a/sources/extsysmon/sources/weathersource.cpp +++ b/sources/extsysmon/sources/weathersource.cpp @@ -45,13 +45,15 @@ QVariant WeatherSource::data(QString source) { qCDebug(LOG_ESM) << "Source" << source; - if (source.startsWith(QString("weather/weatherId"))) { - QVariantHash data = extWeather->itemByTagNumber(index(source))->run(); + int ind = index(source); + source.remove(QString("weather/")); + if (!values.contains(source)) { + QVariantHash data = extWeather->itemByTagNumber(ind)->run(); for (auto key : data.keys()) values[key] = data[key]; } - QString key = QString(source).remove(QString("weather/")); - return values[key]; + QVariant value = values.take(source); + return value; }