diff --git a/sources/awesome-widget-kf5/package/contents/ui/about.qml b/sources/awesome-widget-kf5/package/contents/ui/about.qml index 2356434..d9bb93e 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/about.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/about.qml @@ -34,7 +34,7 @@ Item { Column { id: pageColumn - width: units.gridUnit * 25 + anchors.fill: parent QtControls.TabView { height: parent.height width: parent.width diff --git a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml index 8d660d9..c249184 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml @@ -69,7 +69,7 @@ Item { Column { id: pageColumn - width: units.gridUnit * 25 + anchors.fill: parent Row { height: implicitHeight width: parent.width diff --git a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml b/sources/awesome-widget-kf5/package/contents/ui/appearance.qml index 0ca5464..9fc2619 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/appearance.qml @@ -49,7 +49,7 @@ Item { Column { id: pageColumn - width: units.gridUnit * 25 + anchors.fill: parent Row { height: implicitHeight width: parent.width diff --git a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml b/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml index c03bd29..b24182e 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml @@ -57,7 +57,7 @@ Item { Column { id: pageColumn - width: units.gridUnit * 25 + anchors.fill: parent Row { height: implicitHeight width: parent.width @@ -105,11 +105,11 @@ Item { id: gpuDev width: parent.width * 3 / 5 model: ["auto", "disable", "ati", "nvidia"] - onCurrentIndexChanged: cfg_dataengine["GPUDEV"] = model[currentIndex] Component.onCompleted: { for (var i=0; i #include #include +#include #include #include @@ -39,7 +40,6 @@ #include "extscript.h" #include "extupgrade.h" #include "graphicalitem.h" -#include "version.h" AWKeys::AWKeys(QObject *parent) @@ -50,9 +50,6 @@ AWKeys::AWKeys(QObject *parent) QString debugEnv = environment.value(QString("DEBUG"), QString("no")); debug = (debugEnv == QString("yes")); - // signals - connect(this, SIGNAL(sourceAdded(QString)), this, SLOT(addSource(QString))); - // init dialog dialog = new QDialog(nullptr); widgetDialog = new QListWidget(dialog); @@ -88,7 +85,7 @@ AWKeys::~AWKeys() } -void AWKeys::initKeys(const QString pattern, +void AWKeys::initKeys(const QString currentPattern, const QMap tooltipParams, const bool popup) { @@ -105,16 +102,18 @@ void AWKeys::initKeys(const QString pattern, if (toolTip != nullptr) delete toolTip; // init + pattern = currentPattern; extQuotes = getExtQuotes(); extScripts = getExtScripts(); extUpgrade = getExtUpgrade(); graphicalItems = getGraphicalItems(); - keys = dictKeys(); - foundBars = findGraphicalItems(pattern); - foundKeys = findKeys(pattern); + // update network and hdd list + addKeyToCache(QString("Hdd")); + addKeyToCache(QString("Network")); + loadKeysFromCache(); + reinitKeys(); toolTip = new AWToolTip(this, tooltipParams); - ready = true; enablePopup = popup; } @@ -127,10 +126,10 @@ bool AWKeys::isDebugEnabled() } -QString AWKeys::parsePattern(const QString pattern) +QString AWKeys::parsePattern() { if (debug) qDebug() << PDEBUG; - if (!ready) return pattern; + if (keys.isEmpty()) return pattern; QString parsed = pattern; parsed.replace(QString("$$"), QString("$\\$\\")); @@ -149,7 +148,7 @@ QString AWKeys::toolTipImage() { if(debug) qDebug() << PDEBUG; - if (!ready) return QString(); + if (keys.isEmpty()) return QString(); QPixmap tooltip = toolTip->image(); QByteArray byteArray; @@ -168,7 +167,7 @@ QSize AWKeys::toolTipSize() } -bool AWKeys::addDevice(const QString source) +void AWKeys::addDevice(const QString source) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Source" << source; @@ -181,49 +180,15 @@ bool AWKeys::addDevice(const QString source) if (diskRegexp.indexIn(source) > -1) { QString device = source; device.remove(QString("/Rate/rblk")); - diskDevices.append(device); - } else if (fanRegexp.indexIn(source) > -1) - fanDevices.append(source); - else if (mountRegexp.indexIn(source) > -1) { + addKeyToCache(QString("Disk"), device); + } else if (fanRegexp.indexIn(source) > -1) { + addKeyToCache(QString("Fan"), source); + } else if (mountRegexp.indexIn(source) > -1) { QString device = source; device.remove(QString("partitions")).remove(QString("/filllevel")); - mountDevices.append(device); - } else if (tempRegexp.indexIn(source) > -1) - tempDevices.append(source); - - // check sources to be connected - if ((source.endsWith(QString("/TotalLoad"))) || - (source.endsWith(QString("/clock"))) || - (source.endsWith(QString("/AverageClock"))) || - (source.endsWith(QString("/Rate/rblk"))) || - (source.endsWith(QString("/Rate/wblk"))) || - (source.endsWith(QString("/filllevel"))) || - (source.endsWith(QString("/freespace"))) || - (source.endsWith(QString("/usedspace"))) || - (source.endsWith(QString("/receiver/data"))) || - (source.endsWith(QString("/receiver/data"))) || - (source.endsWith(QString("/transmitter/data"))) || - (source.startsWith(QString("lmsensors/"))) || - (source.startsWith(QString("mem/physical/"))) || - (source.startsWith(QString("mem/swap/"))) || - (source == QString("system/uptime")) || - (source == QString("Local")) || - (source == QString("battery")) || - (source == QString("custom")) || - (source == QString("desktop")) || - (source == QString("netdev")) || - (source == QString("gpu")) || - (source == QString("gputemp")) || - (source == QString("hddtemp")) || - (source == QString("pkg")) || - (source == QString("player")) || - (source == QString("ps")) || - (source == QString("update"))) { - - return true; - } else { - if (debug) qDebug() << PDEBUG << ":" << "Source" << source << "not found"; - return false; + addKeyToCache(QString("Mount"), device); + } else if (tempRegexp.indexIn(source) > -1) { + addKeyToCache(QString("Temp"), source); } } @@ -293,12 +258,12 @@ QStringList AWKeys::dictKeys() allKeys.append(QString("hddw%1").arg(i)); } // hdd temp - for (int i=getHddDevices().count()-1; i>=0; i--) { + for (int i=hddDevices.count()-1; i>=0; i--) { allKeys.append(QString("hddtemp%1").arg(i)); allKeys.append(QString("hddtemp%1").arg(i)); } // network - for (int i=getNetworkDevices().count()-1; i>=0; i--) { + for (int i=networkDevices.count()-1; i>=0; i--) { allKeys.append(QString("down%1").arg(i)); allKeys.append(QString("up%1").arg(i)); } @@ -351,79 +316,19 @@ QStringList AWKeys::dictKeys() } -QStringList AWKeys::getDiskDevices() +QStringList AWKeys::getHddDevices() { if (debug) qDebug() << PDEBUG; - diskDevices.sort(); - - return diskDevices; -} - - -QStringList AWKeys::getFanDevices() -{ - if (debug) qDebug() << PDEBUG; - - fanDevices.sort(); - - return fanDevices; -} - - -QStringList AWKeys::getHddDevices(const bool needAbstract) -{ - if (debug) qDebug() << PDEBUG; - - QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name); - QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$"))); - for (int i=0; i rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; i data, const QMap params) @@ -435,7 +340,7 @@ bool AWKeys::setDataBySource(const QString sourceName, // checking if (!checkKeys(data)) return false; - if (!ready) return false; + if (keys.isEmpty()) return false; // regular expressions QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad")); @@ -523,7 +428,7 @@ bool AWKeys::setDataBySource(const QString sourceName, } else if (sourceName == QString("gpu")) { // gpu load // notification - if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("gpu")].toFloat() < 90.0)) + if ((data[QString("value")].toFloat() >= 75.0) && (values[QString("gpu")].toFloat() < 75.0)) AWActions::sendNotification(QString("event"), i18n("High GPU load"), enablePopup); // value values[QString("gpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); @@ -575,7 +480,6 @@ bool AWKeys::setDataBySource(const QString sourceName, } } else if (sourceName == QString("hddtemp")) { // hdd temperature - QStringList hddDevices = getHddDevices(); for (int i=0; iexecutable()); else if ((key.startsWith(QString("ask"))) || @@ -852,11 +756,66 @@ void AWKeys::editItem(const QString type) } -void AWKeys::addSource() +void AWKeys::loadKeysFromCache() { if (debug) qDebug() << PDEBUG; + QString fileName = QString("%1/awesomewidgets.ndx").arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)); + if (debug) qDebug() << PDEBUG << ":" << "Cache file" << fileName; + QSettings cache(fileName, QSettings::IniFormat); + QStringList cachedKeys; + cache.beginGroup(QString("Disk")); + diskDevices.clear(); + cachedKeys = cache.allKeys(); + for (int i=0; i rawInterfaceList = QNetworkInterface::allInterfaces(); + for (int i=0; i data) { if (debug) qDebug() << PDEBUG; @@ -1269,7 +1273,7 @@ float AWKeys::temperature(const float temp, const QString units) } -QStringList AWKeys::findGraphicalItems(const QString pattern) +QStringList AWKeys::findGraphicalItems() { if (debug) qDebug() << PDEBUG; @@ -1289,7 +1293,7 @@ QStringList AWKeys::findGraphicalItems(const QString pattern) } -QStringList AWKeys::findKeys(const QString pattern) +QStringList AWKeys::findKeys() { QStringList selectedKeys; for (int i=0; i tooltipParams, const bool popup = false); Q_INVOKABLE bool isDebugEnabled(); - Q_INVOKABLE QString parsePattern(const QString pattern); + Q_INVOKABLE QString parsePattern(); Q_INVOKABLE QString toolTipImage(); Q_INVOKABLE QSize toolTipSize(); // keys - Q_INVOKABLE bool addDevice(const QString source); + Q_INVOKABLE void addDevice(const QString source); Q_INVOKABLE QStringList dictKeys(); - Q_INVOKABLE QStringList getDiskDevices(); - Q_INVOKABLE QStringList getFanDevices(); - Q_INVOKABLE QStringList getHddDevices(const bool needAbstract = false); - Q_INVOKABLE QStringList getMountDevices(); - Q_INVOKABLE QStringList getNetworkDevices(); - Q_INVOKABLE QStringList getTempDevices(); + Q_INVOKABLE QStringList getHddDevices(); Q_INVOKABLE bool setDataBySource(const QString sourceName, const QMap data, const QMap params); @@ -77,11 +72,9 @@ public: // configuration Q_INVOKABLE void editItem(const QString type); -signals: - void sourceAdded(const QString source); - private slots: - void addSource(const QString source); + void loadKeysFromCache(); + void reinitKeys(); // editor void editItemButtonPressed(QAbstractButton *button); void copyBar(const QString original); @@ -91,13 +84,14 @@ private slots: private: // methods + void addKeyToCache(const QString type, const QString key = QString("")); bool checkKeys(const QMap data); QString networkDevice(); int numberCpus(); - float temperature(const float temp, const QString units = QString("Celsius")); + float temperature(const float temp, const QString units); // find methods - QStringList findGraphicalItems(const QString pattern); - QStringList findKeys(const QString pattern); + QStringList findGraphicalItems(); + QStringList findKeys(); // get methods QList getExtQuotes(); QList getExtScripts(); @@ -117,14 +111,14 @@ private: // variables bool debug = false; bool enablePopup = false; - bool ready = false; QList graphicalItems; QList extQuotes; QList extScripts; QList extUpgrade; QStringList foundBars, foundKeys, keys; + QString pattern; QMap values; - QStringList diskDevices, fanDevices, mountDevices, tempDevices; + QStringList diskDevices, fanDevices, hddDevices, mountDevices, networkDevices, tempDevices; }; diff --git a/sources/awesome-widget-kf5/plugin/awkeysop.cpp b/sources/awesome-widget-kf5/plugin/awkeysop.cpp deleted file mode 100644 index 81e7aff..0000000 --- a/sources/awesome-widget-kf5/plugin/awkeysop.cpp +++ /dev/null @@ -1,1357 +0,0 @@ -/*************************************************************************** - * 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 "awkeysop.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "awactions.h" -#include "extquotes.h" -#include "extscript.h" -#include "extupgrade.h" -#include "graphicalitem.h" -#include "version.h" - - -AWKeysOperations::AWKeysOperations(QObject *parent) - : QObject(parent) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - debug = (debugEnv == QString("yes")); - - // signals - connect(this, SIGNAL(sourceAdded(QString)), this, SLOT(addSource(QString))); - - // init dialog - dialog = new QDialog(nullptr); - widgetDialog = new QListWidget(dialog); - dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close, - Qt::Vertical, dialog); - copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole); - createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole); - deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole); - QHBoxLayout *layout = new QHBoxLayout(dialog); - layout->addWidget(widgetDialog); - layout->addWidget(dialogButtons); - dialog->setLayout(layout); - connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this, SLOT(editItemButtonPressed(QAbstractButton *))); - connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject())); -} - - -AWKeysOperations::~AWKeysOperations() -{ - if (debug) qDebug() << PDEBUG; - - delete createButton; - delete copyButton; - delete deleteButton; - delete dialogButtons; - delete widgetDialog; - delete dialog; - - graphicalItems.clear(); - extScripts.clear(); - extUpgrade.clear(); -} - - -AWKeysOperations::AWStruct AWKeysOperations::addDevice(const QString source) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << source; - - QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)")); - QRegExp fanRegexp = QRegExp(QString("lmsensors/.*/fan.*")); - QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel")); - QRegExp tempRegexp = QRegExp(QString("lmsensors/.*temp.*/.*")); - - AWKeysOperations::AWStruct str; - if (diskRegexp.indexIn(source) > -1) { - QString device = source; - device.remove(QString("/Rate/rblk")); - diskDevices.append(device); - } else if (fanRegexp.indexIn(source) > -1) { - fanDevices.append(source); - } else if (mountRegexp.indexIn(source) > -1) { - QString device = source; - device.remove(QString("partitions")).remove(QString("/filllevel")); - mountDevices.append(device); - } else if (tempRegexp.indexIn(source) > -1) { - tempDevices.append(source); - } else { - if (debug) qDebug() << PDEBUG << ":" << "Source" << source << "not found"; - } - - return str; -} - - -QStringList AWKeys::dictKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList allKeys; - // 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 - for (int i=numberCpus()-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("cpu")); - // temperature - for (int i=tempDevices.count()-1; i>=0; i--) - allKeys.append(QString("temp%1").arg(i)); - for (int i=fanDevices.count()-1; i>=0; i--) - allKeys.append(QString("fan%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=mountDevices.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=diskDevices.count()-1; i>=0; i--) { - allKeys.append(QString("hddr%1").arg(i)); - allKeys.append(QString("hddw%1").arg(i)); - } - // hdd temp - for (int i=getHddDevices().count()-1; i>=0; i--) { - allKeys.append(QString("hddtemp%1").arg(i)); - allKeys.append(QString("hddtemp%1").arg(i)); - } - // network - for (int i=getNetworkDevices().count()-1; i>=0; i--) { - allKeys.append(QString("down%1").arg(i)); - allKeys.append(QString("up%1").arg(i)); - } - allKeys.append(QString("down")); - allKeys.append(QString("up")); - allKeys.append(QString("netdev")); - // battery - allKeys.append(QString("ac")); - QStringList allBatteryDevices = QDir(QString("/sys/class/power_supply")) - .entryList(QDir::Dirs | QDir::NoDotAndDotDot, - QDir::Name); - for (int i=allBatteryDevices.filter(QRegExp(QString("BAT.*"))).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")); - // ps - allKeys.append(QString("pscount")); - allKeys.append(QString("pstotal")); - allKeys.append(QString("ps")); - // package manager - for (int i=extUpgrade.count()-1; i>=0; i--) - allKeys.append(QString("pkgcount%1").arg(i)); - // quotes - for (int i=extQuotes.count()-1; i>=0; i--) { - allKeys.append(QString("ask%1").arg(i)); - allKeys.append(QString("bid%1").arg(i)); - allKeys.append(QString("price%1").arg(i)); - } - // custom - for (int i=extScripts.count()-1; i>=0; i--) - allKeys.append(QString("custom%1").arg(i)); - // desktop - allKeys.append(QString("desktop")); - allKeys.append(QString("ndesktop")); - allKeys.append(QString("tdesktops")); - // bars - QStringList graphicalItemsKeys; - for (int i=0; iname() + graphicalItems[i]->bar()); - graphicalItemsKeys.sort(); - for (int i=graphicalItemsKeys.count()-1; i>=0; i--) - allKeys.append(graphicalItemsKeys[i]); - - return allKeys; -} - - -QStringList AWKeys::getDiskDevices() -{ - if (debug) qDebug() << PDEBUG; - - diskDevices.sort(); - - return diskDevices; -} - - -QStringList AWKeys::getFanDevices() -{ - if (debug) qDebug() << PDEBUG; - - fanDevices.sort(); - - return fanDevices; -} - - -QStringList AWKeys::getHddDevices(const bool needAbstract) -{ - if (debug) qDebug() << PDEBUG; - - QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name); - QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$"))); - for (int i=0; i rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; i data, - const QMap params) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName; - - if (sourceName == QString("update")) return true; - - // checking - if (!checkKeys(data)) return false; - if (!ready) return false; - - // regular expressions - QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad")); - QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock")); - QRegExp hddrRegExp = QRegExp(QString("disk/.*/Rate/rblk")); - QRegExp hddwRegExp = QRegExp(QString("disk/.*/Rate/wblk")); - QRegExp mountFillRegExp = QRegExp(QString("partitions/.*/filllevel")); - QRegExp mountFreeRegExp = QRegExp(QString("partitions/.*/freespace")); - QRegExp mountUsedRegExp = QRegExp(QString("partitions/.*/usedspace")); - QRegExp netRecRegExp = QRegExp(QString("network/interfaces/.*/receiver/data")); - QRegExp netTransRegExp = QRegExp(QString("network/interfaces/.*/transmitter/data")); - QRegExp tempRegExp = QRegExp(QString("lmsensors/.*")); - - if (sourceName == QString("battery")) { - // battery - for (int i=0; isetData(QString("batTooltip"), data[data.keys()[i]].toFloat(), data[QString("ac")].toBool()); - } - } - } else if (sourceName == QString("cpu/system/TotalLoad")) { - // cpu - // notification - if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("cpu")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High CPU load"), enablePopup); - // value - values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - toolTip->setData(QString("cpuTooltip"), data[QString("value")].toFloat()); - } else if (sourceName.contains(cpuRegExp)) { - // cpus - QString number = sourceName; - number.remove(QString("cpu/cpu")).remove(QString("/TotalLoad")); - values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - } else if (sourceName == QString("cpu/system/AverageClock")) { - // cpucl - values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - toolTip->setData(QString("cpuclTooltip"), data[QString("value")].toFloat()); - } else if (sourceName.contains(cpuclRegExp)) { - // cpucls - QString number = sourceName; - number.remove(QString("cpu/cpu")).remove(QString("/clock")); - values[QString("cpucl") + number] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - } else if (sourceName == QString("custom")) { - // custom - for (int i=0; i= 90.0) && (values[QString("gpu")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High GPU load"), enablePopup); - // value - values[QString("gpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - } else if (sourceName == QString("gputemp")) { - // gpu temperature - values[QString("gputemp")] = QString("%1").arg( - temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1); - } else if (sourceName.contains(mountFillRegExp)) { - // fill level - QString mount = sourceName; - mount.remove(QString("partitions")).remove(QString("/filllevel")); - for (int i=0; i= 90.0) && (values[QString("hdd%1").arg(i)].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount), enablePopup); - values[QString("hdd%1").arg(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - break; - } - } else if (sourceName.contains(mountFreeRegExp)) { - // free space - QString mount = sourceName; - mount.remove(QString("partitions")).remove(QString("/freespace")); - for (int i=0; i= 90.0) && (values[QString("mem")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup); - // value - values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1); - toolTip->setData(QString("memTooltip"), values[QString("mem")].toFloat()); - } else if (sourceName == QString("netdev")) { - // network device - // notification - if (values[QString("netdev")] != data[QString("value")].toString()) - AWActions::sendNotification(QString("event"), i18n("Network device has been changed to %1", - data[QString("value")].toString()), - enablePopup); - // value - values[QString("netdev")] = data[QString("value")].toString(); - } else if (sourceName.contains(netRecRegExp)) { - // download speed - QString device = sourceName; - device.remove(QString("network/interfaces/")).remove(QString("/receiver/data")); - QStringList allNetworkDevices = getNetworkDevices(); - for (int i=0; isetData(QString("downTooltip"), data[QString("value")].toFloat()); - } - } else if (sourceName.contains(netTransRegExp)) { - // upload speed - QString device = sourceName; - device.remove(QString("network/interfaces/")).remove(QString("/transmitter/data")); - QStringList allNetworkDevices = getNetworkDevices(); - for (int i=0; isetData(QString("upTooltip"), data[QString("value")].toFloat()); - } - } else if (sourceName == QString("pkg")) { - // package manager - for (int i=0; i 0.0) && (values[QString("swap")].toFloat() == 0.0)) - AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup); - // value - values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1); - toolTip->setData(QString("swapTooltip"), values[QString("swap")].toFloat()); - } else if (sourceName.contains(tempRegExp)) { - // temperature devices - if (data[QString("units")].toString() == QString("rpm")) { - for (int i=0; i"); - message += i18n("Value: %1", valueByKey(tag)); - - return AWActions::sendNotification(QString("tag"), message); -} - - -QString AWKeys::infoByKey(QString key) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; - - key.remove(QRegExp(QString("^bar[0-9]{1,}"))); - if (key.startsWith(QString("custom"))) - return QString("%1").arg(extScripts[key.remove(QString("custom")).toInt()]->executable()); - else if (key.contains(QRegExp(QString("^hdd[rw]")))) - return QString("%1").arg(diskDevices[key.remove(QRegExp(QString("hdd[rw]"))).toInt()]); - else if (key.startsWith(QString("fan"))) - return QString("%1").arg(fanDevices[key.remove(QString("fan")).toInt()]); - else if (key.contains(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))) - return QString("%1").arg(mountDevices[key.remove(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))).toInt()]); - else if (key.startsWith(QString("hddtemp"))) - return QString("%1").arg(getHddDevices()[key.remove(QString("hddtemp")).toInt()]); - else if (key.contains(QRegExp(QString("^(down|up)[0-9]")))) - return QString("%1").arg(getNetworkDevices()[key.remove(QRegExp(QString("^(down|up)"))).toInt()]); - else if (key.startsWith(QString("pkgcount"))) - return QString("%1").arg(extUpgrade[key.remove(QString("pkgcount")).toInt()]->executable()); - else if ((key.startsWith(QString("ask"))) || - (key.startsWith(QString("bid"))) || - (key.startsWith(QString("price")))) - return QString("%1").arg(extQuotes[key.remove(QRegExp(QString("^(ask|bid|price)"))).toInt()]->ticker()); - else if (key.startsWith(QString("temp"))) - return QString("%1").arg(tempDevices[key.remove(QString("temp")).toInt()]); - - return QString("(none)"); -} - - -QString AWKeys::valueByKey(QString key) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; - - key.remove(QRegExp(QString("^bar[0-9]{1,}"))); - - return values[key]; -} - - -void AWKeys::editItem(const QString type) -{ - if (debug) qDebug() << PDEBUG; - - widgetDialog->clear(); - if (type == QString("graphicalitem")) { - requestedItem = RequestedGraphicalItem; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Tag: %1", graphicalItems[i]->name() + graphicalItems[i]->bar())); - tooltip.append(i18n("Comment: %1", graphicalItems[i]->comment())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } else if (type == QString("extquotes")) { - requestedItem = RequestedExtQuotes; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", extQuotes[i]->name())); - tooltip.append(i18n("Comment: %1", extQuotes[i]->comment())); - tooltip.append(i18n("Ticker: %1", extQuotes[i]->ticker())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } else if (type == QString("extscript")) { - requestedItem = RequestedExtScript; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", extScripts[i]->name())); - tooltip.append(i18n("Comment: %1", extScripts[i]->comment())); - tooltip.append(i18n("Exec: %1", extScripts[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } else if (type == QString("extupgrade")) { - requestedItem = RequestedExtUpgrade; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", extUpgrade[i]->name())); - tooltip.append(i18n("Comment: %1", extUpgrade[i]->comment())); - tooltip.append(i18n("Exec: %1", extUpgrade[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } - - int ret = dialog->exec(); - if (debug) qDebug() << PDEBUG << ":" << "Dialog returns" << ret; - requestedItem = Nothing; -} - - -void AWKeys::addSource(const QString source) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << source; -} - - -void AWKeys::editItemButtonPressed(QAbstractButton *button) -{ - if (debug) qDebug() << PDEBUG; - - QListWidgetItem *item = widgetDialog->currentItem(); - if (dynamic_cast(button) == copyButton) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtQuotes: - copyQuotes(current); - break; - case RequestedExtScript: - copyScript(current); - break; - case RequestedExtUpgrade: - copyUpgrade(current); - break; - case RequestedGraphicalItem: - copyBar(current); - break; - case Nothing: - default: - break; - } - } else if (dynamic_cast(button) == createButton) { - switch (requestedItem) { - case RequestedExtQuotes: - copyQuotes(QString("")); - break; - case RequestedExtScript: - copyScript(QString("")); - break; - case RequestedExtUpgrade: - copyUpgrade(QString("")); - break; - case RequestedGraphicalItem: - copyBar(QString("")); - break; - case Nothing: - default: - break; - } - } else if (dynamic_cast(button) == deleteButton) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtQuotes: - for (int i=0; ifileName() != current) continue; - if (extQuotes[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - extQuotes.clear(); - extQuotes = getExtQuotes(); - } - break; - } - break; - case RequestedExtScript: - for (int i=0; ifileName() != current) continue; - if (extScripts[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - extScripts.clear(); - extScripts = getExtScripts(); - } - break; - } - break; - case RequestedExtUpgrade: - for (int i=0; ifileName() != current) continue; - if (extUpgrade[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - extUpgrade.clear(); - extUpgrade = getExtUpgrade(); - } - break; - } - break; - case RequestedGraphicalItem: - for (int i=0; ifileName() != current) continue; - if (graphicalItems[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - graphicalItems.clear(); - graphicalItems = getGraphicalItems(); - } - break; - } - break; - case Nothing: - default: - break; - } - } else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtQuotes: - for (int i=0; ifileName() != current) continue; - extQuotes[i]->showConfiguration(); - break; - } - break; - case RequestedExtScript: - for (int i=0; ifileName() != current) continue; - extScripts[i]->showConfiguration(); - break; - } - break; - case RequestedExtUpgrade: - for (int i=0; ifileName() != current) continue; - extUpgrade[i]->showConfiguration(); - break; - } - break; - case RequestedGraphicalItem: - for (int i=0; ifileName() != current) continue; - graphicalItems[i]->showConfiguration(); - break; - } - break; - case Nothing: - default: - break; - } - } -} - - -void AWKeys::copyBar(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - int number = 0; - while (true) { - bool exit = true; - for (int i=0; iname() == QString("bar%1").arg(number)) { - number++; - exit = false; - break; - } - if (exit) break; - } - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/desktops"), - QStandardPaths::LocateDirectory); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - 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.*"))))); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (graphicalItems[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - GraphicalItem *item = new GraphicalItem(0, name, dirs, debug); - item->setName(QString("bar%1").arg(number)); - if (originalItem != -1) { - item->setComment(graphicalItems[originalItem]->comment()); - item->setBar(graphicalItems[originalItem]->bar()); - item->setActiveColor(graphicalItems[originalItem]->activeColor()); - item->setInactiveColor(graphicalItems[originalItem]->inactiveColor()); - item->setType(graphicalItems[originalItem]->type()); - item->setDirection(graphicalItems[originalItem]->direction()); - item->setHeight(graphicalItems[originalItem]->height()); - item->setWidth(graphicalItems[originalItem]->width()); - } - - if (item->showConfiguration(bars) == 1) { - graphicalItems.clear(); - graphicalItems = getGraphicalItems(); - QListWidgetItem *widgetItem = new QListWidgetItem(item->fileName()); - QStringList tooltip; - tooltip.append(i18n("Tag: %1", item->name() + item->bar())); - tooltip.append(i18n("Comment: %1", item->comment())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete item; -} - - -void AWKeys::copyQuotes(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/quotes"), - QStandardPaths::LocateDirectory); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (extQuotes[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - ExtQuotes *quotes = new ExtQuotes(0, name, dirs, debug); - if (originalItem != -1) { - quotes->setActive(extQuotes[originalItem]->isActive()); - quotes->setComment(extQuotes[originalItem]->comment()); - quotes->setInterval(extQuotes[originalItem]->interval()); - quotes->setName(extQuotes[originalItem]->name()); - quotes->setTicker(extQuotes[originalItem]->ticker()); - } - - if (quotes->showConfiguration() == 1) { - extQuotes.clear(); - extQuotes = getExtQuotes(); - QListWidgetItem *widgetItem = new QListWidgetItem(quotes->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", quotes->name())); - tooltip.append(i18n("Comment: %1", quotes->comment())); - tooltip.append(i18n("Ticker: %1", quotes->ticker())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete quotes; -} - - - -void AWKeys::copyScript(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/scripts"), - QStandardPaths::LocateDirectory); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (extScripts[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - ExtScript *script = new ExtScript(0, name, dirs, debug); - if (originalItem != -1) { - script->setActive(extScripts[originalItem]->isActive()); - script->setComment(extScripts[originalItem]->comment()); - script->setExecutable(extScripts[originalItem]->executable()); - script->setHasOutput(extScripts[originalItem]->hasOutput()); - script->setInterval(extScripts[originalItem]->interval()); - script->setName(extScripts[originalItem]->name()); - script->setPrefix(extScripts[originalItem]->prefix()); - script->setRedirect(extScripts[originalItem]->redirect()); - } - - if (script->showConfiguration() == 1) { - extScripts.clear(); - extScripts = getExtScripts(); - QListWidgetItem *widgetItem = new QListWidgetItem(script->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", script->name())); - tooltip.append(i18n("Comment: %1", script->comment())); - tooltip.append(i18n("Exec: %1", script->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete script; -} - - -void AWKeys::copyUpgrade(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/upgrade"), - QStandardPaths::LocateDirectory); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (extUpgrade[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug); - if (originalItem != -1) { - upgrade->setActive(extUpgrade[originalItem]->isActive()); - upgrade->setComment(extUpgrade[originalItem]->comment()); - upgrade->setExecutable(extUpgrade[originalItem]->executable()); - upgrade->setName(extUpgrade[originalItem]->name()); - upgrade->setNull(extUpgrade[originalItem]->null()); - upgrade->setInterval(extUpgrade[originalItem]->interval()); - } - - if (upgrade->showConfiguration() == 1) { - extUpgrade.clear(); - extUpgrade = getExtUpgrade(); - QListWidgetItem *widgetItem = new QListWidgetItem(upgrade->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", upgrade->name())); - tooltip.append(i18n("Comment: %1", upgrade->comment())); - tooltip.append(i18n("Exec: %1", upgrade->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete upgrade; -} - - -bool AWKeys::checkKeys(const QMap data) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Data" << data; - - return (data.count() != 0); -} - - -QString AWKeys::networkDevice() -{ - if (debug) qDebug() << PDEBUG; - - QString device = QString("lo"); - QList rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; iname() + graphicalItems[i]->bar()); - orderedKeys.sort(); - - QStringList selectedKeys; - for (int i=orderedKeys.count()-1; i>=0; i--) - if (pattern.contains(QString("$") + orderedKeys[i])) { - if (debug) qDebug() << PDEBUG << ":" << "Found key" << orderedKeys[i]; - selectedKeys.append(orderedKeys[i]); - } - - return selectedKeys; -} - - -QStringList AWKeys::findKeys(const QString pattern) -{ - QStringList selectedKeys; - for (int i=0; i AWKeys::getExtQuotes() -{ - if (debug) qDebug() << PDEBUG; - - QList externalQuotes; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/quotes"); - QDir localDirectory; - if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/quotes"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; i AWKeys::getExtScripts() -{ - if (debug) qDebug() << PDEBUG; - - QList externalScripts; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/scripts"); - QDir localDirectory; - if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/scripts"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; i AWKeys::getExtUpgrade() -{ - if (debug) qDebug() << PDEBUG; - - QList externalUpgrade; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/upgrade"); - QDir localDirectory; - if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/upgrade"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; i AWKeys::getGraphicalItems() -{ - if (debug) qDebug() << PDEBUG; - - QList items; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/desktops"); - QDir localDirectory; - if (localDirectory.mkpath(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/desktops"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; iname() + graphicalItems[i]->bar()) != tag) continue; - item = graphicalItems[i]; - break; - } - - return item; -} - - -QStringList AWKeys::getTimeKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList keys; - keys.append(QString("dddd")); - keys.append(QString("ddd")); - keys.append(QString("dd")); - keys.append(QString("d")); - keys.append(QString("MMMM")); - keys.append(QString("MMM")); - keys.append(QString("MM")); - keys.append(QString("M")); - keys.append(QString("yyyy")); - keys.append(QString("yy")); - keys.append(QString("hh")); - keys.append(QString("h")); - keys.append(QString("mm")); - keys.append(QString("m")); - keys.append(QString("ss")); - keys.append(QString("s")); - - return keys; -} diff --git a/sources/awesome-widget-kf5/plugin/awkeysop.h b/sources/awesome-widget-kf5/plugin/awkeysop.h deleted file mode 100644 index 0a35e1f..0000000 --- a/sources/awesome-widget-kf5/plugin/awkeysop.h +++ /dev/null @@ -1,126 +0,0 @@ -/*************************************************************************** - * 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 AWKEYS_H -#define AWKEYS_H - -#include -#include -#include -#include -#include -#include -#include -#include - - -class ExtQuotes; -class ExtScript; -class ExtUpgrade; -class GraphicalItem; - -class AWKeysOperations : public QObject -{ - Q_OBJECT - - enum RequestedItem { - Nothing, - RequestedGraphicalItem, - RequestedExtQuotes, - RequestedExtScript, - RequestedExtUpgrade - }; - typedef struct { - QString key = QString(); - QString value = QString(); - } AWStruct; - -public: - AWKeysOperations(QObject *parent = 0); - ~AWKeysOperations(); - - // keys - AWStruct addDevice(const QString source); - Q_INVOKABLE QStringList dictKeys(); - Q_INVOKABLE QStringList getDiskDevices(); - Q_INVOKABLE QStringList getFanDevices(); - Q_INVOKABLE QStringList getHddDevices(const bool needAbstract = false); - Q_INVOKABLE QStringList getMountDevices(); - Q_INVOKABLE QStringList getNetworkDevices(); - Q_INVOKABLE QStringList getTempDevices(); - Q_INVOKABLE bool setDataBySource(const QString sourceName, - const QMap data, - const QMap params); - // values - Q_INVOKABLE void graphicalValueByKey(); - Q_INVOKABLE QString infoByKey(QString key); - Q_INVOKABLE QString valueByKey(QString key); - // configuration - Q_INVOKABLE void editItem(const QString type); - -signals: - void sourceAdded(const QString source); - -private slots: - void addSource(const QString source); - // editor - void editItemButtonPressed(QAbstractButton *button); - void copyBar(const QString original); - void copyQuotes(const QString original); - void copyScript(const QString original); - void copyUpgrade(const QString original); - -private: - // methods - bool checkKeys(const QMap data); - QString networkDevice(); - int numberCpus(); - float temperature(const float temp, const QString units = QString("Celsius")); - // find methods - QStringList findGraphicalItems(const QString pattern); - QStringList findKeys(const QString pattern); - // get methods - QList getExtQuotes(); - QList getExtScripts(); - QList getExtUpgrade(); - QList getGraphicalItems(); - GraphicalItem *getItemByTag(const QString tag); - QStringList getTimeKeys(); - // graphical elements - QDialog *dialog = nullptr; - QListWidget *widgetDialog = nullptr; - QDialogButtonBox *dialogButtons = nullptr; - QPushButton *copyButton = nullptr; - QPushButton *createButton = nullptr; - QPushButton *deleteButton = nullptr; - RequestedItem requestedItem = Nothing; - // variables - bool debug = false; - bool enablePopup = false; - bool ready = false; - QList graphicalItems; - QList extQuotes; - QList extScripts; - QList extUpgrade; - QStringList foundBars, foundKeys, keys; - QMap values; - QStringList diskDevices, fanDevices, mountDevices, tempDevices; -}; - - -#endif /* AWKEYS_H */ diff --git a/sources/desktop-panel-kf5/package/metadata.desktop b/sources/desktop-panel-kf5/package/metadata.desktop new file mode 100644 index 0000000..3131538 --- /dev/null +++ b/sources/desktop-panel-kf5/package/metadata.desktop @@ -0,0 +1,28 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Desktop Panel +Comment=A minimalistic Plasmoid +Comment[en]=A minimalistic Plasmoid +Comment[es]=Un plasmoide minimalista +Comment[es]=Un script Plasmoïde minimaliste +Comment[pt_BR]=Um script Plasmoid +Comment[ru]=Минималистичный плазмоид +Comment[uk]=Мінімалістичний плазмоїд +X-KDE-ServiceTypes=Plasma/Applet +Type=Service +Icon=utilities-system-monitor + +X-KDE-ServiceTypes=Plasma/Applet +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/main.qml +X-Plasma-RemoteLocation= + +X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis +X-KDE-PluginInfo-Email=esalexeev@gmail.com +X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel +X-KDE-PluginInfo-Version=2.2.2 +X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/ +X-KDE-PluginInfo-Category=System Information +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPLv3 +X-KDE-PluginInfo-EnabledByDefault=true diff --git a/sources/extsysmon/quotes/aapl.desktop b/sources/extsysmon/quotes/aapl.desktop index 7fcf3bd..f6a89c9 100644 --- a/sources/extsysmon/quotes/aapl.desktop +++ b/sources/extsysmon/quotes/aapl.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=AAPL.NASDAQ Comment=Apple Inc X-AW-Ticker=AAPL -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/eurrub.desktop b/sources/extsysmon/quotes/eurrub.desktop index 8d4b1c8..cb16d0b 100644 --- a/sources/extsysmon/quotes/eurrub.desktop +++ b/sources/extsysmon/quotes/eurrub.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=EUR/RUB Comment=EUR/RUB X-AW-Ticker=EURRUB=X -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/eurusd.desktop b/sources/extsysmon/quotes/eurusd.desktop index 07d7660..baff8f4 100644 --- a/sources/extsysmon/quotes/eurusd.desktop +++ b/sources/extsysmon/quotes/eurusd.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=EUR/USD Comment=EUR/USD X-AW-Ticker=EURUSD=X -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/goog.desktop b/sources/extsysmon/quotes/goog.desktop index 56f7245..b5d7e70 100644 --- a/sources/extsysmon/quotes/goog.desktop +++ b/sources/extsysmon/quotes/goog.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=GOOG.NASDAQ Comment=Google Inc X-AW-Ticker=GOOG -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/msft.desktop b/sources/extsysmon/quotes/msft.desktop index 2f4c499..077b4a9 100644 --- a/sources/extsysmon/quotes/msft.desktop +++ b/sources/extsysmon/quotes/msft.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=MSFT.NASDAQ Comment=Microsoft Corp X-AW-Ticker=MSFT -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/rts.desktop b/sources/extsysmon/quotes/rts.desktop index c1af55b..5cb4062 100644 --- a/sources/extsysmon/quotes/rts.desktop +++ b/sources/extsysmon/quotes/rts.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=RTS Comment=RTS Index X-AW-Ticker=RTS.RS -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/snp.desktop b/sources/extsysmon/quotes/snp.desktop index e7fcd8f..fa71e3c 100644 --- a/sources/extsysmon/quotes/snp.desktop +++ b/sources/extsysmon/quotes/snp.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=S&P Comment=S&P 500 Index X-AW-Ticker=^GSPC -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/usdrub.desktop b/sources/extsysmon/quotes/usdrub.desktop index 204e179..10e277a 100644 --- a/sources/extsysmon/quotes/usdrub.desktop +++ b/sources/extsysmon/quotes/usdrub.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=USD/RUB Comment=USD/RUB X-AW-Ticker=USDRUB=X -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60 diff --git a/sources/extsysmon/quotes/vix.desktop b/sources/extsysmon/quotes/vix.desktop index 5368ae2..3dff31a 100644 --- a/sources/extsysmon/quotes/vix.desktop +++ b/sources/extsysmon/quotes/vix.desktop @@ -3,6 +3,6 @@ Encoding=UTF-8 Name=VIX Comment=Volatility S&P 500 X-AW-Ticker=^VIX -X-AW-Active=true +X-AW-Active=false X-AW-ApiVersion=1 X-AW-Interval=60