mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
add createConfigurationInterface() function
This commit is contained in:
parent
5b44fa5c75
commit
068a976499
@ -23,7 +23,7 @@ else ()
|
|||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_subdirectory (awesomewidget)
|
add_subdirectory (awesome-widget)
|
||||||
add_subdirectory (ext-sysmon)
|
add_subdirectory (ext-sysmon)
|
||||||
add_subdirectory (desktop-panel)
|
add_subdirectory (desktop-panel)
|
||||||
add_subdirectory (ptm)
|
add_subdirectory (ptm)
|
||||||
|
@ -21,7 +21,8 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
set (SUBPROJECT_MISC_DIR "contents/misc")
|
set (SUBPROJECT_MISC_DIR "contents/misc")
|
||||||
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 ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
file (GLOB SUBPROJECT_UI *.ui)
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
file (GLOB SUBPROJECT_NOTIFY ${SUBPROJECT_MISC_DIR}/*.notifyrc)
|
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})
|
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
# make
|
# make
|
||||||
|
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
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})
|
target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
|
||||||
|
|
||||||
# install
|
# install
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConfigWindow</class>
|
<class>AdvancedWindow</class>
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
<widget class="QWidget" name="AdvancedWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Advanced configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -41,9 +41,9 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-145</y>
|
||||||
<width>677</width>
|
<width>677</width>
|
||||||
<height>752</height>
|
<height>723</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
@ -327,33 +327,6 @@ $m - uptime minutes without zero</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_netdir">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_netdir">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Network directory</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_netdir">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>"/sys/class/net" by default</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_netdev">
|
<layout class="QHBoxLayout" name="layout_netdev">
|
||||||
<item>
|
<item>
|
||||||
@ -531,7 +504,6 @@ $m - uptime minutes without zero</string>
|
|||||||
<tabstop>listWidget_mount</tabstop>
|
<tabstop>listWidget_mount</tabstop>
|
||||||
<tabstop>listWidget_hddSpeedDevice</tabstop>
|
<tabstop>listWidget_hddSpeedDevice</tabstop>
|
||||||
<tabstop>listWidget_hddDevice</tabstop>
|
<tabstop>listWidget_hddDevice</tabstop>
|
||||||
<tabstop>lineEdit_netdir</tabstop>
|
|
||||||
<tabstop>checkBox_netdev</tabstop>
|
<tabstop>checkBox_netdev</tabstop>
|
||||||
<tabstop>comboBox_netdev</tabstop>
|
<tabstop>comboBox_netdev</tabstop>
|
||||||
<tabstop>lineEdit_batdev</tabstop>
|
<tabstop>lineEdit_batdev</tabstop>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConfigWindow</class>
|
<class>AppearanceWindow</class>
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
<widget class="QWidget" name="AppearanceWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Appearance configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -143,9 +143,9 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_fontSize">
|
<layout class="QHBoxLayout" name="layout_size">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_fontSize">
|
<widget class="QLabel" name="label_size">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>200</width>
|
||||||
@ -158,7 +158,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_fontSize">
|
<spacer name="spacer_size">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -171,7 +171,7 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBox_fontSize">
|
<widget class="QSpinBox" name="spinBox_size">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>180</width>
|
<width>180</width>
|
||||||
|
99
sources/awesome-widget/awesome-widget.cpp
Normal file
99
sources/awesome-widget/awesome-widget.cpp
Normal file
@ -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 <QGraphicsLinearLayout>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
91
sources/awesome-widget/awesome-widget.h
Normal file
91
sources/awesome-widget/awesome-widget.h
Normal file
@ -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 <Plasma/Applet>
|
||||||
|
#include <Plasma/DataEngine>
|
||||||
|
#include <Plasma/Label>
|
||||||
|
|
||||||
|
#include <ui_advanced.h>
|
||||||
|
#include <ui_appearance.h>
|
||||||
|
#include <ui_deconfig.h>
|
||||||
|
#include <ui_tooltipconfig.h>
|
||||||
|
#include <ui_widget.h>
|
||||||
|
|
||||||
|
|
||||||
|
class QGraphicsLinearLayout;
|
||||||
|
|
||||||
|
class AwesomeWidget : public Plasma::Applet
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AwesomeWidget(QObject *parent, const QVariantList &args);
|
||||||
|
~AwesomeWidget();
|
||||||
|
QString getNetworkDevice();
|
||||||
|
void init();
|
||||||
|
// de configuration
|
||||||
|
QMap<QString, QString> readDataEngineConfiguration();
|
||||||
|
void writeDataEngineConfiguration(const QMap<QString, QString> settings);
|
||||||
|
QMap<QString, QString> updateDataEngineConfiguration(const QMap<QString, QString> 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<QString, QString> configuration;
|
||||||
|
QStringList diskDevices;
|
||||||
|
QStringList formatLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* AWESOME_WIDGET_H */
|
373
sources/awesome-widget/configuration.cpp
Normal file
373
sources/awesome-widget/configuration.cpp
Normal file
@ -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 <KConfigDialog>
|
||||||
|
#include <KGlobal>
|
||||||
|
#include <KStandardDirs>
|
||||||
|
#include <QNetworkInterface>
|
||||||
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <task/taskadds.h>
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> AwesomeWidget::readDataEngineConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QMap<QString, QString> 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<fileStr.split(QChar('=')).count(); i++)
|
||||||
|
value.append(fileStr.split(QChar('='))[i]);
|
||||||
|
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
||||||
|
}
|
||||||
|
if (configFile.atEnd()) break;
|
||||||
|
}
|
||||||
|
configFile.close();
|
||||||
|
|
||||||
|
return updateDataEngineConfiguration(rawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::writeDataEngineConfiguration(const QMap<QString, QString> settings)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QMap<QString, QString> 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<config.keys().count(); i++) {
|
||||||
|
QByteArray string = (config.keys()[i] + QString("=") + config[config.keys()[i]] + QString("\n")).toUtf8();
|
||||||
|
configFile.write(string);
|
||||||
|
}
|
||||||
|
configFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> AwesomeWidget::updateDataEngineConfiguration(const QMap<QString, QString> rawConfig)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QMap<QString, QString> config;
|
||||||
|
QString key, value;
|
||||||
|
// remove spaces and copy source map
|
||||||
|
for (int i=0; i<rawConfig.keys().count(); i++) {
|
||||||
|
key = rawConfig.keys()[i];
|
||||||
|
value = rawConfig[key];
|
||||||
|
key.remove(QChar(' '));
|
||||||
|
if ((key != QString("CUSTOM")) &&
|
||||||
|
(key != QString("DESKTOPCMD")) &&
|
||||||
|
(key != QString("HDDTEMPCMD")) &&
|
||||||
|
(key != QString("PKGCMD")))
|
||||||
|
value.remove(QChar(' '));
|
||||||
|
config[key] = value;
|
||||||
|
}
|
||||||
|
// pkgcmd
|
||||||
|
for (int i=config[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
||||||
|
i<config[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
|
||||||
|
i++)
|
||||||
|
config[QString("PKGNULL")] += QString(",0");
|
||||||
|
|
||||||
|
for (int i=0; i<config.keys().count(); i++)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") + config[config.keys()[i]];
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
QString cmd, qoutput;
|
||||||
|
QStringList headerList;
|
||||||
|
TaskResult process;
|
||||||
|
|
||||||
|
QWidget *advWidget = new QWidget;
|
||||||
|
uiAdvancedConfig.setupUi(advWidget);
|
||||||
|
QWidget *appWidget = new QWidget;
|
||||||
|
uiAppConfig.setupUi(appWidget);
|
||||||
|
QWidget *configWidget = new QWidget;
|
||||||
|
uiWidConfig.setupUi(configWidget);
|
||||||
|
QWidget *deConfigWidget = new QWidget;
|
||||||
|
uiDEConfig.setupUi(deConfigWidget);
|
||||||
|
QWidget *tooltipWidget = new QWidget;
|
||||||
|
uiTooltipConfig.setupUi(tooltipWidget);
|
||||||
|
|
||||||
|
//widget
|
||||||
|
uiWidConfig.textEdit_elements->setPlainText(configuration[QString("text")]);
|
||||||
|
|
||||||
|
// advanced
|
||||||
|
if (configuration[QString("background")].toInt() == 0)
|
||||||
|
uiAdvancedConfig.checkBox_background->setCheckState(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<qoutput.split(QString("\n\n")).count(); i++) {
|
||||||
|
QString sensor = qoutput.split(QString("\n\n"))[i];
|
||||||
|
for (int j=0; j<sensor.split(QChar('\n')).count(); j++) {
|
||||||
|
QString device = sensor.split(QChar('\n'))[j];
|
||||||
|
if (device.indexOf(QString("°C")) > -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<configuration[QString("tempDevice")].split(QString("@@")).count(); i++) {
|
||||||
|
QList<QListWidgetItem *> items = uiAdvancedConfig.listWidget_tempDevice
|
||||||
|
->findItems(configuration[QString("tempDevice")].split(QString("@@"))[i], Qt::MatchFixedString);
|
||||||
|
for (int j=0; j<items.count(); j++)
|
||||||
|
items[j]->setCheckState(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; i<qoutput.split(QChar('\n')).count(); i++) {
|
||||||
|
QString mountPoint = qoutput.split(QChar('\n'))[i].split(QString(" on "))[1].split(QString(" type "))[0];
|
||||||
|
QListWidgetItem item = QListWidgetItem(mountPoint);
|
||||||
|
item.setCheckState(Qt::Unchecked);
|
||||||
|
uiAdvancedConfig.listWidget_mount->addItem(&item);
|
||||||
|
}
|
||||||
|
for (int i=0; i<configuration[QString("mount")].split(QString("@@")).count(); i++) {
|
||||||
|
QList<QListWidgetItem *> items = uiAdvancedConfig.listWidget_mount
|
||||||
|
->findItems(configuration[QString("mount")].split(QString("@@"))[i], Qt::MatchFixedString);
|
||||||
|
for (int j=0; j<items.count(); j++)
|
||||||
|
items[j]->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
uiAdvancedConfig.listWidget_hddSpeedDevice->clear();
|
||||||
|
for (int i=0; i<diskDevices.count(); i++) {
|
||||||
|
QListWidgetItem item = QListWidgetItem(diskDevices[i]);
|
||||||
|
item.setCheckState(Qt::Unchecked);
|
||||||
|
uiAdvancedConfig.listWidget_hddSpeedDevice->addItem(&item);
|
||||||
|
}
|
||||||
|
for (int i=0; i<configuration[QString("disk")].split(QString("@@")).count(); i++) {
|
||||||
|
QList<QListWidgetItem *> items = uiAdvancedConfig.listWidget_hddSpeedDevice
|
||||||
|
->findItems(configuration[QString("disk")].split(QString("@@"))[i], Qt::MatchFixedString);
|
||||||
|
for (int j=0; j<items.count(); j++)
|
||||||
|
items[j]->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
if (configuration[QString("useCustomNetdev")].toInt() == 0)
|
||||||
|
uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Unchecked);
|
||||||
|
else
|
||||||
|
uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Checked);
|
||||||
|
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
||||||
|
QStringList interfaceList;
|
||||||
|
for (int i=0; i<rawInterfaceList.count(); i++)
|
||||||
|
interfaceList.append(rawInterfaceList[i].name());
|
||||||
|
uiAdvancedConfig.comboBox_netdev->clear();
|
||||||
|
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<QString, QString> 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; i<deSettings[QString("CUSTOM")].split(QString("@@")).count(); i++)
|
||||||
|
uiDEConfig.tableWidget_customCommand->setItem(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; i<qoutput.split(QChar('\n')).count(); i++)
|
||||||
|
uiDEConfig.comboBox_hdddev->addItem(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; i<deSettings[QString("PKGCMD")].split(QChar(',')).count(); i++) {
|
||||||
|
uiDEConfig.tableWidget_pkgCommand->setItem(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);
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConfigWindow</class>
|
<class>DEWindow</class>
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
<widget class="QWidget" name="DEWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>DE Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
51
sources/awesome-widget/deinteraction.cpp
Normal file
51
sources/awesome-widget/deinteraction.cpp
Normal file
@ -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 <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
33
sources/awesome-widget/reinit.cpp
Normal file
33
sources/awesome-widget/reinit.cpp
Normal file
@ -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 <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::reinit()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::updateText()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConfigWindow</class>
|
<class>TooltipWindow</class>
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
<widget class="QWidget" name="TooltipWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Tooltip configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -28,8 +28,8 @@
|
|||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <task/taskadds.h>
|
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <task/taskadds.h>
|
||||||
|
|
||||||
|
|
||||||
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||||
|
@ -243,7 +243,7 @@ class ConfigDefinition:
|
|||||||
self.configpage['tooltip'].checkBox_background.setCheckState(0)
|
self.configpage['tooltip'].checkBox_background.setCheckState(0)
|
||||||
else:
|
else:
|
||||||
self.configpage['tooltip'].checkBox_background.setCheckState(2)
|
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_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_cpuclock.setColor(QColor(str(settings.get('cpuclock_color', '#00ff00'))))
|
||||||
self.configpage['tooltip'].ui.kcolorcombo_mem.setColor(QColor(str(settings.get('mem_color', '#0000ff'))))
|
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_hddtempCmd.setText(deSettings['HDDTEMPCMD'])
|
||||||
self.configpage['dataengine'].ui.lineEdit_mpdaddress.setText(deSettings['MPDADDRESS'])
|
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.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
|
|
||||||
self.configpage['dataengine'].ui.comboBox_mpris.addItem(deSettings['MPRIS'])
|
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.comboBox_mpris.setCurrentIndex(self.configpage['dataengine'].ui.comboBox_mpris.count()-1)
|
||||||
self.configpage['dataengine'].ui.tableWidget_pkgCommand.clear()
|
self.configpage['dataengine'].ui.tableWidget_pkgCommand.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user