diff --git a/.gitmodules b/.gitmodules
index e7e8d20..425dd6e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "sources/3rdparty/pdebug"]
- path = sources/3rdparty/pdebug
- url = https://github.com/arcan1s/qtadds-pdebug.git
[submodule "sources/3rdparty/task"]
path = sources/3rdparty/task
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git
diff --git a/sources/3rdparty/pdebug b/sources/3rdparty/pdebug
deleted file mode 160000
index 75e4a0d..0000000
--- a/sources/3rdparty/pdebug
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 75e4a0df83478802bba53345486b42c56713fe09
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
index 89f4077..fbbe8cc 100644
--- a/sources/awesome-widget/plugin/awkeys.cpp
+++ b/sources/awesome-widget/plugin/awkeys.cpp
@@ -79,11 +79,6 @@ void AWKeys::initKeys(const QString currentPattern)
{
if (debug) qDebug() << PDEBUG;
- // clear
- keys.clear();
- foundBars.clear();
- foundKeys.clear();
-
// init
pattern = currentPattern;
// update network and hdd list
@@ -133,28 +128,6 @@ void AWKeys::setWrapNewLines(const bool wrap)
}
-QString AWKeys::parsePattern() const
-{
- if (debug) qDebug() << PDEBUG;
- if (keys.isEmpty()) return pattern;
-
- QString parsed = pattern;
- parsed.replace(QString("$$"), QString("$\\$\\"));
- foreach(QString key, foundLambdas)
- parsed.replace(QString("${{%1}}").arg(key), calculateLambda(key));
- foreach(QString key, foundKeys)
- parsed.replace(QString("$%1").arg(key), htmlValue(key));
- foreach(QString bar, foundBars)
- parsed.replace(QString("$%1").arg(bar),
- graphicalItems->itemByTag(bar)->image(valueByKey(bar).toFloat()));
- parsed.replace(QString("$\\$\\"), QString("$$"));
- // wrap new lines if required
- if (wrapNewLines) parsed.replace(QString("\n"), QString("
"));
-
- return parsed;
-}
-
-
QSize AWKeys::toolTipSize() const
{
if (debug) qDebug() << PDEBUG;
@@ -202,13 +175,12 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
// uptime
allKeys.append(QString("uptime"));
allKeys.append(QString("cuptime"));
- // cpuclock
- for (int i=numberCpus()-1; i>=0; i--)
+ // cpuclock & cpu
+ for (int i=QThread::idealThreadCount()-1; i>=0; i--) {
allKeys.append(QString("cpucl%1").arg(i));
- allKeys.append(QString("cpucl"));
- // cpu
- for (int i=numberCpus()-1; i>=0; i--)
allKeys.append(QString("cpu%1").arg(i));
+ }
+ allKeys.append(QString("cpucl"));
allKeys.append(QString("cpu"));
// temperature
for (int i=tempDevices.count()-1; i>=0; i--)
@@ -366,9 +338,6 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data,
if (sourceName == QString("update")) return emit(needToBeUpdated());
- // checking
- if (keys.isEmpty()) return;
-
// regular expressions
QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad"));
QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock"));
@@ -738,14 +707,7 @@ void AWKeys::editItem(const QString type)
if (debug) qDebug() << PDEBUG;
if (type == QString("graphicalitem")) {
- QStringList bars;
- bars.append(keys.filter((QRegExp(QString("^cpu(?!cl).*")))));
- bars.append(keys.filter((QRegExp(QString("^gpu$")))));
- bars.append(keys.filter((QRegExp(QString("^mem$")))));
- bars.append(keys.filter((QRegExp(QString("^swap$")))));
- bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*")))));
- bars.append(keys.filter((QRegExp(QString("^bat.*")))));
- graphicalItems->setConfigArgs(bars);
+ 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();
@@ -813,7 +775,6 @@ void AWKeys::reinitKeys()
{
if (debug) qDebug() << PDEBUG;
- keys = dictKeys();
foundBars = findGraphicalItems();
foundKeys = findKeys();
foundLambdas = findLambdas();
@@ -865,44 +826,41 @@ void AWKeys::addKeyToCache(const QString type, const QString key)
}
-QString AWKeys::calculateLambda(QString key) const
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Lambda key" << key;
-
- QScriptEngine engine;
- foreach(QString lambdaKey, foundKeys)
- key.replace(QString("$%1").arg(lambdaKey), values[lambdaKey]);
- if (debug) qDebug() << PDEBUG << ":" << "Expression" << key;
-
- QScriptValue result = engine.evaluate(key);
- if (engine.hasUncaughtException()) {
- int line = engine.uncaughtExceptionLineNumber();
- if (debug) qDebug() << PDEBUG << ":" << "Uncaught exception at line"
- << line << ":" << result.toString();
- return QString();
- } else
- return result.toString();
-}
-
-
-QString AWKeys::htmlValue(QString key) const
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
-
- QString value = values[key];
- if (!key.startsWith(QString("custom")))
- value.replace(QString(" "), QString(" "));
- return value;
-}
-
-
-int AWKeys::numberCpus() const
+QString AWKeys::parsePattern() const
{
if (debug) qDebug() << PDEBUG;
- return QThread::idealThreadCount();
+ QString parsed = pattern;
+ parsed.replace(QString("$$"), QString("$\\$\\"));
+ foreach(QString key, foundLambdas)
+ parsed.replace(QString("${{%1}}").arg(key), [this](QString key) {
+ QScriptEngine engine;
+ foreach(QString lambdaKey, foundKeys)
+ key.replace(QString("$%1").arg(lambdaKey), values[lambdaKey]);
+ if (debug) qDebug() << PDEBUG << ":" << "Expression" << key;
+ QScriptValue result = engine.evaluate(key);
+ if (engine.hasUncaughtException()) {
+ int line = engine.uncaughtExceptionLineNumber();
+ if (debug) qDebug() << PDEBUG << ":" << "Uncaught exception at line"
+ << line << ":" << result.toString();
+ return QString();
+ } else
+ return result.toString();
+ }(key));
+ foreach(QString key, foundKeys)
+ parsed.replace(QString("$%1").arg(key), [](QString key, QString value) {
+ if (!key.startsWith(QString("custom")))
+ value.replace(QString(" "), QString(" "));
+ return value;
+ }(key, values[key]));
+ foreach(QString bar, foundBars)
+ parsed.replace(QString("$%1").arg(bar),
+ graphicalItems->itemByTag(bar)->image(valueByKey(bar).toFloat()));
+ parsed.replace(QString("$\\$\\"), QString("$$"));
+ // wrap new lines if required
+ if (wrapNewLines) parsed.replace(QString("\n"), QString("
"));
+
+ return parsed;
}
@@ -955,7 +913,7 @@ QStringList AWKeys::findKeys() const
if (debug) qDebug() << PDEBUG;
QStringList selectedKeys;
- foreach(QString key, keys) {
+ foreach(QString key, dictKeys()) {
if (key.startsWith(QString("bar"))) continue;
if (pattern.contains(QString("$%1").arg(key))) {
if (debug) qDebug() << PDEBUG << ":" << "Found key" << key;
diff --git a/sources/awesome-widget/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h
index 8e13ba9..9ecc2d6 100644
--- a/sources/awesome-widget/plugin/awkeys.h
+++ b/sources/awesome-widget/plugin/awkeys.h
@@ -48,7 +48,6 @@ public:
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
Q_INVOKABLE void setTranslateStrings(const bool translate = false);
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
- Q_INVOKABLE QString parsePattern() const;
Q_INVOKABLE QSize toolTipSize() const;
// keys
Q_INVOKABLE void addDevice(const QString source);
@@ -78,9 +77,7 @@ private slots:
private:
// methods
void addKeyToCache(const QString type, const QString key = QString(""));
- QString calculateLambda(QString key) const;
- QString htmlValue(QString key) const;
- int numberCpus() const;
+ QString parsePattern() const;
float temperature(const float temp, const QString units) const;
// find methods
QStringList findGraphicalItems() const;
@@ -98,7 +95,7 @@ private:
ExtItemAggregator *extUpgrade;
ExtItemAggregator *extWeather;
QString pattern;
- QStringList foundBars, foundKeys, foundLambdas, keys;
+ QStringList foundBars, foundKeys, foundLambdas;
QStringList timeKeys = QString(TIME_KEYS).split(QChar(','));
QHash values;
QStringList diskDevices, hddDevices, mountDevices, networkDevices, tempDevices;
diff --git a/sources/desktop-panel/plugin/dpadds.cpp b/sources/desktop-panel/plugin/dpadds.cpp
index fdfcc20..cb41aae 100644
--- a/sources/desktop-panel/plugin/dpadds.cpp
+++ b/sources/desktop-panel/plugin/dpadds.cpp
@@ -50,9 +50,9 @@ DPAdds::DPAdds(QObject *parent)
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
debug = (debugEnv == QString("yes"));
- connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(changeDesktop(int)));
- connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SLOT(changeWindowList(WId)));
- connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(changeWindowList(WId)));
+ connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SIGNAL(desktopChanged()));
+ connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SIGNAL(windowListChanged()));
+ connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SIGNAL(windowListChanged()));
}
@@ -400,24 +400,6 @@ void DPAdds::setCurrentDesktop(const int desktop) const
}
-void DPAdds::changeDesktop(const int desktop) const
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
-
- emit(desktopChanged());
-}
-
-
-void DPAdds::changeWindowList(const WId window) const
-{
- if (debug) qDebug() << PDEBUG;
- if (debug) qDebug() << PDEBUG << ":" << "Window" << window;
-
- emit(windowListChanged());
-}
-
-
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const
{
if (debug) qDebug() << PDEBUG;
diff --git a/sources/desktop-panel/plugin/dpadds.h b/sources/desktop-panel/plugin/dpadds.h
index 8cdb0ac..3fbffda 100644
--- a/sources/desktop-panel/plugin/dpadds.h
+++ b/sources/desktop-panel/plugin/dpadds.h
@@ -71,10 +71,6 @@ public slots:
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
Q_INVOKABLE void setCurrentDesktop(const int desktop) const;
-private slots:
- void changeDesktop(const int desktop) const;
- void changeWindowList(const WId window) const;
-
private:
DesktopWindowsInfo getInfoByDesktop(const int desktop) const;
QList getPanels() const;
diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp
index 1984480..81459a8 100644
--- a/sources/extsysmon/extsysmon.cpp
+++ b/sources/extsysmon/extsysmon.cpp
@@ -59,10 +59,10 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
setMinimumPollingInterval(333);
readConfiguration();
- externalQuotes = new ExtItemAggregator(nullptr, QString("quotes"), debug);
- externalScripts = new ExtItemAggregator(nullptr, QString("scripts"), debug);
- externalUpgrade = new ExtItemAggregator(nullptr, QString("upgrade"), debug);
- externalWeather = new ExtItemAggregator(nullptr, QString("weather"), debug);
+ extQuotes = new ExtItemAggregator(nullptr, QString("quotes"), debug);
+ extScripts = new ExtItemAggregator(nullptr, QString("scripts"), debug);
+ extUpgrade = new ExtItemAggregator(nullptr, QString("upgrade"), debug);
+ extWeather = new ExtItemAggregator(nullptr, QString("weather"), debug);
}
@@ -70,10 +70,10 @@ ExtendedSysMon::~ExtendedSysMon()
{
if (debug) qDebug() << PDEBUG;
- delete externalQuotes;
- delete externalScripts;
- delete externalUpgrade;
- delete externalWeather;
+ delete extQuotes;
+ delete extScripts;
+ delete extUpgrade;
+ delete extWeather;
}
@@ -579,7 +579,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
QVariantHash battery = getBattery(configuration[QString("ACPIPATH")]);
foreach(QString key, battery.keys()) setData(source, key, battery[key]);
} else if (source == QString("custom")) {
- foreach(ExtScript *script, externalScripts->items()) {
+ foreach(ExtScript *script, extScripts->items()) {
QVariantHash data = script->run();
foreach(QString key, data.keys()) setData(source, key, data[key]);
}
@@ -599,7 +599,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
} else if (source == QString("netdev")) {
setData(source, QString("value"), getNetworkDevice());
} else if (source == QString("pkg")) {
- foreach(ExtUpgrade *upgrade, externalUpgrade->items()) {
+ foreach(ExtUpgrade *upgrade, extUpgrade->items()) {
QVariantHash data = upgrade->run();
foreach(QString key, data.keys()) setData(source, key, data[key]);
}
@@ -613,14 +613,14 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
QVariantHash ps = getPsStats();
foreach(QString key, ps.keys()) setData(source, key, ps[key]);
} else if (source == QString("quotes")) {
- foreach(ExtQuotes *quote, externalQuotes->items()) {
+ foreach(ExtQuotes *quote, extQuotes->items()) {
QVariantHash data = quote->run();
foreach(QString key, data.keys()) setData(source, key, data[key]);
}
} else if (source == QString("update")) {
setData(source, QString("value"), true);
} else if (source == QString("weather")) {
- foreach(ExtWeather *weather, externalWeather->items()) {
+ foreach(ExtWeather *weather, extWeather->items()) {
QVariantHash data = weather->run();
foreach(QString key, data.keys()) setData(source, key, data[key]);
}
diff --git a/sources/extsysmon/extsysmon.h b/sources/extsysmon/extsysmon.h
index 5059f9e..0d3afaf 100644
--- a/sources/extsysmon/extsysmon.h
+++ b/sources/extsysmon/extsysmon.h
@@ -59,10 +59,10 @@ protected:
private:
// configuration
QHash configuration;
- ExtItemAggregator *externalQuotes;
- ExtItemAggregator *externalScripts;
- ExtItemAggregator *externalUpgrade;
- ExtItemAggregator *externalWeather;
+ ExtItemAggregator *extQuotes;
+ ExtItemAggregator *extScripts;
+ ExtItemAggregator *extUpgrade;
+ ExtItemAggregator *extWeather;
bool debug;
// reread configuration
QStringList getAllHdd() const;