diff --git a/sources/netctl-dataengine/extsysmon.conf b/sources/netctl-dataengine/extsysmon.conf deleted file mode 100644 index 8bcaf13..0000000 --- a/sources/netctl-dataengine/extsysmon.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file for Extended Systemmonitor DataEngine (v.1.6) -# 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 diff --git a/sources/netctl-dataengine/extsysmon.cpp b/sources/netctl-dataengine/extsysmon.cpp deleted file mode 100644 index 4d37ef8..0000000 --- a/sources/netctl-dataengine/extsysmon.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2013 by Evgeniy Alekseev * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#include "extsysmon.h" - -#include -#include -#include - -#include -#include - - -ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) - : Plasma::DataEngine(parent, args) -{ - Q_UNUSED(args) - - setMinimumPollingInterval(333); - readConfiguration(); -} - -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() -{ - // pre-setup - FILE *f_out; - f_out = popen("lspci 2> /dev/null", "r"); - char device[256]; - QString dev; - while (fgets(device, 256, f_out) != NULL) - { - dev = QString(device); - if (dev.toLower().contains("nvidia")) - gpudev = QString("nvidia"); - else if (dev.toLower().contains("radeon")) - gpudev = QString("ati"); - } - pclose(f_out); - - f_out = popen("ls -1 /dev/sd[a-z] 2> /dev/null ; ls -1 /dev/hd[a-z] 2> /dev/null", "r"); - while (fgets(device, 256, f_out) != NULL) - { - dev = QString(device).split("\n")[0]; - if (dev[0] == '/') - hdddev.append(dev); - } - pclose(f_out); - - mpdAddress = QString("localhost"); - mpdPort = QString("6600"); - - QString fileStr; - // FIXME: define configuration file - QString confFileName = QString(getenv("HOME")) + QString("/.kde4/share/config/extsysmon.conf"); - QFile confFile(confFileName); - bool exists = confFile.open(QIODevice::ReadOnly); - if (!exists) - { - confFileName = QString("/usr/share/config/extsysmon.conf"); - confFile.setFileName(confFileName); - 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() == 2) - { - if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV")) - { - if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("ati")) - gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; - else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("nvidia")) - gpudev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; - else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("auto")) - gpudev = QString("ignore"); - } - else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV")) - { - if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("all")) - { - hdddev.clear(); - for (int i=0; i /dev/null | grep Gpu | tail -n1", "r"); - fgets (output, 256, f_out); - if ((output[0] == '\0') || - (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) - value = QString(" N\\A"); - else - { - out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; - sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); - value = QString(val); - } - pclose(f_out); - } - else if (gpudev == QString("ati")) - { - f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r"); - fgets (output, 256, f_out); - if ((output[0] == '\0') || - (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3)) - value = QString(" N\\A"); - else - { - out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3]; - sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); - value = QString(val); - } - pclose(f_out); - } - else - { - value = QString(" N\\A"); - } - if (ok == false) - value = QString(" N\\A"); - value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); - setData(source, key, value); - } - else if (source == QString("gputemp")) - { - key = QString("GPUTemp"); - if (gpudev == QString("nvidia")) - { - f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r"); - fgets (output, 256, f_out); - if ((output[0] == '\0') || - (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) - value = QString(" N\\A"); - else - { - out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; - sprintf (val, "%4.1f", out.toFloat(&ok)); - value = QString(val); - } - pclose(f_out); - } - else if (gpudev == QString("ati")) - { - f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r"); - fgets (output, 256, f_out); - if ((output[0] == '\0') || - (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4)) - value = QString(" N\\A"); - else - { - out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4]; - sprintf (val, "%4.1f", out.toFloat(&ok)); - value = QString(val); - } - pclose(f_out); - } - else - { - value = QString(" N\\A"); - } - if (ok == false) - value = QString(" N\\A"); - value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); - setData(source, key, value); - } - else if (source == QString("hddtemp")) - { - char command[256], *dev; - QByteArray qb; - for (int i=0; i /dev/null", dev); - f_out = popen(command, "r"); - fgets(output, 256, f_out); - if ((output[0] == '\0') || - (QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3)) - value = QString(" N\\A"); - else - { - out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2]; - sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok)); - value = QString(val); - } - pclose(f_out); - if (ok == false) - value = QString(" N\\A"); - value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); - setData(source, hdddev[i], value); - } - } - else if (source == QString("player")) - { - QProcess player; - QString qoutput; - // qmmp - qoutput = QString(""); - key = QString("qmmp_artist"); - player.start("qmmp --nowplaying %if(%p,%p,Unknown)"); - player.waitForFinished(-1); - qoutput = player.readAllStandardOutput(); - if (qoutput == QString("")) - value = QString("N\\A"); - else - value = qoutput.split(QString("\n"), QString::SkipEmptyParts)[0]; - setData(source, key, value); - qoutput = QString(""); - key = QString("qmmp_title"); - player.start("qmmp --nowplaying %if(%t,%t,Unknown)"); - player.waitForFinished(-1); - qoutput = player.readAllStandardOutput(); - if (qoutput == QString("")) - value = QString("N\\A"); - else - value = qoutput.split(QString("\n"), QString::SkipEmptyParts)[0]; - setData(source, key, value); - // amarok - QString value_artist, qstr; - qoutput = QString(""); - value = QString("N\\A"); - value_artist = QString("N\\A"); - player.start("qdbus org.kde.amarok /Player GetMetadata"); - player.waitForFinished(-1); - qoutput = player.readAllStandardOutput(); - for (int i=0; i /dev/null", \ - mpdAddress.toUtf8().data(), mpdPort.toUtf8().data()); - qoutput = QString(""); - player.start(QString(commandStr)); - player.waitForFinished(-1); - qoutput = player.readAllStandardOutput(); - for (int i=0; i * - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef EXTSYSMON_H -#define EXTSYSMON_H - -#include - -class ExtendedSysMon : public Plasma::DataEngine -{ - Q_OBJECT - -public: - ExtendedSysMon(QObject *parent, const QVariantList &args); - -protected: - bool sourceRequestEvent(const QString &name); - bool updateSourceEvent(const QString &source); - bool readConfiguration(); - QStringList sources() const; -// main configuration - QStringList hdddev; - QString gpudev; -// configuration - QString mpdAddress; - QString mpdPort; -}; - -#endif // EXTSYSMON_H diff --git a/sources/netctl-dataengine/plasma-engine-extsysmon.desktop b/sources/netctl-dataengine/plasma-engine-extsysmon.desktop deleted file mode 100644 index caa4567..0000000 --- a/sources/netctl-dataengine/plasma-engine-extsysmon.desktop +++ /dev/null @@ -1,20 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Extended SystemMonitor DataEngine -Comment=Adds gpu, gputemp and hddtemp to DataEngine -ServiceTypes=Plasma/DataEngine -Type=Service -Icon=utilities-system-monitor - -X-KDE-ServiceTypes=Plasma/DataEngine -X-KDE-Library=plasma_engine_extsysmon -X-Plasma-EngineName=ext-sysmon - -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis -X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=ext-sysmon -X-KDE-PluginInfo-Version=1.6 -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true