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_MINOR 11)
set (PROJECT_VERSION_PATCH 0) set (PROJECT_VERSION_PATCH 0)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) 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}") message (STATUS "Version: ${PROJECT_VERSION}")

View File

@ -9,7 +9,12 @@ add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_subdirectory (po) add_subdirectory (po)
include (KDE4Defaults) 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 sources
set (PLUGIN_NAME ${SUBPROJECT}) set (PLUGIN_NAME ${SUBPROJECT})

View File

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

View File

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

View File

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