mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
fix bug introduced by lazy subscription
Sources in custom dataengine updated only if user subscribe on specified source. I've implemented drop returing value so if no requested value found it will return force update event.
This commit is contained in:
parent
071d7fdb78
commit
5af4b0c40c
@ -44,9 +44,10 @@ QVariant BatterySource::data(QString source)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Source" << source;
|
qCDebug(LOG_ESM) << "Source" << source;
|
||||||
|
|
||||||
if (source == QString("battery/ac"))
|
if (!values.contains(source))
|
||||||
run();
|
run();
|
||||||
return values[source];
|
QVariant value = values.take(source);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,9 +52,10 @@ QVariant PlayerSource::data(QString source)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Source" << source;
|
qCDebug(LOG_ESM) << "Source" << source;
|
||||||
|
|
||||||
if (source == QString("player/title"))
|
if (!values.contains(source))
|
||||||
run();
|
run();
|
||||||
return values[source];
|
QVariant value = values.take(source);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,9 +41,10 @@ QVariant ProcessesSource::data(QString source)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Source" << source;
|
qCDebug(LOG_ESM) << "Source" << source;
|
||||||
|
|
||||||
if (source == QString("ps/running/count"))
|
if (!values.contains(source))
|
||||||
run();
|
run();
|
||||||
return values[source];
|
QVariant value = values.take(source);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,13 +45,15 @@ QVariant QuotesSource::data(QString source)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Source" << source;
|
qCDebug(LOG_ESM) << "Source" << source;
|
||||||
|
|
||||||
if (source.startsWith(QString("quotes/percpricechg"))) {
|
int ind = index(source);
|
||||||
QVariantHash data = extQuotes->itemByTagNumber(index(source))->run();
|
source.remove(QString("quotes/"));
|
||||||
|
if (!values.contains(source)) {
|
||||||
|
QVariantHash data = extQuotes->itemByTagNumber(ind)->run();
|
||||||
for (auto key : data.keys())
|
for (auto key : data.keys())
|
||||||
values[key] = data[key];
|
values[key] = data[key];
|
||||||
}
|
}
|
||||||
QString key = QString(source).remove(QString("quotes/"));
|
QVariant value = values.take(source);
|
||||||
return values[key];
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,13 +45,15 @@ QVariant WeatherSource::data(QString source)
|
|||||||
{
|
{
|
||||||
qCDebug(LOG_ESM) << "Source" << source;
|
qCDebug(LOG_ESM) << "Source" << source;
|
||||||
|
|
||||||
if (source.startsWith(QString("weather/weatherId"))) {
|
int ind = index(source);
|
||||||
QVariantHash data = extWeather->itemByTagNumber(index(source))->run();
|
source.remove(QString("weather/"));
|
||||||
|
if (!values.contains(source)) {
|
||||||
|
QVariantHash data = extWeather->itemByTagNumber(ind)->run();
|
||||||
for (auto key : data.keys())
|
for (auto key : data.keys())
|
||||||
values[key] = data[key];
|
values[key] = data[key];
|
||||||
}
|
}
|
||||||
QString key = QString(source).remove(QString("weather/"));
|
QVariant value = values.take(source);
|
||||||
return values[key];
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user