diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index 2a946a9..17e88a2 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -23,7 +23,7 @@ else () message (STATUS "Unknown compiler") endif () -add_subdirectory (awesomewidget) +add_subdirectory (awesome-widget) add_subdirectory (ext-sysmon) add_subdirectory (desktop-panel) add_subdirectory (ptm) diff --git a/sources/awesome-widget/CMakeLists.txt b/sources/awesome-widget/CMakeLists.txt index f5c5961..ac8d1d0 100644 --- a/sources/awesome-widget/CMakeLists.txt +++ b/sources/awesome-widget/CMakeLists.txt @@ -21,7 +21,8 @@ include_directories (${CMAKE_SOURCE_DIR} set (SUBPROJECT_MISC_DIR "contents/misc") file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) 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 ${PROJECT_TRDPARTY_DIR}/task/task.h) file (GLOB SUBPROJECT_UI *.ui) file (GLOB SUBPROJECT_NOTIFY ${SUBPROJECT_MISC_DIR}/*.notifyrc) @@ -29,8 +30,9 @@ file (GLOB SUBPROJECT_NOTIFY ${SUBPROJECT_MISC_DIR}/*.notifyrc) configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) # make +qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) -kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE}) +kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) # install diff --git a/sources/awesome-widget/advanced.ui b/sources/awesome-widget/advanced.ui index 9fbbed5..210d6dc 100644 --- a/sources/awesome-widget/advanced.ui +++ b/sources/awesome-widget/advanced.ui @@ -1,7 +1,7 @@ - ConfigWindow - + AdvancedWindow + 0 @@ -29,7 +29,7 @@ - Form + Advanced configuration @@ -41,9 +41,9 @@ 0 - 0 + -145 677 - 752 + 723 @@ -327,33 +327,6 @@ $m - uptime minutes without zero - - - - - - - 200 - 0 - - - - Network directory - - - - - - - "/sys/class/net" by default - - - - - - - - @@ -531,7 +504,6 @@ $m - uptime minutes without zero listWidget_mount listWidget_hddSpeedDevice listWidget_hddDevice - lineEdit_netdir checkBox_netdev comboBox_netdev lineEdit_batdev diff --git a/sources/awesome-widget/appearance.ui b/sources/awesome-widget/appearance.ui index decd5a6..fdce775 100644 --- a/sources/awesome-widget/appearance.ui +++ b/sources/awesome-widget/appearance.ui @@ -1,7 +1,7 @@ - ConfigWindow - + AppearanceWindow + 0 @@ -29,7 +29,7 @@ - Form + Appearance configuration @@ -143,9 +143,9 @@ - + - + 200 @@ -158,7 +158,7 @@ - + Qt::Horizontal @@ -171,7 +171,7 @@ - + 180 diff --git a/sources/awesome-widget/awesome-widget.cpp b/sources/awesome-widget/awesome-widget.cpp new file mode 100644 index 0000000..cee242e --- /dev/null +++ b/sources/awesome-widget/awesome-widget.cpp @@ -0,0 +1,99 @@ +/*************************************************************************** + * This file is part of pytextmonitor * + * * + * pytextmonitor 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 3 of the * + * License, or (at your option) any later version. * + * * + * pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awesome-widget.h" + +#include +#include + +#include + + +AwesomeWidget::AwesomeWidget(QObject *parent, const QVariantList &args) + : Plasma::Applet(parent, args) +{ + // debug + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); + QString debugEnv = environment.value(QString("PTM_DEBUG"), QString("no")); + if (debugEnv == QString("yes")) + debug = true; + else + debug = false; + + setHasConfigurationInterface(true); + // text format init + formatLine.append(QString("")); + formatLine.append(QString("")); +} + + +AwesomeWidget::~AwesomeWidget() +{ +} + + +void AwesomeWidget::init() +{ + if (debug) qDebug() << PDEBUG; + + extsysmonEngine = dataEngine(QString("ext-sysmon")); + sysmonEngine = dataEngine(QString("systemmonitor")); + timeEngine = dataEngine(QString("time")); + + layout = new QGraphicsLinearLayout(); + layout->setContentsMargins(1, 1, 1, 1); + setLayout(layout); + + // read variables + configChanged(); +} + + +//QString DesktopPanel::parsePattern(const QString rawLine, const int 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; +// if (currentDesktop == num + 1) +// mark = configuration[QString("mark")]; +// else +// mark = QString(""); +// if (line.split(QString("$mark"))[0] != line) { +// 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() << 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() << 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() << PDEBUG << ":" << "Found total"; +// line = line.split(QString("$total"))[0] + QString::number(desktopNames.count()) + line.split(QString("$total"))[1]; +// } + +// return line; +//} + + +K_EXPORT_PLASMA_APPLET(ptm-awesome-widget, AwesomeWidget) diff --git a/sources/awesome-widget/awesome-widget.h b/sources/awesome-widget/awesome-widget.h new file mode 100644 index 0000000..d38152b --- /dev/null +++ b/sources/awesome-widget/awesome-widget.h @@ -0,0 +1,91 @@ +/*************************************************************************** + * This file is part of pytextmonitor * + * * + * pytextmonitor 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 3 of the * + * License, or (at your option) any later version. * + * * + * pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef AWESOME_WIDGET_H +#define AWESOME_WIDGET_H + +#include +#include +#include + +#include +#include +#include +#include +#include + + +class QGraphicsLinearLayout; + +class AwesomeWidget : public Plasma::Applet +{ + Q_OBJECT + +public: + AwesomeWidget(QObject *parent, const QVariantList &args); + ~AwesomeWidget(); + QString getNetworkDevice(); + void init(); + // de configuration + QMap readDataEngineConfiguration(); + void writeDataEngineConfiguration(const QMap settings); + QMap updateDataEngineConfiguration(const QMap rawConfig); + +public slots: + // dataengine + void connectToEngine(); + void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); + void disconnectFromEngine(); + // configuration interface + void configAccepted(); + void configChanged(); + +private slots: + void reinit(); + // configuration interface + void setNetworkDevice(); + void setTooltipBackground(); + +protected: + void createConfigurationInterface(KConfigDialog *parent); + +private: + // functions + void updateText(); + // ui + QGraphicsLinearLayout *layout; + // debug + bool debug; + // data engine + Plasma::DataEngine *extsysmonEngine; + Plasma::DataEngine *sysmonEngine; + Plasma::DataEngine *timeEngine; + // configuration interface + Ui::AdvancedWindow uiAdvancedConfig; + Ui::AppearanceWindow uiAppConfig; + Ui::ConfigWindow uiWidConfig; + Ui::DEWindow uiDEConfig; + Ui::TooltipWindow uiTooltipConfig; + // configuration + QMap configuration; + QStringList diskDevices; + QStringList formatLine; +}; + + +#endif /* AWESOME_WIDGET_H */ diff --git a/sources/awesome-widget/configuration.cpp b/sources/awesome-widget/configuration.cpp new file mode 100644 index 0000000..26230ad --- /dev/null +++ b/sources/awesome-widget/configuration.cpp @@ -0,0 +1,373 @@ +/*************************************************************************** + * This file is part of pytextmonitor * + * * + * pytextmonitor 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 3 of the * + * License, or (at your option) any later version. * + * * + * pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awesome-widget.h" + +#include +#include +#include +#include +#include + +#include +#include + + +QMap AwesomeWidget::readDataEngineConfiguration() +{ + if (debug) qDebug() << PDEBUG; + + QMap rawConfig; + rawConfig[QString("CUSTOM")] = QString("wget -qO- http://ifconfig.me/ip"); + rawConfig[QString("DESKTOPCMD")] = QString("qdbus org.kde.kwin /KWin currentDesktop"); + rawConfig[QString("GPUDEV")] = QString("auto"); + rawConfig[QString("HDDDEV")] = QString("all"); + rawConfig[QString("HDDTEMPCMD")] = QString("sudo hddtemp"); + rawConfig[QString("MPDADDRESS")] = QString("localhost"); + rawConfig[QString("MPDPORT")] = QString("6600"); + rawConfig[QString("MPRIS")] = QString("auto"); + rawConfig[QString("PKGCMD")] = QString("pacman -Qu"); + rawConfig[QString("PKGNULL")] = QString("0"); + rawConfig[QString("PLAYER")] = QString("mpris"); + + QString fileName = KGlobal::dirs()->findResource("config", "ext-sysmon.conf"); + if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; + QFile configFile(fileName); + if (!configFile.open(QIODevice::ReadOnly)) + return updateDataEngineConfiguration(rawConfig); + QString fileStr; + QStringList value; + while (true) { + fileStr = QString(configFile.readLine()).trimmed(); + if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue; + if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue; + if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue; + if (fileStr.contains(QChar('='))) { + value.clear(); + for (int i=1; i settings) +{ + if (debug) qDebug() << PDEBUG; + + QMap config = updateDataEngineConfiguration(settings); + QString fileName = KGlobal::dirs()->locateLocal("config", "ext-sysmon.conf"); + if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; + QFile configFile(fileName); + if (!configFile.open(QIODevice::WriteOnly)) return; + for (int i=0; i AwesomeWidget::updateDataEngineConfiguration(const QMap rawConfig) +{ + if (debug) qDebug() << PDEBUG; + + QMap config; + QString key, value; + // remove spaces and copy source map + for (int i=0; isetCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_background->setCheckState(Qt::Checked); + if (configuration[QString("layout")].toInt() == 0) + uiAdvancedConfig.checkBox_layout->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_layout->setCheckState(Qt::Checked); + if (configuration[QString("popup")].toInt() == 0) + uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Checked); + if (configuration[QString("popup")].toInt() == 0) + uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Checked); + if (configuration[QString("leftStretch")].toInt() == 0) + uiAdvancedConfig.checkBox_leftStretch->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_leftStretch->setCheckState(Qt::Checked); + if (configuration[QString("rightStretch")].toInt() == 0) + uiAdvancedConfig.checkBox_rightStretch->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_rightStretch->setCheckState(Qt::Checked); + uiAdvancedConfig.lineEdit_timeFormat->setText(configuration[QString("customTime")]); + uiAdvancedConfig.lineEdit_uptimeFormat->setText(configuration[QString("customUptime")]); + uiAdvancedConfig.comboBox_tempUnits->setCurrentIndex( + uiAdvancedConfig.comboBox_tempUnits->findText(configuration[QString("tempUnits")], + Qt::MatchFixedString)); + cmd = QString("sensors"); + if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; + process = runTask(cmd); + if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; + if (process.exitCode != 0) + if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; + qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output); + uiAdvancedConfig.listWidget_tempDevice->clear(); + for (int i=0; i -1) { + QListWidgetItem item = QListWidgetItem(QString("lmsensors/") + sensor.split(QChar('\n'))[0] + QString("/") + + device.split(QChar(':'))[0].replace(QChar(' '), QChar('_'))); + item.setCheckState(Qt::Unchecked); + uiAdvancedConfig.listWidget_tempDevice->addItem(&item); + } + } + } + for (int i=0; i items = uiAdvancedConfig.listWidget_tempDevice + ->findItems(configuration[QString("tempDevice")].split(QString("@@"))[i], Qt::MatchFixedString); + for (int j=0; jsetCheckState(Qt::Checked); + } + cmd = QString("mount"); + if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; + process = runTask(cmd); + if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; + if (process.exitCode != 0) + if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; + qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output); + uiAdvancedConfig.listWidget_mount->clear(); + for (int i=0; iaddItem(&item); + } + for (int i=0; i items = uiAdvancedConfig.listWidget_mount + ->findItems(configuration[QString("mount")].split(QString("@@"))[i], Qt::MatchFixedString); + for (int j=0; jsetCheckState(Qt::Checked); + } + uiAdvancedConfig.listWidget_hddSpeedDevice->clear(); + for (int i=0; iaddItem(&item); + } + for (int i=0; i items = uiAdvancedConfig.listWidget_hddSpeedDevice + ->findItems(configuration[QString("disk")].split(QString("@@"))[i], Qt::MatchFixedString); + for (int j=0; jsetCheckState(Qt::Checked); + } + if (configuration[QString("useCustomNetdev")].toInt() == 0) + uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Checked); + QList rawInterfaceList = QNetworkInterface::allInterfaces(); + QStringList interfaceList; + for (int i=0; iclear(); + uiAdvancedConfig.comboBox_netdev->addItems(interfaceList); + uiAdvancedConfig.comboBox_netdev->setCurrentIndex( + uiAdvancedConfig.comboBox_netdev->findText(configuration[QString("customNetdev")], + Qt::MatchFixedString)); + setNetworkDevice(); + uiAdvancedConfig.lineEdit_batdev->setText(configuration[QString("batteryDevice")]); + uiAdvancedConfig.lineEdit_acdev->setText(configuration[QString("acDevice")]); + uiAdvancedConfig.lineEdit_acOnline->setText(configuration[QString("acOnline")]); + uiAdvancedConfig.lineEdit_acOffline->setText(configuration[QString("acOffile")]); + + // tooltip + uiTooltipConfig.spinBox_tooltipNum->setValue(configuration[QString("tooltipNumber")].toInt()); + if (configuration[QString("useTooltipBackground")].toInt() == 0) + uiAdvancedConfig.checkBox_background->setCheckState(Qt::Unchecked); + else + uiAdvancedConfig.checkBox_background->setCheckState(Qt::Checked); + uiTooltipConfig.kcolorcombo_background->setColor(QColor(configuration[QString("tooltipBackground")])); + setTooltipBackground(); + uiTooltipConfig.kcolorcombo_cpu->setColor(QColor(configuration[QString("cpuColor")])); + uiTooltipConfig.kcolorcombo_cpuclock->setColor(QColor(configuration[QString("cpuclockColor")])); + uiTooltipConfig.kcolorcombo_mem->setColor(QColor(configuration[QString("memColor")])); + uiTooltipConfig.kcolorcombo_swap->setColor(QColor(configuration[QString("swapColor")])); + uiTooltipConfig.kcolorcombo_down->setColor(QColor(configuration[QString("downColor")])); + uiTooltipConfig.kcolorcombo_up->setColor(QColor(configuration[QString("upColor")])); + + // appearance + KConfigGroup cg = config(); + QString fontFamily = cg.readEntry("fontFamily", "Terminus"); + int fontSize = cg.readEntry("fontSize", 10); + QString fontColor = cg.readEntry("fontColor", "#000000"); + int fontWeight = cg.readEntry("fontWeight", 400); + QString fontStyle = cg.readEntry("fontStyle", "normal"); + QFont font = QFont(fontFamily, 12, 400, false); + uiAppConfig.spinBox_interval->setValue(configuration[QString("interval")].toInt()); + uiAppConfig.fontComboBox->setCurrentFont(font); + uiAppConfig.spinBox_size->setValue(fontSize); + uiAppConfig.kcolorcombo->setColor(fontColor); + uiAppConfig.comboBox_style->setCurrentIndex( + uiAppConfig.comboBox_style->findText(fontStyle, Qt::MatchFixedString)); + uiAppConfig.spinBox_weight->setValue(fontWeight); + + // dataengine + QMap deSettings = readDataEngineConfiguration(); + uiDEConfig.tableWidget_customCommand->clear(); + uiDEConfig.tableWidget_customCommand->setRowCount(deSettings[QString("CUSTOM")].split(QString("@@")).count() + 1); + headerList.clear(); + headerList.append(i18n("Custom command")); + uiDEConfig.tableWidget_customCommand->setHorizontalHeaderLabels(headerList); + uiDEConfig.tableWidget_customCommand->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + for (int i=0; isetItem(i, 0, new QTableWidgetItem(deSettings[QString("CUSTOM")].split(QString("@@"))[i])); + uiDEConfig.lineEdit_desktopCmd->setText(deSettings[QString("DESKTOPCMD")]); + uiDEConfig.comboBox_gpudev->setCurrentIndex( + uiDEConfig.comboBox_gpudev->findText(deSettings[QString("GPUDEV")], Qt::MatchFixedString)); + cmd = QString("find /dev -name '[hms]d[a-z]'"); + if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; + process = runTask(cmd); + if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; + if (process.exitCode != 0) + if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; + qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output); + uiDEConfig.comboBox_hdddev->clear(); + uiDEConfig.comboBox_hdddev->addItem(QString("all")); + uiDEConfig.comboBox_hdddev->addItem(QString("disable")); + for (int i=0; iaddItem(qoutput.split(QChar('\n'))[i]); + uiDEConfig.comboBox_hdddev->setCurrentIndex( + uiDEConfig.comboBox_hdddev->findText(deSettings[QString("HDDDEV")], Qt::MatchFixedString)); + uiDEConfig.lineEdit_hddtempCmd->setText(deSettings[QString("HDDTEMPCMD")]); + uiDEConfig.lineEdit_mpdaddress->setText(deSettings[QString("MPDADDRESS")]); + uiDEConfig.spinBox_mpdport->setValue(deSettings[QString("MPDPORT")].toInt()); + uiDEConfig.comboBox_mpris->addItem(deSettings[QString("MPRIS")]); + uiDEConfig.comboBox_mpris->setCurrentIndex(uiDEConfig.comboBox_mpris->count() - 1); + uiDEConfig.tableWidget_pkgCommand->clear(); + uiDEConfig.tableWidget_pkgCommand->setRowCount(deSettings[QString("PKGCMD")].split(QChar(',')).count() + 1); + headerList.clear(); + headerList.append(i18n("Package manager")); + headerList.append(i18n("Null lines")); + uiDEConfig.tableWidget_pkgCommand->setHorizontalHeaderLabels(headerList); + uiDEConfig.tableWidget_pkgCommand->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + for (int i=0; isetItem(i, 0, new QTableWidgetItem(deSettings[QString("PKGCMD")].split(QChar(','))[i])); + uiDEConfig.tableWidget_pkgCommand->setItem(i, 1, new QTableWidgetItem(deSettings[QString("PKGNULL")].split(QChar(','))[i])); + } + + + + + parent->addPage(configWidget, i18n("Widget"), Applet::icon()); + parent->addPage(advWidget, i18n("Advanced"), QString("system-run")); + parent->addPage(tooltipWidget, i18n("Tooltip"), QString("preferences-desktop-color")); + parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme")); + parent->addPage(deConfigWidget, i18n("DataEngine"), QString("utilities-system-monitor")); + + connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); + connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); +} + + +void AwesomeWidget::configAccepted() +{ + if (debug) qDebug() << PDEBUG; +} + + +void AwesomeWidget::configChanged() +{ + if (debug) qDebug() << PDEBUG; + + KConfigGroup cg = config(); + + reinit(); +} + + +void AwesomeWidget::setNetworkDevice() +{ + if (debug) qDebug() << PDEBUG; + + if (uiAdvancedConfig.checkBox_netdev->checkState() == 0) + uiAdvancedConfig.comboBox_netdev->setDisabled(true); + else if (uiAdvancedConfig.checkBox_netdev->checkState() == 2) + uiAdvancedConfig.checkBox_netdev->setEnabled(true); +} + + +void AwesomeWidget::setTooltipBackground() +{ + if (debug) qDebug() << PDEBUG; + + if (uiTooltipConfig.checkBox_background->checkState() == 0) + uiTooltipConfig.kcolorcombo_cpu->setDisabled(true); + else if (uiTooltipConfig.checkBox_background->checkState() == 2) + uiTooltipConfig.kcolorcombo_cpu->setEnabled(true); +} diff --git a/sources/awesome-widget/deconfig.ui b/sources/awesome-widget/deconfig.ui index 05a78c0..30fc080 100644 --- a/sources/awesome-widget/deconfig.ui +++ b/sources/awesome-widget/deconfig.ui @@ -1,7 +1,7 @@ - ConfigWindow - + DEWindow + 0 @@ -29,7 +29,7 @@ - Form + DE Configuration diff --git a/sources/awesome-widget/deinteraction.cpp b/sources/awesome-widget/deinteraction.cpp new file mode 100644 index 0000000..2e8f2b5 --- /dev/null +++ b/sources/awesome-widget/deinteraction.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + * This file is part of pytextmonitor * + * * + * pytextmonitor 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 3 of the * + * License, or (at your option) any later version. * + * * + * pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awesome-widget.h" + + +#include + + +void AwesomeWidget::connectToEngine() +{ + if (debug) qDebug() << PDEBUG; +} + + +void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Run function with source name" << sourceName; + + if (data.keys().count() == 0) + return; +// if (sourceName == QString("desktop")) { +// currentDesktop = data[QString("currentNumber")].toInt(); +// if (desktopNames.isEmpty()) { +// desktopNames = data[QString("list")].toString().split(QString(";;")); +// reinit(); +// } +// updateText(); +// } +} + + +void AwesomeWidget::disconnectFromEngine() +{ + if (debug) qDebug() << PDEBUG; +} diff --git a/sources/awesome-widget/reinit.cpp b/sources/awesome-widget/reinit.cpp new file mode 100644 index 0000000..df4049a --- /dev/null +++ b/sources/awesome-widget/reinit.cpp @@ -0,0 +1,33 @@ +/*************************************************************************** + * This file is part of pytextmonitor * + * * + * pytextmonitor 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 3 of the * + * License, or (at your option) any later version. * + * * + * pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +#include "awesome-widget.h" + + +#include + + +void AwesomeWidget::reinit() +{ + if (debug) qDebug() << PDEBUG; +} + + +void AwesomeWidget::updateText() +{ + if (debug) qDebug() << PDEBUG; +} diff --git a/sources/awesome-widget/tooltipconfig.ui b/sources/awesome-widget/tooltipconfig.ui index f61e6ee..c8f2868 100644 --- a/sources/awesome-widget/tooltipconfig.ui +++ b/sources/awesome-widget/tooltipconfig.ui @@ -1,7 +1,7 @@ - ConfigWindow - + TooltipWindow + 0 @@ -29,7 +29,7 @@ - Form + Tooltip configuration diff --git a/sources/awesome-widget/widget.ui b/sources/awesome-widget/widget.ui index 0486b61..9685ddc 100644 --- a/sources/awesome-widget/widget.ui +++ b/sources/awesome-widget/widget.ui @@ -29,7 +29,7 @@ - Form + Widget configuration @@ -46,1252 +46,17 @@ - - - true + + + QTextEdit::NoWrap + + + false - - - - 0 - 0 - 666 - 696 - - - - - - - - - - 200 - 0 - - - - Time - - - true - - - - - - - $time - time in default format -$isotime - time in ISO format -$shorttime - time in short format -$longtime - time in log format -$custom - custom time format - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Uptime - - - true - - - - - - - $uptime - system uptime -$custom - custom format - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 2 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - CPU - - - true - - - true - - - - - - - $cpu - total load CPU, % -$cpu0 - load CPU for core 0, % -... -$cpu9 - load CPU for core 9, % -... -$cpuN - load CPU for core N, % - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 3 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - CPU Clock - - - true - - - true - - - - - - - $cpucl - average CPU clock, MHz -$cpucl0 - CPU clock for core 0, MHz -... -$cpucl9 - CPU clock for core 9, MHz -... -$cpuclN - CPU clock for core N, MHz - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 4 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Temperature - - - true - - - - - - - $tempN - physical temperature on device N (from 0). Example: $temp0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 5 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - GPU - - - true - - - - - - - $gpu - gpu usage, % - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 6 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - GPU Temp - - - true - - - - - - - $gputemp - physical temperature on GPU - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 7 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Memory - - - true - - - true - - - - - - - $mem - RAM usage, % -$memmb - RAM usage, MB -$memgb - RAM usage, GB -$memtotmb - total RAM, MB -$memtotgb - total RAM, GB - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 8 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Swap - - - true - - - true - - - - - - - $swap - swap usage, % -$swapmb - swap usage, MB -$swapgb - swap usage, GB -$swaptotmb - total swap, MB -$swaptotgb - total swap, GB - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 9 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - HDD - - - true - - - - - - - $hddN - usage for mount point N (from 0), %. Example: $hdd0 -$hddmbN - usage for mount point N (from 0), MB. Example: $hddmb0 -$hddgbN - usage for mount point N (from 0), GB. Example: $hddgb0 -$hddtotmbN - total size of mount point N (from 0), MB. Example: $hddtotmb0 -$hddtotgbN - total size of mount point N (from 0), GB. Example: $hddtotgb0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 10 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - HDD speed - - - true - - - - - - - $hddrN - read speed HDD N (from 0), KB/s. Example: $hddr0 -$hddwN - write speed HDD N (from 0), KB/s. Example: $hddw0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 11 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - HDD temp - - - true - - - - - - - $hddtempN - physical temperature on device N (from 0). Example: $hddtemp0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 12 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Network - - - true - - - true - - - - - - - $down - download speed, KB/s -$up - upload speed, KB/s -$netdev - current network device - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 13 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Battery - - - true - - - - - - - $bat - battery charge, % -$ac - AC status - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 14 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Music player - - - true - - - - - - - $album - song album -$artist - song artist -$progress - song progress -$time - song duration -$title - song title - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 15 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Processes - - - true - - - - - - - $pscount - number of running processes -$pstotal - total number of running processes -$ps - list of running processes comma separated - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 16 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Package manager - - - true - - - - - - - $pkgcountN - number of packages which are available for updates, command N. For example $pkgcount0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 17 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Custom - - - true - - - - - - - $customN - get output from custom command N (from N). Example `$custom0` - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 18 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - - - - 200 - 0 - - - - Current desktop - - - true - - - - - - - $name - desktop name -$number - desktop number -$total - total number of desktops - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 16777215 - - - - 1 - - - 19 - - - 1 - - - 19 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - scrollArea_settings - checkBox_time - lineEdit_time - slider_time - checkBox_uptime - lineEdit_uptime - slider_uptime - checkBox_cpu - lineEdit_cpu - slider_cpu - checkBox_cpuclock - lineEdit_cpuclock - slider_cpuclock - checkBox_temp - lineEdit_temp - slider_temp - checkBox_gpu - lineEdit_gpu - slider_gpu - checkBox_gpuTemp - lineEdit_gpuTemp - slider_gpuTemp - checkBox_mem - lineEdit_mem - slider_mem - checkBox_swap - lineEdit_swap - slider_swap - checkBox_hdd - lineEdit_hdd - slider_hdd - checkBox_hddTemp - checkBox_hddSpeed - lineEdit_hddSpeed - slider_hddSpeed - lineEdit_hddTemp - slider_hddTemp - checkBox_net - lineEdit_net - slider_net - checkBox_bat - lineEdit_bat - slider_bat - checkBox_player - lineEdit_player - slider_player - checkBox_ps - lineEdit_ps - slider_ps - checkBox_pkg - lineEdit_pkg - slider_pkg - checkBox_custom - lineEdit_custom - slider_custom - checkBox_desktop - lineEdit_desktop - slider_desktop - diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index 3f3a24a..db0082c 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -28,8 +28,8 @@ #include #include -#include #include +#include ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) diff --git a/sources/ptm/contents/code/configdef.py b/sources/ptm/contents/code/configdef.py index 7a62736..b92802f 100644 --- a/sources/ptm/contents/code/configdef.py +++ b/sources/ptm/contents/code/configdef.py @@ -243,7 +243,7 @@ class ConfigDefinition: self.configpage['tooltip'].checkBox_background.setCheckState(0) else: self.configpage['tooltip'].checkBox_background.setCheckState(2) - self.configpage['tooltip'].ui.kcolorcombo_cpu.setColor(QColor(str(settings.get('tooltip_background', 'null')))) + self.configpage['tooltip'].ui.kcolorcombo_background.setColor(QColor(str(settings.get('tooltip_background', 'null')))) self.configpage['tooltip'].ui.kcolorcombo_cpu.setColor(QColor(str(settings.get('cpu_color', '#ff0000')))) self.configpage['tooltip'].ui.kcolorcombo_cpuclock.setColor(QColor(str(settings.get('cpuclock_color', '#00ff00')))) self.configpage['tooltip'].ui.kcolorcombo_mem.setColor(QColor(str(settings.get('mem_color', '#0000ff')))) @@ -287,7 +287,6 @@ class ConfigDefinition: self.configpage['dataengine'].ui.lineEdit_hddtempCmd.setText(deSettings['HDDTEMPCMD']) self.configpage['dataengine'].ui.lineEdit_mpdaddress.setText(deSettings['MPDADDRESS']) self.configpage['dataengine'].ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT'])) - self.configpage['dataengine'].ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT'])) self.configpage['dataengine'].ui.comboBox_mpris.addItem(deSettings['MPRIS']) self.configpage['dataengine'].ui.comboBox_mpris.setCurrentIndex(self.configpage['dataengine'].ui.comboBox_mpris.count()-1) self.configpage['dataengine'].ui.tableWidget_pkgCommand.clear()