mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
some work on porting
This commit is contained in:
parent
43efbbba72
commit
c850aaf2a3
@ -13,4 +13,4 @@ include (KDECMakeSettings)
|
|||||||
include (KDECompilerSettings)
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
add_subdirectory (plugin)
|
add_subdirectory (plugin)
|
||||||
plasma_install_package (package org.kde.plasma.awesome-widget)
|
plasma_install_package (package org.kde.plasma.awesomewidget)
|
||||||
|
@ -21,7 +21,7 @@ import org.kde.plasma.plasmoid 2.0
|
|||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
import org.kde.plasma.private.awesome-widget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -59,36 +59,27 @@ Item {
|
|||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: systemmonitorDE
|
id: systemmonitorDE
|
||||||
engine: "systemmonitor"
|
engine: "systemmonitor"
|
||||||
|
connectedSources: systemmonitorDE.sources
|
||||||
Component.onCompleted: {
|
interval: plasmoid.configuration.autoUpdateInterval
|
||||||
if (debug) console.log("[main::onCompleted] : Connect sources to systemmonitor")
|
|
||||||
|
|
||||||
systemmonitorDE.connectAllSources(main, plasmoid.configuration.interval)
|
|
||||||
}
|
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
if ((data.value == "N\\A") || (data.value == "")) return
|
if ((data.value == "N\\A") || (data.value == "")) return
|
||||||
// update
|
// update
|
||||||
info[sourceName] = data.value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: extsysmonDE
|
id: extsysmonDE
|
||||||
engine: "ext-sysmon"
|
engine: "ext-sysmon"
|
||||||
|
connectedSources: extsysmonDE.sources
|
||||||
Component.onCompleted: {
|
interval: plasmoid.configuration.autoUpdateInterval
|
||||||
if (debug) console.log("[main::onCompleted] : Connect sources to ext-sysmon")
|
|
||||||
|
|
||||||
extsysmonDE.connectAllSources(main, plasmoid.configuration.interval)
|
|
||||||
}
|
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
if (sourceName == "update") needUpdate()
|
// if (sourceName == "update") needUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ X-Plasma-RemoteLocation=
|
|||||||
|
|
||||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=org.kde.plasma.awesome-widget
|
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
X-KDE-PluginInfo-Category=System Information
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
@ -35,6 +35,6 @@ qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
|||||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesome-widget)
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesome-widget)
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||||
|
@ -128,7 +128,7 @@ QMap<QString, QVariant> AWActions::updateDataEngineConfiguration(QMap<QString, Q
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
for (int i=rawConfig[QString("PKGNULL")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
for (int i=rawConfig[QString("PKGNULL")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
||||||
i<rawConfig[QString("PKGCMD")].toString().split(QString(","), QString::SkipEmptyParts).count()+1;
|
i<rawConfig[QString("PKGCMD")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
||||||
i++)
|
i++)
|
||||||
rawConfig[QString("PKGNULL")].toString() += QString(",0");
|
rawConfig[QString("PKGNULL")].toString() += QString(",0");
|
||||||
|
|
||||||
|
@ -1,203 +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 "awdesources.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QRegExp>
|
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
|
||||||
AWDESources::AWDESources(QObject *parent, const QString pattern,
|
|
||||||
const QStringList foundKeys,
|
|
||||||
const QStringList foundBars,
|
|
||||||
const QMap<QString, QVariant> counts,
|
|
||||||
const QMap<QString, QVariant> paths,
|
|
||||||
const QMap<QString, QVariant> tooltipBools)
|
|
||||||
: QObject(parent),
|
|
||||||
m_pattern(pattern),
|
|
||||||
m_foundKeys(foundKeys),
|
|
||||||
m_foundBars(foundBars),
|
|
||||||
m_counts(counts),
|
|
||||||
m_paths(paths),
|
|
||||||
m_tooltipBools(tooltipBools)
|
|
||||||
{
|
|
||||||
// debug
|
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
|
||||||
debug = (debugEnv == QString("yes"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AWDESources::~AWDESources()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWDESources::getSourcesForExtSystemMonitor()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList sources;
|
|
||||||
QRegExp regExp;
|
|
||||||
|
|
||||||
// battery
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)(ac|bat.*)"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1) ||
|
|
||||||
(m_tooltipBools[QString("batteryTooltip")].toBool()))
|
|
||||||
sources.append(QString("battery"));
|
|
||||||
// custom command
|
|
||||||
regExp = QRegExp(QString("custom.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("custom"));
|
|
||||||
// desktop
|
|
||||||
regExp = QRegExp(QString(".*desktop.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("desktop"));
|
|
||||||
// gpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)gpu"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1))
|
|
||||||
sources.append(QString("gpu"));
|
|
||||||
// gpu temp
|
|
||||||
regExp = QRegExp(QString("gputemp"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("gputemp"));
|
|
||||||
// hdd temp
|
|
||||||
regExp = QRegExp(QString("hddtemp.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("hddtemp"));
|
|
||||||
// package manager
|
|
||||||
regExp = QRegExp(QString("pkgcount.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("pkg"));
|
|
||||||
// player
|
|
||||||
regExp = QRegExp(QString("(album|artist|duration|progress|title)"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("player"));
|
|
||||||
// ps
|
|
||||||
regExp = QRegExp(QString("ps.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("ps"));
|
|
||||||
// update == always true
|
|
||||||
sources.append(QString("update"));
|
|
||||||
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWDESources::getSourcesForSystemMonitor()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList sources;
|
|
||||||
QRegExp regExp;
|
|
||||||
|
|
||||||
// cpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)cpu(?!cl).*"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1) ||
|
|
||||||
(m_tooltipBools[QString("cpuTooltip")].toBool())) {
|
|
||||||
sources.append(QString("cpu/system/TotalLoad"));
|
|
||||||
for (int i=0; i<m_counts[QString("cpu")].toInt(); i++)
|
|
||||||
sources.append(QString("cpu/cpu") + QString::number(i) + QString("/TotalLoad"));
|
|
||||||
}
|
|
||||||
// cpuclock
|
|
||||||
regExp = QRegExp(QString("cpucl.*"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1) ||
|
|
||||||
(m_tooltipBools[QString("cpuclTooltip")].toBool())) {
|
|
||||||
sources.append(QString("cpu/system/AverageClock"));
|
|
||||||
for (int i=0; i<m_counts[QString("cpu")].toInt(); i++)
|
|
||||||
sources.append(QString("cpu/cpu") + QString::number(i) + QString("/clock"));
|
|
||||||
}
|
|
||||||
// disk speed
|
|
||||||
regExp = QRegExp(QString("hdd[rw].*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<m_paths[QString("disk")].toString().split(QString("@@")).count(); i++) {
|
|
||||||
sources.append(m_paths[QString("disk")].toString().split(QString("@@"))[i] + QString("/Rate/rblk"));
|
|
||||||
sources.append(m_paths[QString("disk")].toString().split(QString("@@"))[i] + QString("/Rate/wblk"));
|
|
||||||
}
|
|
||||||
// fan
|
|
||||||
regExp = QRegExp(QString("fan.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(m_paths[QString("fanDevice")].toString().split(QString("@@")));
|
|
||||||
// mount
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb).*"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1))
|
|
||||||
for (int i=0; i<m_paths[QString("mount")].toString().split(QString("@@")).count(); i++) {
|
|
||||||
sources.append(QString("partitions") + m_paths[QString("mount")].toString().split(QString("@@"))[i] + QString("/filllevel"));
|
|
||||||
sources.append(QString("partitions") + m_paths[QString("mount")].toString().split(QString("@@"))[i] + QString("/freespace"));
|
|
||||||
sources.append(QString("partitions") + m_paths[QString("mount")].toString().split(QString("@@"))[i] + QString("/usedspace"));
|
|
||||||
}
|
|
||||||
// memory
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)mem.*"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1) ||
|
|
||||||
(m_tooltipBools[QString("memTooltip")].toBool())) {
|
|
||||||
sources.append(QString("mem/physical/free"));
|
|
||||||
sources.append(QString("mem/physical/used"));
|
|
||||||
sources.append(QString("mem/physical/application"));
|
|
||||||
}
|
|
||||||
// network
|
|
||||||
regExp = QRegExp(QString("(down|up|netdev)"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_tooltipBools[QString("downTooltip")].toBool())) {
|
|
||||||
sources.append(QString("network/interfaces/") + m_paths[QString("netdev")].toString() + QString("/transmitter/data"));
|
|
||||||
sources.append(QString("network/interfaces/") + m_paths[QString("netdev")].toString() + QString("/receiver/data"));
|
|
||||||
}
|
|
||||||
// swap
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)swap.*"));
|
|
||||||
if ((m_foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(m_foundBars.indexOf(regExp) > -1) ||
|
|
||||||
(m_paths[QString("swapTooltip")].toBool())) {
|
|
||||||
sources.append(QString("mem/swap/free"));
|
|
||||||
sources.append(QString("mem/swap/used"));
|
|
||||||
}
|
|
||||||
// temp
|
|
||||||
regExp = QRegExp(QString("temp.*"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(m_paths[QString("tempDevice")].toString().split(QString("@@")));
|
|
||||||
// uptime
|
|
||||||
regExp = QRegExp(QString("(^|c)uptime"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("system/uptime"));
|
|
||||||
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AWDESources::getSourcesForTimeMonitor()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList sources;
|
|
||||||
QRegExp regExp;
|
|
||||||
|
|
||||||
// time
|
|
||||||
regExp = QRegExp(QString("(^|iso|short|long|c)time"));
|
|
||||||
if (m_foundKeys.indexOf(regExp) > -1)
|
|
||||||
sources.append(QString("Local"));
|
|
||||||
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
|
|
@ -43,7 +43,7 @@ static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scr
|
|||||||
|
|
||||||
void AWPlugin::registerTypes(const char *uri)
|
void AWPlugin::registerTypes(const char *uri)
|
||||||
{
|
{
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesome-widget"));
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget"));
|
||||||
|
|
||||||
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||||
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
||||||
|
@ -17,16 +17,18 @@
|
|||||||
|
|
||||||
#include "awkeys.h"
|
#include "awkeys.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
|
#include <QRegExp>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
#include "awdesources.h"
|
#include "awtooltip.h"
|
||||||
#include "extscript.h"
|
#include "extscript.h"
|
||||||
#include "graphicalitem.h"
|
#include "graphicalitem.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@ -50,17 +52,23 @@ AWKeys::~AWKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWKeys::initKeys(const QString pattern)
|
void AWKeys::initKeys(const QString pattern, const int maxTooltip)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
|
counts.clear();
|
||||||
|
keys.clear();
|
||||||
foundBars.clear();
|
foundBars.clear();
|
||||||
foundKeys.clear();
|
foundKeys.clear();
|
||||||
|
toolTip = nullptr;
|
||||||
|
|
||||||
// init
|
// init
|
||||||
|
counts = getCounts();
|
||||||
|
keys = dictKeys();
|
||||||
foundBars = findGraphicalItems(pattern);
|
foundBars = findGraphicalItems(pattern);
|
||||||
foundKeys = findKeys(pattern);
|
foundKeys = findKeys(pattern);
|
||||||
|
toolTip = new AWToolTip(this, maxTooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,12 +79,10 @@ void AWKeys::initValues()
|
|||||||
// clear
|
// clear
|
||||||
extScripts.clear();
|
extScripts.clear();
|
||||||
graphicalItems.clear();
|
graphicalItems.clear();
|
||||||
keys.clear();
|
|
||||||
|
|
||||||
// init
|
// init
|
||||||
extScripts = getExtScripts();
|
extScripts = getExtScripts();
|
||||||
graphicalItems = getGraphicalItems();
|
graphicalItems = getGraphicalItems();
|
||||||
keys = dictKeys();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,95 +124,46 @@ int AWKeys::numberCpus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString AWKeys::parsePattern(const QString pattern, const QMap<QString, QVariant> values)
|
QString AWKeys::parsePattern(const QString pattern)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString parsed = pattern;
|
QString parsed = pattern;
|
||||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
for (int i=0; i<foundKeys.count(); i++)
|
for (int i=0; i<foundKeys.count(); i++)
|
||||||
parsed.replace(QString("$") + foundKeys[i], values[foundKeys[i]].toString());
|
parsed.replace(QString("$") + foundKeys[i], values[foundKeys[i]]);
|
||||||
for (int i=0; i<foundBars.count(); i++)
|
for (int i=0; i<foundBars.count(); i++) {
|
||||||
parsed.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->image(values[foundBars[i]].toFloat()));
|
QString key = foundBars[i];
|
||||||
|
key.remove(QRegExp(QString("bar[0-9]{1,}")));
|
||||||
|
parsed.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->image(values[key].toFloat()));
|
||||||
|
}
|
||||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||||
|
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList AWKeys::sourcesForDataEngine(const QString pattern,
|
|
||||||
const QMap<QString, QVariant> paths,
|
|
||||||
const QMap<QString, QVariant> tooltipBools,
|
|
||||||
const QString dataEngine)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Pattern" << pattern;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "DataEngine" << dataEngine;
|
|
||||||
|
|
||||||
AWDESources *deSources = new AWDESources(this, pattern, foundKeys, foundBars,
|
|
||||||
counts(), paths, tooltipBools);
|
|
||||||
|
|
||||||
QStringList sources;
|
|
||||||
if (dataEngine == QString("ext-sysmon"))
|
|
||||||
sources = deSources->getSourcesForExtSystemMonitor();
|
|
||||||
else if (dataEngine == QString("systemmonitor"))
|
|
||||||
sources = deSources->getSourcesForSystemMonitor();
|
|
||||||
else if (dataEngine == QString("time"))
|
|
||||||
sources = deSources->getSourcesForTimeMonitor();
|
|
||||||
delete deSources;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Sources" << sources;
|
|
||||||
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float AWKeys::temperature(const float temp, const QString units)
|
float AWKeys::temperature(const float temp, const QString units)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
float convertedTemp = temp;
|
float converted = temp;
|
||||||
if (units == QString("Celsius"))
|
if (units == QString("Celsius"))
|
||||||
;
|
;
|
||||||
else if (units == QString("Fahrenheit"))
|
else if (units == QString("Fahrenheit"))
|
||||||
convertedTemp = temp * 9.0 / 5.0 + 32.0;
|
converted = temp * 9.0 / 5.0 + 32.0;
|
||||||
else if (units == QString("Kelvin"))
|
else if (units == QString("Kelvin"))
|
||||||
convertedTemp = temp + 273.15;
|
converted = temp + 273.15;
|
||||||
else if (units == QString("Reaumur"))
|
else if (units == QString("Reaumur"))
|
||||||
convertedTemp = temp * 0.8;
|
converted = temp * 0.8;
|
||||||
else if (units == QString("cm^-1"))
|
else if (units == QString("cm^-1"))
|
||||||
convertedTemp = (temp + 273.15) * 0.695;
|
converted = (temp + 273.15) * 0.695;
|
||||||
else if (units == QString("kJ/mol"))
|
else if (units == QString("kJ/mol"))
|
||||||
convertedTemp = (temp + 273.15) * 8.31;
|
converted = (temp + 273.15) * 8.31;
|
||||||
else if (units == QString("kcal/mol"))
|
else if (units == QString("kcal/mol"))
|
||||||
convertedTemp = (temp + 273.15) * 1.98;
|
converted = (temp + 273.15) * 1.98;
|
||||||
|
|
||||||
return convertedTemp;
|
return converted;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWKeys::counts()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QMap<QString, QVariant> awCounts;
|
|
||||||
awCounts[QString("cpu")] = numberCpus();
|
|
||||||
awCounts[QString("custom")] = getExtScripts().count();
|
|
||||||
// awCounts[QString("disk")] = configuration[QString("disk")].split(QString("@@")).count();
|
|
||||||
// awCounts[QString("fan")] = configuration[QString("fanDevice")].split(QString("@@")).count();
|
|
||||||
// awCounts[QString("hddtemp")] = configuration[QString("hdd")].split(QString("@@")).count();
|
|
||||||
// awCounts[QString("mount")] = configuration[QString("mount")].split(QString("@@")).count();
|
|
||||||
// awCounts[QString("pkg")] = deSettings[QString("PKGCMD")].split(QChar(',')).count();
|
|
||||||
// awCounts[QString("temp")] = configuration[QString("tempDevice")].split(QString("@@")).count();
|
|
||||||
// awCounts[QString("tooltip")] = 0;
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("cpuTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("cpuclTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("memTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("swapTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("downTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] += configuration[QString("batteryTooltip")].toInt();
|
|
||||||
// awCounts[QString("tooltip")] = counts[QString("tooltip")] / 2;
|
|
||||||
|
|
||||||
return awCounts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -214,7 +171,6 @@ QStringList AWKeys::dictKeys()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QVariant> awCounts = counts();
|
|
||||||
QStringList allKeys;
|
QStringList allKeys;
|
||||||
// time
|
// time
|
||||||
allKeys.append(QString("time"));
|
allKeys.append(QString("time"));
|
||||||
@ -226,17 +182,17 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("uptime"));
|
allKeys.append(QString("uptime"));
|
||||||
allKeys.append(QString("cuptime"));
|
allKeys.append(QString("cuptime"));
|
||||||
// cpuclock
|
// cpuclock
|
||||||
for (int i=awCounts[QString("cpu")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("cpu")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("cpucl") + QString::number(i));
|
allKeys.append(QString("cpucl") + QString::number(i));
|
||||||
allKeys.append(QString("cpucl"));
|
allKeys.append(QString("cpucl"));
|
||||||
// cpu
|
// cpu
|
||||||
for (int i=awCounts[QString("cpu")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("cpu")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("cpu") + QString::number(i));
|
allKeys.append(QString("cpu") + QString::number(i));
|
||||||
allKeys.append(QString("cpu"));
|
allKeys.append(QString("cpu"));
|
||||||
// temperature
|
// temperature
|
||||||
for (int i=awCounts[QString("temp")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("temp")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("temp") + QString::number(i));
|
allKeys.append(QString("temp") + QString::number(i));
|
||||||
for (int i=awCounts[QString("fan")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("fan")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("fan") + QString::number(i));
|
allKeys.append(QString("fan") + QString::number(i));
|
||||||
// gputemp
|
// gputemp
|
||||||
allKeys.append(QString("gputemp"));
|
allKeys.append(QString("gputemp"));
|
||||||
@ -261,7 +217,7 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("swaptotgb"));
|
allKeys.append(QString("swaptotgb"));
|
||||||
allKeys.append(QString("swap"));
|
allKeys.append(QString("swap"));
|
||||||
// hdd
|
// hdd
|
||||||
for (int i=awCounts[QString("mount")].toInt()-1; i>=0; i--) {
|
for (int i=counts[QString("mount")].toInt()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddmb") + QString::number(i));
|
allKeys.append(QString("hddmb") + QString::number(i));
|
||||||
allKeys.append(QString("hddgb") + QString::number(i));
|
allKeys.append(QString("hddgb") + QString::number(i));
|
||||||
allKeys.append(QString("hddfreemb") + QString::number(i));
|
allKeys.append(QString("hddfreemb") + QString::number(i));
|
||||||
@ -271,12 +227,12 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("hdd") + QString::number(i));
|
allKeys.append(QString("hdd") + QString::number(i));
|
||||||
}
|
}
|
||||||
// hdd speed
|
// hdd speed
|
||||||
for (int i=awCounts[QString("disk")].toInt()-1; i>=0; i--) {
|
for (int i=counts[QString("disk")].toInt()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddr") + QString::number(i));
|
allKeys.append(QString("hddr") + QString::number(i));
|
||||||
allKeys.append(QString("hddw") + QString::number(i));
|
allKeys.append(QString("hddw") + QString::number(i));
|
||||||
}
|
}
|
||||||
// hdd temp
|
// hdd temp
|
||||||
for (int i=awCounts[QString("hddtemp")].toInt()-1; i>=0; i--) {
|
for (int i=counts[QString("hddtemp")].toInt()-1; i>=0; i--) {
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
allKeys.append(QString("hddtemp") + QString::number(i));
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
allKeys.append(QString("hddtemp") + QString::number(i));
|
||||||
}
|
}
|
||||||
@ -286,7 +242,7 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("netdev"));
|
allKeys.append(QString("netdev"));
|
||||||
// battery
|
// battery
|
||||||
allKeys.append(QString("ac"));
|
allKeys.append(QString("ac"));
|
||||||
for (int i=awCounts[QString("bat")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("bat")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("bat") + QString::number(i));
|
allKeys.append(QString("bat") + QString::number(i));
|
||||||
allKeys.append(QString("bat"));
|
allKeys.append(QString("bat"));
|
||||||
// player
|
// player
|
||||||
@ -300,10 +256,10 @@ QStringList AWKeys::dictKeys()
|
|||||||
allKeys.append(QString("pstotal"));
|
allKeys.append(QString("pstotal"));
|
||||||
allKeys.append(QString("ps"));
|
allKeys.append(QString("ps"));
|
||||||
// package manager
|
// package manager
|
||||||
for (int i=awCounts[QString("pkg")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("pkg")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("pkgcount") + QString::number(i));
|
allKeys.append(QString("pkgcount") + QString::number(i));
|
||||||
// custom
|
// custom
|
||||||
for (int i=awCounts[QString("custom")].toInt()-1; i>=0; i--)
|
for (int i=counts[QString("custom")].toInt()-1; i>=0; i--)
|
||||||
allKeys.append(QString("custom") + QString::number(i));
|
allKeys.append(QString("custom") + QString::number(i));
|
||||||
// desktop
|
// desktop
|
||||||
allKeys.append(QString("desktop"));
|
allKeys.append(QString("desktop"));
|
||||||
@ -371,6 +327,285 @@ QStringList AWKeys::timeKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWKeys::setDataBySource(const QString sourceName,
|
||||||
|
const QMap<QString, QVariant> data,
|
||||||
|
const QMap<QString, QVariant> params)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
||||||
|
|
||||||
|
// 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; i<data.keys().count(); i++) {
|
||||||
|
if (data.keys()[i] == QString("ac")) {
|
||||||
|
values[QString("ac")] = data.keys()[i];
|
||||||
|
// if (data[QString("ac")].toBool())
|
||||||
|
// values[QString("ac")] = configuration[QString("acOnline")];
|
||||||
|
// else
|
||||||
|
// values[QString("ac")] = configuration[QString("acOffline")];
|
||||||
|
} else {
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
||||||
|
toolTip->setData(QString("bat"), data[data.keys()[i]].toFloat(), data[QString("ac")].toBool());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("cpu/system/TotalLoad")) {
|
||||||
|
// cpu
|
||||||
|
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
||||||
|
toolTip->setData(QString("cpu"), 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("cpucl"), 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<data.keys().count(); i++)
|
||||||
|
values[data.keys()[i]] = data[data.keys()[i]].toString();
|
||||||
|
} else if (sourceName == QString("desktop")) {
|
||||||
|
// desktops
|
||||||
|
values[QString("desktop")] = data[QString("currentName")].toString();
|
||||||
|
values[QString("ndesktop")] = QString("%1").arg(data[QString("currentNumber")].toInt());
|
||||||
|
values[QString("tdesktops")] = QString("%1").arg(data[QString("number")].toInt());
|
||||||
|
} else if (sourceName.contains(hddrRegExp)) {
|
||||||
|
// read speed
|
||||||
|
QString device = sourceName;
|
||||||
|
device.remove(QString("/Rate/rblk"));
|
||||||
|
for (int i=0; i<counts[QString("disk")].toInt(); i++)
|
||||||
|
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
||||||
|
values[QString("hddr") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (sourceName.contains(hddwRegExp)) {
|
||||||
|
// write speed
|
||||||
|
QString device = sourceName;
|
||||||
|
device.remove(QString("/Rate/wblk"));
|
||||||
|
for (int i=0; i<counts[QString("disk")].toInt(); i++)
|
||||||
|
if (params[QString("disk")].toString().split(QString("@@"))[i] == device) {
|
||||||
|
values[QString("hddw") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("gpu")) {
|
||||||
|
// gpu load
|
||||||
|
values[QString("gpu")] = QString("%1").arg(data[QString("GPU")].toFloat(), 5, 'f', 1);
|
||||||
|
} else if (sourceName == QString("gputemp")) {
|
||||||
|
// gpu temperature
|
||||||
|
values[QString("gputemp")] = QString("%1").arg(
|
||||||
|
temperature(data[QString("GPUTemp")].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<counts[QString("mount")].toInt(); i++)
|
||||||
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
|
values[QString("hdd") + QString::number(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<counts[QString("mount")].toInt(); i++)
|
||||||
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
|
values[QString("hddfreemb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("hddfreegb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (sourceName.contains(mountUsedRegExp)) {
|
||||||
|
// used
|
||||||
|
QString mount = sourceName;
|
||||||
|
mount.remove(QString("partitions")).remove(QString("/usedspace"));
|
||||||
|
for (int i=0; i<counts[QString("mount")].toInt(); i++)
|
||||||
|
if (params[QString("mount")].toString().split(QString("@@"))[i] == mount) {
|
||||||
|
values[QString("hddmb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("hddgb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
||||||
|
// total
|
||||||
|
values[QString("hddtotmb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
values[QString("hddfreemb") + QString::number(i)].toInt() +
|
||||||
|
values[QString("hddmb") + QString::number(i)].toInt());
|
||||||
|
values[QString("hddtotgb") + QString::number(i)] = QString("%1").arg(
|
||||||
|
values[QString("hddfreegb") + QString::number(i)].toFloat() +
|
||||||
|
values[QString("hddgb") + QString::number(i)].toFloat(), 5, 'f', 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("hddtemp")) {
|
||||||
|
// hdd temperature
|
||||||
|
for (int i=0; i<data.keys().count(); i++)
|
||||||
|
for (int j=0; j<counts[QString("hddtemp")].toInt(); j++)
|
||||||
|
if (data.keys()[i] == params[QString("hdd")].toString().split(QString("@@"))[j]) {
|
||||||
|
values[QString("hddtemp") + QString::number(j)] = QString("%1").arg(
|
||||||
|
temperature(data[data.keys()[i]].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("mem/physical/application")) {
|
||||||
|
// app memory
|
||||||
|
values[QString("memmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("memgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
||||||
|
} else if (sourceName == QString("mem/physical/free")) {
|
||||||
|
// free memory
|
||||||
|
values[QString("memfreemb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("memfreegb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
||||||
|
} else if (sourceName == QString("mem/physical/used")) {
|
||||||
|
// used memory
|
||||||
|
values[QString("memusedmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 0, 'f', 0);
|
||||||
|
values[QString("memusedgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
||||||
|
// total
|
||||||
|
values[QString("memtotmb")] = QString("%1").arg(
|
||||||
|
values[QString("memusedmb")].toInt() + values[QString("memfreemb")].toInt(), 5);
|
||||||
|
values[QString("memtotgb")] = QString("%1").arg(
|
||||||
|
values[QString("memusedgb")].toFloat() + values[QString("memfreegb")].toFloat(), 4, 'f', 1);
|
||||||
|
// percentage
|
||||||
|
values[QString("mem")] = QString("%1").arg(
|
||||||
|
100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat(), 5, 'f', 1);
|
||||||
|
toolTip->setData(QString("mem"), values[QString("mem")].toFloat());
|
||||||
|
} else if (sourceName == QString("netdev")) {
|
||||||
|
// network device
|
||||||
|
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"));
|
||||||
|
if (device == networkDevice(params[QString("customNetdev")].toString())) {
|
||||||
|
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
|
toolTip->setData(QString("down"), data[QString("value")].toFloat());
|
||||||
|
}
|
||||||
|
} else if (sourceName.contains(netTransRegExp)) {
|
||||||
|
// upload speed
|
||||||
|
QString device = sourceName;
|
||||||
|
device.remove(QString("network/interfaces/")).remove(QString("/transmitter/data"));
|
||||||
|
if (device == networkDevice(params[QString("customNetdev")].toString())) {
|
||||||
|
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
||||||
|
toolTip->setData(QString("up"), data[QString("value")].toFloat());
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("pkg")) {
|
||||||
|
// package manager
|
||||||
|
for (int i=0; i<data.keys().count(); i++)
|
||||||
|
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toInt(), 2);
|
||||||
|
} else if (sourceName == QString("player")) {
|
||||||
|
// player
|
||||||
|
values[QString("album")] = data[QString("album")].toString();
|
||||||
|
values[QString("artist")] = data[QString("artist")].toString();
|
||||||
|
values[QString("duration")] = data[QString("duration")].toString();
|
||||||
|
values[QString("progress")] = data[QString("progress")].toString();
|
||||||
|
values[QString("title")] = data[QString("title")].toString();
|
||||||
|
} else if (sourceName == QString("ps")) {
|
||||||
|
// ps
|
||||||
|
values[QString("ps")] = data[QString("ps")].toString();
|
||||||
|
values[QString("pscount")] = QString("%1").arg(data[QString("pscount")].toInt(), 2);
|
||||||
|
values[QString("pstotal")] = QString("%1").arg(data[QString("pstotal")].toInt(), 3);
|
||||||
|
} else if (sourceName == QString("mem/swap/free")) {
|
||||||
|
// free swap
|
||||||
|
values[QString("swapfreemb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("swapfreegb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
||||||
|
} else if (sourceName == QString("mem/swap/used")) {
|
||||||
|
// used swap
|
||||||
|
values[QString("swapmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
||||||
|
values[QString("swapgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
||||||
|
// total
|
||||||
|
values[QString("swaptotmb")] = QString("%1").arg(
|
||||||
|
values[QString("swapmb")].toInt() + values[QString("swapfreemb")].toInt(), 5);
|
||||||
|
values[QString("swaptotgb")] = QString("%1").arg(
|
||||||
|
values[QString("swapgb")].toFloat() + values[QString("swapfreegb")].toFloat(), 4, 'f', 1);
|
||||||
|
// percentage
|
||||||
|
values[QString("swap")] = QString("%1").arg(
|
||||||
|
100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat(), 5, 'f', 1);
|
||||||
|
toolTip->setData(QString("swap"), values[QString("swap")].toFloat());
|
||||||
|
} else if (sourceName.contains(tempRegExp)) {
|
||||||
|
// temperature devices
|
||||||
|
if (data[QString("units")].toString() == QString("rpm")) {
|
||||||
|
for (int i=0; i<counts[QString("fan")].toInt(); i++)
|
||||||
|
if (sourceName == params[QString("fanDevice")].toString().split(QString("@@"))[i]) {
|
||||||
|
values[QString("fan") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i=0; i<counts[QString("temp")].toInt(); i++)
|
||||||
|
if (sourceName == params[QString("tempDevice")].toString().split(QString("@@"))[i]) {
|
||||||
|
values[QString("temp") + QString::number(i)] = QString("%1").arg(
|
||||||
|
temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (sourceName == QString("Local")) {
|
||||||
|
// time
|
||||||
|
values[QString("time")] = data[QString("DateTime")].toDateTime().toString(Qt::TextDate);
|
||||||
|
values[QString("isotime")] = data[QString("DateTime")].toDateTime().toString(Qt::ISODate);
|
||||||
|
values[QString("shorttime")] = data[QString("DateTime")].toDateTime().toString(Qt::SystemLocaleShortDate);
|
||||||
|
values[QString("longtime")] = data[QString("DateTime")].toDateTime().toString(Qt::SystemLocaleLongDate);
|
||||||
|
QStringList _timeKeys = timeKeys();
|
||||||
|
values[QString("ctime")] = params[QString("customTime")].toString();
|
||||||
|
for (int i=0; i<_timeKeys.count(); i++)
|
||||||
|
values[QString("ctime")].replace(QString("$") + _timeKeys[i],
|
||||||
|
data[QString("DateTime")].toDateTime().toString(_timeKeys[i]));
|
||||||
|
} else if (sourceName == QString("system/uptime")) {
|
||||||
|
// uptime
|
||||||
|
int uptime = data[QString("value")].toFloat();
|
||||||
|
int seconds = uptime - uptime % 60;
|
||||||
|
int minutes = seconds / 60 % 60;
|
||||||
|
int hours = ((seconds / 60) - minutes) / 60 % 24;
|
||||||
|
int days = (((seconds / 60) - minutes) / 60 - hours) / 24;
|
||||||
|
values[QString("uptime")] = QString("%1d%2h%3m").arg(days, 3).arg(hours, 2).arg(minutes, 2);
|
||||||
|
values[QString("cuptime")] = params[QString("customUptime")].toString();
|
||||||
|
values[QString("cuptime")].replace(QString("$dd"), QString("%1").arg(days, 3, 10, QChar('0')));
|
||||||
|
values[QString("cuptime")].replace(QString("$d"), QString("%1").arg(days));
|
||||||
|
values[QString("cuptime")].replace(QString("$hh"), QString("%1").arg(hours, 2, 10, QChar('0')));
|
||||||
|
values[QString("cuptime")].replace(QString("$h"), QString("%1").arg(hours));
|
||||||
|
values[QString("cuptime")].replace(QString("$mm"), QString("%1").arg(minutes, 2, 10, QChar('0')));
|
||||||
|
values[QString("cuptime")].replace(QString("$m"), QString("%1").arg(minutes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QVariant> AWKeys::getCounts()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QMap<QString, QVariant> awCounts;
|
||||||
|
awCounts[QString("cpu")] = numberCpus();
|
||||||
|
awCounts[QString("custom")] = getExtScripts().count();
|
||||||
|
// awCounts[QString("disk")] = configuration[QString("disk")].split(QString("@@")).count();
|
||||||
|
// awCounts[QString("fan")] = configuration[QString("fanDevice")].split(QString("@@")).count();
|
||||||
|
// awCounts[QString("hddtemp")] = configuration[QString("hdd")].split(QString("@@")).count();
|
||||||
|
// awCounts[QString("mount")] = configuration[QString("mount")].split(QString("@@")).count();
|
||||||
|
// awCounts[QString("pkg")] = deSettings[QString("PKGCMD")].split(QChar(',')).count();
|
||||||
|
// awCounts[QString("temp")] = configuration[QString("tempDevice")].split(QString("@@")).count();
|
||||||
|
// awCounts[QString("tooltip")] = 0;
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("cpuTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("cpuclTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("memTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("swapTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("downTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] += configuration[QString("batteryTooltip")].toInt();
|
||||||
|
// awCounts[QString("tooltip")] = counts[QString("tooltip")] / 2;
|
||||||
|
|
||||||
|
return awCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList AWKeys::findGraphicalItems(const QString pattern)
|
QStringList AWKeys::findGraphicalItems(const QString pattern)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
@ -413,7 +648,7 @@ QList<ExtScript *> AWKeys::getExtScripts()
|
|||||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||||
QString("/plasma_engine_extsysmon/scripts");
|
QString("/plasma_engine_extsysmon/scripts");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if (localDirectory.mkdir(localDir))
|
if (localDirectory.mkpath(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||||
@ -444,7 +679,7 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
|||||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
QString localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||||
QString("/plasma_applet_awesome-widget/desktops");
|
QString("/plasma_applet_awesome-widget/desktops");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if (localDirectory.mkdir(localDir))
|
if (localDirectory.mkpath(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class AWToolTip;
|
||||||
class ExtScript;
|
class ExtScript;
|
||||||
class GraphicalItem;
|
class GraphicalItem;
|
||||||
|
|
||||||
@ -36,23 +37,22 @@ public:
|
|||||||
AWKeys(QObject *parent = 0);
|
AWKeys(QObject *parent = 0);
|
||||||
~AWKeys();
|
~AWKeys();
|
||||||
|
|
||||||
Q_INVOKABLE void initKeys(const QString pattern);
|
Q_INVOKABLE void initKeys(const QString pattern, const int maxTooltip);
|
||||||
Q_INVOKABLE void initValues();
|
Q_INVOKABLE void initValues();
|
||||||
Q_INVOKABLE bool isDebugEnabled();
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
Q_INVOKABLE QString networkDevice(const QString custom = QString(""));
|
Q_INVOKABLE QString networkDevice(const QString custom = QString(""));
|
||||||
Q_INVOKABLE int numberCpus();
|
Q_INVOKABLE int numberCpus();
|
||||||
Q_INVOKABLE QString parsePattern(const QString pattern, const QMap<QString, QVariant> values);
|
Q_INVOKABLE QString parsePattern(const QString pattern);
|
||||||
Q_INVOKABLE QStringList sourcesForDataEngine(const QString pattern,
|
|
||||||
const QMap<QString, QVariant> paths,
|
|
||||||
const QMap<QString, QVariant> tooltipBools,
|
|
||||||
const QString dataEngine = QString("systemmonitor"));
|
|
||||||
Q_INVOKABLE float temperature(const float temp, const QString units = QString("Celsius"));
|
Q_INVOKABLE float temperature(const float temp, const QString units = QString("Celsius"));
|
||||||
// keys
|
// keys
|
||||||
Q_INVOKABLE QMap<QString, QVariant> counts();
|
|
||||||
Q_INVOKABLE QStringList dictKeys();
|
Q_INVOKABLE QStringList dictKeys();
|
||||||
Q_INVOKABLE QStringList extScriptsInfo();
|
Q_INVOKABLE QStringList extScriptsInfo();
|
||||||
Q_INVOKABLE QStringList graphicalItemsInfo();
|
Q_INVOKABLE QStringList graphicalItemsInfo();
|
||||||
Q_INVOKABLE QStringList timeKeys();
|
Q_INVOKABLE QStringList timeKeys();
|
||||||
|
Q_INVOKABLE void setDataBySource(const QString sourceName,
|
||||||
|
const QMap<QString, QVariant> data,
|
||||||
|
const QMap<QString, QVariant> params);
|
||||||
|
Q_INVOKABLE QMap<QString, QVariant> getCounts();
|
||||||
Q_INVOKABLE QStringList findGraphicalItems(const QString pattern);
|
Q_INVOKABLE QStringList findGraphicalItems(const QString pattern);
|
||||||
Q_INVOKABLE QStringList findKeys(const QString pattern);
|
Q_INVOKABLE QStringList findKeys(const QString pattern);
|
||||||
|
|
||||||
@ -60,11 +60,14 @@ private:
|
|||||||
QList<ExtScript *> getExtScripts();
|
QList<ExtScript *> getExtScripts();
|
||||||
QList<GraphicalItem *> getGraphicalItems();
|
QList<GraphicalItem *> getGraphicalItems();
|
||||||
GraphicalItem *getItemByTag(const QString tag);
|
GraphicalItem *getItemByTag(const QString tag);
|
||||||
|
AWToolTip *toolTip = nullptr;
|
||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
QList<GraphicalItem *> graphicalItems;
|
QList<GraphicalItem *> graphicalItems;
|
||||||
QList<ExtScript *> extScripts;
|
QList<ExtScript *> extScripts;
|
||||||
QStringList foundBars, foundKeys, keys;
|
QStringList foundBars, foundKeys, keys;
|
||||||
|
QMap<QString, QVariant> counts;
|
||||||
|
QMap<QString, QString> values;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
57
sources/awesome-widget-kf5/plugin/awtooltip.cpp
Normal file
57
sources/awesome-widget-kf5/plugin/awtooltip.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 "awtooltip.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
|
AWToolTip::AWToolTip(QObject *parent,
|
||||||
|
const int maxCount)
|
||||||
|
: QObject(parent),
|
||||||
|
m_maxCount(maxCount)
|
||||||
|
{
|
||||||
|
// debug
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
debug = (debugEnv == QString("yes"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AWToolTip::~AWToolTip()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWToolTip::setData (const QString source, const float value, const bool ac)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (data[source].count() == 0)
|
||||||
|
data[source].append(0.0);
|
||||||
|
else if (data[source].count() > m_maxCount)
|
||||||
|
data[source].takeFirst();
|
||||||
|
|
||||||
|
if (ac)
|
||||||
|
data[source].append(value);
|
||||||
|
else
|
||||||
|
data[source].append(-value);
|
||||||
|
}
|
@ -16,39 +16,33 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef AWDESOURCES_H
|
#ifndef AWTOOLTIP_H
|
||||||
#define AWDESOURCES_H
|
#define AWTOOLTIP_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariant>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
|
||||||
class AWDESources : public QObject
|
class AWToolTip : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AWDESources(QObject *parent = 0,
|
AWToolTip(QObject *parent = 0,
|
||||||
const QString pattern = QString(""),
|
int maxCount = 0);
|
||||||
const QStringList foundKeys = QStringList(),
|
~AWToolTip();
|
||||||
const QStringList foundBars = QStringList(),
|
|
||||||
const QMap<QString, QVariant> counts = QMap<QString, QVariant>(),
|
|
||||||
const QMap<QString, QVariant> paths = QMap<QString, QVariant>(),
|
|
||||||
const QMap<QString, QVariant> tooltipBools = QMap<QString, QVariant>());
|
|
||||||
~AWDESources();
|
|
||||||
|
|
||||||
QStringList getSourcesForExtSystemMonitor();
|
// Q_INVOKABLE QPixmap image();
|
||||||
QStringList getSourcesForSystemMonitor();
|
void setData(const QString source, const float value,
|
||||||
QStringList getSourcesForTimeMonitor();
|
const bool ac = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
QString m_pattern;
|
int m_maxCount = 0;
|
||||||
QStringList m_foundKeys, m_foundBars;
|
QMap<QString, QList<float>> data;
|
||||||
QMap<QString, QVariant> m_counts, m_paths, m_tooltipBools;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* AWDESOURCES_H */
|
#endif /* AWTOOLTIP_H */
|
@ -1,3 +1,3 @@
|
|||||||
module org.kde.plasma.private.awesome-widget
|
module org.kde.plasma.private.awesomewidget
|
||||||
|
|
||||||
plugin awplugin
|
plugin awplugin
|
||||||
|
@ -11,7 +11,7 @@ if (BUILD_KDE4)
|
|||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||||
else ()
|
else ()
|
||||||
find_package (Qt5 REQUIRED COMPONENTS Widgets)
|
find_package (Qt5 REQUIRED COMPONENTS Network Widgets)
|
||||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||||
|
@ -138,7 +138,7 @@ void ExtendedSysMon::initScripts()
|
|||||||
localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||||
QString("/plasma_engine_extsysmon/scripts");
|
QString("/plasma_engine_extsysmon/scripts");
|
||||||
QDir localDirectory;
|
QDir localDirectory;
|
||||||
if (localDirectory.mkdir(localDir))
|
if (localDirectory.mkpath(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||||
@ -246,7 +246,7 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(QMap<QString, QString
|
|||||||
}
|
}
|
||||||
// pkgcmd
|
// pkgcmd
|
||||||
for (int i=rawConfig[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
for (int i=rawConfig[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
||||||
i<rawConfig[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
|
i<rawConfig[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count();
|
||||||
i++)
|
i++)
|
||||||
rawConfig[QString("PKGNULL")] += QString(",0");
|
rawConfig[QString("PKGNULL")] += QString(",0");
|
||||||
// player
|
// player
|
||||||
@ -530,7 +530,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPsStats()
|
|||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
|
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
|
||||||
if (!qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("ps ")))
|
if (!qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("ps ")))
|
||||||
psList.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
|
psList.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
|
||||||
psStats[QString("psCount")] = psList.count();
|
psStats[QString("pscount")] = psList.count();
|
||||||
psStats[QString("ps")] = psList.join(QString(","));
|
psStats[QString("ps")] = psList.join(QString(","));
|
||||||
|
|
||||||
cmd = QString("ps -e --no-headers -o command");
|
cmd = QString("ps -e --no-headers -o command");
|
||||||
@ -539,7 +539,7 @@ QMap<QString, QVariant> ExtendedSysMon::getPsStats()
|
|||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||||
psStats[QString("psTotal")] = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
|
psStats[QString("pstotal")] = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
|
||||||
|
|
||||||
return psStats;
|
return psStats;
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|||||||
setData(source, QString("value"), getNetworkDevice());
|
setData(source, QString("value"), getNetworkDevice());
|
||||||
} else if (source == QString("pkg")) {
|
} else if (source == QString("pkg")) {
|
||||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
||||||
setData(source, QString("pkgCount") + QString::number(i),
|
setData(source, QString("pkgcount") + QString::number(i),
|
||||||
getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i]));
|
getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i]));
|
||||||
} else if (source == QString("player")) {
|
} else if (source == QString("player")) {
|
||||||
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
QMap<QString, QVariant> player = getPlayerInfo(configuration[QString("PLAYER")],
|
||||||
|
Loading…
Reference in New Issue
Block a user