diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index 3f40892..eb24293 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -157,10 +156,10 @@ void ExtendedSysMon::setProcesses() } // gpu processes[QString("gpu")].append(new QProcess); - connect(processes[QString("gpu")][0], SIGNAL(readyReadStandardOutput()), this, SLOT(getGpu())); + connect(processes[QString("gpu")][0], SIGNAL(readyReadStandardOutput()), this, SLOT(setGpu())); // gputemp processes[QString("gputemp")].append(new QProcess); - connect(processes[QString("gputemp")][0], SIGNAL(readyReadStandardOutput()), this, SLOT(getGpuTemp())); + connect(processes[QString("gputemp")][0], SIGNAL(readyReadStandardOutput()), this, SLOT(setGpuTemp())); // hddtemp for (int i=0; i ExtendedSysMon::updateConfiguration(const QMapstart(QString("bash -c \"") + cmd + QString("\"")); } @@ -386,6 +389,7 @@ void ExtendedSysMon::getHddTemp(const QString cmd, const QString device, const i if (debug) qDebug() << "[DE]" << "[getHddTemp]"; if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with cmd" << cmd; if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with device" << device; + if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with number" << number; if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run cmd" << cmd + QString(" ") + device; processes[QString("hddtemp")][number]->start(cmd + QString(" ") + device); } @@ -630,15 +634,19 @@ void ExtendedSysMon::getUpgradeInfo(const QString pkgCommand, const int number) { if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]"; if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run function with cmd" << pkgCommand; - QString cmd = QString("bash -c \"") + pkgCommand + QString("\""); + if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run function with number" << number; + QString cmd = QString("bash -c \"") + pkgCommand + QString(" | wc -l\""); if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run cmd" << cmd; processes[QString("pkg")][number]->start(cmd); } -void ExtendedSysMon::setUpgradeInfo() +void ExtendedSysMon::setUpgradeInfo(int exitCode, QProcess::ExitStatus exitStatus) { + Q_UNUSED(exitStatus) + if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]"; + if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Cmd returns" << exitCode; int pkgNull = 0; int value = 0; QString qoutput = QString(""); @@ -647,7 +655,7 @@ void ExtendedSysMon::setUpgradeInfo() if (!qoutput.isEmpty()) { if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Found data for cmd" << i; pkgNull = configuration[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts)[i].toInt(); - value = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); + value = qoutput.toInt(); if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Return" << value; QString source = QString("pkg"); QString key = QString("pkgCount") + QString::number(i); @@ -669,11 +677,9 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) { if (debug) qDebug() << "[DE]" << "[updateSourceEvent]"; if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Run function with source name" << source; - QString key; if (source == QString("custom")) { - for (int i=0; i - -class QProcess; +#include class ExtendedSysMon : public Plasma::DataEngine { @@ -52,7 +51,7 @@ private slots: void setGpu(); void setGpuTemp(); void setHddTemp(); - void setUpgradeInfo(); + void setUpgradeInfo(int exitCode, QProcess::ExitStatus exitStatus); void setPlayer(); void setPs();