diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index e6e0f09..0e7c6ad 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -7,8 +7,8 @@ cmake_policy (SET CMP0015 NEW) project (pytextmonitor) set (PROJECT_VERSION_MAJOR 1) -set (PROJECT_VERSION_MINOR 7) -set (PROJECT_VERSION_PATCH 5) +set (PROJECT_VERSION_MINOR 8) +set (PROJECT_VERSION_PATCH 0) set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message (STATUS "Version: ${PROJECT_VERSION}") diff --git a/sources/ext-sysmon/extsysmon.conf b/sources/ext-sysmon/extsysmon.conf index 87d018d..fb0bff3 100644 --- a/sources/ext-sysmon/extsysmon.conf +++ b/sources/ext-sysmon/extsysmon.conf @@ -1,6 +1,9 @@ # Configuration file for Extended Systemmonitor DataEngine # Uncomment needed lines +# Custom command +#CUSTOM=wget -qO- http://ifconfig.me/ip + # Set GPU device # May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto' #GPUDEV=auto @@ -12,5 +15,15 @@ #MPDADDRESS=localhost #MPDPORT=6600 -# Custom command -#CUSTOM=wget -qO- http://ifconfig.me/ip +# Package upgrade info +## from vicious +## Arch: PKGCMD=pacman -Qu PKGNULL=0 +## Debian: PKGCMD=apt-show-versions -u -b PKGNULL=0 +## Ubuntu: PKGCMD=aptitude search '~U' PKGNULL=0 +## Fedora: PKGCMD=yum list updates PKGNULL=3 +## FreeBSD: PKGCMD=pkg_version -I -l '<' PKGNULL=0 +## Mandriva: PKGCMD=urpmq --auto-select PKGNULL=0 +# Commands to run, comma separated +#PKGCMD=pacman -Qu +# Number of null lines for commands, comma separated +#PKGNULL=0 diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index bf8c384..b4833df 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -72,13 +72,13 @@ QString ExtendedSysMon::getAutoGpu() QStringList ExtendedSysMon::sources() const { QStringList source; + source.append(QString("custom")); source.append(QString("gpu")); source.append(QString("gputemp")); source.append(QString("hddtemp")); source.append(QString("pkg")); source.append(QString("player")); source.append(QString("ps")); - source.append(QString("custom")); return source; } @@ -86,12 +86,13 @@ QStringList ExtendedSysMon::sources() const bool ExtendedSysMon::readConfiguration() { // pre-setup + configuration[QString("CUSTOM")] = QString("wget -qO- http://ifconfig.me/ip"); configuration[QString("GPUDEV")] = QString("auto"); configuration[QString("HDDDEV")] = QString("all"); configuration[QString("MPDADDRESS")] = QString("localhost"); configuration[QString("MPDPORT")] = QString("6600"); - configuration[QString("CUSTOM")] = QString("wget -qO- http://ifconfig.me/ip"); configuration[QString("PKGCMD")] = QString("pacman -Qu"); + configuration[QString("PKGNULL")] = QString("0"); QString fileStr; // FIXME: define configuration file @@ -118,6 +119,10 @@ bool ExtendedSysMon::readConfiguration() configuration[QString("GPUDEV")] = getAutoGpu(); if (configuration[QString("HDDDEV")] == QString("all")) configuration[QString("HDDDEV")] = getAllHdd(); + for (int i=configuration[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count(); + itoUnicode(command.readAllStandardOutput()); for (int i=0; itoUnicode(command.readAllStandardOutput()).trimmed(); + for (int i=0; itoUnicode(command.readAllStandardOutput()).trimmed(); + count = qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); + return (count - pkgNull); +} + + bool ExtendedSysMon::sourceRequestEvent(const QString &name) { return updateSourceEvent(name); @@ -332,7 +371,12 @@ bool ExtendedSysMon::sourceRequestEvent(const QString &name) bool ExtendedSysMon::updateSourceEvent(const QString &source) { QString key; - if (source == QString("gpu")) { + if (source == QString("custom")) { + key = QString("custom"); + QString value = getCustomCmd(configuration[QString("CUSTOM")]); + setData(source, key, value); + } + else if (source == QString("gpu")) { key = QString("GPU"); float value = getGpu(configuration[QString("GPUDEV")]); setData(source, key, value); @@ -349,6 +393,14 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) setData(source, deviceList[i], value); } } + else if (source == QString("pkg")) { + for (int i=0; i