mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-26 12:09:56 +00:00
Initial support of templates and so on (#71)
* Initial syntax is the following: * $template{{ some JS code here }} - simple template based on JS code inside. It works the same as lambda functions, but calculates only once. * aw_count(regex) - keys count found for given regex * aw_keys(regex, [separator]) - keys found for given regex and joined by using given separator * aw_names(regex, [separator]) - key names found for given regex and joined by using given separator (the same as previous but w\o $) The template and function syntax may be changed before release. * replace `foreach` to `for (auto foo : bar)` and update CONTRIBUTING.md accordingly
This commit is contained in:
@ -34,7 +34,7 @@ ExtendedSysMon::ExtendedSysMon(QObject *parent, const QVariantList &args)
|
||||
Q_UNUSED(args)
|
||||
qSetMessagePattern(LOG_FORMAT);
|
||||
qCDebug(LOG_ESM) << __PRETTY_FUNCTION__;
|
||||
foreach (const QString metadata, getBuildData())
|
||||
for (auto metadata : getBuildData())
|
||||
qCDebug(LOG_ESM) << metadata;
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
@ -42,7 +42,7 @@ ExtendedSysMon::ExtendedSysMon(QObject *parent, const QVariantList &args)
|
||||
|
||||
// init aggregator
|
||||
aggregator = new ExtSysMonAggregator(this, configuration);
|
||||
foreach (QString source, aggregator->sources())
|
||||
for (auto source : aggregator->sources())
|
||||
setData(source, aggregator->initialData(source));
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
|
||||
QChar(','), QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
|
||||
foreach (QString device, deviceList)
|
||||
for (auto device : deviceList)
|
||||
if ((QFile::exists(device)) && (device.contains(diskRegexp)))
|
||||
devices.append(device);
|
||||
if (devices.isEmpty())
|
||||
@ -194,7 +194,7 @@ ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
|
||||
if (rawConfig[QString("PLAYERSYMBOLS")].toInt() <= 0)
|
||||
rawConfig[QString("PLAYERSYMBOLS")] = QString("10");
|
||||
|
||||
foreach (QString key, rawConfig.keys())
|
||||
for (auto key : rawConfig.keys())
|
||||
qCInfo(LOG_ESM) << key << "=" << rawConfig[key];
|
||||
return rawConfig;
|
||||
}
|
||||
|
Reference in New Issue
Block a user