update to use submodules

This commit is contained in:
arcan1s 2014-08-28 15:35:57 +04:00
parent 5584ba0e9f
commit 93abb86340
8 changed files with 105 additions and 96 deletions

View File

@ -10,6 +10,7 @@ set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 11)
set (PROJECT_VERSION_PATCH 0)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
message (STATUS "Version: ${PROJECT_VERSION}")

View File

@ -9,7 +9,12 @@ add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_subdirectory (po)
include (KDE4Defaults)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../
${PROJECT_TRDPARTY_DIR})
# set sources
set (PLUGIN_NAME ${SUBPROJECT})

View File

@ -16,8 +16,6 @@
***************************************************************************/
#include "desktop-panel.h"
#include "ui_appearance.h"
#include "ui_widget.h"
#include <KConfigDialog>
#include <KGlobal>
@ -34,6 +32,8 @@
#include <QProcessEnvironment>
#include <QTextCodec>
#include <pdebug/pdebug.h>
CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num)
: Plasma::Label(wid),
@ -48,7 +48,7 @@ CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num)
else
debug = false;
if (debug) qDebug() << "[PTM-DP]" << "Init label" << number;
if (debug) qDebug() << PDEBUG << ":" << "Init label" << number;
}
@ -59,7 +59,7 @@ CustomPlasmaLabel::~CustomPlasmaLabel()
int CustomPlasmaLabel::getNumber()
{
if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[getNumber]";
if (debug) qDebug() << PDEBUG;
return number;
}
@ -67,8 +67,8 @@ int CustomPlasmaLabel::getNumber()
void CustomPlasmaLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]";
if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]" << "Get signal" << event->button();
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
if (event->button() == Qt::LeftButton)
widget->setCurrentDesktop(number);
@ -106,7 +106,7 @@ DesktopPanel::~DesktopPanel()
void DesktopPanel::init()
{
if (debug) qDebug() << "[PTM-DP]" << "[init]";
if (debug) qDebug() << PDEBUG;
extsysmonEngine = dataEngine(QString("ext-sysmon"));
@ -124,11 +124,11 @@ void DesktopPanel::init()
QStringList DesktopPanel::getDesktopNames()
{
if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]";
if (debug) qDebug() << PDEBUG;
QStringList list;
QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::ReadOnly)) return list;
@ -161,7 +161,7 @@ QStringList DesktopPanel::getDesktopNames()
QList<Plasma::Containment *> DesktopPanel::getPanels()
{
if (debug) qDebug() << "[PTM-DP]" << "[getPanels]";
if (debug) qDebug() << PDEBUG;
QList<Plasma::Containment *> panels;
for (int i=0; i<containment()->corona()->containments().count(); i++)
@ -174,8 +174,8 @@ QList<Plasma::Containment *> DesktopPanel::getPanels()
QString DesktopPanel::panelLocationToStr(Plasma::Location loc)
{
if (debug) qDebug() << "[PTM-DP]" << "[panelLocationToStr]";
if (debug) qDebug() << "[PTM-DP]" << "[panelLocationToStr]" << ":" << "Location" << loc;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Location" << loc;
switch(loc) {
case Plasma::TopEdge:
@ -194,9 +194,9 @@ QString DesktopPanel::panelLocationToStr(Plasma::Location loc)
QString DesktopPanel::parsePattern(const QString rawLine, const int num)
{
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]";
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Run function with raw line" << rawLine;
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Run function with number" << num;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Run function with raw line" << rawLine;
if (debug) qDebug() << PDEBUG << ":" << "Run function with number" << num;
QString line, mark;
line = rawLine;
@ -205,19 +205,19 @@ QString DesktopPanel::parsePattern(const QString rawLine, const int num)
else
mark = QString("");
if (line.split(QString("$mark"))[0] != line) {
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found mark";
if (debug) qDebug() << PDEBUG << ":" << "Found mark";
line = line.split(QString("$mark"))[0] + mark + line.split(QString("$mark"))[1];
}
if (line.split(QString("$name"))[0] != line) {
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found name";
if (debug) qDebug() << PDEBUG << ":" << "Found name";
line = line.split(QString("$name"))[0] + desktopNames[num] + line.split(QString("$name"))[1];
}
if (line.split(QString("$number"))[0] != line) {
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found number";
if (debug) qDebug() << PDEBUG << ":" << "Found number";
line = line.split(QString("$number"))[0] + QString::number(num + 1) + line.split(QString("$number"))[1];
}
if (line.split(QString("$total"))[0] != line) {
if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found total";
if (debug) qDebug() << PDEBUG << ":" << "Found total";
line = line.split(QString("$total"))[0] + QString::number(desktopNames.count()) + line.split(QString("$total"))[1];
}
@ -227,7 +227,7 @@ QString DesktopPanel::parsePattern(const QString rawLine, const int num)
void DesktopPanel::reinit()
{
if (debug) qDebug() << "[PTM-DP]" << "[reinit]";
if (debug) qDebug() << PDEBUG;
// clear
// labels
@ -270,7 +270,7 @@ void DesktopPanel::reinit()
void DesktopPanel::changePanelsState()
{
if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]";
if (debug) qDebug() << PDEBUG;
QList<Plasma::Containment *> panels = getPanels();
for (int i=0; i<panels.count(); i++) {
@ -281,12 +281,12 @@ void DesktopPanel::changePanelsState()
bool wasVisible = panels[i]->view()->isVisible();
int winId = panels[i]->view()->winId();
if (wasVisible) {
if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]" << ":" << "Hide panel";
if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
oldState = oldInfo.state();
panels[i]->view()->setVisible(false);
} else {
if (debug) qDebug() << "[PTM-DP]" << "[changePanelsState]" << ":" << "Show panel";
if (debug) qDebug() << PDEBUG << ":" << "Show panel";
panels[i]->view()->setVisible(true);
KWindowSystem::clearState(winId, NET::KeepAbove);
KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
@ -298,11 +298,11 @@ void DesktopPanel::changePanelsState()
void DesktopPanel::setCurrentDesktop(const int number)
{
if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]";
if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]" << "Set desktop" << number + 1;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Set desktop" << number + 1;
QString cmd = parsePattern(configuration[QString("desktopcmd")], number);
if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]" << "Run cmd " << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Run cmd " << cmd;
QProcess command;
command.startDetached(cmd);
@ -311,12 +311,12 @@ void DesktopPanel::setCurrentDesktop(const int number)
void DesktopPanel::updateText()
{
if (debug) qDebug() << "[PTM-DP]" << "[updateText]";
if (debug) qDebug() << PDEBUG;
if (labels.isEmpty()) return;
QString line, text;
for (int i=0; i<labels.count(); i++) {
if (debug) qDebug() << "[PTM-DP]" << "[updateText]" << "Label" << i;
if (debug) qDebug() << PDEBUG << ":" << "Label" << i;
line = parsePattern(configuration[QString("pattern")], i);
if (currentDesktop == i + 1)
text = currentFormatLine[0] + line + currentFormatLine[1];
@ -330,8 +330,8 @@ void DesktopPanel::updateText()
// data engine interaction
void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data)
{
if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]";
if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]" << ":" << "Run function with source name" << sourceName;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Run function with source name" << sourceName;
if (data.keys().count() == 0)
return;
@ -345,7 +345,7 @@ void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngi
// configuration interface
void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
{
if (debug) qDebug() << "[PTM-DP]" << "[createConfigurationInterface]";
if (debug) qDebug() << PDEBUG;
QWidget *appWidget = new QWidget;
uiAppConfig.setupUi(appWidget);
@ -431,7 +431,7 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
void DesktopPanel::configAccepted()
{
if (debug) qDebug() << "[PTM-DP]" << "[configAccepted]";
if (debug) qDebug() << PDEBUG;
extsysmonEngine->disconnectSource(QString("desktop"), this);
KConfigGroup cg = config();
@ -470,7 +470,7 @@ void DesktopPanel::configAccepted()
void DesktopPanel::configChanged()
{
if (debug) qDebug() << "[PTM-DP]" << "[configChanged]";
if (debug) qDebug() << PDEBUG;
KConfigGroup cg = config();

View File

@ -6,13 +6,18 @@ find_package (KDE4 REQUIRED)
include (KDE4Defaults)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../
${PROJECT_TRDPARTY_DIR})
set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
file (GLOB SUBPROJECT_SOURCE *.cpp)
set (TASK_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/task.h)
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
file (GLOB SUBPROJECT_CONF *.conf)
# prepare

View File

@ -28,7 +28,8 @@
#include <QTextCodec>
#include <QThread>
#include "taskadds.h"
#include <task/taskadds.h>
#include <pdebug/pdebug.h>
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
@ -51,32 +52,32 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
QString ExtendedSysMon::getAllHdd()
{
if (debug) qDebug() << "[DE]" << "[getAllHdd]";
if (debug) qDebug() << PDEBUG;
QStringList devices;
QString cmd = QString("find /dev -name [hms]d[a-z]");
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
devices.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "Device list" << devices;
if (debug) qDebug() << PDEBUG << ":" << "Device list" << devices;
return devices.join(QChar(','));
}
QString ExtendedSysMon::getAutoGpu()
{
if (debug) qDebug() << "[DE]" << "[getAutoGpu]";
if (debug) qDebug() << PDEBUG;
QString gpu = QString("disable");
QString cmd = QString("lspci");
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
if (qoutput.toLower().contains("nvidia"))
@ -84,36 +85,36 @@ QString ExtendedSysMon::getAutoGpu()
else if (qoutput.toLower().contains("radeon"))
gpu = QString("ati");
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Device" << gpu;
if (debug) qDebug() << PDEBUG << ":" << "Device" << gpu;
return gpu;
}
QString ExtendedSysMon::getAutoMpris()
{
if (debug) qDebug() << "[DE]" << "[getAutoMpris]";
if (debug) qDebug() << PDEBUG;
QString mpris;
QString cmd = QString("bash -c \"qdbus 'org.mpris.MediaPlayer2.*'\"");
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(cmd);
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (qoutput.split(QChar('\n'))[0].split(QChar('.')).count() > 3)
mpris = qoutput.split(QChar('\n'))[0].split(QChar('.'))[3];
if (debug) qDebug() << "[DE]" << "[getAutoMpris]" << ":" << "Player found" << mpris;
if (debug) qDebug() << PDEBUG << ":" << "Player found" << mpris;
return mpris;
}
QStringList ExtendedSysMon::getDesktopNames()
{
if (debug) qDebug() << "[DE]" << "[getDesktopNames]";
if (debug) qDebug() << PDEBUG;
QStringList list;
QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
if (debug) qDebug() << "[DE]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::ReadOnly)) return list;
@ -146,7 +147,7 @@ QStringList ExtendedSysMon::getDesktopNames()
QStringList ExtendedSysMon::sources() const
{
if (debug) qDebug() << "[DE]" << "[sources]";
if (debug) qDebug() << PDEBUG;
QStringList source;
source.append(QString("custom"));
@ -158,14 +159,14 @@ QStringList ExtendedSysMon::sources() const
source.append(QString("player"));
source.append(QString("ps"));
if (debug) qDebug() << "[DE]" << "[sources]" << ":" << "Sources" << source;
if (debug) qDebug() << PDEBUG << ":" << "Sources" << source;
return source;
}
void ExtendedSysMon::readConfiguration()
{
if (debug) qDebug() << "[DE]" << "[readConfiguration]";
if (debug) qDebug() << PDEBUG;
// pre-setup
QMap<QString, QString> rawConfig;
@ -183,7 +184,7 @@ void ExtendedSysMon::readConfiguration()
rawConfig[QString("PLAYER")] = QString("mpris");
QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::ReadOnly)) {
configuration = updateConfiguration(rawConfig);
@ -212,7 +213,7 @@ void ExtendedSysMon::readConfiguration()
QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig)
{
if (debug) qDebug() << "[DE]" << "[updateConfiguration]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> config;
QString key, value;
@ -268,7 +269,7 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, Q
config[QString("PLAYER")] = QString("mpris");
for (int i=0; i<config.keys().count(); i++)
if (debug) qDebug() << "[DE]" << "[updateConfiguration]" << ":" <<
if (debug) qDebug() << PDEBUG << ":" <<
config.keys()[i] + QString("=") + config[config.keys()[i]];
return config;
}
@ -276,11 +277,11 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, Q
QMap<QString, QVariant> ExtendedSysMon::getCurrentDesktop(const QString cmd)
{
if (debug) qDebug() << "[DE]" << "[getCurrentDesktop]";
if (debug) qDebug() << "[DE]" << "[getCurrentDesktop]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(QString("bash -c \"") + cmd + QString("\""));
if (debug) qDebug() << "[DE]" << "[getCurrentDesktop]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
int number = qoutput.toInt();
@ -296,11 +297,11 @@ QMap<QString, QVariant> ExtendedSysMon::getCurrentDesktop(const QString cmd)
QString ExtendedSysMon::getCustomCmd(const QString cmd)
{
if (debug) qDebug() << "[DE]" << "[getCustomCmd]";
if (debug) qDebug() << "[DE]" << "[getCustomCmd]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(QString("bash -c \"") + cmd + QString("\""));
if (debug) qDebug() << "[DE]" << "[getCustomCmd]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
}
@ -308,8 +309,8 @@ QString ExtendedSysMon::getCustomCmd(const QString cmd)
float ExtendedSysMon::getGpu(const QString device)
{
if (debug) qDebug() << "[DE]" << "[getGpu]";
if (debug) qDebug() << "[DE]" << "[getGpu]" << ":" << "Device" << device;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
float value = 0.0;
if ((device != QString("nvidia")) && (device != QString("ati")))
@ -319,9 +320,9 @@ float ExtendedSysMon::getGpu(const QString device)
cmd = QString("nvidia-smi -q -d UTILIZATION");
else if (device == QString("ati"))
cmd = QString("aticonfig --od-getclocks");
if (debug) qDebug() << "[DE]" << "[getGpu]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(QString("bash -c \"") + cmd + QString("\""));
if (debug) qDebug() << "[DE]" << "[getGpu]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (configuration[QString("GPUDEV")] == QString("nvidia"))
@ -349,8 +350,8 @@ float ExtendedSysMon::getGpu(const QString device)
float ExtendedSysMon::getGpuTemp(const QString device)
{
if (debug) qDebug() << "[DE]" << "[getGpuTemp]";
if (debug) qDebug() << "[DE]" << "[getGpuTemp]" << ":" << "Device" << device;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
float value = 0.0;
if ((device != QString("nvidia")) && (device != QString("ati")))
@ -360,9 +361,9 @@ float ExtendedSysMon::getGpuTemp(const QString device)
cmd = QString("nvidia-smi -q -d TEMPERATURE");
else if (device == QString("ati"))
cmd = QString("aticonfig --od-gettemperature");
if (debug) qDebug() << "[DE]" << "[getGpuTemp]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(QString("bash -c \"") + cmd + QString("\""));
if (debug) qDebug() << "[DE]" << "[getGpuTemp]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
if (configuration[QString("GPUDEV")] == QString("nvidia"))
@ -388,13 +389,13 @@ float ExtendedSysMon::getGpuTemp(const QString device)
float ExtendedSysMon::getHddTemp(const QString cmd, const QString device)
{
if (debug) qDebug() << "[DE]" << "[getHddTemp]";
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "cmd" << cmd;
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Device" << device;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Device" << device;
float value = 0.0;
TaskResult process = runTask(cmd + QString(" ") + device);
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
@ -412,10 +413,10 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
const QString mpdPort,
QString mpris)
{
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]";
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "player" << playerName;
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "MPD" << mpdAddress + QString(":") + mpdPort;
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "MPRIS" << mpris;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "player" << playerName;
if (debug) qDebug() << PDEBUG << ":" << "MPD" << mpdAddress + QString(":") + mpdPort;
if (debug) qDebug() << PDEBUG << ":" << "MPRIS" << mpris;
QMap<QString, QVariant> info;
info[QString("album")] = QString("unknown");
@ -436,9 +437,9 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
cmd = QString("bash -c \"qdbus org.mpris.%1 /Player GetMetadata && qdbus org.mpris.%1 /Player PositionGet\"")
.arg(mpris);
}
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
QString qstr = QString("");
@ -483,14 +484,14 @@ QMap<QString, QVariant> ExtendedSysMon::getPlayerInfo(const QString playerName,
QMap<QString, QVariant> ExtendedSysMon::getPsStats()
{
if (debug) qDebug() << "[DE]" << "[getPsStats]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QVariant> psStats;
QString cmd, qoutput;
cmd = QString("ps --no-headers -o command");
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Run cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd;
TaskResult process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
QStringList psList;
@ -501,9 +502,9 @@ QMap<QString, QVariant> ExtendedSysMon::getPsStats()
psStats[QString("ps")] = psList.join(QString(","));
cmd = QString("ps -e --no-headers -o command");
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Run cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd;
process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
psStats[QString("psTotal")] = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
@ -514,11 +515,11 @@ QMap<QString, QVariant> ExtendedSysMon::getPsStats()
int ExtendedSysMon::getUpgradeInfo(const QString cmd)
{
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]";
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
TaskResult process = runTask(QString("bash -c \"") + cmd + QString("\""));
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
int count = 0;
@ -532,8 +533,8 @@ int ExtendedSysMon::getUpgradeInfo(const QString cmd)
bool ExtendedSysMon::sourceRequestEvent(const QString &source)
{
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]";
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]" << ":" << "Source" << source;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
return updateSourceEvent(source);
}
@ -541,8 +542,8 @@ bool ExtendedSysMon::sourceRequestEvent(const QString &source)
bool ExtendedSysMon::updateSourceEvent(const QString &source)
{
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]";
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Source" << source;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source" << source;
if (source == QString("custom")) {
for (int i=0; i<configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts).count(); i++) {

View File

@ -1 +0,0 @@
../3rdparty/task/task.h

View File

@ -1 +0,0 @@
../3rdparty/task/taskadds.cpp

View File

@ -1 +0,0 @@
../3rdparty/task/taskadds.h