Release ext-sysmon 1.5

+ added configuration file
This commit is contained in:
arcan1s 2013-11-18 19:16:38 +04:00
parent 24325e2d3a
commit 916c32589f
8 changed files with 103 additions and 30 deletions

View File

@ -22,8 +22,8 @@ makedepends=('automoc4' 'cmake')
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid
https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip) https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip)
install=${pkgname}.install install=${pkgname}.install
md5sums=('2a7e055aaabc8a767eccf0f0cfd03303' md5sums=('9872eedca313768f18de0facc2fc135d'
'b17aba604e5102961faf0bcdfd20744b') '29a0fbc2014b0b7cacfab8186a56a1b6')
build () build ()
{ {

Binary file not shown.

View File

@ -14,6 +14,7 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${PROJECT_NAME}) set (PLUGIN_NAME ${PROJECT_NAME})
file (GLOB PROJECT_DESKTOP *.desktop) file (GLOB PROJECT_DESKTOP *.desktop)
file (GLOB PROJECT_SRCS *.cpp) file (GLOB PROJECT_SRCS *.cpp)
file (GLOB PROJECT_CONF *.conf)
# make # make
kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS}) kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS})
@ -22,3 +23,4 @@ target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
# install # install
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
install (FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${PROJECT_CONF} DESTINATION ../etc/)

13
ext-sysmon/extsysmon.conf Normal file
View File

@ -0,0 +1,13 @@
# Configuration file for Extended Systemmonitor DataEngine (v.1.5)
# Uncomment needed lines
# Set GPU device
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto'
#GPUDEV=auto
# Set block device for hddtemp comma separated or use 'all'
#HDDDEV=all
# Set MPD settings
#MPDADDRESS=localhost
#MPDPORT=6600

View File

@ -20,6 +20,7 @@
#include "extsysmon.h" #include "extsysmon.h"
#include <Plasma/DataContainer> #include <Plasma/DataContainer>
#include <QFile>
#include <stdio.h> #include <stdio.h>
@ -30,7 +31,22 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
Q_UNUSED(args) Q_UNUSED(args)
setMinimumPollingInterval(333); setMinimumPollingInterval(333);
readConfiguration(QString("/etc/extsysmon.conf"));
}
QStringList ExtendedSysMon::sources() const
{
QStringList source;
source.append(QString("gpu"));
source.append(QString("gputemp"));
source.append(QString("hddtemp"));
source.append(QString("player"));
return source;
}
bool ExtendedSysMon::readConfiguration(const QString confFileName)
{
// pre-setup
FILE *f_out; FILE *f_out;
f_out = popen("lspci 2> /dev/null", "r"); f_out = popen("lspci 2> /dev/null", "r");
char device[256]; char device[256];
@ -53,16 +69,53 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
hdddev.append(dev); hdddev.append(dev);
} }
pclose(f_out); pclose(f_out);
mpdAddress = QString("localhost");
mpdPort = QString("6600");
QString fileStr;
QFile confFile(confFileName);
bool exists = confFile.open(QIODevice::ReadOnly);
if (!exists)
return false;
while (true)
{
fileStr = QString(confFile.readLine());
if (confFile.atEnd())
break;
else if (fileStr[0] != '#')
{
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 1)
{
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV"))
{
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("ati"))
gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("nvidia"))
gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] == QString("ignore"))
gpudev = QString("ignore");
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV"))
{
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1] != QString("all"))
{
hdddev.clear();
for (int i=0; i<fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString(","), QString::SkipEmptyParts).count(); i++)
hdddev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString(","), QString::SkipEmptyParts)[i]);
}
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDADDRESS"))
mpdAddress = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDPORT"))
mpdPort = fileStr.split(QString("="), QString::SkipEmptyParts)[1];
}
}
} }
QStringList ExtendedSysMon::sources() const confFile.close();
{ return true;
QStringList source;
source.append(QString("gpu"));
source.append(QString("gputemp"));
source.append(QString("hddtemp"));
source.append(QString("player"));
return source;
} }
bool ExtendedSysMon::sourceRequestEvent(const QString &name) bool ExtendedSysMon::sourceRequestEvent(const QString &name)

View File

@ -32,9 +32,14 @@ public:
protected: protected:
bool sourceRequestEvent(const QString &name); bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source); bool updateSourceEvent(const QString &source);
bool readConfiguration(const QString confFileName);
QStringList sources() const;
// main configuration
QStringList hdddev; QStringList hdddev;
QString gpudev; QString gpudev;
QStringList sources() const; // configuration
QString mpdAddress;
QString mpdPort;
}; };
#endif // EXTSYSMON_H #endif // EXTSYSMON_H

Binary file not shown.

Binary file not shown.