diff --git a/.gitignore b/.gitignore
index 9561581..9a0d19c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@ build
*pkg.tar.[gx]z
src
pkg
+*.deb
# clion settings
.idea
diff --git a/.travis.yml.bckp b/.travis.yml.bckp
index 33c3dac..0ddd9af 100644
--- a/.travis.yml.bckp
+++ b/.travis.yml.bckp
@@ -1,7 +1,16 @@
-install:
- - sudo apt-get update -qq
- - sudo apt-get install -y cmake extra-cmake-modules g++ git libkf5i18n-dev libkf5notifications-dev libkf5service-dev libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev
- - git submobule update --init
+sudo: required
+dist: trusty
+
+language: cpp
+os:
+ - linux
+
+before_script:
+ - sudo apt-add-repository -y ppa:kubuntu-ppa/backports
+ - sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list
+ - sudo sed -i 's/trusty/wily/g' /etc/apt/sources.list.d/kubuntu-ppa-backports-trusty.list
+ - sudo apt-get -qq update
+ - sudo apt-get -y -qq -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install libkf5i18n-dev libkf5notifications-dev libkf5service-dev libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev extra-cmake-modules cmake g++
- rm -rf build
- mkdir build
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3f94a57..c024dd9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,14 +36,15 @@ for more details. To avoid manual labor there is automatic cmake target named
```
* `Q_PROPERTY` macro is allowed and recommended for QObject based classes.
-* Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed.
+* Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed. In other hand
+`Q_FOREACH` (`foreach`) is not allowed use `for (auto foo : bar)` instead.
* Current project standard is **C++11**.
* Do not use C-like code:
- * C-like style iteration if possible. Use `Q_FOREACH` (`foreach`) and
+ * C-like style iteration if possible. Use `for (auto foo : bar)` and
`std::for_each` instead if possible. It is also recommended to use iterators.
* C-like casts, use `const_cast`, `static_cast`, `dymanic_Cast` instead. Using
of `reinterpret_cast` is not recommended. It is highly recommended to use
- `dynamic_Cast` with the exception catching. It is also possible to use
+ `dynamic_cast` with the exception catching. It is also possible to use
`qvariant_cast` if required. Exception is class constructors, e.g.:
```
@@ -81,7 +82,7 @@ for more details. To avoid manual labor there is automatic cmake target named
* Create one file (source and header) per class.
* `else if` construction is allowed and recommended.
* 'true ? foo : bar' construction is allowed and recommended for one-line assignment.
-* any global pointer should be assign to `nullptr` after deletion and before
+* Any global pointer should be assign to `nullptr` after deletion and before
initialization. Exception: if object is deleted into class destructor.
Comments
@@ -146,13 +147,12 @@ For logging please use [QLoggingCategory](http://doc.qt.io/qt-5/qloggingcategory
Available categories should be declared in `awdebug.*` files. The following log
levels should be used:
-* **debug** (`qCDebug()`) - method arguments information.
+* **debug** (`qCDebug()`) - method arguments information. Please note that it
+ is recommended to logging all arguments in the one line.
* **info** (`qCInfo()`) - additional information inside methods.
* **warning** (`qCWarning()`) - not critical information, which may be caused by
mistakes in configuration for example.
-* **error** (`qCError()`) - an error which has been captured in runtime. All errors
- should have own callback methods.
-* **critical** (`qCCritical()`) - a critical error. After this error program will
+* **critical** (`qCCritical()`) - a critical error. After this error program may
be terminated.
The empty log string (e.g. `qCDebug();`) is not allowed because the method names
diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt
index bc96fb9..1ff1734 100644
--- a/sources/CMakeLists.txt
+++ b/sources/CMakeLists.txt
@@ -41,14 +41,14 @@ set(CPPCHECK_EXECUTABLE "/usr/bin/cppcheck" CACHE STRING "Path to cppcheck execu
# flags
if (CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
+ set(CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++14")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
# avoid newer gcc warnings
add_definitions(-D_DEFAULT_SOURCE)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
+ set(CMAKE_CXX_FLAGS "-Wall -std=c++14 -stdlib=libc++")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
diff --git a/sources/awdebug.h b/sources/awdebug.h
index 48dc580..43944ce 100644
--- a/sources/awdebug.h
+++ b/sources/awdebug.h
@@ -28,12 +28,6 @@
"category}][%{function}] %{message}"
#endif /* LOG_FORMAT */
-// redefine info because it doesn't log properly
-#ifdef qCInfo
-#undef qCInfo
-#endif /* qCInfo */
-#define qCInfo qCDebug
-
Q_DECLARE_LOGGING_CATEGORY(LOG_AW)
Q_DECLARE_LOGGING_CATEGORY(LOG_DP)
diff --git a/sources/awesome-widget/package/contents/ui/about.qml b/sources/awesome-widget/package/contents/ui/about.qml
index 0440de8..6cde341 100644
--- a/sources/awesome-widget/package/contents/ui/about.qml
+++ b/sources/awesome-widget/package/contents/ui/about.qml
@@ -97,6 +97,15 @@ Item {
text: awActions.getAboutText("translators")
}
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignJustify
+ textFormat: Text.RichText
+ text: awActions.getAboutText("3rdparty")
+ onLinkActivated: Qt.openUrlExternally(link);
+ }
+
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
@@ -104,7 +113,7 @@ Item {
horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignTop
textFormat: Text.RichText
- text: awActions.getAboutText("3rdparty")
+ text: awActions.getAboutText("thanks")
onLinkActivated: Qt.openUrlExternally(link);
}
}
diff --git a/sources/awesome-widget/package/contents/ui/widget.qml b/sources/awesome-widget/package/contents/ui/widget.qml
index 2787c5e..4c7c508 100644
--- a/sources/awesome-widget/package/contents/ui/widget.qml
+++ b/sources/awesome-widget/package/contents/ui/widget.qml
@@ -198,7 +198,7 @@ Item {
height: implicitHeight
width: parent.width
QtControls.ComboBox {
- width: parent.width * 1 / 5
+ width: parent.width * 2 / 5
textRole: "label"
model: [
{
@@ -252,11 +252,20 @@ Item {
{
'label': i18n("Weathers"),
'regexp': "^(weather(Id)?|humidity|pressure|temperature|timestamp)"
+ },
+ {
+ 'label': i18n("Functions"),
+ 'regexp': "functions"
}
]
onCurrentIndexChanged: {
if (debug) console.debug()
- tags.model = awKeys.dictKeys(true, model[currentIndex]["regexp"])
+ if (model[currentIndex]["regexp"] == "functions")
+ tags.model = ["{{\n\n}}", "template{{\n\n}}",
+ "aw_all<>()", "aw_count<>()", "aw_keys<>()",
+ "aw_names<>()"]
+ else
+ tags.model = awKeys.dictKeys(true, model[currentIndex]["regexp"])
if (debug) console.info("Init model", tags.model, "for", model[currentIndex]["label"])
tags.currentIndex = -1
}
@@ -293,18 +302,6 @@ Item {
awActions.sendNotification("tag", message)
}
}
- QtControls.Button {
- width: parent.width * 1 / 5
- text: i18n("Add lambda")
-
- onClicked: {
- if (debug) console.debug("Lambda button")
- var pos = textPattern.cursorPosition
- var selected = textPattern.selectedText
- textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
- textPattern.insert(pos, selected + "${{\n\n}}")
- }
- }
}
Row {
diff --git a/sources/awesome-widget/plugin/awactions.cpp b/sources/awesome-widget/plugin/awactions.cpp
index 6a181c5..f519632 100644
--- a/sources/awesome-widget/plugin/awactions.cpp
+++ b/sources/awesome-widget/plugin/awactions.cpp
@@ -144,6 +144,14 @@ QString AWActions::getAboutText(const QString type) const
.arg(trdPartyList.at(i).split(QChar(','))[1])
.arg(trdPartyList.at(i).split(QChar(','))[2]);
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
+ } else if (type == QString("thanks")) {
+ QStringList thanks = QString(SPECIAL_THANKS)
+ .split(QChar(';'), QString::SkipEmptyParts);
+ for (int i = 0; i < thanks.count(); i++)
+ thanks[i] = QString("%1")
+ .arg(thanks.at(i).split(QChar(','))[0])
+ .arg(thanks.at(i).split(QChar(','))[1]);
+ text = i18n("Special thanks to %1", thanks.join(QString(", ")));
}
return text;
@@ -171,8 +179,7 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
// to avoid additional object definition this method is static
void AWActions::sendNotification(const QString eventId, const QString message)
{
- qCDebug(LOG_AW) << "Event" << eventId;
- qCDebug(LOG_AW) << "Message" << message;
+ qCDebug(LOG_AW) << "Event" << eventId << "with message" << message;
KNotification *notification = KNotification::event(
eventId, QString("Awesome Widget ::: %1").arg(eventId), message);
@@ -221,18 +228,17 @@ void AWActions::showUpdates(const QString version) const
void AWActions::versionReplyRecieved(QNetworkReply *reply,
const bool showAnyway) const
{
- qCDebug(LOG_AW) << "Return code" << reply->error();
- qCDebug(LOG_AW) << "Reply error message" << reply->errorString();
- qCDebug(LOG_AW) << "Show anyway" << showAnyway;
+ qCDebug(LOG_AW) << "Return code" << reply->error() << "with message"
+ << reply->errorString() << "and show anyway" << showAnyway;
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
- reply->deleteLater();
if ((reply->error() != QNetworkReply::NoError)
|| (error.error != QJsonParseError::NoError)) {
qCWarning(LOG_AW) << "Parse error" << error.errorString();
return;
}
+ reply->deleteLater();
// convert to map
QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap();
@@ -244,9 +250,9 @@ void AWActions::versionReplyRecieved(QNetworkReply *reply,
int old_major = QString(VERSION).split(QChar('.')).at(0).toInt();
int old_minor = QString(VERSION).split(QChar('.')).at(1).toInt();
int old_patch = QString(VERSION).split(QChar('.')).at(2).toInt();
- int new_major = QString(version).split(QChar('.')).at(0).toInt();
- int new_minor = QString(version).split(QChar('.')).at(1).toInt();
- int new_patch = QString(version).split(QChar('.')).at(2).toInt();
+ int new_major = version.split(QChar('.')).at(0).toInt();
+ int new_minor = version.split(QChar('.')).at(1).toInt();
+ int new_patch = version.split(QChar('.')).at(2).toInt();
if ((old_major < new_major)
|| ((old_major == new_major) && (old_minor < new_minor))
|| ((old_major == new_major) && (old_minor == new_minor)
diff --git a/sources/awesome-widget/plugin/awconfighelper.cpp b/sources/awesome-widget/plugin/awconfighelper.cpp
index 6263b30..2dd0259 100644
--- a/sources/awesome-widget/plugin/awconfighelper.cpp
+++ b/sources/awesome-widget/plugin/awconfighelper.cpp
@@ -61,7 +61,7 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
QQmlPropertyMap *configuration
= static_cast(nativeConfig);
settings.beginGroup(QString("plasmoid"));
- foreach (QString key, configuration->keys()) {
+ for (auto key : configuration->keys()) {
QVariant value = configuration->value(key);
if (!value.isValid())
continue;
@@ -70,13 +70,13 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
settings.endGroup();
// extensions
- foreach (QString item, m_dirs) {
+ for (auto item : m_dirs) {
QStringList items
= QDir(QString("%1/%2").arg(m_baseDir).arg(item))
.entryList(QStringList() << QString("*.desktop"),
QDir::Files);
settings.beginGroup(item);
- foreach (QString it, items)
+ for (auto it : items)
copyExtensions(it, item, settings, false);
settings.endGroup();
}
@@ -112,9 +112,9 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
// extensions
if (importExtensions) {
- foreach (QString item, m_dirs) {
+ for (auto item : m_dirs) {
settings.beginGroup(item);
- foreach (QString it, settings.childGroups())
+ for (auto it : settings.childGroups())
copyExtensions(it, item, settings, true);
settings.endGroup();
}
@@ -137,7 +137,7 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
// plasmoid configuration
if (importPlasmoid) {
settings.beginGroup(QString("plasmoid"));
- foreach (QString key, settings.childKeys())
+ for (auto key : settings.childKeys())
configuration[key] = settings.value(key);
settings.endGroup();
}
@@ -216,9 +216,8 @@ void AWConfigHelper::copyExtensions(const QString item, const QString type,
QSettings &settings,
const bool inverse) const
{
- qCDebug(LOG_AW) << "Extension" << item;
- qCDebug(LOG_AW) << "Type" << type;
- qCDebug(LOG_AW) << "Inverse" << inverse;
+ qCDebug(LOG_AW) << "Extension" << item << "has type" << type
+ << "inverse copying" << inverse;
settings.beginGroup(item);
QSettings itemSettings(
@@ -239,7 +238,7 @@ void AWConfigHelper::copyExtensions(const QString item, const QString type,
void AWConfigHelper::copySettings(QSettings &from, QSettings &to) const
{
- foreach (QString key, from.childKeys())
+ for (auto key : from.childKeys())
to.setValue(key, from.value(key));
}
@@ -247,8 +246,7 @@ void AWConfigHelper::copySettings(QSettings &from, QSettings &to) const
void AWConfigHelper::readFile(QSettings &settings, const QString key,
const QString fileName) const
{
- qCDebug(LOG_AW) << "Key" << key;
- qCDebug(LOG_AW) << "File" << fileName;
+ qCDebug(LOG_AW) << "Key" << key << "from file" << fileName;
QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
@@ -264,8 +262,7 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key,
void AWConfigHelper::writeFile(QSettings &settings, const QString key,
const QString fileName) const
{
- qCDebug(LOG_AW) << "Key" << key;
- qCDebug(LOG_AW) << "File" << fileName;
+ qCDebug(LOG_AW) << "Key" << key << "to file" << fileName;
if (!settings.contains(key))
return;
diff --git a/sources/awesome-widget/plugin/awdataaggregator.cpp b/sources/awesome-widget/plugin/awdataaggregator.cpp
index 0464d8e..01b358c 100644
--- a/sources/awesome-widget/plugin/awdataaggregator.cpp
+++ b/sources/awesome-widget/plugin/awdataaggregator.cpp
@@ -90,7 +90,7 @@ void AWDataAggregator::setParameters(QVariantMap settings)
counts += configuration[QString("downTooltip")].toInt();
counts += configuration[QString("batTooltip")].toInt();
// resize tooltip image
- toolTipView->resize(100.0 * counts, 105.0);
+ toolTipView->resize(100 * counts, 105);
boundaries[QString("cpuTooltip")] = 100.0;
boundaries[QString("cpuclTooltip")] = 4000.0;
@@ -131,7 +131,7 @@ QPixmap AWDataAggregator::tooltipImage()
toolTipScene->clear();
QPen pen;
bool down = false;
- foreach (QString key, requiredKeys) {
+ for (auto key : requiredKeys) {
// create frame
float normX = 100.0 / static_cast(data[key].count());
float normY = 100.0 / (1.5 * boundaries[key]);
@@ -179,9 +179,8 @@ void AWDataAggregator::dataUpdate(const QHash &values)
void AWDataAggregator::checkValue(const QString source, const float value,
const float extremum) const
{
- qCDebug(LOG_AW) << "Notification source" << source;
- qCDebug(LOG_AW) << "Value" << value;
- qCDebug(LOG_AW) << "Called with extremum" << extremum;
+ qCDebug(LOG_AW) << "Notification source" << source << "with value" << value
+ << "called with extremum" << extremum;
if (value >= 0.0) {
if ((m_enablePopup) && (value > extremum)
@@ -200,9 +199,8 @@ void AWDataAggregator::checkValue(const QString source, const float value,
void AWDataAggregator::checkValue(const QString source, const QString current,
const QString received) const
{
- qCDebug(LOG_AW) << "Notification source" << source;
- qCDebug(LOG_AW) << "Current value" << current;
- qCDebug(LOG_AW) << "Received value" << received;
+ qCDebug(LOG_AW) << "Notification source" << source << "with current value"
+ << current << "and received one" << received;
if ((m_enablePopup) && (current != received) && (!received.isEmpty()))
return AWActions::sendNotification(QString("event"),
@@ -225,8 +223,7 @@ void AWDataAggregator::initScene()
QString AWDataAggregator::notificationText(const QString source,
const float value) const
{
- qCDebug(LOG_AW) << "Notification source" << source;
- qCDebug(LOG_AW) << "Value" << value;
+ qCDebug(LOG_AW) << "Notification source" << source << "with value" << value;
QString output;
if (source == QString("batTooltip"))
@@ -247,8 +244,7 @@ QString AWDataAggregator::notificationText(const QString source,
QString AWDataAggregator::notificationText(const QString source,
const QString value) const
{
- qCDebug(LOG_AW) << "Notification source" << source;
- qCDebug(LOG_AW) << "Value" << value;
+ qCDebug(LOG_AW) << "Notification source" << source << "with value" << value;
QString output;
if (source == QString("netdev"))
@@ -287,9 +283,8 @@ void AWDataAggregator::setData(const QHash &values)
void AWDataAggregator::setData(const QString &source, float value,
const float extremum)
{
- qCDebug(LOG_AW) << "Source" << source;
- qCDebug(LOG_AW) << "Value" << value;
- qCDebug(LOG_AW) << "Called with extremum" << extremum;
+ qCDebug(LOG_AW) << "Source" << source << "to value" << value
+ << "with extremum" << extremum;
if (data[source].count() == 0)
data[source].append(0.0);
@@ -316,9 +311,8 @@ void AWDataAggregator::setData(const QString &source, float value,
void AWDataAggregator::setData(const bool dontInvert, const QString &source,
float value)
{
- qCDebug(LOG_AW) << "Do not invert value" << dontInvert;
- qCDebug(LOG_AW) << "Source" << source;
- qCDebug(LOG_AW) << "Value" << value;
+ qCDebug(LOG_AW) << "Do not invert" << dontInvert << "value" << value
+ << "for source" << source;
// invert values for different battery colours
value = dontInvert ? value : -value;
diff --git a/sources/awesome-widget/plugin/awdataengineaggregator.cpp b/sources/awesome-widget/plugin/awdataengineaggregator.cpp
index eeb7e44..7ff6642 100644
--- a/sources/awesome-widget/plugin/awdataengineaggregator.cpp
+++ b/sources/awesome-widget/plugin/awdataengineaggregator.cpp
@@ -17,8 +17,6 @@
#include "awdataengineaggregator.h"
-#include
-
#include "awdebug.h"
#include "awkeys.h"
@@ -41,14 +39,15 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
// disconnect sources first
disconnectSources();
m_dataEngines.clear();
+ delete m_consumer;
}
void AWDataEngineAggregator::disconnectSources()
{
- foreach (QString dataengine, m_dataEngines.keys())
- foreach (QString source, m_dataEngines[dataengine]->sources())
- m_dataEngines[dataengine]->disconnectSource(source, parent());
+ for (auto dataengine : m_dataEngines.values())
+ for (auto source : dataengine->sources())
+ dataengine->disconnectSource(source, parent());
}
@@ -84,17 +83,17 @@ void AWDataEngineAggregator::reconnectSources()
void AWDataEngineAggregator::initDataEngines()
{
- Plasma::DataEngineConsumer *deConsumer = new Plasma::DataEngineConsumer();
+ m_consumer = new Plasma::DataEngineConsumer();
m_dataEngines[QString("systemmonitor")]
- = deConsumer->dataEngine(QString("systemmonitor"));
+ = m_consumer->dataEngine(QString("systemmonitor"));
m_dataEngines[QString("extsysmon")]
- = deConsumer->dataEngine(QString("extsysmon"));
- m_dataEngines[QString("time")] = deConsumer->dataEngine(QString("time"));
+ = m_consumer->dataEngine(QString("extsysmon"));
+ m_dataEngines[QString("time")] = m_consumer->dataEngine(QString("time"));
// additional method required by systemmonitor structure
connect(m_dataEngines[QString("systemmonitor")],
&Plasma::DataEngine::sourceAdded, [this](const QString source) {
- static_cast(parent())->addDevice(source);
+ emit(deviceAdded(source));
m_dataEngines[QString("systemmonitor")]->connectSource(
source, parent(), m_interval);
});
diff --git a/sources/awesome-widget/plugin/awdataengineaggregator.h b/sources/awesome-widget/plugin/awdataengineaggregator.h
index 5a86ab6..229fce1 100644
--- a/sources/awesome-widget/plugin/awdataengineaggregator.h
+++ b/sources/awesome-widget/plugin/awdataengineaggregator.h
@@ -20,6 +20,7 @@
#define AWDATAENGINEAGGREGATOR_H
#include
+#include
#include
@@ -37,12 +38,16 @@ public:
// properties
void setInterval(const int _interval);
+signals:
+ void deviceAdded(const QString &source);
+
public slots:
void dropSource(const QString source);
void reconnectSources();
private:
void initDataEngines();
+ Plasma::DataEngineConsumer *m_consumer = nullptr;
QHash m_dataEngines;
int m_interval;
};
diff --git a/sources/awesome-widget/plugin/awesomewidget.cpp b/sources/awesome-widget/plugin/awesomewidget.cpp
index f306bf2..6d6233b 100644
--- a/sources/awesome-widget/plugin/awesomewidget.cpp
+++ b/sources/awesome-widget/plugin/awesomewidget.cpp
@@ -21,6 +21,7 @@
#include "awactions.h"
#include "awconfighelper.h"
+#include "awdataengineaggregator.h"
#include "awkeys.h"
diff --git a/sources/awesome-widget/plugin/awkeycache.cpp b/sources/awesome-widget/plugin/awkeycache.cpp
new file mode 100644
index 0000000..4002f7d
--- /dev/null
+++ b/sources/awesome-widget/plugin/awkeycache.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+#include "awkeycache.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include "awdebug.h"
+
+
+bool AWKeyCache::addKeyToCache(const QString type, const QString key)
+{
+ qCDebug(LOG_AW) << "Key" << key << "with type" << type;
+
+ QString fileName = QString("%1/awesomewidgets.ndx")
+ .arg(QStandardPaths::writableLocation(
+ QStandardPaths::GenericCacheLocation));
+ qCInfo(LOG_AW) << "Cache file" << fileName;
+ QSettings cache(fileName, QSettings::IniFormat);
+
+ cache.beginGroup(type);
+ QStringList cachedValues;
+ for (auto key : cache.allKeys())
+ cachedValues.append(cache.value(key).toString());
+
+ if (type == QString("hdd")) {
+ QStringList allDevices
+ = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
+ QStringList devices
+ = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
+ for (auto dev : devices) {
+ QString device = QString("/dev/%1").arg(dev);
+ if (cachedValues.contains(device))
+ continue;
+ qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
+ cache.setValue(
+ QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
+ device);
+ }
+ } else if (type == QString("net")) {
+ QList rawInterfaceList
+ = QNetworkInterface::allInterfaces();
+ for (auto interface : rawInterfaceList) {
+ QString device = interface.name();
+ if (cachedValues.contains(device))
+ continue;
+ qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
+ cache.setValue(
+ QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
+ device);
+ }
+ } else {
+ if (cachedValues.contains(key))
+ return false;
+ qCInfo(LOG_AW) << "Found new key" << key << "for type" << type;
+ cache.setValue(
+ QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), key);
+ }
+ cache.endGroup();
+
+ cache.sync();
+ return true;
+}
+
+
+QHash AWKeyCache::loadKeysFromCache()
+{
+ QString fileName = QString("%1/awesomewidgets.ndx")
+ .arg(QStandardPaths::writableLocation(
+ QStandardPaths::GenericCacheLocation));
+ qCInfo(LOG_AW) << "Cache file" << fileName;
+ QSettings cache(fileName, QSettings::IniFormat);
+
+ QHash devices;
+ for (auto group : cache.childGroups()) {
+ cache.beginGroup(group);
+ for (auto key : cache.allKeys())
+ devices[group].append(cache.value(key).toString());
+ cache.endGroup();
+ }
+
+ return devices;
+}
diff --git a/sources/awesome-widget/plugin/awkeycache.h b/sources/awesome-widget/plugin/awkeycache.h
new file mode 100644
index 0000000..806e61d
--- /dev/null
+++ b/sources/awesome-widget/plugin/awkeycache.h
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+
+#ifndef AWKEYCACHE_H
+#define AWKEYCACHE_H
+
+#include
+#include
+
+
+namespace AWKeyCache
+{
+bool addKeyToCache(const QString type, const QString key = QString(""));
+QHash loadKeysFromCache();
+};
+
+
+#endif /* AWKEYCACHE_H */
diff --git a/sources/awesome-widget/plugin/awkeyoperations.cpp b/sources/awesome-widget/plugin/awkeyoperations.cpp
new file mode 100644
index 0000000..135d6f2
--- /dev/null
+++ b/sources/awesome-widget/plugin/awkeyoperations.cpp
@@ -0,0 +1,405 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+#include "awkeyoperations.h"
+
+#include
+#include
+#include
+#include
+
+#include "awdebug.h"
+#include "awkeycache.h"
+#include "awpatternfunctions.h"
+#include "version.h"
+// extensions
+#include "extquotes.h"
+#include "extscript.h"
+#include "extupgrade.h"
+#include "extweather.h"
+#include "graphicalitem.h"
+
+
+AWKeyOperations::AWKeyOperations(QObject *parent)
+ : QObject(parent)
+{
+ qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
+}
+
+
+AWKeyOperations::~AWKeyOperations()
+{
+ qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
+
+ // extensions
+ delete graphicalItems;
+ delete extQuotes;
+ delete extScripts;
+ delete extUpgrade;
+ delete extWeather;
+}
+
+
+QStringList AWKeyOperations::devices(const QString type) const
+{
+ qCDebug(LOG_AW) << "Looking for type" << type;
+
+ return m_devices[type];
+}
+
+
+QHash AWKeyOperations::devices() const
+{
+ return m_devices;
+}
+
+
+void AWKeyOperations::updateCache()
+{
+ // update network and hdd list
+ addKeyToCache(QString("hdd"));
+ addKeyToCache(QString("net"));
+}
+
+
+QStringList AWKeyOperations::dictKeys() const
+{
+ QStringList allKeys;
+ // weather
+ for (int i = extWeather->activeItems().count() - 1; i >= 0; i--) {
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("weatherId")));
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("weather")));
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("humidity")));
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("pressure")));
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("temperature")));
+ allKeys.append(
+ extWeather->activeItems().at(i)->tag(QString("timestamp")));
+ }
+ // time
+ allKeys.append(QString("time"));
+ allKeys.append(QString("isotime"));
+ allKeys.append(QString("shorttime"));
+ allKeys.append(QString("longtime"));
+ allKeys.append(QString("ctime"));
+ // uptime
+ allKeys.append(QString("uptime"));
+ allKeys.append(QString("cuptime"));
+ // cpuclock & cpu
+ for (int i = QThread::idealThreadCount() - 1; i >= 0; i--) {
+ allKeys.append(QString("cpucl%1").arg(i));
+ allKeys.append(QString("cpu%1").arg(i));
+ }
+ allKeys.append(QString("cpucl"));
+ allKeys.append(QString("cpu"));
+ // temperature
+ for (int i = m_devices[QString("temp")].count() - 1; i >= 0; i--)
+ allKeys.append(QString("temp%1").arg(i));
+ // gputemp
+ allKeys.append(QString("gputemp"));
+ // gpu
+ allKeys.append(QString("gpu"));
+ // memory
+ allKeys.append(QString("memmb"));
+ allKeys.append(QString("memgb"));
+ allKeys.append(QString("memfreemb"));
+ allKeys.append(QString("memfreegb"));
+ allKeys.append(QString("memtotmb"));
+ allKeys.append(QString("memtotgb"));
+ allKeys.append(QString("memusedmb"));
+ allKeys.append(QString("memusedgb"));
+ allKeys.append(QString("mem"));
+ // swap
+ allKeys.append(QString("swapmb"));
+ allKeys.append(QString("swapgb"));
+ allKeys.append(QString("swapfreemb"));
+ allKeys.append(QString("swapfreegb"));
+ allKeys.append(QString("swaptotmb"));
+ allKeys.append(QString("swaptotgb"));
+ allKeys.append(QString("swap"));
+ // hdd
+ for (int i = m_devices[QString("mount")].count() - 1; i >= 0; i--) {
+ allKeys.append(QString("hddmb%1").arg(i));
+ allKeys.append(QString("hddgb%1").arg(i));
+ allKeys.append(QString("hddfreemb%1").arg(i));
+ allKeys.append(QString("hddfreegb%1").arg(i));
+ allKeys.append(QString("hddtotmb%1").arg(i));
+ allKeys.append(QString("hddtotgb%1").arg(i));
+ allKeys.append(QString("hdd%1").arg(i));
+ }
+ // hdd speed
+ for (int i = m_devices[QString("disk")].count() - 1; i >= 0; i--) {
+ allKeys.append(QString("hddr%1").arg(i));
+ allKeys.append(QString("hddw%1").arg(i));
+ }
+ // hdd temp
+ for (int i = m_devices[QString("hdd")].count() - 1; i >= 0; i--)
+ allKeys.append(QString("hddtemp%1").arg(i));
+ // network
+ for (int i = m_devices[QString("net")].count() - 1; i >= 0; i--) {
+ allKeys.append(QString("downunits%1").arg(i));
+ allKeys.append(QString("upunits%1").arg(i));
+ allKeys.append(QString("downkb%1").arg(i));
+ allKeys.append(QString("down%1").arg(i));
+ allKeys.append(QString("upkb%1").arg(i));
+ allKeys.append(QString("up%1").arg(i));
+ }
+ allKeys.append(QString("downunits"));
+ allKeys.append(QString("upunits"));
+ allKeys.append(QString("downkb"));
+ allKeys.append(QString("down"));
+ allKeys.append(QString("upkb"));
+ allKeys.append(QString("up"));
+ allKeys.append(QString("netdev"));
+ // battery
+ allKeys.append(QString("ac"));
+ QStringList allBatteryDevices
+ = QDir(QString("/sys/class/power_supply"))
+ .entryList(QStringList() << QString("BAT*"),
+ QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ for (int i = allBatteryDevices.count() - 1; i >= 0; i--)
+ allKeys.append(QString("bat%1").arg(i));
+ allKeys.append(QString("bat"));
+ // player
+ allKeys.append(QString("album"));
+ allKeys.append(QString("artist"));
+ allKeys.append(QString("duration"));
+ allKeys.append(QString("progress"));
+ allKeys.append(QString("title"));
+ allKeys.append(QString("dalbum"));
+ allKeys.append(QString("dartist"));
+ allKeys.append(QString("dtitle"));
+ allKeys.append(QString("salbum"));
+ allKeys.append(QString("sartist"));
+ allKeys.append(QString("stitle"));
+ // ps
+ allKeys.append(QString("pscount"));
+ allKeys.append(QString("pstotal"));
+ allKeys.append(QString("ps"));
+ // package manager
+ for (int i = extUpgrade->activeItems().count() - 1; i >= 0; i--)
+ allKeys.append(
+ extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
+ // quotes
+ for (int i = extQuotes->activeItems().count() - 1; i >= 0; i--) {
+ allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask")));
+ allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg")));
+ allKeys.append(
+ extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
+ allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid")));
+ allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg")));
+ allKeys.append(
+ extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
+ allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price")));
+ allKeys.append(
+ extQuotes->activeItems().at(i)->tag(QString("pricechg")));
+ allKeys.append(
+ extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
+ }
+ // custom
+ for (int i = extScripts->activeItems().count() - 1; i >= 0; i--)
+ allKeys.append(extScripts->activeItems().at(i)->tag(QString("custom")));
+ // desktop
+ allKeys.append(QString("desktop"));
+ allKeys.append(QString("ndesktop"));
+ allKeys.append(QString("tdesktops"));
+ // load average
+ allKeys.append(QString("la15"));
+ allKeys.append(QString("la5"));
+ allKeys.append(QString("la1"));
+ // bars
+ QStringList graphicalItemsKeys;
+ for (auto item : graphicalItems->items())
+ graphicalItemsKeys.append(item->tag());
+ graphicalItemsKeys.sort();
+ for (int i = graphicalItemsKeys.count() - 1; i >= 0; i--)
+ allKeys.append(graphicalItemsKeys.at(i));
+
+ return allKeys;
+}
+
+
+// this method is required to provide GraphicalItem functions (e.g. paint()) to
+// parent classes
+GraphicalItem *AWKeyOperations::giByKey(const QString key) const
+{
+ qCDebug(LOG_AW) << "Looking for item" << key;
+
+ return graphicalItems->itemByTag(key);
+}
+
+
+QString AWKeyOperations::infoByKey(QString key) const
+{
+ qCDebug(LOG_AW) << "Requested key" << key;
+
+ key.remove(QRegExp(QString("^bar[0-9]{1,}")));
+ if (key.startsWith(QString("custom")))
+ return extScripts->itemByTagNumber(
+ key.remove(QString("custom")).toInt())
+ ->uniq();
+ else if (key.contains(QRegExp(QString("^hdd[rw]"))))
+ return QString("%1").arg(m_devices[QString(
+ "disk")][key.remove(QRegExp(QString("hdd[rw]"))).toInt()]);
+ else if (key.contains(QRegExp(
+ QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))))
+ return QString("%1").arg(m_devices[QString(
+ "mount")][key
+ .remove(QRegExp(QString(
+ "^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))
+ .toInt()]);
+ else if (key.startsWith(QString("hddtemp")))
+ return QString("%1").arg(
+ m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()]);
+ else if (key.contains(QRegExp(QString("^(down|up)[0-9]"))))
+ return QString("%1").arg(m_devices[QString(
+ "net")][key.remove(QRegExp(QString("^(down|up)"))).toInt()]);
+ else if (key.startsWith(QString("pkgcount")))
+ return extUpgrade->itemByTagNumber(
+ key.remove(QString("pkgcount")).toInt())
+ ->uniq();
+ else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))))
+ return extQuotes->itemByTagNumber(
+ key.remove(QRegExp(QString(
+ "(^|perc)(ask|bid|price)(chg|)")))
+ .toInt())
+ ->uniq();
+ else if (key.contains(QRegExp(
+ QString("(weather|weatherId|humidity|pressure|temperature)"))))
+ return extWeather
+ ->itemByTagNumber(
+ key
+ .remove(QRegExp(QString(
+ "(weather|weatherId|humidity|pressure|temperature)")))
+ .toInt())
+ ->uniq();
+ else if (key.startsWith(QString("temp")))
+ return QString("%1").arg(
+ m_devices[QString("temp")][key.remove(QString("temp")).toInt()]);
+
+ return QString("(none)");
+}
+
+
+QString AWKeyOperations::pattern() const
+{
+ return m_pattern;
+}
+
+
+void AWKeyOperations::setPattern(const QString currentPattern)
+{
+ qCDebug(LOG_AW) << "Set pattern" << currentPattern;
+
+ m_pattern = currentPattern;
+}
+
+
+void AWKeyOperations::editItem(const QString type)
+{
+ qCDebug(LOG_AW) << "Item type" << type;
+
+ if (type == QString("graphicalitem")) {
+ QStringList keys = dictKeys().filter(QRegExp(
+ QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")));
+ keys.sort();
+ graphicalItems->setConfigArgs(keys);
+ return graphicalItems->editItems();
+ } else if (type == QString("extquotes")) {
+ return extQuotes->editItems();
+ } else if (type == QString("extscript")) {
+ return extScripts->editItems();
+ } else if (type == QString("extupgrade")) {
+ return extUpgrade->editItems();
+ } else if (type == QString("extweather")) {
+ return extWeather->editItems();
+ }
+}
+
+
+void AWKeyOperations::addDevice(const QString &source)
+{
+ qCDebug(LOG_AW) << "Source" << source;
+
+ QRegExp diskRegexp
+ = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
+ QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel"));
+
+ if (source.contains(diskRegexp)) {
+ QString device = source;
+ device.remove(QString("/Rate/rblk"));
+ addKeyToCache(QString("disk"), device);
+ } else if (source.contains(mountRegexp)) {
+ QString device = source;
+ device.remove(QString("partitions")).remove(QString("/filllevel"));
+ addKeyToCache(QString("mount"), device);
+ } else if (source.startsWith(QString("lmsensors"))) {
+ addKeyToCache(QString("temp"), source);
+ }
+}
+
+
+void AWKeyOperations::addKeyToCache(const QString type, const QString key)
+{
+ qCDebug(LOG_AW) << "Key" << key << "with type" << type;
+
+ if (AWKeyCache::addKeyToCache(type, key)) {
+ m_devices = AWKeyCache::loadKeysFromCache();
+ reinitKeys();
+ }
+}
+
+
+void AWKeyOperations::reinitKeys()
+{
+ // renew extensions
+ // delete them if any
+ delete graphicalItems;
+ graphicalItems = nullptr;
+ delete extQuotes;
+ extQuotes = nullptr;
+ delete extScripts;
+ extScripts = nullptr;
+ delete extUpgrade;
+ extUpgrade = nullptr;
+ delete extWeather;
+ extWeather = nullptr;
+ // create
+ graphicalItems
+ = new ExtItemAggregator(nullptr, QString("desktops"));
+ extQuotes = new ExtItemAggregator(nullptr, QString("quotes"));
+ extScripts = new ExtItemAggregator(nullptr, QString("scripts"));
+ extUpgrade = new ExtItemAggregator(nullptr, QString("upgrade"));
+ extWeather = new ExtItemAggregator(nullptr, QString("weather"));
+
+ // init
+ QStringList allKeys = dictKeys();
+
+ // apply aw_* functions
+ m_pattern = AWPatternFunctions::insertAllKeys(m_pattern, allKeys);
+ m_pattern = AWPatternFunctions::insertKeyCount(m_pattern, allKeys);
+ m_pattern = AWPatternFunctions::insertKeyNames(m_pattern, allKeys);
+ m_pattern = AWPatternFunctions::insertKeys(m_pattern, allKeys);
+ // wrap templates
+ m_pattern = AWPatternFunctions::expandTemplates(m_pattern);
+
+ emit(updateKeys(allKeys));
+}
diff --git a/sources/awesome-widget/plugin/awkeyoperations.h b/sources/awesome-widget/plugin/awkeyoperations.h
new file mode 100644
index 0000000..11c9161
--- /dev/null
+++ b/sources/awesome-widget/plugin/awkeyoperations.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+
+#ifndef AWKEYOPERATIONS_H
+#define AWKEYOPERATIONS_H
+
+#include
+
+#include
+#include
+
+#include "extitemaggregator.h"
+
+
+class AWDataAggregator;
+class AWDataEngineAggregator;
+class AWKeysAggregator;
+class ExtQuotes;
+class ExtScript;
+class ExtUpgrade;
+class ExtWeather;
+class GraphicalItem;
+class QThreadPool;
+
+class AWKeyOperations : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString pattern READ pattern WRITE setPattern)
+
+public:
+ explicit AWKeyOperations(QObject *parent = nullptr);
+ virtual ~AWKeyOperations();
+ QStringList devices(const QString type) const;
+ QHash devices() const;
+ void updateCache();
+ // keys
+ QStringList dictKeys() const;
+ GraphicalItem *giByKey(const QString key) const;
+ // values
+ QString infoByKey(QString key) const;
+ QString pattern() const;
+ void setPattern(const QString currentPattern);
+ // configuration
+ void editItem(const QString type);
+
+signals:
+ void updateKeys(const QStringList currentKeys);
+
+public slots:
+ void addDevice(const QString &source);
+
+private:
+ // methods
+ void addKeyToCache(const QString type, const QString key = QString(""));
+ void reinitKeys();
+ // objects
+ ExtItemAggregator *graphicalItems = nullptr;
+ ExtItemAggregator *extQuotes = nullptr;
+ ExtItemAggregator *extScripts = nullptr;
+ ExtItemAggregator *extUpgrade = nullptr;
+ ExtItemAggregator *extWeather = nullptr;
+ // variables
+ QHash m_devices;
+ QString m_pattern;
+};
+
+
+#endif /* AWKEYOPERATIONS_H */
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
index 39e0647..23ccd90 100644
--- a/sources/awesome-widget/plugin/awkeys.cpp
+++ b/sources/awesome-widget/plugin/awkeys.cpp
@@ -18,23 +18,16 @@
#include "awkeys.h"
#include
-#include
-#include
#include
-#include
#include
-#include
-#include
#include
#include "awdataaggregator.h"
#include "awdataengineaggregator.h"
#include "awdebug.h"
+#include "awkeyoperations.h"
#include "awkeysaggregator.h"
-#include "extquotes.h"
-#include "extscript.h"
-#include "extupgrade.h"
-#include "extweather.h"
+#include "awpatternfunctions.h"
#include "graphicalitem.h"
#include "version.h"
@@ -44,16 +37,18 @@ AWKeys::AWKeys(QObject *parent)
{
qSetMessagePattern(LOG_FORMAT);
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
- foreach (const QString metadata, getBuildData())
+ for (auto metadata : getBuildData())
qCDebug(LOG_AW) << metadata;
-#ifdef BUILD_FUTURE
// thread pool
m_threadPool = new QThreadPool(this);
-#endif /* BUILD_FUTURE */
aggregator = new AWKeysAggregator(this);
dataAggregator = new AWDataAggregator(this);
+ keyOperator = new AWKeyOperations(this);
+ // update key data if required
+ connect(keyOperator, SIGNAL(updateKeys(QStringList)), this,
+ SLOT(reinitKeys(QStringList)));
// transfer signal from AWDataAggregator object to QML ui
connect(dataAggregator, SIGNAL(toolTipPainted(const QString)), this,
SIGNAL(needToolTipToBeUpdated(const QString)));
@@ -65,18 +60,12 @@ AWKeys::~AWKeys()
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
- // extensions
- delete graphicalItems;
- delete extQuotes;
- delete extScripts;
- delete extUpgrade;
- delete extWeather;
-
// core
delete dataEngineAggregator;
delete m_threadPool;
delete aggregator;
delete dataAggregator;
+ delete keyOperator;
}
@@ -91,23 +80,23 @@ void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
void AWKeys::initKeys(const QString currentPattern, const int interval,
const int limit)
{
- qCDebug(LOG_AW) << "Pattern" << currentPattern;
- qCDebug(LOG_AW) << "Interval" << interval;
- qCDebug(LOG_AW) << "Queue limit" << limit;
+ qCDebug(LOG_AW) << "Pattern" << currentPattern << "with interval"
+ << interval << "and queue limit" << limit;
// init
- m_pattern = currentPattern;
+ keyOperator->setPattern(currentPattern);
if (dataEngineAggregator == nullptr) {
dataEngineAggregator = new AWDataEngineAggregator(this, interval);
connect(this, SIGNAL(dropSourceFromDataengine(QString)),
dataEngineAggregator, SLOT(dropSource(QString)));
+ // transfer signal from dataengine to update source list
+ connect(dataEngineAggregator, SIGNAL(deviceAdded(const QString &)),
+ keyOperator, SLOT(addDevice(const QString &)));
} else
dataEngineAggregator->setInterval(interval);
-#ifdef BUILD_FUTURE
m_threadPool->setMaxThreadCount(limit == 0 ? QThread::idealThreadCount()
: limit);
-#endif /* BUILD_FUTURE */
- updateCache();
+ keyOperator->updateCache();
return dataEngineAggregator->reconnectSources();
}
@@ -115,8 +104,7 @@ void AWKeys::initKeys(const QString currentPattern, const int interval,
void AWKeys::setAggregatorProperty(const QString key, const QVariant value)
{
- qCDebug(LOG_AW) << "Key" << key;
- qCDebug(LOG_AW) << "Value" << value;
+ qCDebug(LOG_AW) << "Key" << key << "with value" << value;
aggregator->setProperty(key.toUtf8().constData(), value);
}
@@ -132,172 +120,16 @@ void AWKeys::setWrapNewLines(const bool wrap)
void AWKeys::updateCache()
{
- // update network and hdd list
- addKeyToCache(QString("hdd"));
- addKeyToCache(QString("net"));
+ return keyOperator->updateCache();
}
QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
{
- qCDebug(LOG_AW) << "Should be sorted" << sorted;
- qCDebug(LOG_AW) << "Filter" << regexp;
-
- QStringList allKeys;
- // weather
- for (int i = extWeather->activeItems().count() - 1; i >= 0; i--) {
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("weatherId")));
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("weather")));
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("humidity")));
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("pressure")));
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("temperature")));
- allKeys.append(
- extWeather->activeItems().at(i)->tag(QString("timestamp")));
- }
- // time
- allKeys.append(QString("time"));
- allKeys.append(QString("isotime"));
- allKeys.append(QString("shorttime"));
- allKeys.append(QString("longtime"));
- allKeys.append(QString("ctime"));
- // uptime
- allKeys.append(QString("uptime"));
- allKeys.append(QString("cuptime"));
- // cpuclock & cpu
- for (int i = QThread::idealThreadCount() - 1; i >= 0; i--) {
- allKeys.append(QString("cpucl%1").arg(i));
- allKeys.append(QString("cpu%1").arg(i));
- }
- allKeys.append(QString("cpucl"));
- allKeys.append(QString("cpu"));
- // temperature
- for (int i = m_devices[QString("temp")].count() - 1; i >= 0; i--)
- allKeys.append(QString("temp%1").arg(i));
- // gputemp
- allKeys.append(QString("gputemp"));
- // gpu
- allKeys.append(QString("gpu"));
- // memory
- allKeys.append(QString("memmb"));
- allKeys.append(QString("memgb"));
- allKeys.append(QString("memfreemb"));
- allKeys.append(QString("memfreegb"));
- allKeys.append(QString("memtotmb"));
- allKeys.append(QString("memtotgb"));
- allKeys.append(QString("memusedmb"));
- allKeys.append(QString("memusedgb"));
- allKeys.append(QString("mem"));
- // swap
- allKeys.append(QString("swapmb"));
- allKeys.append(QString("swapgb"));
- allKeys.append(QString("swapfreemb"));
- allKeys.append(QString("swapfreegb"));
- allKeys.append(QString("swaptotmb"));
- allKeys.append(QString("swaptotgb"));
- allKeys.append(QString("swap"));
- // hdd
- for (int i = m_devices[QString("mount")].count() - 1; i >= 0; i--) {
- allKeys.append(QString("hddmb%1").arg(i));
- allKeys.append(QString("hddgb%1").arg(i));
- allKeys.append(QString("hddfreemb%1").arg(i));
- allKeys.append(QString("hddfreegb%1").arg(i));
- allKeys.append(QString("hddtotmb%1").arg(i));
- allKeys.append(QString("hddtotgb%1").arg(i));
- allKeys.append(QString("hdd%1").arg(i));
- }
- // hdd speed
- for (int i = m_devices[QString("disk")].count() - 1; i >= 0; i--) {
- allKeys.append(QString("hddr%1").arg(i));
- allKeys.append(QString("hddw%1").arg(i));
- }
- // hdd temp
- for (int i = m_devices[QString("hdd")].count() - 1; i >= 0; i--)
- allKeys.append(QString("hddtemp%1").arg(i));
- // network
- for (int i = m_devices[QString("net")].count() - 1; i >= 0; i--) {
- allKeys.append(QString("downunits%1").arg(i));
- allKeys.append(QString("upunits%1").arg(i));
- allKeys.append(QString("downkb%1").arg(i));
- allKeys.append(QString("down%1").arg(i));
- allKeys.append(QString("upkb%1").arg(i));
- allKeys.append(QString("up%1").arg(i));
- }
- allKeys.append(QString("downunits"));
- allKeys.append(QString("upunits"));
- allKeys.append(QString("downkb"));
- allKeys.append(QString("down"));
- allKeys.append(QString("upkb"));
- allKeys.append(QString("up"));
- allKeys.append(QString("netdev"));
- // battery
- allKeys.append(QString("ac"));
- QStringList allBatteryDevices
- = QDir(QString("/sys/class/power_supply"))
- .entryList(QStringList() << QString("BAT*"),
- QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
- for (int i = allBatteryDevices.count() - 1; i >= 0; i--)
- allKeys.append(QString("bat%1").arg(i));
- allKeys.append(QString("bat"));
- // player
- allKeys.append(QString("album"));
- allKeys.append(QString("artist"));
- allKeys.append(QString("duration"));
- allKeys.append(QString("progress"));
- allKeys.append(QString("title"));
- allKeys.append(QString("dalbum"));
- allKeys.append(QString("dartist"));
- allKeys.append(QString("dtitle"));
- allKeys.append(QString("salbum"));
- allKeys.append(QString("sartist"));
- allKeys.append(QString("stitle"));
- // ps
- allKeys.append(QString("pscount"));
- allKeys.append(QString("pstotal"));
- allKeys.append(QString("ps"));
- // package manager
- for (int i = extUpgrade->activeItems().count() - 1; i >= 0; i--)
- allKeys.append(
- extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
- // quotes
- for (int i = extQuotes->activeItems().count() - 1; i >= 0; i--) {
- allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask")));
- allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg")));
- allKeys.append(
- extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
- allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid")));
- allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg")));
- allKeys.append(
- extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
- allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price")));
- allKeys.append(
- extQuotes->activeItems().at(i)->tag(QString("pricechg")));
- allKeys.append(
- extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
- }
- // custom
- for (int i = extScripts->activeItems().count() - 1; i >= 0; i--)
- allKeys.append(extScripts->activeItems().at(i)->tag(QString("custom")));
- // desktop
- allKeys.append(QString("desktop"));
- allKeys.append(QString("ndesktop"));
- allKeys.append(QString("tdesktops"));
- // load average
- allKeys.append(QString("la15"));
- allKeys.append(QString("la5"));
- allKeys.append(QString("la1"));
- // bars
- QStringList graphicalItemsKeys;
- foreach (GraphicalItem *item, graphicalItems->items())
- graphicalItemsKeys.append(item->tag());
- graphicalItemsKeys.sort();
- for (int i = graphicalItemsKeys.count() - 1; i >= 0; i--)
- allKeys.append(graphicalItemsKeys.at(i));
+ qCDebug(LOG_AW) << "Should be sorted" << sorted << "and filter applied"
+ << regexp;
+ QStringList allKeys = keyOperator->dictKeys();
// sort if required
if (sorted)
allKeys.sort();
@@ -308,7 +140,7 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
QStringList AWKeys::getHddDevices() const
{
- QStringList devices = m_devices[QString("hdd")];
+ QStringList devices = keyOperator->devices(QString("hdd"));
// required by selector in the UI
devices.insert(0, QString("disable"));
devices.insert(0, QString("auto"));
@@ -319,60 +151,16 @@ QStringList AWKeys::getHddDevices() const
QString AWKeys::infoByKey(QString key) const
{
- qCDebug(LOG_AW) << "Requested key" << key;
+ qCDebug(LOG_AW) << "Requested info for key" << key;
- key.remove(QRegExp(QString("^bar[0-9]{1,}")));
- if (key.startsWith(QString("custom")))
- return extScripts->itemByTagNumber(
- key.remove(QString("custom")).toInt())
- ->uniq();
- else if (key.contains(QRegExp(QString("^hdd[rw]"))))
- return QString("%1").arg(m_devices[QString(
- "disk")][key.remove(QRegExp(QString("hdd[rw]"))).toInt()]);
- else if (key.contains(QRegExp(
- QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))))
- return QString("%1").arg(m_devices[QString(
- "mount")][key
- .remove(QRegExp(QString(
- "^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))
- .toInt()]);
- else if (key.startsWith(QString("hddtemp")))
- return QString("%1").arg(
- m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()]);
- else if (key.contains(QRegExp(QString("^(down|up)[0-9]"))))
- return QString("%1").arg(m_devices[QString(
- "net")][key.remove(QRegExp(QString("^(down|up)"))).toInt()]);
- else if (key.startsWith(QString("pkgcount")))
- return extUpgrade->itemByTagNumber(
- key.remove(QString("pkgcount")).toInt())
- ->uniq();
- else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))))
- return extQuotes->itemByTagNumber(
- key.remove(QRegExp(QString(
- "(^|perc)(ask|bid|price)(chg|)")))
- .toInt())
- ->uniq();
- else if (key.contains(QRegExp(
- QString("(weather|weatherId|humidity|pressure|temperature)"))))
- return extWeather
- ->itemByTagNumber(
- key
- .remove(QRegExp(QString(
- "(weather|weatherId|humidity|pressure|temperature)")))
- .toInt())
- ->uniq();
- else if (key.startsWith(QString("temp")))
- return QString("%1").arg(
- m_devices[QString("temp")][key.remove(QString("temp")).toInt()]);
-
- return QString("(none)");
+ return keyOperator->infoByKey(key);
}
// HACK this method requires to define tag value from bar from UI interface
QString AWKeys::valueByKey(QString key) const
{
- qCDebug(LOG_AW) << "Requested key" << key;
+ qCDebug(LOG_AW) << "Requested value for key" << key;
return values.value(key.remove(QRegExp(QString("^bar[0-9]{1,}"))),
QString(""));
@@ -383,41 +171,7 @@ void AWKeys::editItem(const QString type)
{
qCDebug(LOG_AW) << "Item type" << type;
- if (type == QString("graphicalitem")) {
- graphicalItems->setConfigArgs(dictKeys(
- true, QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")));
- return graphicalItems->editItems();
- } else if (type == QString("extquotes")) {
- return extQuotes->editItems();
- } else if (type == QString("extscript")) {
- return extScripts->editItems();
- } else if (type == QString("extupgrade")) {
- return extUpgrade->editItems();
- } else if (type == QString("extweather")) {
- return extWeather->editItems();
- }
-}
-
-
-void AWKeys::addDevice(const QString source)
-{
- qCDebug(LOG_AW) << "Source" << source;
-
- QRegExp diskRegexp
- = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
- QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel"));
-
- if (source.contains(diskRegexp)) {
- QString device = source;
- device.remove(QString("/Rate/rblk"));
- addKeyToCache(QString("disk"), device);
- } else if (source.contains(mountRegexp)) {
- QString device = source;
- device.remove(QString("partitions")).remove(QString("/filllevel"));
- addKeyToCache(QString("mount"), device);
- } else if (source.startsWith(QString("lmsensors"))) {
- addKeyToCache(QString("temp"), source);
- }
+ return keyOperator->editItem(type);
}
@@ -430,210 +184,48 @@ void AWKeys::dataUpdated(const QString &sourceName,
return emit(needToBeUpdated());
}
-#ifdef BUILD_FUTURE
// run concurrent data update
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sourceName,
data);
-#else /* BUILD_FUTURE */
- return setDataBySource(sourceName, data);
-#endif /* BUILD_FUTURE */
}
-void AWKeys::loadKeysFromCache()
+void AWKeys::reinitKeys(const QStringList currentKeys)
{
- QString fileName = QString("%1/awesomewidgets.ndx")
- .arg(QStandardPaths::writableLocation(
- QStandardPaths::GenericCacheLocation));
- qCInfo(LOG_AW) << "Cache file" << fileName;
- QSettings cache(fileName, QSettings::IniFormat);
-
- foreach (QString group, cache.childGroups()) {
- cache.beginGroup(group);
- m_devices.remove(group);
- foreach (QString key, cache.allKeys())
- m_devices[group].append(cache.value(key).toString());
- cache.endGroup();
- }
-
- return reinitKeys();
-}
-
-
-void AWKeys::reinitKeys()
-{
- // renew extensions
- // delete them if any
- delete graphicalItems;
- graphicalItems = nullptr;
- delete extQuotes;
- extQuotes = nullptr;
- delete extScripts;
- extScripts = nullptr;
- delete extUpgrade;
- extUpgrade = nullptr;
- delete extWeather;
- extWeather = nullptr;
- // create
- graphicalItems
- = new ExtItemAggregator(nullptr, QString("desktops"));
- extQuotes = new ExtItemAggregator(nullptr, QString("quotes"));
- extScripts = new ExtItemAggregator(nullptr, QString("scripts"));
- extUpgrade = new ExtItemAggregator(nullptr, QString("upgrade"));
- extWeather = new ExtItemAggregator(nullptr, QString("weather"));
-
- // init
- QStringList allKeys = dictKeys();
-
-#ifdef BUILD_TESTING
- // not documented feature - place all available tags
- m_pattern = m_pattern.replace(QString("$ALL"), [allKeys]() {
- QStringList strings;
- foreach (QString tag, allKeys)
- strings.append(QString("%1: $%1").arg(tag));
- return strings.join(QString(" | "));
- }());
-#endif /* BUILD_TESTING */
+ qCDebug(LOG_AW) << "Update found keys by using list" << currentKeys;
// append lists
- // bars
- m_foundBars = [allKeys](QString pattern) {
- QStringList selectedKeys;
- foreach (QString key, allKeys)
- if ((key.startsWith(QString("bar")))
- && (pattern.contains(QString("$%1").arg(key)))) {
- qCInfo(LOG_AW) << "Found bar" << key;
- selectedKeys.append(key);
- }
- if (selectedKeys.isEmpty())
- qCWarning(LOG_AW) << "No bars found";
- return selectedKeys;
- }(m_pattern);
-
- // main key list
- m_foundKeys = [allKeys](QString pattern) {
- QStringList selectedKeys;
- foreach (QString key, allKeys)
- if ((!key.startsWith(QString("bar")))
- && (pattern.contains(QString("$%1").arg(key)))) {
- qCInfo(LOG_AW) << "Found key" << key;
- selectedKeys.append(key);
- }
- if (selectedKeys.isEmpty())
- qCWarning(LOG_AW) << "No keys found";
- return selectedKeys;
- }(m_pattern);
-
- // lambdas
- m_foundLambdas = [](QString pattern) {
- QStringList selectedKeys;
- // substring inside ${{ }} (with brackets) which should not contain ${{
- QRegularExpression lambdaRegexp(
- QString("\\$\\{\\{((?!\\$\\{\\{).)*?\\}\\}"));
- lambdaRegexp.setPatternOptions(
- QRegularExpression::DotMatchesEverythingOption);
-
- QRegularExpressionMatchIterator it = lambdaRegexp.globalMatch(pattern);
- while (it.hasNext()) {
- QRegularExpressionMatch match = it.next();
- QString lambda = match.captured();
- // drop brakets
- lambda.remove(QRegExp(QString("^\\$\\{\\{")));
- lambda.remove(QRegExp(QString("\\}\\}$")));
- // append
- qCInfo(LOG_AW) << "Found lambda" << lambda;
- selectedKeys.append(lambda);
- }
- if (selectedKeys.isEmpty())
- qCWarning(LOG_AW) << "No lambdas found";
- return selectedKeys;
- }(m_pattern);
+ m_foundBars
+ = AWPatternFunctions::findBars(keyOperator->pattern(), currentKeys);
+ m_foundKeys
+ = AWPatternFunctions::findKeys(keyOperator->pattern(), currentKeys);
+ m_foundLambdas = AWPatternFunctions::findLambdas(keyOperator->pattern());
// set key data to aggregator
- aggregator->setDevices(m_devices);
+ aggregator->setDevices(keyOperator->devices());
}
void AWKeys::updateTextData()
{
-#ifdef BUILD_FUTURE
QFuture text = QtConcurrent::run(m_threadPool, [this]() {
calculateValues();
- return parsePattern(m_pattern);
+ return parsePattern(keyOperator->pattern());
});
-#else /* BUILD_FUTURE */
- calculateValues();
- QString text = parsePattern(m_pattern);
-#endif /* BUILD_FUTURE */
emit(needTextToBeUpdated(text));
emit(dataAggregator->updateData(values));
}
-void AWKeys::addKeyToCache(const QString type, const QString key)
-{
- qCDebug(LOG_AW) << "Key type" << type;
- qCDebug(LOG_AW) << "Key" << key;
-
- QString fileName = QString("%1/awesomewidgets.ndx")
- .arg(QStandardPaths::writableLocation(
- QStandardPaths::GenericCacheLocation));
- qCInfo(LOG_AW) << "Cache file" << fileName;
- QSettings cache(fileName, QSettings::IniFormat);
-
- cache.beginGroup(type);
- QStringList cachedValues;
- foreach (QString key, cache.allKeys())
- cachedValues.append(cache.value(key).toString());
-
- if (type == QString("hdd")) {
- QStringList allDevices
- = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
- QStringList devices
- = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
- foreach (QString dev, devices) {
- QString device = QString("/dev/%1").arg(dev);
- if (cachedValues.contains(device))
- continue;
- qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
- cache.setValue(
- QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
- device);
- }
- } else if (type == QString("net")) {
- QList rawInterfaceList
- = QNetworkInterface::allInterfaces();
- foreach (QNetworkInterface interface, rawInterfaceList) {
- QString device = interface.name();
- if (cachedValues.contains(device))
- continue;
- qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
- cache.setValue(
- QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
- device);
- }
- } else {
- if (cachedValues.contains(key))
- return;
- qCInfo(LOG_AW) << "Found new key" << key << "for type" << type;
- cache.setValue(
- QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), key);
- }
- cache.endGroup();
-
- cache.sync();
- return loadKeysFromCache();
-}
-
-
// HACK this method is required since I could not define some values by using
// specified pattern. Usually they are values which depend on several others
void AWKeys::calculateValues()
{
// hddtot*
- foreach (QString device, m_devices[QString("mount")]) {
- int index = m_devices[QString("mount")].indexOf(device);
+ QStringList mountDevices = keyOperator->devices(QString("mount"));
+ for (auto device : mountDevices) {
+ int index = mountDevices.indexOf(device);
values[QString("hddtotmb%1").arg(index)] = QString("%1").arg(
values[QString("hddfreemb%1").arg(index)].toFloat()
+ values[QString("hddmb%1").arg(index)].toFloat(),
@@ -660,7 +252,8 @@ void AWKeys::calculateValues()
5, 'f', 1);
// up, down, upkb, downkb, upunits, downunits
- int netIndex = m_devices[QString("net")].indexOf(values[QString("netdev")]);
+ int netIndex = keyOperator->devices(QString("net"))
+ .indexOf(values[QString("netdev")]);
values[QString("down")] = values[QString("down%1").arg(netIndex)];
values[QString("downkb")] = values[QString("downkb%1").arg(netIndex)];
values[QString("downunits")] = values[QString("downunits%1").arg(netIndex)];
@@ -684,12 +277,12 @@ void AWKeys::calculateValues()
5, 'f', 1);
// lambdas
- foreach (QString key, m_foundLambdas)
+ for (auto key : m_foundLambdas)
values[key] = [this](QString key) {
QJSEngine engine;
// apply $this values
key.replace(QString("$this"), values[key]);
- foreach (QString lambdaKey, m_foundKeys)
+ for (auto lambdaKey : m_foundKeys)
key.replace(QString("$%1").arg(lambdaKey), values[lambdaKey]);
qCInfo(LOG_AW) << "Expression" << key;
QJSValue result = engine.evaluate(key);
@@ -708,14 +301,14 @@ void AWKeys::calculateValues()
QString AWKeys::parsePattern(QString pattern) const
{
// screen sign
- pattern.replace(QString("$$"), QString("$\\$\\"));
+ pattern.replace(QString("$$"), QString(0x1d));
// lambdas
- foreach (QString key, m_foundLambdas)
+ for (auto key : m_foundLambdas)
pattern.replace(QString("${{%1}}").arg(key), values[key]);
// main keys
- foreach (QString key, m_foundKeys)
+ for (auto key : m_foundKeys)
pattern.replace(QString("$%1").arg(key),
[](QString key, QString value) {
if ((!key.startsWith(QString("custom")))
@@ -725,8 +318,8 @@ QString AWKeys::parsePattern(QString pattern) const
}(key, values[key]));
// bars
- foreach (QString bar, m_foundBars) {
- GraphicalItem *item = graphicalItems->itemByTag(bar);
+ for (auto bar : m_foundBars) {
+ GraphicalItem *item = keyOperator->giByKey(bar);
QString key = bar;
key.remove(QRegExp(QString("^bar[0-9]{1,}")));
if (item->type() == GraphicalItem::Graph)
@@ -739,7 +332,7 @@ QString AWKeys::parsePattern(QString pattern) const
}
// prepare strings
- pattern.replace(QString("$\\$\\"), QString("$$"));
+ pattern.replace(QString(0x1d), QString("$"));
if (m_wrapNewLines)
pattern.replace(QString("\n"), QString("
"));
@@ -749,8 +342,7 @@ QString AWKeys::parsePattern(QString pattern) const
void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
{
- qCDebug(LOG_AW) << "Source" << sourceName;
- qCDebug(LOG_AW) << "Data" << data;
+ qCDebug(LOG_AW) << "Source" << sourceName << "with data" << data;
// first list init
QStringList tags = aggregator->keysFromSource(sourceName);
@@ -758,25 +350,18 @@ void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
tags = aggregator->registerSource(sourceName,
data[QString("units")].toString());
- // update data or drop source if there are no matches
+ // update data or drop source if there are no matches and exit
if (tags.isEmpty()) {
- qCDebug(LOG_AW) << "Source" << sourceName << "not found";
- emit(dropSourceFromDataengine(sourceName));
- } else {
-#ifdef BUILD_FUTURE
- m_mutex.lock();
-#endif /* BUILD_FUTURE */
- // HACK workaround for time values which are stored in the different
- // path
- QVariant value = sourceName == QString("Local")
- ? data[QString("DateTime")]
- : data[QString("value")];
- std::for_each(tags.cbegin(), tags.cend(),
- [this, value](const QString tag) {
- values[tag] = aggregator->formater(value, tag);
- });
-#ifdef BUILD_FUTURE
- m_mutex.unlock();
-#endif /* BUILD_FUTURE */
+ qCInfo(LOG_AW) << "Source" << sourceName << "not found";
+ return emit(dropSourceFromDataengine(sourceName));
}
+
+ m_mutex.lock();
+ // HACK workaround for time values which are stored in the different path
+ QVariant value = sourceName == QString("Local") ? data[QString("DateTime")]
+ : data[QString("value")];
+ std::for_each(tags.cbegin(), tags.cend(), [this, value](const QString tag) {
+ values[tag] = aggregator->formater(value, tag);
+ });
+ m_mutex.unlock();
}
diff --git a/sources/awesome-widget/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h
index a8300f1..c3c0ff9 100644
--- a/sources/awesome-widget/plugin/awkeys.h
+++ b/sources/awesome-widget/plugin/awkeys.h
@@ -24,17 +24,11 @@
#include
#include
-#include "extitemaggregator.h"
-
class AWDataAggregator;
class AWDataEngineAggregator;
+class AWKeyOperations;
class AWKeysAggregator;
-class ExtQuotes;
-class ExtScript;
-class ExtUpgrade;
-class ExtWeather;
-class GraphicalItem;
class QThreadPool;
class AWKeys : public QObject
@@ -50,6 +44,8 @@ public:
Q_INVOKABLE void setAggregatorProperty(const QString key,
const QVariant value);
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
+ // additional method to force load keys from Qml UI. Used in some
+ // configuration pages
Q_INVOKABLE void updateCache();
// keys
Q_INVOKABLE QStringList dictKeys(const bool sorted = false,
@@ -62,7 +58,6 @@ public:
Q_INVOKABLE void editItem(const QString type);
public slots:
- void addDevice(const QString source);
void dataUpdated(const QString &sourceName,
const Plasma::DataEngine::Data &data);
// dummy method required by DataEngine connections
@@ -75,13 +70,11 @@ signals:
void needToBeUpdated();
private slots:
- void loadKeysFromCache();
- void reinitKeys();
+ void reinitKeys(const QStringList currentKeys);
void updateTextData();
private:
// methods
- void addKeyToCache(const QString type, const QString key = QString(""));
void calculateValues();
QString parsePattern(QString pattern) const;
void setDataBySource(const QString &sourceName, const QVariantMap &data);
@@ -89,15 +82,9 @@ private:
AWDataAggregator *dataAggregator = nullptr;
AWDataEngineAggregator *dataEngineAggregator = nullptr;
AWKeysAggregator *aggregator = nullptr;
- ExtItemAggregator *graphicalItems = nullptr;
- ExtItemAggregator *extQuotes = nullptr;
- ExtItemAggregator *extScripts = nullptr;
- ExtItemAggregator *extUpgrade = nullptr;
- ExtItemAggregator *extWeather = nullptr;
+ AWKeyOperations *keyOperator = nullptr;
// variables
- QHash m_devices;
QStringList m_foundBars, m_foundKeys, m_foundLambdas;
- QString m_pattern;
QHash values;
bool m_wrapNewLines = false;
// multithread features
diff --git a/sources/awesome-widget/plugin/awkeysaggregator.cpp b/sources/awesome-widget/plugin/awkeysaggregator.cpp
index 0ac20a1..f846b72 100644
--- a/sources/awesome-widget/plugin/awkeysaggregator.cpp
+++ b/sources/awesome-widget/plugin/awkeysaggregator.cpp
@@ -42,8 +42,7 @@ AWKeysAggregator::~AWKeysAggregator()
QString AWKeysAggregator::formater(const QVariant &data,
const QString &key) const
{
- qCDebug(LOG_AW) << "Data" << data;
- qCDebug(LOG_AW) << "Key" << key;
+ qCDebug(LOG_AW) << "Data" << data << "for key" << key;
QString output;
QLocale loc = m_translate ? QLocale::system() : QLocale::c();
@@ -102,7 +101,7 @@ QString AWKeysAggregator::formater(const QVariant &data,
case TimeCustom:
output = m_customTime;
[&output, loc, this](const QDateTime dt) {
- foreach (QString key, timeKeys)
+ for (auto key : timeKeys)
output.replace(QString("$%1").arg(key), loc.toString(dt, key));
}(data.toDateTime());
break;
@@ -135,7 +134,7 @@ QString AWKeysAggregator::formater(const QVariant &data,
return source;
}(m_formater[key] == Uptime ? QString("$ddd$hhh$mmm")
: m_customUptime,
- data.toFloat());
+ static_cast(data.toFloat()));
break;
case NoFormat:
default:
@@ -155,6 +154,15 @@ QStringList AWKeysAggregator::keysFromSource(const QString &source) const
}
+QStringList
+AWKeysAggregator::requiredByKeysFromSource(const QString &source) const
+{
+ qCDebug(LOG_AW) << "Search for source" << source;
+
+ return m_requiredByMap.values(source);
+}
+
+
void AWKeysAggregator::setAcOffline(const QString inactive)
{
qCDebug(LOG_AW) << "Inactive AC string" << inactive;
@@ -216,8 +224,7 @@ void AWKeysAggregator::setTranslate(const bool translate)
QStringList AWKeysAggregator::registerSource(const QString &source,
const QString &units)
{
- qCDebug(LOG_AW) << "Source" << source;
- qCDebug(LOG_AW) << "Units" << units;
+ qCDebug(LOG_AW) << "Source" << source << "with units" << units;
// regular expressions
QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad"));
@@ -331,6 +338,11 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
key = QString("hddfreegb%1").arg(index);
m_map.insertMulti(source, key);
m_formater[key] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source,
+ QString("hddtotmb%1").arg(index));
+ m_requiredByMap.insertMulti(source,
+ QString("hddtotgb%1").arg(index));
}
} else if (source.contains(mountUsedRegExp)) {
// used
@@ -346,6 +358,11 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
key = QString("hddgb%1").arg(index);
m_map.insertMulti(source, key);
m_formater[key] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source,
+ QString("hddtotmb%1").arg(index));
+ m_requiredByMap.insertMulti(source,
+ QString("hddtotgb%1").arg(index));
}
} else if (source.startsWith(QString("hdd/temperature"))) {
// hdd temperature
@@ -372,6 +389,8 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
// gb
m_map.insertMulti(source, QString("memgb"));
m_formater[QString("memgb")] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("mem"));
} else if (source == QString("mem/physical/free")) {
// free memory
// mb
@@ -380,6 +399,10 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
// gb
m_map.insertMulti(source, QString("memfreegb"));
m_formater[QString("memfreegb")] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("memtotmb"));
+ m_requiredByMap.insertMulti(source, QString("memtotgb"));
+ m_requiredByMap.insertMulti(source, QString("mem"));
} else if (source == QString("mem/physical/used")) {
// used memory
// mb
@@ -388,10 +411,21 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
// gb
m_map.insertMulti(source, QString("memusedgb"));
m_formater[QString("memusedgb")] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("memtotmb"));
+ m_requiredByMap.insertMulti(source, QString("memtotgb"));
+ m_requiredByMap.insertMulti(source, QString("mem"));
} else if (source == QString("network/current/name")) {
// network device
m_map[source] = QString("netdev");
m_formater[QString("netdev")] = NoFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("down"));
+ m_requiredByMap.insertMulti(source, QString("downkb"));
+ m_requiredByMap.insertMulti(source, QString("downunits"));
+ m_requiredByMap.insertMulti(source, QString("up"));
+ m_requiredByMap.insertMulti(source, QString("upkb"));
+ m_requiredByMap.insertMulti(source, QString("upunits"));
} else if (source.contains(netRegExp)) {
// network speed
QString type = source.contains(QString("receiver")) ? QString("down")
@@ -412,6 +446,13 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
m_map.insertMulti(source, key);
m_formater[key] = NetSmartUnits;
}
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("%1").arg(type));
+ m_requiredByMap.insertMulti(source, QString("%1kb").arg(type));
+ m_requiredByMap.insertMulti(source, QString("%1units").arg(type));
+ m_requiredByMap.insertMulti(source, QString("%1").arg(type));
+ m_requiredByMap.insertMulti(source, QString("%1kb").arg(type));
+ m_requiredByMap.insertMulti(source, QString("%1units").arg(type));
} else if (source.startsWith(QString("upgrade"))) {
// package manager
QString key = source;
@@ -450,6 +491,10 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
// gb
m_map.insertMulti(source, QString("swapfreegb"));
m_formater[QString("swapfreegb")] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("swaptotmb"));
+ m_requiredByMap.insertMulti(source, QString("swaptotgb"));
+ m_requiredByMap.insertMulti(source, QString("swap"));
} else if (source == QString("mem/swap/used")) {
// used swap
// mb
@@ -458,6 +503,10 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
// gb
m_map.insertMulti(source, QString("swapgb"));
m_formater[QString("swapgb")] = MemGBFormat;
+ // fill required by list
+ m_requiredByMap.insertMulti(source, QString("swaptotmb"));
+ m_requiredByMap.insertMulti(source, QString("swaptotgb"));
+ m_requiredByMap.insertMulti(source, QString("swap"));
} else if (source.startsWith(QString("lmsensors/"))) {
// temperature
int index = m_devices[QString("temp")].indexOf(source);
diff --git a/sources/awesome-widget/plugin/awkeysaggregator.h b/sources/awesome-widget/plugin/awkeysaggregator.h
index f808d03..37bfc77 100644
--- a/sources/awesome-widget/plugin/awkeysaggregator.h
+++ b/sources/awesome-widget/plugin/awkeysaggregator.h
@@ -67,6 +67,7 @@ public:
// get methods
QString formater(const QVariant &data, const QString &key) const;
QStringList keysFromSource(const QString &source) const;
+ QStringList requiredByKeysFromSource(const QString &source) const;
// set methods
void setAcOffline(const QString inactive);
void setAcOnline(const QString active);
@@ -90,6 +91,7 @@ private:
QHash m_devices;
QHash m_formater;
QHash m_map;
+ QHash m_requiredByMap;
QString m_tempUnits;
bool m_translate = false;
};
diff --git a/sources/awesome-widget/plugin/awpatternfunctions.cpp b/sources/awesome-widget/plugin/awpatternfunctions.cpp
new file mode 100644
index 0000000..60e9b30
--- /dev/null
+++ b/sources/awesome-widget/plugin/awpatternfunctions.cpp
@@ -0,0 +1,267 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+#include "awpatternfunctions.h"
+
+#include
+#include
+
+#include "awdebug.h"
+
+
+QVariantList AWPatternFunctions::findFunctionCalls(const QString function,
+ const QString code)
+{
+ qCDebug(LOG_AW) << "Looking for function" << function << "in" << code;
+
+ // I suggest the following regex for the internal functions
+ // $aw_function_name{{function body}}
+ // * args should be always comma separated (e.g. commas are not supported
+ // in this field if they are not screened by $, i.e. '$,'
+ // * body depends on the function name, double brackets (i.e. {{ or }}) are
+ // not supported
+ QRegularExpression regex(
+ QString("\\$%1\\<(?.*?)\\>\\{\\{(?.*?)\\}\\}")
+ .arg(function));
+ regex.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
+
+ QVariantList foundFunctions;
+ QRegularExpressionMatchIterator it = regex.globalMatch(code);
+ while (it.hasNext()) {
+ QRegularExpressionMatch match = it.next();
+
+ QVariantHash metadata;
+ // work with args
+ QString argsString = match.captured(QString("args"));
+ if (argsString.isEmpty()) {
+ metadata[QString("args")] = QStringList();
+ } else {
+ // replace '$,' to 0x1d
+ argsString.replace(QString("$,"), QString(0x1d));
+ QStringList args = argsString.split(QChar(','));
+ std::for_each(args.begin(), args.end(), [](QString &arg) {
+ arg.replace(QString(0x1d), QString(","));
+ });
+ metadata[QString("args")] = args;
+ }
+ // other variables
+ metadata[QString("body")] = match.captured(QString("body"));
+ metadata[QString("what")] = match.captured();
+ foundFunctions.append(metadata);
+ }
+
+ return foundFunctions;
+}
+
+
+QString AWPatternFunctions::expandTemplates(QString code)
+{
+ qCDebug(LOG_AW) << "Expand templates in" << code;
+
+ // match the following construction $template{{some code here}}
+ QRegularExpression templatesRegexp(
+ QString("\\$template\\{\\{(?.*?)\\}\\}"));
+ templatesRegexp.setPatternOptions(
+ QRegularExpression::DotMatchesEverythingOption);
+
+ QRegularExpressionMatchIterator it = templatesRegexp.globalMatch(code);
+ while (it.hasNext()) {
+ QRegularExpressionMatch match = it.next();
+ QString body = match.captured(QString("body"));
+
+ QJSEngine engine;
+ qCInfo(LOG_AW) << "Expression" << body;
+ QJSValue result = engine.evaluate(body);
+ QString templateResult = QString("");
+ if (result.isError()) {
+ qCWarning(LOG_AW) << "Uncaught exception at line"
+ << result.property("lineNumber").toInt() << ":"
+ << result.toString();
+ } else {
+ templateResult = result.toString();
+ }
+
+ // replace template
+ code.replace(match.captured(), templateResult);
+ }
+
+ return code;
+}
+
+
+QString AWPatternFunctions::insertAllKeys(QString code, const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
+ << keys;
+
+ QVariantList found
+ = AWPatternFunctions::findFunctionCalls(QString("aw_all"), code);
+ for (auto function : found) {
+ QVariantHash metadata = function.toHash();
+ QString separator
+ = metadata[QString("args")].toStringList().isEmpty()
+ ? QString(",")
+ : metadata[QString("args")].toStringList().at(0);
+ QStringList required
+ = keys.filter(QRegExp(metadata[QString("body")].toString()));
+ std::for_each(required.begin(), required.end(), [](QString &value) {
+ value = QString("%1: $%1").arg(value);
+ });
+
+ code.replace(metadata[QString("what")].toString(),
+ required.join(separator));
+ }
+
+ return code;
+}
+
+
+QString AWPatternFunctions::insertKeyCount(QString code, const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for count in code" << code << "using list"
+ << keys;
+
+ QVariantList found
+ = AWPatternFunctions::findFunctionCalls(QString("aw_count"), code);
+ for (auto function : found) {
+ QVariantHash metadata = function.toHash();
+ int count = keys.filter(QRegExp(metadata[QString("body")].toString()))
+ .count();
+
+ code.replace(metadata[QString("what")].toString(),
+ QString::number(count));
+ }
+
+ return code;
+}
+
+
+QString AWPatternFunctions::insertKeyNames(QString code, const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for key names in code" << code << "using list"
+ << keys;
+
+ QVariantList found
+ = AWPatternFunctions::findFunctionCalls(QString("aw_names"), code);
+ for (auto function : found) {
+ QVariantHash metadata = function.toHash();
+ QString separator
+ = metadata[QString("args")].toStringList().isEmpty()
+ ? QString(",")
+ : metadata[QString("args")].toStringList().at(0);
+ QStringList required
+ = keys.filter(QRegExp(metadata[QString("body")].toString()));
+
+ code.replace(metadata[QString("what")].toString(),
+ required.join(separator));
+ }
+
+ return code;
+}
+
+
+QString AWPatternFunctions::insertKeys(QString code, const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
+ << keys;
+
+ QVariantList found
+ = AWPatternFunctions::findFunctionCalls(QString("aw_keys"), code);
+ for (auto function : found) {
+ QVariantHash metadata = function.toHash();
+ QString separator
+ = metadata[QString("args")].toStringList().isEmpty()
+ ? QString(",")
+ : metadata[QString("args")].toStringList().at(0);
+ QStringList required
+ = keys.filter(QRegExp(metadata[QString("body")].toString()));
+ std::for_each(required.begin(), required.end(), [](QString &value) {
+ value = QString("$%1").arg(value);
+ });
+
+ code.replace(metadata[QString("what")].toString(),
+ required.join(separator));
+ }
+
+ return code;
+}
+
+
+QStringList AWPatternFunctions::findBars(const QString code,
+ const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for bars in code" << code << "using list"
+ << keys;
+
+ QStringList selectedKeys;
+ for (auto key : keys)
+ if ((key.startsWith(QString("bar")))
+ && (code.contains(QString("$%1").arg(key)))) {
+ qCInfo(LOG_AW) << "Found bar" << key;
+ selectedKeys.append(key);
+ }
+ if (selectedKeys.isEmpty())
+ qCWarning(LOG_AW) << "No bars found";
+
+ return selectedKeys;
+}
+
+
+QStringList AWPatternFunctions::findKeys(const QString code,
+ const QStringList keys)
+{
+ qCDebug(LOG_AW) << "Looking for keys in code" << code << "using list"
+ << keys;
+
+ QStringList selectedKeys;
+ for (auto key : keys)
+ if ((!key.startsWith(QString("bar")))
+ && (code.contains(QString("$%1").arg(key)))) {
+ qCInfo(LOG_AW) << "Found key" << key;
+ selectedKeys.append(key);
+ }
+ if (selectedKeys.isEmpty())
+ qCWarning(LOG_AW) << "No keys found";
+
+ return selectedKeys;
+}
+
+
+QStringList AWPatternFunctions::findLambdas(const QString code)
+{
+ qCDebug(LOG_AW) << "Looking for lambdas in code" << code;
+
+ QStringList selectedKeys;
+ // match the following construction ${{some code here}}
+ QRegularExpression lambdaRegexp(QString("\\$\\{\\{(?.*?)\\}\\}"));
+ lambdaRegexp.setPatternOptions(
+ QRegularExpression::DotMatchesEverythingOption);
+
+ QRegularExpressionMatchIterator it = lambdaRegexp.globalMatch(code);
+ while (it.hasNext()) {
+ QRegularExpressionMatch match = it.next();
+ QString lambda = match.captured(QString("body"));
+
+ // append
+ qCInfo(LOG_AW) << "Found lambda" << lambda;
+ selectedKeys.append(lambda);
+ }
+ if (selectedKeys.isEmpty())
+ qCWarning(LOG_AW) << "No lambdas found";
+
+ return selectedKeys;
+}
diff --git a/sources/awesome-widget/plugin/awpatternfunctions.h b/sources/awesome-widget/plugin/awpatternfunctions.h
new file mode 100644
index 0000000..d5d362f
--- /dev/null
+++ b/sources/awesome-widget/plugin/awpatternfunctions.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * This file is part of awesome-widgets *
+ * *
+ * awesome-widgets is free software: you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * awesome-widgets is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
+ ***************************************************************************/
+
+
+#ifndef AWPATTERNFUNCTIONS_H
+#define AWPATTERNFUNCTIONS_H
+
+#include
+#include
+
+
+namespace AWPatternFunctions
+{
+// insert methods
+QString expandTemplates(QString code);
+QVariantList findFunctionCalls(const QString function, const QString code);
+QString insertAllKeys(QString code, const QStringList keys);
+QString insertKeyCount(QString code, const QStringList keys);
+QString insertKeyNames(QString code, const QStringList keys);
+QString insertKeys(QString code, const QStringList keys);
+// find methods
+QStringList findBars(const QString code, const QStringList keys);
+QStringList findKeys(const QString code, const QStringList keys);
+QStringList findLambdas(const QString code);
+};
+
+
+#endif /* AWPATTERNFUNCTIONS_H */
diff --git a/sources/awesomewidgets/abstractextitem.cpp b/sources/awesomewidgets/abstractextitem.cpp
index 4249bc5..6691f10 100644
--- a/sources/awesomewidgets/abstractextitem.cpp
+++ b/sources/awesomewidgets/abstractextitem.cpp
@@ -33,8 +33,9 @@ AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName,
, m_dirs(directories)
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
- qCDebug(LOG_LIB) << "Desktop name" << desktopName;
- qCDebug(LOG_LIB) << "Directories" << directories;
+
+ qCDebug(LOG_LIB) << "Desktop name" << desktopName << "directories"
+ << directories;
m_name = m_fileName;
}
@@ -193,14 +194,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;
diff --git a/sources/awesomewidgets/abstractextitemaggregator.cpp b/sources/awesomewidgets/abstractextitemaggregator.cpp
index a9159e9..69113c7 100644
--- a/sources/awesomewidgets/abstractextitemaggregator.cpp
+++ b/sources/awesomewidgets/abstractextitemaggregator.cpp
@@ -91,10 +91,8 @@ void AbstractExtItemAggregator::setConfigArgs(const QVariant _configArgs)
}
-void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *item)
+void AbstractExtItemAggregator::editItemActivated(QListWidgetItem *)
{
- Q_UNUSED(item)
-
return editItem();
}
diff --git a/sources/awesomewidgets/abstractextitemaggregator.h b/sources/awesomewidgets/abstractextitemaggregator.h
index c10b202..54724a2 100644
--- a/sources/awesomewidgets/abstractextitemaggregator.h
+++ b/sources/awesomewidgets/abstractextitemaggregator.h
@@ -48,7 +48,7 @@ public:
void setConfigArgs(const QVariant _configArgs);
private slots:
- void editItemActivated(QListWidgetItem *item);
+ void editItemActivated(QListWidgetItem *);
void editItemButtonPressed(QAbstractButton *button);
private:
diff --git a/sources/awesomewidgets/awesomewidgets-extweather-ids.json b/sources/awesomewidgets/awesomewidgets-extweather-ids.json
index 094ce99..69f9085 100644
--- a/sources/awesomewidgets/awesomewidgets-extweather-ids.json
+++ b/sources/awesomewidgets/awesomewidgets-extweather-ids.json
@@ -1,139 +1,113 @@
{
- "__url": "http://openweathermap.org/weather-conditions",
+ "__url": "https://developer.yahoo.com/weather/documentation.html",
"image": {
"__comment": "should be described as html image with full path inside",
- "default": "",
+ "default": "
",
- "800": "
",
-
- "801": "
",
-
- "802": "
",
- "803": "
",
-
- "804": "
",
-
- "300": "
",
- "301": "
",
- "302": "
",
- "310": "
",
- "311": "
",
- "312": "
",
- "313": "
",
- "314": "
",
- "321": "
",
- "520": "
",
- "521": "
",
- "522": "
",
- "531": "
",
-
- "500": "
",
- "501": "
",
- "502": "
",
- "503": "
",
- "504": "
",
-
- "200": "
",
- "201": "
",
- "202": "
",
- "210": "
",
- "211": "
",
- "212": "
",
- "221": "
",
- "230": "
",
- "231": "
",
- "232": "
",
-
- "511": "
",
- "600": "
",
- "601": "
",
- "602": "
",
- "611": "
",
- "612": "
",
- "615": "
",
- "616": "
",
- "620": "
",
- "621": "
",
- "622": "
",
-
- "701": "
",
- "711": "
",
- "721": "
",
- "731": "
",
- "741": "
",
- "751": "
",
- "761": "
",
- "762": "
",
- "771": "
",
- "781": "
"
+ "0": "
",
+ "1": "
",
+ "2": "
",
+ "3": "
",
+ "4": "
",
+ "5": "
",
+ "6": "
",
+ "7": "
",
+ "8": "
",
+ "9": "
",
+ "10": "
",
+ "11": "
",
+ "12": "
",
+ "13": "
",
+ "14": "
",
+ "15": "
",
+ "16": "
",
+ "17": "
",
+ "18": "
",
+ "19": "
",
+ "20": "
",
+ "21": "
",
+ "22": "
",
+ "23": "
",
+ "24": "
",
+ "25": "
",
+ "26": "
",
+ "27": "
",
+ "28": "
",
+ "29": "
",
+ "30": "
",
+ "31": "
",
+ "32": "
",
+ "33": "
",
+ "34": "
",
+ "35": "
",
+ "36": "
",
+ "37": "
",
+ "38": "
",
+ "39": "
",
+ "40": "
",
+ "41": "
",
+ "42": "
",
+ "43": "
",
+ "44": "
",
+ "45": "
",
+ "46": "
",
+ "47": "
",
+ "3200": "
"
},
"text": {
"default": "\u2604",
+ "3200": "\u2604",
- "800": "\u2600",
-
- "801": "\u26C5",
-
- "802": "\u2601",
- "803": "\u2601",
-
- "804": "\u2601",
-
- "300": "\u2602",
- "301": "\u2602",
- "302": "\u2602",
- "310": "\u2602",
- "311": "\u2602",
- "312": "\u2602",
- "313": "\u2602",
- "314": "\u2602",
- "321": "\u2602",
- "520": "\u2602",
- "521": "\u2602",
- "522": "\u2602",
- "531": "\u2602",
-
- "500": "\u2614",
- "501": "\u2614",
- "502": "\u2614",
- "503": "\u2614",
- "504": "\u2614",
-
- "200": "\u2608",
- "201": "\u2608",
- "202": "\u2608",
- "210": "\u2608",
- "211": "\u2608",
- "212": "\u2608",
- "221": "\u2608",
- "230": "\u2608",
- "231": "\u2608",
- "232": "\u2608",
-
- "511": "\u2603",
- "600": "\u2603",
- "601": "\u2603",
- "602": "\u2603",
- "611": "\u2603",
- "612": "\u2603",
- "615": "\u2603",
- "616": "\u2603",
- "620": "\u2603",
- "621": "\u2603",
- "622": "\u2603",
-
- "701": "\u26C5",
- "711": "\u26C5",
- "721": "\u26C5",
- "731": "\u26C5",
- "741": "\u26C5",
- "751": "\u26C5",
- "761": "\u26C5",
- "762": "\u26C5",
- "771": "\u26C5",
- "781": "\u26C5"
+ "0": "\u2604",
+ "1": "\u2604",
+ "2": "\u2604",
+ "3": "\u26C8",
+ "4": "\u26C8",
+ "5": "\u2614",
+ "6": "\u2614",
+ "7": "\u2614",
+ "8": "\u2614",
+ "9": "\u2614",
+ "10": "\u2614",
+ "11": "\u2614",
+ "12": "\u2614",
+ "13": "\u26C4",
+ "14": "\u26C7",
+ "15": "\u26C7",
+ "16": "\u2614",
+ "17": "\u2614",
+ "18": "\u2614",
+ "19": "\u26C5",
+ "20": "\u26C5",
+ "21": "\u26C5",
+ "22": "\u26C5",
+ "23": "\u26C5",
+ "24": "\u26C5",
+ "25": "\u26C5",
+ "26": "\u2601",
+ "27": "\u2601",
+ "28": "\u2601",
+ "29": "\u2601",
+ "30": "\u2601",
+ "31": "\u263D",
+ "32": "\u2600",
+ "33": "\u263D",
+ "34": "\u2600",
+ "35": "\u2614",
+ "36": "\u2600",
+ "37": "\u26C8",
+ "38": "\u26C8",
+ "39": "\u26C8",
+ "40": "\u26C7",
+ "41": "\u26C7",
+ "42": "\u26C7",
+ "43": "\u26C7",
+ "44": "\u2601",
+ "45": "\u26C8",
+ "46": "\u26C7",
+ "47": "\u26C8"
}
}
diff --git a/sources/awesomewidgets/extitemaggregator.h b/sources/awesomewidgets/extitemaggregator.h
index ecb4f1d..5e0b9ea 100644
--- a/sources/awesomewidgets/extitemaggregator.h
+++ b/sources/awesomewidgets/extitemaggregator.h
@@ -37,8 +37,9 @@ public:
{
qSetMessagePattern(LOG_FORMAT);
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
- foreach (const QString metadata, getBuildData())
+ for (auto metadata : getBuildData())
qCDebug(LOG_LIB) << metadata;
+
qCDebug(LOG_LIB) << "Type" << type;
initItems();
@@ -66,7 +67,7 @@ public:
qCDebug(LOG_LIB) << "Tag" << _tag;
T *found = nullptr;
- foreach (T *item, m_items) {
+ for (auto item : m_items) {
if (item->tag() != _tag)
continue;
found = item;
@@ -83,7 +84,7 @@ public:
qCDebug(LOG_LIB) << "Number" << _number;
T *found = nullptr;
- foreach (T *item, m_items) {
+ for (auto item : m_items) {
if (item->number() != _number)
continue;
found = item;
@@ -102,7 +103,7 @@ public:
return nullptr;
T *found = nullptr;
- foreach (T *item, m_items) {
+ for (auto item : m_items) {
if (item->fileName() != widgetItem->text())
continue;
found = item;
@@ -120,7 +121,7 @@ public:
int uniqNumber() const
{
QList tagList;
- foreach (T *item, m_items)
+ for (auto item : m_items)
tagList.append(item->number());
int number = 0;
while (tagList.contains(number))
@@ -152,9 +153,9 @@ private:
QStandardPaths::LocateDirectory);
QStringList names;
QList items;
- foreach (QString dir, dirs) {
+ for (auto dir : dirs) {
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
- foreach (QString file, files) {
+ for (auto file : files) {
if ((!file.endsWith(QString(".desktop")))
|| (names.contains(file)))
continue;
@@ -177,7 +178,7 @@ private:
m_activeItems.clear();
m_items = getItems();
- foreach (T *item, m_items) {
+ for (auto item : m_items) {
if (!item->isActive())
continue;
m_activeItems.append(item);
@@ -187,7 +188,7 @@ private:
void repaint()
{
widgetDialog->clear();
- foreach (T *_item, m_items) {
+ for (auto _item : m_items) {
QListWidgetItem *item
= new QListWidgetItem(_item->fileName(), widgetDialog);
QStringList tooltip;
diff --git a/sources/awesomewidgets/extquotes.cpp b/sources/awesomewidgets/extquotes.cpp
index dc26994..49e9725 100644
--- a/sources/awesomewidgets/extquotes.cpp
+++ b/sources/awesomewidgets/extquotes.cpp
@@ -150,7 +150,7 @@ QVariantHash ExtQuotes::run()
qCInfo(LOG_LIB) << "Send request";
isRunning = true;
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
- new QReplyTimeout(reply, 1000);
+ new QReplyTimeout(reply, REQUEST_TIMEOUT);
}
// update value
@@ -208,8 +208,8 @@ void ExtQuotes::writeConfiguration() const
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
{
- qCDebug(LOG_LIB) << "Return code" << reply->error();
- qCDebug(LOG_LIB) << "Reply error message" << reply->errorString();
+ qCDebug(LOG_LIB) << "Return code" << reply->error() << "with message"
+ << reply->errorString();
isRunning = false;
QJsonParseError error;
@@ -279,8 +279,7 @@ get quotes for the instrument. Refer to \
QString ExtQuotes::url() const
{
- QString apiUrl = QString(YAHOO_URL);
- apiUrl.replace(QString("$TICKER"), m_ticker);
+ QString apiUrl = QString(YAHOO_QUOTES_URL).arg(m_ticker);
qCInfo(LOG_LIB) << "API url" << apiUrl;
return apiUrl;
diff --git a/sources/awesomewidgets/extquotes.h b/sources/awesomewidgets/extquotes.h
index c271b8c..0c16351 100644
--- a/sources/awesomewidgets/extquotes.h
+++ b/sources/awesomewidgets/extquotes.h
@@ -22,10 +22,10 @@
#include "abstractextitem.h"
-#define YAHOO_URL \
+#define YAHOO_QUOTES_URL \
"https://query.yahooapis.com/v1/public/yql?q=select * from " \
"yahoo.finance.quotes where " \
- "symbol=\"$TICKER\"&env=store://datatables.org/" \
+ "symbol=\"%1\"&env=store://datatables.org/" \
"alltableswithkeys&format=json"
diff --git a/sources/awesomewidgets/extscript.cpp b/sources/awesomewidgets/extscript.cpp
index 51ed024..6c114a0 100644
--- a/sources/awesomewidgets/extscript.cpp
+++ b/sources/awesomewidgets/extscript.cpp
@@ -64,8 +64,7 @@ ExtScript::~ExtScript()
ExtScript *ExtScript::copy(const QString _fileName, const int _number)
{
- qCDebug(LOG_LIB) << "File" << _fileName;
- qCDebug(LOG_LIB) << "Number" << _number;
+ qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
ExtScript *item = new ExtScript(static_cast(parent()), _fileName,
directories());
@@ -188,7 +187,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 +195,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());
}
@@ -206,8 +205,7 @@ QString ExtScript::applyFilters(QString _value) const
void ExtScript::updateFilter(const QString _filter, const bool _add)
{
- qCDebug(LOG_LIB) << "Filter" << _filter;
- qCDebug(LOG_LIB) << "Should be added" << _add;
+ qCDebug(LOG_LIB) << "Should be added filters" << _add << "from" << _filter;
if (_add) {
if (m_filters.contains(_filter))
diff --git a/sources/awesomewidgets/extupgrade.cpp b/sources/awesomewidgets/extupgrade.cpp
index 06b9515..2fe6a4f 100644
--- a/sources/awesomewidgets/extupgrade.cpp
+++ b/sources/awesomewidgets/extupgrade.cpp
@@ -60,8 +60,7 @@ ExtUpgrade::~ExtUpgrade()
ExtUpgrade *ExtUpgrade::copy(const QString _fileName, const int _number)
{
- qCDebug(LOG_LIB) << "File" << _fileName;
- qCDebug(LOG_LIB) << "Number" << _number;
+ qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
ExtUpgrade *item = new ExtUpgrade(static_cast(parent()),
_fileName, directories());
diff --git a/sources/awesomewidgets/extweather.cpp b/sources/awesomewidgets/extweather.cpp
index 6245af4..8e865d5 100644
--- a/sources/awesomewidgets/extweather.cpp
+++ b/sources/awesomewidgets/extweather.cpp
@@ -74,8 +74,7 @@ ExtWeather::~ExtWeather()
ExtWeather *ExtWeather::copy(const QString _fileName, const int _number)
{
- qCDebug(LOG_LIB) << "File" << _fileName;
- qCDebug(LOG_LIB) << "Number" << _number;
+ qCDebug(LOG_LIB) << "File" << _fileName << "number" << _number;
ExtWeather *item = new ExtWeather(static_cast(parent()),
_fileName, directories());
@@ -235,9 +234,8 @@ QVariantHash ExtWeather::run()
if (times == 1) {
qCInfo(LOG_LIB) << "Send request";
isRunning = true;
- QNetworkReply *reply
- = manager->get(QNetworkRequest(QUrl(url(m_ts != 0))));
- new QReplyTimeout(reply, 1000);
+ QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
+ new QReplyTimeout(reply, REQUEST_TIMEOUT);
}
// update value
@@ -305,7 +303,7 @@ void ExtWeather::writeConfiguration() const
void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
{
- qCDebug(LOG_LIB) << "Return code" << reply->error();
+ qCDebug(LOG_LIB) << "Return code" << reply->error() << "with messa";
qCDebug(LOG_LIB) << "Reply error message" << reply->errorString();
isRunning = false;
@@ -319,51 +317,52 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
}
// convert to map
- QVariantMap json = jsonDoc.toVariant().toMap();
- if (json[QString("cod")].toInt() != 200) {
- qCWarning(LOG_LIB) << "Invalid OpenWeatherMap return code"
- << json[QString("cod")].toInt();
+ QVariantMap json = jsonDoc.toVariant().toMap()[QString("query")].toMap();
+ if (json[QString("count")].toInt() != 1) {
+ qCWarning(LOG_LIB) << "Found data count"
+ << json[QString("count")].toInt() << "is not 1";
return;
}
+ QVariantMap results
+ = json[QString("results")].toMap()[QString("channel")].toMap();
+ QVariantMap item = results[QString("item")].toMap();
- QVariantHash data;
if (m_ts == 0) {
- data = parseSingleJson(json);
+ // current weather
+ int id = item[QString("condition")].toMap()[QString("code")].toInt();
+ values[tag(QString("weatherId"))] = id;
+ values[tag(QString("weather"))] = weatherFromInt(id);
+ values[tag(QString("temperature"))]
+ = item[QString("condition")].toMap()[QString("temp")].toInt();
+ values[tag(QString("timestamp"))]
+ = item[QString("condition")].toMap()[QString("date")].toString();
+ values[tag(QString("humidity"))] = results[QString("atmosphere")]
+ .toMap()[QString("humidity")]
+ .toInt();
+ values[tag(QString("pressure"))]
+ = static_cast(results[QString("atmosphere")]
+ .toMap()[QString("pressure")]
+ .toFloat());
} else {
- QVariantList list = json[QString("list")].toList();
- data = parseSingleJson(list.count() <= m_ts ? list.at(m_ts - 1).toMap()
- : list.last().toMap());
+ // forecast weather
+ QVariantList weatherList = item[QString("forecast")].toList();
+ QVariantMap weatherMap = weatherList.count() < m_ts
+ ? weatherList.last().toMap()
+ : weatherList.at(m_ts).toMap();
+ int id = weatherMap[QString("code")].toInt();
+ values[tag(QString("weatherId"))] = id;
+ values[tag(QString("weather"))] = weatherFromInt(id);
+ values[tag(QString("timestamp"))]
+ = weatherMap[QString("date")].toString();
+ // yahoo provides high and low temperatures. Lets calculate average one
+ values[tag(QString("temperature"))]
+ = (weatherMap[QString("high")].toFloat()
+ + weatherMap[QString("low")].toFloat())
+ / 2.0;
+ // ... and no forecast data for humidity and pressure
+ values[tag(QString("humidity"))] = 0;
+ values[tag(QString("pressure"))] = 0.0;
}
- foreach (QString key, data.keys())
- values[tag(key)] = data[key];
-}
-
-
-QVariantHash ExtWeather::parseSingleJson(const QVariantMap json) const
-{
- qCDebug(LOG_LIB) << "Single json data" << json;
-
- QVariantHash output;
-
- // weather status
- QVariantList weather = json[QString("weather")].toList();
- if (!weather.isEmpty()) {
- int _id = weather.first().toMap()[QString("id")].toInt();
- output[QString("weatherId")] = _id;
- output[QString("weather")] = weatherFromInt(_id);
- }
-
- // main data
- QVariantMap mainWeather = json[QString("main")].toMap();
- if (!weather.isEmpty()) {
- output[QString("humidity")]
- = mainWeather[QString("humidity")].toFloat();
- output[QString("pressure")]
- = mainWeather[QString("pressure")].toFloat();
- output[QString("temperature")] = mainWeather[QString("temp")].toFloat();
- }
-
- return output;
}
@@ -381,13 +380,10 @@ void ExtWeather::translate()
}
-QString ExtWeather::url(const bool isForecast) const
+QString ExtWeather::url() const
{
- qCDebug(LOG_LIB) << "Is forecast" << isForecast;
- QString apiUrl = isForecast ? QString(OWM_FORECAST_URL) : QString(OWM_URL);
- apiUrl.replace(QString("$CITY"), m_city);
- apiUrl.replace(QString("$COUNTRY"), m_country);
+ QString apiUrl = QString(YAHOO_WEATHER_URL).arg(m_city).arg(m_country);
qCInfo(LOG_LIB) << "API url" << apiUrl;
return apiUrl;
diff --git a/sources/awesomewidgets/extweather.h b/sources/awesomewidgets/extweather.h
index 0639314..eafac3e 100644
--- a/sources/awesomewidgets/extweather.h
+++ b/sources/awesomewidgets/extweather.h
@@ -22,12 +22,10 @@
#include "abstractextitem.h"
-#define OWM_URL \
- "http://api.openweathermap.org/data/2.5/" \
- "weather?q=$CITY,$COUNTRY&units=metric"
-#define OWM_FORECAST_URL \
- "http://api.openweathermap.org/data/2.5/" \
- "forecast?q=$CITY,$COUNTRY&units=metric"
+#define YAHOO_WEATHER_URL \
+ "https://query.yahooapis.com/v1/public/yql?format=json&q=select * from " \
+ "weather.forecast where u='c' and woeid in (select woeid from " \
+ "geo.places(1) where text='%1, %2')"
namespace Ui
@@ -76,9 +74,8 @@ private:
QNetworkAccessManager *manager;
bool isRunning = false;
Ui::ExtWeather *ui;
- QVariantHash parseSingleJson(const QVariantMap json) const;
void translate();
- QString url(const bool isForecast = false) const;
+ QString url() const;
// properties
QString m_city = QString("London");
QString m_country = QString("uk");
diff --git a/sources/awesomewidgets/graphicalitem.cpp b/sources/awesomewidgets/graphicalitem.cpp
index 1f4cabf..843da2b 100644
--- a/sources/awesomewidgets/graphicalitem.cpp
+++ b/sources/awesomewidgets/graphicalitem.cpp
@@ -65,8 +65,7 @@ GraphicalItem::~GraphicalItem()
GraphicalItem *GraphicalItem::copy(const QString _fileName, const int _number)
{
- qCDebug(LOG_LIB) << "File" << _fileName;
- qCDebug(LOG_LIB) << "Number" << _number;
+ qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number;
GraphicalItem *item = new GraphicalItem(static_cast(parent()),
_fileName, directories());
diff --git a/sources/awesomewidgets/weather/0.gif b/sources/awesomewidgets/weather/0.gif
new file mode 100644
index 0000000..7db0580
Binary files /dev/null and b/sources/awesomewidgets/weather/0.gif differ
diff --git a/sources/awesomewidgets/weather/01d.png b/sources/awesomewidgets/weather/01d.png
deleted file mode 100644
index 7d2f792..0000000
Binary files a/sources/awesomewidgets/weather/01d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/02d.png b/sources/awesomewidgets/weather/02d.png
deleted file mode 100644
index d86a99c..0000000
Binary files a/sources/awesomewidgets/weather/02d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/03d.png b/sources/awesomewidgets/weather/03d.png
deleted file mode 100644
index 8a4a8e9..0000000
Binary files a/sources/awesomewidgets/weather/03d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/04d.png b/sources/awesomewidgets/weather/04d.png
deleted file mode 100644
index 4677b85..0000000
Binary files a/sources/awesomewidgets/weather/04d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/09d.png b/sources/awesomewidgets/weather/09d.png
deleted file mode 100644
index b7cb53b..0000000
Binary files a/sources/awesomewidgets/weather/09d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/1.gif b/sources/awesomewidgets/weather/1.gif
new file mode 100644
index 0000000..bdf5a7a
Binary files /dev/null and b/sources/awesomewidgets/weather/1.gif differ
diff --git a/sources/awesomewidgets/weather/10.gif b/sources/awesomewidgets/weather/10.gif
new file mode 100644
index 0000000..94673cb
Binary files /dev/null and b/sources/awesomewidgets/weather/10.gif differ
diff --git a/sources/awesomewidgets/weather/10d.png b/sources/awesomewidgets/weather/10d.png
deleted file mode 100644
index b1e1f83..0000000
Binary files a/sources/awesomewidgets/weather/10d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/11.gif b/sources/awesomewidgets/weather/11.gif
new file mode 100644
index 0000000..15290ec
Binary files /dev/null and b/sources/awesomewidgets/weather/11.gif differ
diff --git a/sources/awesomewidgets/weather/11d.png b/sources/awesomewidgets/weather/11d.png
deleted file mode 100644
index f3ce654..0000000
Binary files a/sources/awesomewidgets/weather/11d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/12.gif b/sources/awesomewidgets/weather/12.gif
new file mode 100644
index 0000000..2f412db
Binary files /dev/null and b/sources/awesomewidgets/weather/12.gif differ
diff --git a/sources/awesomewidgets/weather/13.gif b/sources/awesomewidgets/weather/13.gif
new file mode 100644
index 0000000..4befd50
Binary files /dev/null and b/sources/awesomewidgets/weather/13.gif differ
diff --git a/sources/awesomewidgets/weather/13d.png b/sources/awesomewidgets/weather/13d.png
deleted file mode 100644
index 7b64a6c..0000000
Binary files a/sources/awesomewidgets/weather/13d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/14.gif b/sources/awesomewidgets/weather/14.gif
new file mode 100644
index 0000000..b68e55a
Binary files /dev/null and b/sources/awesomewidgets/weather/14.gif differ
diff --git a/sources/awesomewidgets/weather/15.gif b/sources/awesomewidgets/weather/15.gif
new file mode 100644
index 0000000..9918287
Binary files /dev/null and b/sources/awesomewidgets/weather/15.gif differ
diff --git a/sources/awesomewidgets/weather/16.gif b/sources/awesomewidgets/weather/16.gif
new file mode 100644
index 0000000..f805f62
Binary files /dev/null and b/sources/awesomewidgets/weather/16.gif differ
diff --git a/sources/awesomewidgets/weather/17.gif b/sources/awesomewidgets/weather/17.gif
new file mode 100644
index 0000000..7db0580
Binary files /dev/null and b/sources/awesomewidgets/weather/17.gif differ
diff --git a/sources/awesomewidgets/weather/18.gif b/sources/awesomewidgets/weather/18.gif
new file mode 100644
index 0000000..e8f808b
Binary files /dev/null and b/sources/awesomewidgets/weather/18.gif differ
diff --git a/sources/awesomewidgets/weather/19.gif b/sources/awesomewidgets/weather/19.gif
new file mode 100644
index 0000000..7e142dc
Binary files /dev/null and b/sources/awesomewidgets/weather/19.gif differ
diff --git a/sources/awesomewidgets/weather/2.gif b/sources/awesomewidgets/weather/2.gif
new file mode 100644
index 0000000..bdf5a7a
Binary files /dev/null and b/sources/awesomewidgets/weather/2.gif differ
diff --git a/sources/awesomewidgets/weather/20.gif b/sources/awesomewidgets/weather/20.gif
new file mode 100644
index 0000000..0aa42a2
Binary files /dev/null and b/sources/awesomewidgets/weather/20.gif differ
diff --git a/sources/awesomewidgets/weather/21.gif b/sources/awesomewidgets/weather/21.gif
new file mode 100644
index 0000000..47b0015
Binary files /dev/null and b/sources/awesomewidgets/weather/21.gif differ
diff --git a/sources/awesomewidgets/weather/22.gif b/sources/awesomewidgets/weather/22.gif
new file mode 100644
index 0000000..a79aafc
Binary files /dev/null and b/sources/awesomewidgets/weather/22.gif differ
diff --git a/sources/awesomewidgets/weather/23.gif b/sources/awesomewidgets/weather/23.gif
new file mode 100644
index 0000000..66daadb
Binary files /dev/null and b/sources/awesomewidgets/weather/23.gif differ
diff --git a/sources/awesomewidgets/weather/24.gif b/sources/awesomewidgets/weather/24.gif
new file mode 100644
index 0000000..66daadb
Binary files /dev/null and b/sources/awesomewidgets/weather/24.gif differ
diff --git a/sources/awesomewidgets/weather/25.gif b/sources/awesomewidgets/weather/25.gif
new file mode 100644
index 0000000..6d8e2a1
Binary files /dev/null and b/sources/awesomewidgets/weather/25.gif differ
diff --git a/sources/awesomewidgets/weather/26.gif b/sources/awesomewidgets/weather/26.gif
new file mode 100644
index 0000000..8ed0378
Binary files /dev/null and b/sources/awesomewidgets/weather/26.gif differ
diff --git a/sources/awesomewidgets/weather/27.gif b/sources/awesomewidgets/weather/27.gif
new file mode 100644
index 0000000..17461bd
Binary files /dev/null and b/sources/awesomewidgets/weather/27.gif differ
diff --git a/sources/awesomewidgets/weather/28.gif b/sources/awesomewidgets/weather/28.gif
new file mode 100644
index 0000000..7b14b7a
Binary files /dev/null and b/sources/awesomewidgets/weather/28.gif differ
diff --git a/sources/awesomewidgets/weather/29.gif b/sources/awesomewidgets/weather/29.gif
new file mode 100644
index 0000000..3669d6f
Binary files /dev/null and b/sources/awesomewidgets/weather/29.gif differ
diff --git a/sources/awesomewidgets/weather/3.gif b/sources/awesomewidgets/weather/3.gif
new file mode 100644
index 0000000..7db0580
Binary files /dev/null and b/sources/awesomewidgets/weather/3.gif differ
diff --git a/sources/awesomewidgets/weather/30.gif b/sources/awesomewidgets/weather/30.gif
new file mode 100644
index 0000000..8178a2e
Binary files /dev/null and b/sources/awesomewidgets/weather/30.gif differ
diff --git a/sources/awesomewidgets/weather/31.gif b/sources/awesomewidgets/weather/31.gif
new file mode 100644
index 0000000..e0c709f
Binary files /dev/null and b/sources/awesomewidgets/weather/31.gif differ
diff --git a/sources/awesomewidgets/weather/32.gif b/sources/awesomewidgets/weather/32.gif
new file mode 100644
index 0000000..203ad8b
Binary files /dev/null and b/sources/awesomewidgets/weather/32.gif differ
diff --git a/sources/awesomewidgets/weather/3200.gif b/sources/awesomewidgets/weather/3200.gif
new file mode 100644
index 0000000..e23b248
Binary files /dev/null and b/sources/awesomewidgets/weather/3200.gif differ
diff --git a/sources/awesomewidgets/weather/33.gif b/sources/awesomewidgets/weather/33.gif
new file mode 100644
index 0000000..f67352d
Binary files /dev/null and b/sources/awesomewidgets/weather/33.gif differ
diff --git a/sources/awesomewidgets/weather/34.gif b/sources/awesomewidgets/weather/34.gif
new file mode 100644
index 0000000..8e593e9
Binary files /dev/null and b/sources/awesomewidgets/weather/34.gif differ
diff --git a/sources/awesomewidgets/weather/35.gif b/sources/awesomewidgets/weather/35.gif
new file mode 100644
index 0000000..7db0580
Binary files /dev/null and b/sources/awesomewidgets/weather/35.gif differ
diff --git a/sources/awesomewidgets/weather/36.gif b/sources/awesomewidgets/weather/36.gif
new file mode 100644
index 0000000..d7daaf4
Binary files /dev/null and b/sources/awesomewidgets/weather/36.gif differ
diff --git a/sources/awesomewidgets/weather/37.gif b/sources/awesomewidgets/weather/37.gif
new file mode 100644
index 0000000..75b00e5
Binary files /dev/null and b/sources/awesomewidgets/weather/37.gif differ
diff --git a/sources/awesomewidgets/weather/38.gif b/sources/awesomewidgets/weather/38.gif
new file mode 100644
index 0000000..75b00e5
Binary files /dev/null and b/sources/awesomewidgets/weather/38.gif differ
diff --git a/sources/awesomewidgets/weather/39.gif b/sources/awesomewidgets/weather/39.gif
new file mode 100644
index 0000000..2f412db
Binary files /dev/null and b/sources/awesomewidgets/weather/39.gif differ
diff --git a/sources/awesomewidgets/weather/4.gif b/sources/awesomewidgets/weather/4.gif
new file mode 100644
index 0000000..7db0580
Binary files /dev/null and b/sources/awesomewidgets/weather/4.gif differ
diff --git a/sources/awesomewidgets/weather/40.gif b/sources/awesomewidgets/weather/40.gif
new file mode 100644
index 0000000..2f412db
Binary files /dev/null and b/sources/awesomewidgets/weather/40.gif differ
diff --git a/sources/awesomewidgets/weather/41.gif b/sources/awesomewidgets/weather/41.gif
new file mode 100644
index 0000000..f805f62
Binary files /dev/null and b/sources/awesomewidgets/weather/41.gif differ
diff --git a/sources/awesomewidgets/weather/42.gif b/sources/awesomewidgets/weather/42.gif
new file mode 100644
index 0000000..f805f62
Binary files /dev/null and b/sources/awesomewidgets/weather/42.gif differ
diff --git a/sources/awesomewidgets/weather/43.gif b/sources/awesomewidgets/weather/43.gif
new file mode 100644
index 0000000..1db832e
Binary files /dev/null and b/sources/awesomewidgets/weather/43.gif differ
diff --git a/sources/awesomewidgets/weather/44.gif b/sources/awesomewidgets/weather/44.gif
new file mode 100644
index 0000000..8178a2e
Binary files /dev/null and b/sources/awesomewidgets/weather/44.gif differ
diff --git a/sources/awesomewidgets/weather/45.gif b/sources/awesomewidgets/weather/45.gif
new file mode 100644
index 0000000..5939640
Binary files /dev/null and b/sources/awesomewidgets/weather/45.gif differ
diff --git a/sources/awesomewidgets/weather/46.gif b/sources/awesomewidgets/weather/46.gif
new file mode 100644
index 0000000..55b5126
Binary files /dev/null and b/sources/awesomewidgets/weather/46.gif differ
diff --git a/sources/awesomewidgets/weather/47.gif b/sources/awesomewidgets/weather/47.gif
new file mode 100644
index 0000000..aac25aa
Binary files /dev/null and b/sources/awesomewidgets/weather/47.gif differ
diff --git a/sources/awesomewidgets/weather/5.gif b/sources/awesomewidgets/weather/5.gif
new file mode 100644
index 0000000..7881d41
Binary files /dev/null and b/sources/awesomewidgets/weather/5.gif differ
diff --git a/sources/awesomewidgets/weather/50d.png b/sources/awesomewidgets/weather/50d.png
deleted file mode 100644
index 18afb34..0000000
Binary files a/sources/awesomewidgets/weather/50d.png and /dev/null differ
diff --git a/sources/awesomewidgets/weather/6.gif b/sources/awesomewidgets/weather/6.gif
new file mode 100644
index 0000000..e8f808b
Binary files /dev/null and b/sources/awesomewidgets/weather/6.gif differ
diff --git a/sources/awesomewidgets/weather/7.gif b/sources/awesomewidgets/weather/7.gif
new file mode 100644
index 0000000..226e31f
Binary files /dev/null and b/sources/awesomewidgets/weather/7.gif differ
diff --git a/sources/awesomewidgets/weather/8.gif b/sources/awesomewidgets/weather/8.gif
new file mode 100644
index 0000000..63645a6
Binary files /dev/null and b/sources/awesomewidgets/weather/8.gif differ
diff --git a/sources/awesomewidgets/weather/9.gif b/sources/awesomewidgets/weather/9.gif
new file mode 100644
index 0000000..b08ac3b
Binary files /dev/null and b/sources/awesomewidgets/weather/9.gif differ
diff --git a/sources/desktop-panel/package/contents/ui/about.qml b/sources/desktop-panel/package/contents/ui/about.qml
index 3b29952..ba648f7 100644
--- a/sources/desktop-panel/package/contents/ui/about.qml
+++ b/sources/desktop-panel/package/contents/ui/about.qml
@@ -98,6 +98,15 @@ Item {
text: dpAdds.getAboutText("translators")
}
+ QtControls.Label {
+ QtLayouts.Layout.fillWidth: true
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignJustify
+ textFormat: Text.RichText
+ text: dpAdds.getAboutText("3rdparty")
+ onLinkActivated: Qt.openUrlExternally(link);
+ }
+
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
@@ -105,7 +114,7 @@ Item {
horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignTop
textFormat: Text.RichText
- text: dpAdds.getAboutText("3rdparty")
+ text: dpAdds.getAboutText("thanks")
onLinkActivated: Qt.openUrlExternally(link);
}
}
diff --git a/sources/desktop-panel/package/contents/ui/main.qml b/sources/desktop-panel/package/contents/ui/main.qml
index 684f05a..20f8732 100644
--- a/sources/desktop-panel/package/contents/ui/main.qml
+++ b/sources/desktop-panel/package/contents/ui/main.qml
@@ -113,7 +113,7 @@ Item {
for (var i=0; iaddLine(rect.left() + margin, rect.bottom() + margin,
rect.left() + margin, rect.top() + margin,
@@ -191,12 +191,11 @@ QString DPAdds::toolTipImage(const int desktop) const
QString DPAdds::parsePattern(const QString pattern, const int desktop) const
{
- qCDebug(LOG_DP) << "Pattern" << pattern;
- qCDebug(LOG_DP) << "Desktop number" << desktop;
+ qCDebug(LOG_DP) << "Pattern" << pattern << "for desktop" << desktop;
QString parsed = pattern;
parsed.replace(QString("$$"), QString("$\\$\\"));
- foreach (QString key, dictKeys())
+ for (auto key : dictKeys())
parsed.replace(QString("$%1").arg(key), valueByKey(key, desktop));
parsed.replace(QString("$\\$\\"), QString("$$"));
@@ -224,8 +223,7 @@ void DPAdds::setToolTipData(const QVariantMap tooltipData)
QString DPAdds::valueByKey(const QString key, int desktop) const
{
- qCDebug(LOG_DP) << "Requested key" << key;
- qCDebug(LOG_DP) << "Desktop number" << desktop;
+ qCDebug(LOG_DP) << "Requested key" << key << "for desktop" << desktop;
if (desktop == -1)
desktop = currentDesktop();
@@ -301,6 +299,14 @@ QString DPAdds::getAboutText(const QString type) const
.arg(trdPartyList.at(i).split(QChar(',')).at(1))
.arg(trdPartyList.at(i).split(QChar(',')).at(2));
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
+ } else if (type == QString("thanks")) {
+ QStringList thanks = QString(SPECIAL_THANKS)
+ .split(QChar(';'), QString::SkipEmptyParts);
+ for (int i = 0; i < thanks.count(); i++)
+ thanks[i] = QString("%1")
+ .arg(thanks.at(i).split(QChar(','))[0])
+ .arg(thanks.at(i).split(QChar(','))[1]);
+ text = i18n("Special thanks to %1", thanks.join(QString(", ")));
}
return text;
@@ -328,8 +334,7 @@ QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const
// to avoid additional object definition this method is static
void DPAdds::sendNotification(const QString eventId, const QString message)
{
- qCDebug(LOG_DP) << "Event" << eventId;
- qCDebug(LOG_DP) << "Message" << message;
+ qCDebug(LOG_DP) << "Event" << eventId << "with message" << message;
KNotification *notification = KNotification::event(
eventId, QString("Desktop Panel ::: %1").arg(eventId), message);
@@ -355,7 +360,7 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const
DesktopWindowsInfo info;
info.desktop = KWindowSystem::workArea(desktop);
- foreach (WId id, KWindowSystem::windows()) {
+ for (auto id : KWindowSystem::windows()) {
KWindowInfo winInfo = KWindowInfo(
id, NET::Property::WMDesktop | NET::Property::WMGeometry
| NET::Property::WMState | NET::Property::WMWindowType
diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp
index 019533e..818f9a3 100644
--- a/sources/extsysmon/extsysmon.cpp
+++ b/sources/extsysmon/extsysmon.cpp
@@ -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 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 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;
}
diff --git a/sources/extsysmon/extsysmonaggregator.cpp b/sources/extsysmon/extsysmonaggregator.cpp
index bd14e95..44f33cd 100644
--- a/sources/extsysmon/extsysmonaggregator.cpp
+++ b/sources/extsysmon/extsysmonaggregator.cpp
@@ -91,37 +91,37 @@ void ExtSysMonAggregator::init(const QHash config)
// battery
AbstractExtSysMonSource *batteryItem
= new BatterySource(this, QStringList() << config[QString("ACPIPATH")]);
- foreach (QString source, batteryItem->sources())
+ for (auto source : batteryItem->sources())
m_map[source] = batteryItem;
// custom
AbstractExtSysMonSource *customItem = new CustomSource(this, QStringList());
- foreach (QString source, customItem->sources())
+ for (auto source : customItem->sources())
m_map[source] = customItem;
// desktop
AbstractExtSysMonSource *desktopItem
= new DesktopSource(this, QStringList());
- foreach (QString source, desktopItem->sources())
+ for (auto source : desktopItem->sources())
m_map[source] = desktopItem;
// gpu load
AbstractExtSysMonSource *gpuLoadItem
= new GPULoadSource(this, QStringList() << config[QString("GPUDEV")]);
- foreach (QString source, gpuLoadItem->sources())
+ for (auto source : gpuLoadItem->sources())
m_map[source] = gpuLoadItem;
// gpu temperature
AbstractExtSysMonSource *gpuTempItem = new GPUTemperatureSource(
this, QStringList() << config[QString("GPUDEV")]);
- foreach (QString source, gpuTempItem->sources())
+ for (auto source : gpuTempItem->sources())
m_map[source] = gpuTempItem;
// hdd temperature
AbstractExtSysMonSource *hddTempItem = new HDDTemperatureSource(
this, QStringList() << config[QString("HDDDEV")]
<< config[QString("HDDTEMPCMD")]);
- foreach (QString source, hddTempItem->sources())
+ for (auto source : hddTempItem->sources())
m_map[source] = hddTempItem;
// network
AbstractExtSysMonSource *networkItem
= new NetworkSource(this, QStringList());
- foreach (QString source, networkItem->sources())
+ for (auto source : networkItem->sources())
m_map[source] = networkItem;
// player
AbstractExtSysMonSource *playerItem = new PlayerSource(
@@ -129,35 +129,35 @@ void ExtSysMonAggregator::init(const QHash config)
<< config[QString("PLAYER")] << config[QString("MPDADDRESS")]
<< config[QString("MPDPORT")] << config[QString("MPRIS")]
<< config[QString("PLAYERSYMBOLS")]);
- foreach (QString source, playerItem->sources())
+ for (auto source : playerItem->sources())
m_map[source] = playerItem;
// processes
AbstractExtSysMonSource *processesItem
= new ProcessesSource(this, QStringList());
- foreach (QString source, processesItem->sources())
+ for (auto source : processesItem->sources())
m_map[source] = processesItem;
// quotes
AbstractExtSysMonSource *quotesItem = new QuotesSource(this, QStringList());
- foreach (QString source, quotesItem->sources())
+ for (auto source : quotesItem->sources())
m_map[source] = quotesItem;
// update
AbstractExtSysMonSource *updateItem = new UpdateSource(this, QStringList());
- foreach (QString source, updateItem->sources())
+ for (auto source : updateItem->sources())
m_map[source] = updateItem;
// upgrade
AbstractExtSysMonSource *upgradeItem
= new UpgradeSource(this, QStringList());
- foreach (QString source, upgradeItem->sources())
+ for (auto source : upgradeItem->sources())
m_map[source] = upgradeItem;
// weather
AbstractExtSysMonSource *weatherItem
= new WeatherSource(this, QStringList());
- foreach (QString source, weatherItem->sources())
+ for (auto source : weatherItem->sources())
m_map[source] = weatherItem;
#ifdef BUILD_TESTING
// additional load source
AbstractExtSysMonSource *loadItem = new LoadSource(this, QStringList());
- foreach (QString source, loadItem->sources())
+ for (auto source : loadItem->sources())
m_map[source] = loadItem;
#endif /* BUILD_TESTING */
}
diff --git a/sources/extsysmon/sources/customsource.cpp b/sources/extsysmon/sources/customsource.cpp
index 68c9c7d..26ad6e8 100644
--- a/sources/extsysmon/sources/customsource.cpp
+++ b/sources/extsysmon/sources/customsource.cpp
@@ -76,7 +76,7 @@ QStringList CustomSource::sources() const
QStringList CustomSource::getSources()
{
QStringList sources;
- foreach (ExtScript *item, extScripts->activeItems())
+ for (auto item : extScripts->activeItems())
sources.append(QString("custom/%1").arg(item->tag(QString("custom"))));
return sources;
diff --git a/sources/extsysmon/sources/gpuloadsource.cpp b/sources/extsysmon/sources/gpuloadsource.cpp
index c4d0c12..6150bda 100644
--- a/sources/extsysmon/sources/gpuloadsource.cpp
+++ b/sources/extsysmon/sources/gpuloadsource.cpp
@@ -61,8 +61,8 @@ QVariant GPULoadSource::data(QString source)
QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (m_device == QString("nvidia")) {
- foreach (QString str,
- qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str :
+ qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("")))
continue;
QString load = str.remove(QString(""))
@@ -72,8 +72,8 @@ QVariant GPULoadSource::data(QString source)
break;
}
} else if (m_device == QString("ati")) {
- foreach (QString str,
- qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str :
+ qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("load")))
continue;
QString load
diff --git a/sources/extsysmon/sources/gputempsource.cpp b/sources/extsysmon/sources/gputempsource.cpp
index c02ec81..3c83258 100644
--- a/sources/extsysmon/sources/gputempsource.cpp
+++ b/sources/extsysmon/sources/gputempsource.cpp
@@ -62,8 +62,8 @@ QVariant GPUTemperatureSource::data(QString source)
QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (m_device == QString("nvidia")) {
- foreach (QString str,
- qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str :
+ qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("")))
continue;
QString temp = str.remove(QString(""))
@@ -72,8 +72,8 @@ QVariant GPUTemperatureSource::data(QString source)
break;
}
} else if (m_device == QString("ati")) {
- foreach (QString str,
- qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str :
+ qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("Temperature")))
continue;
QString temp
diff --git a/sources/extsysmon/sources/hddtempsource.cpp b/sources/extsysmon/sources/hddtempsource.cpp
index 2816e3b..92b9b22 100644
--- a/sources/extsysmon/sources/hddtempsource.cpp
+++ b/sources/extsysmon/sources/hddtempsource.cpp
@@ -61,8 +61,7 @@ QVariant HDDTemperatureSource::data(QString source)
QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (m_smartctl) {
- foreach (QString str,
- qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.startsWith(QString("194")))
continue;
if (str.split(QChar(' '), QString::SkipEmptyParts).count() < 9)
@@ -104,7 +103,7 @@ QVariantMap HDDTemperatureSource::initialData(QString source) const
QStringList HDDTemperatureSource::sources() const
{
QStringList sources;
- foreach (QString device, m_devices)
+ for (auto device : m_devices)
sources.append(QString("hdd/temperature%1").arg(device));
return sources;
diff --git a/sources/extsysmon/sources/networksource.cpp b/sources/extsysmon/sources/networksource.cpp
index 2203000..45a27ef 100644
--- a/sources/extsysmon/sources/networksource.cpp
+++ b/sources/extsysmon/sources/networksource.cpp
@@ -46,7 +46,7 @@ QVariant NetworkSource::data(QString source)
QList rawInterfaceList
= QNetworkInterface::allInterfaces();
qCInfo(LOG_ESM) << "Devices" << rawInterfaceList;
- foreach (QNetworkInterface interface, rawInterfaceList) {
+ for (auto interface : rawInterfaceList) {
if ((interface.flags().testFlag(QNetworkInterface::IsLoopBack))
|| (interface.flags().testFlag(
QNetworkInterface::IsPointToPoint)))
diff --git a/sources/extsysmon/sources/playersource.cpp b/sources/extsysmon/sources/playersource.cpp
index 61b4814..c580a2d 100644
--- a/sources/extsysmon/sources/playersource.cpp
+++ b/sources/extsysmon/sources/playersource.cpp
@@ -150,13 +150,13 @@ void PlayerSource::run()
if (m_player == QString("mpd")) {
// mpd
QHash data = getPlayerMpdInfo(m_mpdAddress);
- foreach (QString key, data.keys())
+ for (auto key : data.keys())
values[key] = data[key];
} else if (m_player == QString("mpris")) {
// players which supports mpris
QString mpris = m_mpris == QString("auto") ? getAutoMpris() : m_mpris;
QHash data = getPlayerMprisInfo(mpris);
- foreach (QString key, data.keys())
+ for (auto key : data.keys())
values[key] = data[key];
}
@@ -221,7 +221,7 @@ QString PlayerSource::getAutoMpris() const
return QString();
QStringList arguments = listServices.arguments().first().toStringList();
- foreach (QString arg, arguments) {
+ for (auto arg : arguments) {
if (!arg.startsWith(QString("org.mpris.MediaPlayer2.")))
continue;
qCInfo(LOG_ESM) << "Service found" << arg;
@@ -251,7 +251,7 @@ QVariantHash PlayerSource::getPlayerMpdInfo(const QString mpdAddress) const
QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
- foreach (QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
+ for (auto str : qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (str.split(QString(": "), QString::SkipEmptyParts).count() == 2) {
// "Metadata: data"
QString metadata = str.split(QString(": "), QString::SkipEmptyParts)
@@ -346,9 +346,8 @@ QVariantHash PlayerSource::getPlayerMprisInfo(const QString mpris) const
QString PlayerSource::buildString(const QString current, const QString value,
const int s) const
{
- qCDebug(LOG_ESM) << "Current value" << current;
- qCDebug(LOG_ESM) << "New value" << value;
- qCDebug(LOG_ESM) << "Strip after" << s;
+ qCDebug(LOG_ESM) << "Current value" << current << "received" << value
+ << "will be stripped after" << s;
int index = value.indexOf(current);
if ((current.isEmpty()) || ((index + s + 1) > value.count())) {
@@ -361,8 +360,7 @@ QString PlayerSource::buildString(const QString current, const QString value,
QString PlayerSource::stripString(const QString value, const int s) const
{
- qCDebug(LOG_ESM) << "New value" << value;
- qCDebug(LOG_ESM) << "Strip after" << s;
+ qCDebug(LOG_ESM) << "New value" << value << "will be stripped after" << s;
return value.count() > s ? QString("%1\u2026").arg(value.left(s - 1))
: value.leftJustified(s, QLatin1Char(' '));
diff --git a/sources/extsysmon/sources/processessource.cpp b/sources/extsysmon/sources/processessource.cpp
index 4a01b81..4f41cb9 100644
--- a/sources/extsysmon/sources/processessource.cpp
+++ b/sources/extsysmon/sources/processessource.cpp
@@ -84,7 +84,7 @@ void ProcessesSource::run()
QStringList directories = allDirectories.filter(QRegExp(QString("(\\d+)")));
QStringList running;
- foreach (QString dir, directories) {
+ for (auto dir : directories) {
QFile statusFile(QString("/proc/%1/status").arg(dir));
if (!statusFile.open(QIODevice::ReadOnly))
continue;
diff --git a/sources/extsysmon/sources/quotessource.cpp b/sources/extsysmon/sources/quotessource.cpp
index d2f7e90..a9d8129 100644
--- a/sources/extsysmon/sources/quotessource.cpp
+++ b/sources/extsysmon/sources/quotessource.cpp
@@ -47,7 +47,7 @@ QVariant QuotesSource::data(QString source)
if (source.startsWith(QString("quotes/percpricechg"))) {
QVariantHash data = extQuotes->itemByTagNumber(index(source))->run();
- foreach (QString key, data.keys())
+ for (auto key : data.keys())
values[key] = data[key];
}
QString key = QString(source).remove(QString("quotes/"));
@@ -148,7 +148,7 @@ QStringList QuotesSource::sources() const
QStringList QuotesSource::getSources()
{
QStringList sources;
- foreach (ExtQuotes *item, extQuotes->activeItems()) {
+ for (auto item : extQuotes->activeItems()) {
sources.append(QString("quotes/%1").arg(item->tag(QString("ask"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("askchg"))));
sources.append(
diff --git a/sources/extsysmon/sources/upgradesource.cpp b/sources/extsysmon/sources/upgradesource.cpp
index 84bb579..243c0bd 100644
--- a/sources/extsysmon/sources/upgradesource.cpp
+++ b/sources/extsysmon/sources/upgradesource.cpp
@@ -76,7 +76,7 @@ QStringList UpgradeSource::sources() const
QStringList UpgradeSource::getSources()
{
QStringList sources;
- foreach (ExtUpgrade *item, extUpgrade->activeItems())
+ for (auto item : extUpgrade->activeItems())
sources.append(
QString("upgrade/%1").arg(item->tag(QString("pkgcount"))));
diff --git a/sources/extsysmon/sources/weathersource.cpp b/sources/extsysmon/sources/weathersource.cpp
index f805432..9a57851 100644
--- a/sources/extsysmon/sources/weathersource.cpp
+++ b/sources/extsysmon/sources/weathersource.cpp
@@ -47,7 +47,7 @@ QVariant WeatherSource::data(QString source)
if (source.startsWith(QString("weather/weatherId"))) {
QVariantHash data = extWeather->itemByTagNumber(index(source))->run();
- foreach (QString key, data.keys())
+ for (auto key : data.keys())
values[key] = data[key];
}
QString key = QString(source).remove(QString("weather/"));
@@ -92,7 +92,7 @@ QVariantMap WeatherSource::initialData(QString source) const
= QString("Atmospheric pressure for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer");
- data[QString("units")] = QString("hPa");
+ data[QString("units")] = QString("mb");
} else if (source.startsWith(QString("weather/temperature"))) {
data[QString("min")] = 0.0;
data[QString("max")] = 0.0;
@@ -101,6 +101,14 @@ QVariantMap WeatherSource::initialData(QString source) const
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("float");
data[QString("units")] = QString("°C");
+ } else if (source.startsWith(QString("weather/timestamp"))) {
+ data[QString("min")] = QString("");
+ data[QString("max")] = QString("");
+ data[QString("name")]
+ = QString("Timestamp for '%1'")
+ .arg(extWeather->itemByTagNumber(ind)->uniq());
+ data[QString("type")] = QString("QString");
+ data[QString("units")] = QString("");
}
return data;
@@ -116,7 +124,7 @@ QStringList WeatherSource::sources() const
QStringList WeatherSource::getSources()
{
QStringList sources;
- foreach (ExtWeather *item, extWeather->activeItems()) {
+ for (auto item : extWeather->activeItems()) {
sources.append(
QString("weather/%1").arg(item->tag(QString("weatherId"))));
sources.append(
@@ -127,6 +135,8 @@ QStringList WeatherSource::getSources()
QString("weather/%1").arg(item->tag(QString("pressure"))));
sources.append(
QString("weather/%1").arg(item->tag(QString("temperature"))));
+ sources.append(
+ QString("weather/%1").arg(item->tag(QString("timestamp"))));
}
return sources;
diff --git a/sources/translations/awesome-widgets.pot b/sources/translations/awesome-widgets.pot
index 8f500e6..437a528 100644
--- a/sources/translations/awesome-widgets.pot
+++ b/sources/translations/awesome-widgets.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -110,9 +110,36 @@ msgstr ""
msgid "Export configuration"
msgstr ""
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+msgid "Could not save configuration file"
+msgstr ""
+
msgid "Import configuration"
msgstr ""
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+msgid "Import extensions"
+msgstr ""
+
+msgid "Import additional files"
+msgstr ""
+
msgid "Font"
msgstr ""
@@ -378,6 +405,9 @@ msgstr ""
msgid "This software uses: %1"
msgstr ""
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr ""
@@ -399,33 +429,6 @@ msgstr ""
msgid "There are updates"
msgstr ""
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-msgid "Could not save configuration file"
-msgstr ""
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-msgid "Import extensions"
-msgstr ""
-
-msgid "Import additional files"
-msgstr ""
-
msgid "AC online"
msgstr ""
diff --git a/sources/translations/en.po b/sources/translations/en.po
index 42d6afa..c40d104 100644
--- a/sources/translations/en.po
+++ b/sources/translations/en.po
@@ -1,13 +1,13 @@
# Copyright (C) 2014
# This file is distributed under the same license as the PyTextMonitor package.
#
-# Evgeniy Alekseev , 2014, 2015.
+# Evgeniy Alekseev , 2014, 2015, 2016.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
-"PO-Revision-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
+"PO-Revision-Date: 2016-01-26 21:48+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: English \n"
"Language: ru\n"
@@ -111,9 +111,36 @@ msgstr "Drop key cache"
msgid "Export configuration"
msgstr "Export configuration"
+msgid "Export"
+msgstr "Export"
+
+msgid "Success"
+msgstr "Success"
+
+msgid "Please note that binary files were not copied"
+msgstr "Please note that binary files were not copied"
+
+msgid "Ooops..."
+msgstr "Ooops..."
+
+msgid "Could not save configuration file"
+msgstr "Could not save configuration file"
+
msgid "Import configuration"
msgstr "Import configuration"
+msgid "Import"
+msgstr "Import"
+
+msgid "Import plasmoid settings"
+msgstr "Import plasmoid settings"
+
+msgid "Import extensions"
+msgstr "Import extensions"
+
+msgid "Import additional files"
+msgstr "Import additional files"
+
msgid "Font"
msgstr "Font"
@@ -383,6 +410,9 @@ msgstr "Translators: %1"
msgid "This software uses: %1"
msgstr "This software uses: %1"
+msgid "Special thanks to %1"
+msgstr "Special thanks to %1"
+
msgid "Select font"
msgstr "Select font"
@@ -404,33 +434,6 @@ msgstr "Click \"Ok\" to download"
msgid "There are updates"
msgstr "There are updates"
-msgid "Export"
-msgstr "Export"
-
-msgid "Success"
-msgstr "Success"
-
-msgid "Please note that binary files were not copied"
-msgstr "Please note that binary files were not copied"
-
-msgid "Ooops..."
-msgstr "Ooops..."
-
-msgid "Could not save configuration file"
-msgstr "Could not save configuration file"
-
-msgid "Import"
-msgstr "Import"
-
-msgid "Import plasmoid settings"
-msgstr "Import plasmoid settings"
-
-msgid "Import extensions"
-msgstr "Import extensions"
-
-msgid "Import additional files"
-msgstr "Import additional files"
-
msgid "AC online"
msgstr "AC online"
diff --git a/sources/translations/es.po b/sources/translations/es.po
index 4984b2a..b1b6c63 100644
--- a/sources/translations/es.po
+++ b/sources/translations/es.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Awesome widgets\n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-09-26 22:07+0000\n"
"Last-Translator: Ernesto Avilés Vázquez \n"
"Language-Team: Spanish (http://www.transifex.com/arcanis/awesome-widgets/"
@@ -113,9 +113,38 @@ msgstr "Borrar caché de claves"
msgid "Export configuration"
msgstr ""
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+msgid "Could not save configuration file"
+msgstr ""
+
msgid "Import configuration"
msgstr ""
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+#, fuzzy
+msgid "Import extensions"
+msgstr "Extensiones"
+
+#, fuzzy
+msgid "Import additional files"
+msgstr "Filtros adicionales"
+
msgid "Font"
msgstr "Tipo de letra"
@@ -386,6 +415,9 @@ msgstr "Traductores: %1"
msgid "This software uses: %1"
msgstr "Este software usa: %1"
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "Elegir tipo de letra"
@@ -407,35 +439,6 @@ msgstr "Haz clic en «Ok» para descargar"
msgid "There are updates"
msgstr "Hay actualizaciones disponibles"
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-msgid "Could not save configuration file"
-msgstr ""
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-#, fuzzy
-msgid "Import extensions"
-msgstr "Extensiones"
-
-#, fuzzy
-msgid "Import additional files"
-msgstr "Filtros adicionales"
-
msgid "AC online"
msgstr "Alimentación conectada"
diff --git a/sources/translations/fr.po b/sources/translations/fr.po
index c11dd66..34ddcf5 100644
--- a/sources/translations/fr.po
+++ b/sources/translations/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-07-31 22:16+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: French \n"
@@ -115,9 +115,36 @@ msgstr ""
msgid "Export configuration"
msgstr ""
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+msgid "Could not save configuration file"
+msgstr ""
+
msgid "Import configuration"
msgstr ""
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+msgid "Import extensions"
+msgstr ""
+
+msgid "Import additional files"
+msgstr ""
+
msgid "Font"
msgstr "Police"
@@ -398,6 +425,9 @@ msgstr "Traducteurs: %1"
msgid "This software uses: %1"
msgstr "Ce logiciel utilise: %1"
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "Sélectionner une couleur"
@@ -422,33 +452,6 @@ msgstr "Cliquer sur \"Valider\" pour télécharger"
msgid "There are updates"
msgstr "Des mises à jour sont disponibles"
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-msgid "Could not save configuration file"
-msgstr ""
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-msgid "Import extensions"
-msgstr ""
-
-msgid "Import additional files"
-msgstr ""
-
msgid "AC online"
msgstr "Alimentation branchée"
diff --git a/sources/translations/nl.po b/sources/translations/nl.po
index aaaadaf..9c4a562 100644
--- a/sources/translations/nl.po
+++ b/sources/translations/nl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Awesome widgets\n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-08-20 22:52+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: Dutch \n"
@@ -116,10 +116,38 @@ msgstr ""
msgid "Export configuration"
msgstr "Configuratie"
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+#, fuzzy
+msgid "Could not save configuration file"
+msgstr "Configuratie"
+
#, fuzzy
msgid "Import configuration"
msgstr "Configuratie"
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+msgid "Import extensions"
+msgstr ""
+
+msgid "Import additional files"
+msgstr ""
+
msgid "Font"
msgstr "Lettertype"
@@ -402,6 +430,9 @@ msgstr "Vertalers: %1"
msgid "This software uses: %1"
msgstr "Deze software gebruikt: %1"
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "Lettertype selecteren"
@@ -424,34 +455,6 @@ msgstr "Klik op \"OK\" om te downloaden"
msgid "There are updates"
msgstr "Er zijn updates"
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-#, fuzzy
-msgid "Could not save configuration file"
-msgstr "Configuratie"
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-msgid "Import extensions"
-msgstr ""
-
-msgid "Import additional files"
-msgstr ""
-
msgid "AC online"
msgstr "AC online"
diff --git a/sources/translations/pt_BR.po b/sources/translations/pt_BR.po
index 24bf696..9cb71f1 100644
--- a/sources/translations/pt_BR.po
+++ b/sources/translations/pt_BR.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-07-31 22:21+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: Russian \n"
@@ -115,10 +115,38 @@ msgstr ""
msgid "Export configuration"
msgstr "Configuração"
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+#, fuzzy
+msgid "Could not save configuration file"
+msgstr "Configuração"
+
#, fuzzy
msgid "Import configuration"
msgstr "Configuração"
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+msgid "Import extensions"
+msgstr ""
+
+msgid "Import additional files"
+msgstr ""
+
msgid "Font"
msgstr "Tamanho da fonte"
@@ -398,6 +426,9 @@ msgstr "Tradutores: %1"
msgid "This software uses: %1"
msgstr "Este software usa: %1"
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "Selecionar fonte"
@@ -420,34 +451,6 @@ msgstr "Clique \"Ok\" para baixar"
msgid "There are updates"
msgstr "Há atualizações disponíveis"
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-#, fuzzy
-msgid "Could not save configuration file"
-msgstr "Configuração"
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-msgid "Import extensions"
-msgstr ""
-
-msgid "Import additional files"
-msgstr ""
-
msgid "AC online"
msgstr "Carregador conectado"
diff --git a/sources/translations/ru.po b/sources/translations/ru.po
index d6125a1..97a8e6b 100644
--- a/sources/translations/ru.po
+++ b/sources/translations/ru.po
@@ -1,13 +1,13 @@
# Copyright (C) 2014
# This file is distributed under the same license as the PyTextMonitor package.
#
-# Evgeniy Alekseev , 2014, 2015.
+# Evgeniy Alekseev , 2014, 2015, 2016.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
-"PO-Revision-Date: 2015-10-20 01:22+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
+"PO-Revision-Date: 2016-01-26 21:49+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: Russian \n"
"Language: ru\n"
@@ -111,9 +111,36 @@ msgstr "Сбросить кеш ключей"
msgid "Export configuration"
msgstr "Экспорт настроек"
+msgid "Export"
+msgstr "Экспорт"
+
+msgid "Success"
+msgstr "Успешно"
+
+msgid "Please note that binary files were not copied"
+msgstr "Пожалуйста, обратите внимание, что бинарные файлы не были скопированы"
+
+msgid "Ooops..."
+msgstr "Ууупс..."
+
+msgid "Could not save configuration file"
+msgstr "Не могу сохранить файл настроек"
+
msgid "Import configuration"
msgstr "Импорт настроек"
+msgid "Import"
+msgstr "Импорт"
+
+msgid "Import plasmoid settings"
+msgstr "Импорт настроек плазмоида"
+
+msgid "Import extensions"
+msgstr "Импорт расширений"
+
+msgid "Import additional files"
+msgstr "Импорт дополнительных файлов"
+
msgid "Font"
msgstr "Шрифт"
@@ -383,6 +410,9 @@ msgstr "Переводчики: %1"
msgid "This software uses: %1"
msgstr "Данное приложение использует: %1"
+msgid "Special thanks to %1"
+msgstr "Отдельно спасибо %1"
+
msgid "Select font"
msgstr "Выберете шрифт"
@@ -404,33 +434,6 @@ msgstr "Нажмите \"Ok\" для загрузки"
msgid "There are updates"
msgstr "Найдены обновления"
-msgid "Export"
-msgstr "Экспорт"
-
-msgid "Success"
-msgstr "Успешно"
-
-msgid "Please note that binary files were not copied"
-msgstr "Пожалуйста, обратите внимание, что бинарные файлы не были скопированы"
-
-msgid "Ooops..."
-msgstr "Ууупс..."
-
-msgid "Could not save configuration file"
-msgstr "Не могу сохранить файл настроек"
-
-msgid "Import"
-msgstr "Импорт"
-
-msgid "Import plasmoid settings"
-msgstr "Импорт настроек плазмоида"
-
-msgid "Import extensions"
-msgstr "Импорт расширений"
-
-msgid "Import additional files"
-msgstr "Импорт дополнительных файлов"
-
msgid "AC online"
msgstr "AC подключен"
diff --git a/sources/translations/uk.po b/sources/translations/uk.po
index 07013d9..330f72e 100644
--- a/sources/translations/uk.po
+++ b/sources/translations/uk.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-09-27 12:37+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: Ukrainian \n"
@@ -114,10 +114,40 @@ msgstr "Скинути кеш ключів"
msgid "Export configuration"
msgstr "Налаштування"
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+#, fuzzy
+msgid "Could not save configuration file"
+msgstr "Налаштування"
+
#, fuzzy
msgid "Import configuration"
msgstr "Налаштування"
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+#, fuzzy
+msgid "Import extensions"
+msgstr "Розширення"
+
+#, fuzzy
+msgid "Import additional files"
+msgstr "Додаткові фільтри"
+
msgid "Font"
msgstr "Шрифт"
@@ -398,6 +428,9 @@ msgstr "Перекладачі: %1"
msgid "This software uses: %1"
msgstr "Ця програма використовує: %1"
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "Оберіть шрифт"
@@ -420,36 +453,6 @@ msgstr "Натисніть \"Ok\" для завантаження"
msgid "There are updates"
msgstr "Знайдені оновлення"
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-#, fuzzy
-msgid "Could not save configuration file"
-msgstr "Налаштування"
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-#, fuzzy
-msgid "Import extensions"
-msgstr "Розширення"
-
-#, fuzzy
-msgid "Import additional files"
-msgstr "Додаткові фільтри"
-
msgid "AC online"
msgstr "AC підключений"
diff --git a/sources/translations/zh.po b/sources/translations/zh.po
index 5a11637..20de05f 100644
--- a/sources/translations/zh.po
+++ b/sources/translations/zh.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://github.com/arcan1s/awesome-widgets/issues\n"
-"POT-Creation-Date: 2015-10-20 01:21+0300\n"
+"POT-Creation-Date: 2016-01-26 21:48+0300\n"
"PO-Revision-Date: 2015-07-31 22:24+0300\n"
"Last-Translator: Evgeniy Alekseev \n"
"Language-Team: Russian \n"
@@ -111,9 +111,36 @@ msgstr ""
msgid "Export configuration"
msgstr ""
+msgid "Export"
+msgstr ""
+
+msgid "Success"
+msgstr ""
+
+msgid "Please note that binary files were not copied"
+msgstr ""
+
+msgid "Ooops..."
+msgstr ""
+
+msgid "Could not save configuration file"
+msgstr ""
+
msgid "Import configuration"
msgstr ""
+msgid "Import"
+msgstr ""
+
+msgid "Import plasmoid settings"
+msgstr ""
+
+msgid "Import extensions"
+msgstr ""
+
+msgid "Import additional files"
+msgstr ""
+
msgid "Font"
msgstr "字体"
@@ -397,6 +424,9 @@ msgstr ""
msgid "This software uses: %1"
msgstr ""
+msgid "Special thanks to %1"
+msgstr ""
+
msgid "Select font"
msgstr "选择字体"
@@ -418,33 +448,6 @@ msgstr ""
msgid "There are updates"
msgstr ""
-msgid "Export"
-msgstr ""
-
-msgid "Success"
-msgstr ""
-
-msgid "Please note that binary files were not copied"
-msgstr ""
-
-msgid "Ooops..."
-msgstr ""
-
-msgid "Could not save configuration file"
-msgstr ""
-
-msgid "Import"
-msgstr ""
-
-msgid "Import plasmoid settings"
-msgstr ""
-
-msgid "Import extensions"
-msgstr ""
-
-msgid "Import additional files"
-msgstr ""
-
#, fuzzy
msgid "AC online"
msgstr "外接电源使用中标签"
diff --git a/sources/version.h.in b/sources/version.h.in
index eec6074..b9fdfb6 100644
--- a/sources/version.h.in
+++ b/sources/version.h.in
@@ -11,6 +11,7 @@
#define EMAIL "@PROJECT_CONTACT@"
#define LICENSE "@PROJECT_LICENSE@"
#define TRDPARTY_LICENSE "tasks,BSD,https://github.com/mhogomchungu/tasks;QReplyTimeout wrapper,no,http://codereview.stackexchange.com/questions/30031/qnetworkreply-network-reply-timeout-helper"
+#define SPECIAL_THANKS "Yahoo! Finance,https://finance.yahoo.com/;Yahoo! Weather,https://weather.yahoo.com/;JetBrains,https://www.jetbrains.com/"
// configuraion
// graphical items api version
@@ -23,6 +24,8 @@
#define AWEUAPI 3
// extweather api version
#define AWEWAPI 2
+// network requests timeout, ms
+#define REQUEST_TIMEOUT 5000
// available time keys
#define TIME_KEYS "dddd,ddd,dd,d,MMMM,MMM,MM,M,yyyy,yy,hh,h,HH,H,mm,m,ss,s,t,ap,a,AP,A"
#cmakedefine BUILD_FUTURE