mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-13 22:05:48 +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:
@ -193,14 +193,14 @@ void AbstractExtItem::readConfiguration()
|
||||
|
||||
bool AbstractExtItem::tryDelete() const
|
||||
{
|
||||
foreach (QString dir, m_dirs) {
|
||||
for (auto dir : m_dirs) {
|
||||
bool status = QFile::remove(QString("%1/%2").arg(dir).arg(m_fileName));
|
||||
qCInfo(LOG_LIB) << "Remove file"
|
||||
<< QString("%1/%2").arg(dir).arg(m_fileName) << status;
|
||||
}
|
||||
|
||||
// check if exists
|
||||
foreach (QString dir, m_dirs)
|
||||
for (auto dir : m_dirs)
|
||||
if (QFile::exists(QString("%1/%2").arg(dir).arg(m_fileName)))
|
||||
return false;
|
||||
return true;
|
||||
|
@ -188,7 +188,7 @@ QString ExtScript::applyFilters(QString _value) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Value" << _value;
|
||||
|
||||
foreach (QString filt, m_filters) {
|
||||
for (auto filt : m_filters) {
|
||||
qCInfo(LOG_LIB) << "Found filter" << filt;
|
||||
QVariantMap filter = jsonFilters[filt].toMap();
|
||||
if (filter.isEmpty()) {
|
||||
@ -196,7 +196,7 @@ QString ExtScript::applyFilters(QString _value) const
|
||||
<< "in the json";
|
||||
continue;
|
||||
}
|
||||
foreach (QString f, filter.keys())
|
||||
for (auto f : filter.keys())
|
||||
_value.replace(f, filter[f].toString());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user