mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
some optimizations
This commit is contained in:
parent
f5e40d084d
commit
ab0ab0d40f
@ -170,14 +170,13 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
|||||||
|
|
||||||
QStringList allKeys;
|
QStringList allKeys;
|
||||||
// weather
|
// weather
|
||||||
for (int i=extWeather->items().count()-1; i>=0; i--) {
|
for (int i=extWeather->activeItems().count()-1; i>=0; i--) {
|
||||||
if (!extWeather->items().at(i)->isActive()) continue;
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("weatherId")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("weatherId")));
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("weather")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("weather")));
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("humidity")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("humidity")));
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("pressure")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("pressure")));
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("temperature")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("temperature")));
|
allKeys.append(extWeather->activeItems().at(i)->tag(QString("timestamp")));
|
||||||
allKeys.append(extWeather->items().at(i)->tag(QString("timestamp")));
|
|
||||||
}
|
}
|
||||||
// time
|
// time
|
||||||
allKeys.append(QString("time"));
|
allKeys.append(QString("time"));
|
||||||
@ -280,28 +279,23 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
|||||||
allKeys.append(QString("pstotal"));
|
allKeys.append(QString("pstotal"));
|
||||||
allKeys.append(QString("ps"));
|
allKeys.append(QString("ps"));
|
||||||
// package manager
|
// package manager
|
||||||
for (int i=extUpgrade->items().count()-1; i>=0; i--) {
|
for (int i=extUpgrade->activeItems().count()-1; i>=0; i--)
|
||||||
if (!extUpgrade->items().at(i)->isActive()) continue;
|
allKeys.append(extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
|
||||||
allKeys.append(extUpgrade->items().at(i)->tag(QString("pkgcount")));
|
|
||||||
}
|
|
||||||
// quotes
|
// quotes
|
||||||
for (int i=extQuotes->items().count()-1; i>=0; i--) {
|
for (int i=extQuotes->activeItems().count()-1; i>=0; i--) {
|
||||||
if (!extQuotes->items().at(i)->isActive()) continue;
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("ask")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("askchg")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("percaskchg")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("bid")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("bidchg")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("percbidchg")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("price")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("pricechg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("pricechg")));
|
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
|
||||||
allKeys.append(extQuotes->items().at(i)->tag(QString("percpricechg")));
|
|
||||||
}
|
}
|
||||||
// custom
|
// custom
|
||||||
for (int i=extScripts->items().count()-1; i>=0; i--) {
|
for (int i=extScripts->activeItems().count()-1; i>=0; i--)
|
||||||
if (!extScripts->items().at(i)->isActive()) continue;
|
allKeys.append(extScripts->activeItems().at(i)->tag(QString("custom")));
|
||||||
allKeys.append(extScripts->items().at(i)->tag(QString("custom")));
|
|
||||||
}
|
|
||||||
// desktop
|
// desktop
|
||||||
allKeys.append(QString("desktop"));
|
allKeys.append(QString("desktop"));
|
||||||
allKeys.append(QString("ndesktop"));
|
allKeys.append(QString("ndesktop"));
|
||||||
@ -313,7 +307,7 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
|||||||
// bars
|
// bars
|
||||||
QStringList graphicalItemsKeys;
|
QStringList graphicalItemsKeys;
|
||||||
foreach(GraphicalItem *item, graphicalItems->items())
|
foreach(GraphicalItem *item, graphicalItems->items())
|
||||||
graphicalItemsKeys.append(QString("%1%2").arg(item->name()).arg(item->bar()));
|
graphicalItemsKeys.append(item->tag());
|
||||||
graphicalItemsKeys.sort();
|
graphicalItemsKeys.sort();
|
||||||
for (int i=graphicalItemsKeys.count()-1; i>=0; i--)
|
for (int i=graphicalItemsKeys.count()-1; i>=0; i--)
|
||||||
allKeys.append(graphicalItemsKeys.at(i));
|
allKeys.append(graphicalItemsKeys.at(i));
|
||||||
@ -345,9 +339,13 @@ void AWKeys::dataUpdateReceived(const QString sourceName, const QVariantMap data
|
|||||||
qCDebug(LOG_AW) << "Source" << sourceName;
|
qCDebug(LOG_AW) << "Source" << sourceName;
|
||||||
qCDebug(LOG_AW) << "Data" << data;
|
qCDebug(LOG_AW) << "Data" << data;
|
||||||
|
|
||||||
|
#ifdef BUILD_FUTURE
|
||||||
QtConcurrent::run([this, sourceName, data, params]() {
|
QtConcurrent::run([this, sourceName, data, params]() {
|
||||||
return setDataBySource(sourceName, data, params);
|
return setDataBySource(sourceName, data, params);
|
||||||
});
|
});
|
||||||
|
#else
|
||||||
|
return setDataBySource(sourceName, data, params);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -646,11 +644,16 @@ QString AWKeys::parsePattern() const
|
|||||||
void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
||||||
const QVariantMap params)
|
const QVariantMap params)
|
||||||
{
|
{
|
||||||
|
if (lock) {
|
||||||
|
lock = (queue > 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
qCDebug(LOG_AW);
|
qCDebug(LOG_AW);
|
||||||
qCDebug(LOG_AW) << "Source" << sourceName;
|
qCDebug(LOG_AW) << "Source" << sourceName;
|
||||||
qCDebug(LOG_AW) << "Data" << data;
|
qCDebug(LOG_AW) << "Data" << data;
|
||||||
|
|
||||||
if (sourceName == QString("update")) return emit(needToBeUpdated());
|
if (sourceName == QString("update")) return emit(needToBeUpdated());
|
||||||
|
// drop if limits are reached
|
||||||
if (++queue > QUEUE_LIMIT) {
|
if (++queue > QUEUE_LIMIT) {
|
||||||
qCWarning(LOG_AW) << "Messages queue" << queue-- << "more than limits" << QUEUE_LIMIT;
|
qCWarning(LOG_AW) << "Messages queue" << queue-- << "more than limits" << QUEUE_LIMIT;
|
||||||
return;
|
return;
|
||||||
@ -717,20 +720,14 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
// read speed
|
// read speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("/Rate/rblk"));
|
device.remove(QString("/Rate/rblk"));
|
||||||
for (int i=0; i<diskDevices.count(); i++) {
|
int index = diskDevices.indexOf(device);
|
||||||
if (diskDevices.at(i) != device) continue;
|
values[QString("hddr%1").arg(index)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
values[QString("hddr%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(hddwRegExp)) {
|
} else if (sourceName.contains(hddwRegExp)) {
|
||||||
// write speed
|
// write speed
|
||||||
QString device = sourceName;
|
QString device = sourceName;
|
||||||
device.remove(QString("/Rate/wblk"));
|
device.remove(QString("/Rate/wblk"));
|
||||||
for (int i=0; i<diskDevices.count(); i++) {
|
int index = diskDevices.indexOf(device);
|
||||||
if (diskDevices.at(i) != device) continue;
|
values[QString("hddw%1").arg(index)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
values[QString("hddw%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("gpu")) {
|
} else if (sourceName == QString("gpu")) {
|
||||||
// gpu load
|
// gpu load
|
||||||
// notification
|
// notification
|
||||||
@ -746,53 +743,42 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
// fill level
|
// fill level
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/filllevel"));
|
mount.remove(QString("partitions")).remove(QString("/filllevel"));
|
||||||
for (int i=0; i<mountDevices.count(); i++) {
|
int index = mountDevices.indexOf(mount);
|
||||||
if (mountDevices.at(i) != mount) continue;
|
if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("hdd%1").arg(index)].toFloat() < 90.0))
|
||||||
if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("hdd%1").arg(i)].toFloat() < 90.0))
|
AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount), enablePopup);
|
||||||
AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount), enablePopup);
|
values[QString("hdd%1").arg(index)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
values[QString("hdd%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(mountFreeRegExp)) {
|
} else if (sourceName.contains(mountFreeRegExp)) {
|
||||||
// free space
|
// free space
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/freespace"));
|
mount.remove(QString("partitions")).remove(QString("/freespace"));
|
||||||
for (int i=0; i<mountDevices.count(); i++) {
|
int index = mountDevices.indexOf(mount);
|
||||||
if (mountDevices.at(i) != mount) continue;
|
values[QString("hddfreemb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddfreemb%1").arg(i)] = QString("%1").arg(
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
values[QString("hddfreegb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddfreegb%1").arg(i)] = QString("%1").arg(
|
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
||||||
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(mountUsedRegExp)) {
|
} else if (sourceName.contains(mountUsedRegExp)) {
|
||||||
// used
|
// used
|
||||||
QString mount = sourceName;
|
QString mount = sourceName;
|
||||||
mount.remove(QString("partitions")).remove(QString("/usedspace"));
|
mount.remove(QString("partitions")).remove(QString("/usedspace"));
|
||||||
for (int i=0; i<mountDevices.count(); i++) {
|
int index = mountDevices.indexOf(mount);
|
||||||
if (mountDevices.at(i) != mount) continue;
|
values[QString("hddmb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddmb%1").arg(i)] = QString("%1").arg(
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
values[QString("hddgb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddgb%1").arg(i)] = QString("%1").arg(
|
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
||||||
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
// total
|
||||||
// total
|
values[QString("hddtotmb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddtotmb%1").arg(i)] = QString("%1").arg(
|
values[QString("hddfreemb%1").arg(index)].toInt() +
|
||||||
values[QString("hddfreemb%1").arg(i)].toInt() +
|
values[QString("hddmb%1").arg(index)].toInt());
|
||||||
values[QString("hddmb%1").arg(i)].toInt());
|
values[QString("hddtotgb%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddtotgb%1").arg(i)] = QString("%1").arg(
|
values[QString("hddfreegb%1").arg(index)].toFloat() +
|
||||||
values[QString("hddfreegb%1").arg(i)].toFloat() +
|
values[QString("hddgb%1").arg(index)].toFloat(), 5, 'f', 1);
|
||||||
values[QString("hddgb%1").arg(i)].toFloat(), 5, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("hddtemp")) {
|
} else if (sourceName == QString("hddtemp")) {
|
||||||
// hdd temperature
|
// hdd temperature
|
||||||
foreach(QString key, data.keys())
|
foreach(QString key, data.keys()) {
|
||||||
for (int i=0; i<hddDevices.count(); i++) {
|
int index = hddDevices.indexOf(key);
|
||||||
if (hddDevices.at(i) != key) continue;
|
values[QString("hddtemp%1").arg(index)] = QString("%1").arg(
|
||||||
values[QString("hddtemp%1").arg(i)] = QString("%1").arg(
|
temperature(data[key].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
temperature(data[key].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.startsWith(QString("cpu/system/loadavg"))) {
|
} else if (sourceName.startsWith(QString("cpu/system/loadavg"))) {
|
||||||
// load average
|
// load average
|
||||||
QString time = sourceName;
|
QString time = sourceName;
|
||||||
@ -848,13 +834,10 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
else
|
else
|
||||||
units = value > 1000.0 ? QString("MB/s") : QString("KB/s");
|
units = value > 1000.0 ? QString("MB/s") : QString("KB/s");
|
||||||
// update
|
// update
|
||||||
for (int i=0; i<networkDevices.count(); i++) {
|
int index = networkDevices.indexOf(device);
|
||||||
if (networkDevices.at(i) != device) continue;
|
values[QString("%1kb%2").arg(type).arg(index)] = QString("%1").arg(value, 4, 'f', 0);
|
||||||
values[QString("%1kb%2").arg(type).arg(i)] = QString("%1").arg(value, 4, 'f', 0);
|
values[QString("%1%2").arg(type).arg(index)] = simplifiedValue;
|
||||||
values[QString("%1%2").arg(type).arg(i)] = simplifiedValue;
|
values[QString("%1units%2").arg(type).arg(index)] = units;
|
||||||
values[QString("%1units%2").arg(type).arg(i)] = units;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (device == values[QString("netdev")]) {
|
if (device == values[QString("netdev")]) {
|
||||||
values[QString("%1kb").arg(type)] = QString("%1").arg(value, 4, 'f', 0);
|
values[QString("%1kb").arg(type)] = QString("%1").arg(value, 4, 'f', 0);
|
||||||
values[type] = simplifiedValue;
|
values[type] = simplifiedValue;
|
||||||
@ -896,14 +879,11 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
|
|||||||
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
|
values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1);
|
||||||
} else if (sourceName.startsWith(QString("lmsensors/"))) {
|
} else if (sourceName.startsWith(QString("lmsensors/"))) {
|
||||||
// temperature devices
|
// temperature devices
|
||||||
for (int i=0; i<tempDevices.count(); i++) {
|
int index = tempDevices.indexOf(sourceName);
|
||||||
if (sourceName != tempDevices.at(i)) continue;
|
float temp = data[QString("units")].toString() == QString("°C") ?
|
||||||
float temp = data[QString("units")].toString() == QString("°C") ?
|
temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()) :
|
||||||
temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()) :
|
data[QString("value")].toFloat();
|
||||||
data[QString("value")].toFloat();
|
values[QString("temp%1").arg(index)] = QString("%1").arg(temp, 4, 'f', 1);
|
||||||
values[QString("temp%1").arg(i)] = QString("%1").arg(temp, 4, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("Local")) {
|
} else if (sourceName == QString("Local")) {
|
||||||
// init locale
|
// init locale
|
||||||
QLocale loc = translateStrings ? QLocale::system() : QLocale::c();
|
QLocale loc = translateStrings ? QLocale::system() : QLocale::c();
|
||||||
|
@ -91,6 +91,7 @@ private:
|
|||||||
ExtItemAggregator<ExtScript> *extScripts;
|
ExtItemAggregator<ExtScript> *extScripts;
|
||||||
ExtItemAggregator<ExtUpgrade> *extUpgrade;
|
ExtItemAggregator<ExtUpgrade> *extUpgrade;
|
||||||
ExtItemAggregator<ExtWeather> *extWeather;
|
ExtItemAggregator<ExtWeather> *extWeather;
|
||||||
|
bool lock = false;
|
||||||
int queue = 0;
|
int queue = 0;
|
||||||
QString pattern;
|
QString pattern;
|
||||||
QStringList foundBars, foundKeys, foundLambdas;
|
QStringList foundBars, foundKeys, foundLambdas;
|
||||||
|
@ -50,7 +50,15 @@ public:
|
|||||||
qCDebug(LOG_LIB);
|
qCDebug(LOG_LIB);
|
||||||
|
|
||||||
m_items.clear();
|
m_items.clear();
|
||||||
}
|
m_activeItems.clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
QList<T *> activeItems()
|
||||||
|
{
|
||||||
|
qCDebug(LOG_LIB);
|
||||||
|
|
||||||
|
return m_activeItems;
|
||||||
|
};
|
||||||
|
|
||||||
void editItems()
|
void editItems()
|
||||||
{
|
{
|
||||||
@ -61,14 +69,6 @@ public:
|
|||||||
qCInfo(LOG_LIB) << "Dialog returns" << ret;
|
qCInfo(LOG_LIB) << "Dialog returns" << ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
void initItems()
|
|
||||||
{
|
|
||||||
qCDebug(LOG_LIB);
|
|
||||||
|
|
||||||
m_items.clear();
|
|
||||||
m_items = getItems();
|
|
||||||
};
|
|
||||||
|
|
||||||
T *itemByTag(const QString _tag) const
|
T *itemByTag(const QString _tag) const
|
||||||
{
|
{
|
||||||
qCDebug(LOG_LIB);
|
qCDebug(LOG_LIB);
|
||||||
@ -84,7 +84,7 @@ public:
|
|||||||
qCWarning(LOG_LIB) << "Could not find item by tag" << _tag;
|
qCWarning(LOG_LIB) << "Could not find item by tag" << _tag;
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
};
|
||||||
|
|
||||||
T *itemByTagNumber(const int _number) const
|
T *itemByTagNumber(const int _number) const
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
qCWarning(LOG_LIB) << "Could not find item by number" << _number;
|
qCWarning(LOG_LIB) << "Could not find item by number" << _number;
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
};
|
||||||
|
|
||||||
T *itemFromWidget() const
|
T *itemFromWidget() const
|
||||||
{
|
{
|
||||||
@ -143,6 +143,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<T *> m_items;
|
QList<T *> m_items;
|
||||||
|
QList<T *> m_activeItems;
|
||||||
QString m_type;
|
QString m_type;
|
||||||
|
|
||||||
// init method
|
// init method
|
||||||
@ -181,6 +182,18 @@ private:
|
|||||||
return items;
|
return items;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void initItems()
|
||||||
|
{
|
||||||
|
qCDebug(LOG_LIB);
|
||||||
|
|
||||||
|
m_items.clear();
|
||||||
|
m_activeItems.clear();
|
||||||
|
|
||||||
|
m_items = getItems();
|
||||||
|
foreach(T *item, m_items)
|
||||||
|
if (item->isActive()) m_activeItems.append(item);
|
||||||
|
};
|
||||||
|
|
||||||
void repaint()
|
void repaint()
|
||||||
{
|
{
|
||||||
qCDebug(LOG_LIB);
|
qCDebug(LOG_LIB);
|
||||||
|
@ -470,7 +470,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
QVariantHash battery = getBattery(configuration[QString("ACPIPATH")]);
|
QVariantHash battery = getBattery(configuration[QString("ACPIPATH")]);
|
||||||
foreach(QString key, battery.keys()) setData(source, key, battery[key]);
|
foreach(QString key, battery.keys()) setData(source, key, battery[key]);
|
||||||
} else if (source == QString("custom")) {
|
} else if (source == QString("custom")) {
|
||||||
foreach(ExtScript *script, extScripts->items()) {
|
foreach(ExtScript *script, extScripts->activeItems()) {
|
||||||
QVariantHash data = script->run();
|
QVariantHash data = script->run();
|
||||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
} else if (source == QString("netdev")) {
|
} else if (source == QString("netdev")) {
|
||||||
setData(source, QString("value"), getNetworkDevice());
|
setData(source, QString("value"), getNetworkDevice());
|
||||||
} else if (source == QString("pkg")) {
|
} else if (source == QString("pkg")) {
|
||||||
foreach(ExtUpgrade *upgrade, extUpgrade->items()) {
|
foreach(ExtUpgrade *upgrade, extUpgrade->activeItems()) {
|
||||||
QVariantHash data = upgrade->run();
|
QVariantHash data = upgrade->run();
|
||||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||||
}
|
}
|
||||||
@ -504,14 +504,14 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
QVariantHash ps = getPsStats();
|
QVariantHash ps = getPsStats();
|
||||||
foreach(QString key, ps.keys()) setData(source, key, ps[key]);
|
foreach(QString key, ps.keys()) setData(source, key, ps[key]);
|
||||||
} else if (source == QString("quotes")) {
|
} else if (source == QString("quotes")) {
|
||||||
foreach(ExtQuotes *quote, extQuotes->items()) {
|
foreach(ExtQuotes *quote, extQuotes->activeItems()) {
|
||||||
QVariantHash data = quote->run();
|
QVariantHash data = quote->run();
|
||||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||||
}
|
}
|
||||||
} else if (source == QString("update")) {
|
} else if (source == QString("update")) {
|
||||||
setData(source, QString("value"), true);
|
setData(source, QString("value"), true);
|
||||||
} else if (source == QString("weather")) {
|
} else if (source == QString("weather")) {
|
||||||
foreach(ExtWeather *weather, extWeather->items()) {
|
foreach(ExtWeather *weather, extWeather->activeItems()) {
|
||||||
QVariantHash data = weather->run();
|
QVariantHash data = weather->run();
|
||||||
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
foreach(QString key, data.keys()) setData(source, key, data[key]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user