mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
implement general methods to plugin
This commit is contained in:
parent
cc7b7b5659
commit
9ff07241b1
@ -46,7 +46,7 @@ else ()
|
||||
endif ()
|
||||
|
||||
# translations
|
||||
add_subdirectory (translations)
|
||||
# add_subdirectory (translations)
|
||||
# aw bars desktops
|
||||
set (AW_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
install (DIRECTORY ${AW_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/plasma_applet_awesome-widget)
|
||||
|
@ -5,7 +5,7 @@ message (STATUS "Subproject ${SUBPROJECT}")
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core DBus Qml)
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
|
@ -1,9 +1,11 @@
|
||||
set (PLUGIN_NAME awplugin)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS})
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR})
|
||||
@ -21,9 +23,12 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesome-widget)
|
||||
|
@ -15,18 +15,24 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "awadds.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QInputDialog>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkInterface>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
|
||||
#include "awadds.h"
|
||||
#include "graphicalitem.h"
|
||||
#include "version.h"
|
||||
|
||||
@ -45,3 +51,156 @@ AWAdds::~AWAdds()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
QString AWAdds::networkDevice(const QString custom)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Custom device" << custom;
|
||||
|
||||
QString device = QString("lo");
|
||||
if (custom.isEmpty()) {
|
||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
||||
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsLoopBack)) &&
|
||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint))) {
|
||||
device = rawInterfaceList[i].name();
|
||||
break;
|
||||
}
|
||||
} else
|
||||
device = custom;
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
int AWAdds::numberCpus()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString cmd = QString("grep -c ^processor /proc/cpuinfo");
|
||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||
|
||||
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed().toInt();
|
||||
}
|
||||
|
||||
|
||||
float AWAdds::tempepature(const float temp, const QString units)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
float convertedTemp = temp;
|
||||
if (units == QString("Celsius"))
|
||||
;
|
||||
else if (units == QString("Fahrenheit"))
|
||||
convertedTemp = temp * 9.0 / 5.0 + 32.0;
|
||||
else if (units == QString("Kelvin"))
|
||||
convertedTemp = temp + 273.15;
|
||||
else if (units == QString("Reaumur"))
|
||||
convertedTemp = temp * 0.8;
|
||||
else if (units == QString("cm^-1"))
|
||||
convertedTemp = (temp + 273.15) * 0.695;
|
||||
else if (units == QString("kJ/mol"))
|
||||
convertedTemp = (temp + 273.15) * 8.31;
|
||||
else if (units == QString("kcal/mol"))
|
||||
convertedTemp = (temp + 273.15) * 1.98;
|
||||
|
||||
return convertedTemp;
|
||||
}
|
||||
|
||||
|
||||
QStringList AWAdds::timeKeys()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList keys;
|
||||
keys.append(QString("dddd"));
|
||||
keys.append(QString("ddd"));
|
||||
keys.append(QString("dd"));
|
||||
keys.append(QString("d"));
|
||||
keys.append(QString("MMMM"));
|
||||
keys.append(QString("MMM"));
|
||||
keys.append(QString("MM"));
|
||||
keys.append(QString("M"));
|
||||
keys.append(QString("yyyy"));
|
||||
keys.append(QString("yy"));
|
||||
keys.append(QString("hh"));
|
||||
keys.append(QString("h"));
|
||||
keys.append(QString("mm"));
|
||||
keys.append(QString("m"));
|
||||
keys.append(QString("ss"));
|
||||
keys.append(QString("s"));
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> AWAdds::readDataEngineConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QMap<QString, QVariant> rawConfig;
|
||||
|
||||
settings.beginGroup(QString("Configuration"));
|
||||
rawConfig[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||
rawConfig[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
||||
rawConfig[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
||||
rawConfig[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp"));
|
||||
rawConfig[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
||||
rawConfig[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
||||
rawConfig[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
||||
rawConfig[QString("PKGCMD")] = settings.value(QString("PKGCMD"), QString("pacman -Qu"));
|
||||
rawConfig[QString("PKGNULL")] = settings.value(QString("PKGNULL"), QString("0"));
|
||||
rawConfig[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris"));
|
||||
settings.endGroup();
|
||||
|
||||
return updateDataEngineConfiguration(rawConfig);
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> AWAdds::updateDataEngineConfiguration(QMap<QString, QVariant> rawConfig)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=rawConfig[QString("PKGNULL")].toString().split(QString(","), QString::SkipEmptyParts).count();
|
||||
i<rawConfig[QString("PKGCMD")].toString().split(QString(","), QString::SkipEmptyParts).count()+1;
|
||||
i++)
|
||||
rawConfig[QString("PKGNULL")].toString() += QString(",0");
|
||||
|
||||
for (int i=0; i<rawConfig.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" <<
|
||||
rawConfig.keys()[i] << QString("=") << rawConfig[rawConfig.keys()[i]];
|
||||
return rawConfig;
|
||||
}
|
||||
|
||||
|
||||
void AWAdds::writeDataEngineConfiguration(const QMap<QString, QVariant> configuration)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/plasma-dataengine-extsysmon.conf");
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Configuration"));
|
||||
settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]);
|
||||
settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]);
|
||||
settings.setValue(QString("HDDTEMPCMD"), configuration[QString("HDDTEMPCMD")]);
|
||||
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]);
|
||||
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
|
||||
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
|
||||
settings.setValue(QString("PKGCMD"), configuration[QString("PKGCMD")]);
|
||||
settings.setValue(QString("PKGNULL"), configuration[QString("PKGNULL")]);
|
||||
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
@ -19,7 +19,10 @@
|
||||
#ifndef AWADDS_H
|
||||
#define AWADDS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class AWAdds : public QObject
|
||||
@ -30,7 +33,16 @@ public:
|
||||
AWAdds(QObject *parent = 0);
|
||||
~AWAdds();
|
||||
|
||||
Q_INVOKABLE QString networkDevice(const QString custom = QString(""));
|
||||
Q_INVOKABLE int numberCpus();
|
||||
Q_INVOKABLE float tempepature(const float temp, const QString units = QString("Celsius"));
|
||||
Q_INVOKABLE QStringList timeKeys();
|
||||
// dataengine
|
||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
||||
|
||||
private:
|
||||
QMap<QString, QVariant> updateDataEngineConfiguration(QMap<QString, QVariant> rawConfig);
|
||||
bool debug = false;
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "awesomewidget.h"
|
||||
|
||||
#include <QtQml>
|
||||
|
||||
#include "awadds.h"
|
||||
|
||||
|
||||
|
@ -22,13 +22,14 @@
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
|
||||
class QQmlEngine;
|
||||
|
||||
class AWPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "graphicalitem.h"
|
||||
#include "ui_graphicalitem.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
@ -32,8 +34,8 @@
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
fileName(desktopName),
|
||||
dirs(directories),
|
||||
m_fileName(desktopName),
|
||||
m_dirs(directories),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::GraphicalItem)
|
||||
{
|
||||
@ -53,14 +55,14 @@ GraphicalItem::~GraphicalItem()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getImage(const float value)
|
||||
QString GraphicalItem::image(const float value)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||
if (_bar == QString("none")) return QString("");
|
||||
if (m_bar == QString("none")) return QString("");
|
||||
|
||||
QColor active = stringToColor(_activeColor);
|
||||
QColor inactive = stringToColor(_inactiveColor);
|
||||
QColor active = stringToColor(m_activeColor);
|
||||
QColor inactive = stringToColor(m_inactiveColor);
|
||||
float percent = value / 100.0;
|
||||
int scale[2] = {1, 1};
|
||||
QPen pen = QPen();
|
||||
@ -72,47 +74,51 @@ QString GraphicalItem::getImage(const float value)
|
||||
view->setFrameShape(QFrame::NoFrame);
|
||||
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
view->resize(_width + 5.0, _height + 5.0);
|
||||
view->resize(m_width + 5.0, m_height + 5.0);
|
||||
|
||||
// paint
|
||||
switch(_type) {
|
||||
switch(m_type) {
|
||||
case Vertical:
|
||||
pen.setWidth(_width);
|
||||
pen.setWidth(m_width);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
scene->addLine(0.5 * _width, -0.5 * _width, 0.5 * _width, (1.0 - percent) * _height - 0.5 * _width, pen);
|
||||
scene->addLine(0.5 * m_width, -0.5 * m_width, 0.5 * m_width,
|
||||
(1.0 - percent) * m_height - 0.5 * m_width, pen);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
scene->addLine(0.5 * _width, (1.0 - percent) * _height + 0.5 * _width, 0.5 * _width, _height + 0.5 * _width, pen);
|
||||
scene->addLine(0.5 * m_width, (1.0 - percent) * m_height + 0.5 * m_width,
|
||||
0.5 * m_width, m_height + 0.5 * m_width, pen);
|
||||
// scale
|
||||
scale[1] = -2 * (int)_direction + 1;
|
||||
scale[1] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
case Circle:
|
||||
QGraphicsEllipseItem *circle;
|
||||
pen.setWidth(1.0);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
||||
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern));
|
||||
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(active, Qt::SolidPattern));
|
||||
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
||||
circle->setStartAngle(90.0 * 16.0);
|
||||
// scale
|
||||
scale[0] = -2 *(int)_direction + 1;
|
||||
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
default:
|
||||
pen.setWidth(_height);
|
||||
pen.setWidth(m_height);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
scene->addLine(percent * _width + 0.5 * _height, 0.5 * _height, _width + 0.5 * _height, 0.5 * _height, pen);
|
||||
scene->addLine(percent * m_width + 0.5 * m_height, 0.5 * m_height,
|
||||
m_width + 0.5 * m_height, 0.5 * m_height, pen);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
scene->addLine(-0.5 * _height, 0.5 * _height, percent * _width - 0.5 * _height, 0.5 * _height, pen);
|
||||
scene->addLine(-0.5 * m_height, 0.5 * m_height,
|
||||
percent * m_width - 0.5 * m_height, 0.5 * m_height, pen);
|
||||
// scale
|
||||
scale[0] = -2 * (int)_direction + 1;
|
||||
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -129,68 +135,68 @@ QString GraphicalItem::getImage(const float value)
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getFileName()
|
||||
QString GraphicalItem::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return fileName;
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getName()
|
||||
QString GraphicalItem::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _name;
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getComment()
|
||||
QString GraphicalItem::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _comment;
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getBar()
|
||||
QString GraphicalItem::bar()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _bar;
|
||||
return m_bar;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getActiveColor()
|
||||
QString GraphicalItem::activeColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _activeColor;
|
||||
return m_activeColor;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getInactiveColor()
|
||||
QString GraphicalItem::inactiveColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _inactiveColor;
|
||||
return m_inactiveColor;
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Type GraphicalItem::getType()
|
||||
GraphicalItem::Type GraphicalItem::type()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _type;
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getStrType()
|
||||
QString GraphicalItem::strType()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString value;
|
||||
switch(_type) {
|
||||
switch(m_type) {
|
||||
case Vertical:
|
||||
value = QString("Vertical");
|
||||
break;
|
||||
@ -206,20 +212,20 @@ QString GraphicalItem::getStrType()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Direction GraphicalItem::getDirection()
|
||||
GraphicalItem::Direction GraphicalItem::direction()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _direction;
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::getStrDirection()
|
||||
QString GraphicalItem::strDirection()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString value;
|
||||
switch (_direction) {
|
||||
switch (m_direction) {
|
||||
case RightToLeft:
|
||||
value = QString("RightToLeft");
|
||||
break;
|
||||
@ -232,117 +238,136 @@ QString GraphicalItem::getStrDirection()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::getHeight()
|
||||
int GraphicalItem::height()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _height;
|
||||
return m_height;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::getWidth()
|
||||
int GraphicalItem::width()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return _width;
|
||||
return m_width;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setName(const QString name)
|
||||
void GraphicalItem::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << name;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
_name = name;
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setComment(const QString comment)
|
||||
void GraphicalItem::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << comment;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
_comment = comment;
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setBar(const QString bar)
|
||||
void GraphicalItem::setBar(const QString _bar)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Bar" << bar;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Bar" << _bar;
|
||||
|
||||
_bar = bar;
|
||||
if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
|
||||
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
||||
(!_bar.contains(QRegExp(QString("mem")))) &&
|
||||
(!_bar.contains(QRegExp(QString("swap")))) &&
|
||||
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
||||
(!_bar.contains(QRegExp(QString("bat.*")))))
|
||||
_bar = QString("none");
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setActiveColor(const QString color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
||||
|
||||
_activeColor = color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setInactiveColor(const QString color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
||||
|
||||
_inactiveColor = color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setType(const QString type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||
|
||||
if (type == QString("Vertical"))
|
||||
_type = Vertical;
|
||||
else if (type == QString("Circle"))
|
||||
_type = Circle;
|
||||
m_bar = QString("none");
|
||||
else
|
||||
_type = Horizontal;
|
||||
m_bar = _bar;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setDirection(const QString direction)
|
||||
void GraphicalItem::setActiveColor(const QString _color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << direction;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
|
||||
if (direction == QString("RightToLeft"))
|
||||
_direction = RightToLeft;
|
||||
m_activeColor = _color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setInactiveColor(const QString _color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
|
||||
m_inactiveColor = _color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setType(const Type _type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||
|
||||
m_type = _type;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setStrType(const QString _type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||
|
||||
if (_type == QString("Vertical"))
|
||||
setType(Vertical);
|
||||
else if (_type == QString("Circle"))
|
||||
setType(Circle);
|
||||
else
|
||||
_direction = LeftToRight;
|
||||
setType(Horizontal);
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setHeight(const int height)
|
||||
void GraphicalItem::setDirection(const Direction _direction)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Height" << height;
|
||||
if (height <= 0) return;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||
|
||||
_height = height;
|
||||
m_direction = _direction;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setWidth(const int width)
|
||||
void GraphicalItem::setStrDirection(const QString _direction)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Width" << width;
|
||||
if (width <= 0) return;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||
|
||||
_width = width;
|
||||
if (_direction == QString("RightToLeft"))
|
||||
setDirection(RightToLeft);
|
||||
else
|
||||
setDirection(LeftToRight);
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setHeight(const int _height)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Height" << _height;
|
||||
if (_height <= 0) return;
|
||||
|
||||
m_height = _height;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setWidth(const int _width)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Width" << _width;
|
||||
if (_width <= 0) return;
|
||||
|
||||
m_width = _width;
|
||||
}
|
||||
|
||||
|
||||
@ -350,19 +375,20 @@ void GraphicalItem::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(dirs[i]).entryList(QDir::Files).contains(fileName)) continue;
|
||||
QSettings settings(dirs[i] + QDir::separator() + fileName, QSettings::IniFormat);
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(m_dirs[i] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), _name).toString());
|
||||
setComment(settings.value(QString("Comment"), _comment).toString());
|
||||
setBar(settings.value(QString("X-AW-Value"), _bar).toString());
|
||||
setActiveColor(settings.value(QString("X-AW-ActiveColor"), _activeColor).toString());
|
||||
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), _inactiveColor).toString());
|
||||
setType(settings.value(QString("X-AW-Type"), getStrType()).toString());
|
||||
setDirection(settings.value(QString("X-AW-Direction"), getStrDirection()).toString());
|
||||
setHeight(settings.value(QString("X-AW-Height"), QString::number(_height)).toInt());
|
||||
setWidth(settings.value(QString("X-AW-Width"), QString::number(_width)).toInt());
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
|
||||
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
|
||||
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
|
||||
setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
|
||||
setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString());
|
||||
setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
|
||||
setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
@ -372,27 +398,28 @@ void GraphicalItem::showConfiguration(const QStringList tags)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_nameValue->setText(_name);
|
||||
ui->lineEdit_comment->setText(_comment);
|
||||
ui->label_nameValue->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
ui->comboBox_value->addItems(tags);
|
||||
ui->comboBox_value->addItem(_bar);
|
||||
ui->comboBox_value->addItem(m_bar);
|
||||
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
||||
ui->pushButton_activeColor->setText(_activeColor);
|
||||
ui->pushButton_inactiveColor->setText(_inactiveColor);
|
||||
ui->comboBox_type->setCurrentIndex((int)_type);
|
||||
ui->comboBox_direction->setCurrentIndex((int)_direction);
|
||||
ui->spinBox_height->setValue(_height);
|
||||
ui->spinBox_width->setValue(_width);
|
||||
ui->pushButton_activeColor->setText(m_activeColor);
|
||||
ui->pushButton_inactiveColor->setText(m_inactiveColor);
|
||||
ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
|
||||
ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
|
||||
ui->spinBox_height->setValue(m_height);
|
||||
ui->spinBox_width->setValue(m_width);
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return;
|
||||
|
||||
setName(ui->label_nameValue->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setBar(ui->comboBox_value->currentText());
|
||||
setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
|
||||
setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
|
||||
setType(ui->comboBox_type->currentText());
|
||||
setDirection(ui->comboBox_direction->currentText());
|
||||
setStrType(ui->comboBox_type->currentText());
|
||||
setStrDirection(ui->comboBox_direction->currentText());
|
||||
setHeight(ui->spinBox_height->value());
|
||||
setWidth(ui->spinBox_width->value());
|
||||
|
||||
@ -404,9 +431,9 @@ void GraphicalItem::tryDelete()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << dirs[i] + QDir::separator() + fileName <<
|
||||
QFile::remove(dirs[i] + QDir::separator() + fileName);
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << m_dirs[i] + QDir::separator() + m_fileName <<
|
||||
QFile::remove(m_dirs[i] + QDir::separator() + m_fileName);
|
||||
}
|
||||
|
||||
|
||||
@ -414,22 +441,22 @@ void GraphicalItem::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(dirs[0] + QDir::separator() + fileName, QSettings::IniFormat);
|
||||
QSettings settings(m_dirs[0] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), _name);
|
||||
settings.setValue(QString("Comment"), _comment);
|
||||
settings.setValue(QString("X-AW-Value"), _bar);
|
||||
settings.setValue(QString("X-AW-ActiveColor"), _activeColor);
|
||||
settings.setValue(QString("X-AW-InactiveColor"), _inactiveColor);
|
||||
settings.setValue(QString("X-AW-Type"), getStrType());
|
||||
settings.setValue(QString("X-AW-Direction"), getStrDirection());
|
||||
settings.setValue(QString("X-AW-Height"), _height);
|
||||
settings.setValue(QString("X-AW-Width"), _width);
|
||||
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("X-AW-Value"), m_bar);
|
||||
settings.setValue(QString("X-AW-ActiveColor"), m_activeColor);
|
||||
settings.setValue(QString("X-AW-InactiveColor"), m_inactiveColor);
|
||||
settings.setValue(QString("X-AW-Type"), strType());
|
||||
settings.setValue(QString("X-AW-Direction"), strDirection());
|
||||
settings.setValue(QString("X-AW-Height"), m_height);
|
||||
settings.setValue(QString("X-AW-Width"), m_width);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
@ -448,17 +475,17 @@ void GraphicalItem::changeColor()
|
||||
colorText.append(QString("%1").arg(newColor.green()));
|
||||
colorText.append(QString("%1").arg(newColor.blue()));
|
||||
colorText.append(QString("%1").arg(newColor.alpha()));
|
||||
((QPushButton *)sender())->setText(colorText.join(QChar(',')));
|
||||
dynamic_cast<QPushButton *>(sender())->setText(colorText.join(QChar(',')));
|
||||
}
|
||||
|
||||
|
||||
QColor GraphicalItem::stringToColor(const QString color)
|
||||
QColor GraphicalItem::stringToColor(const QString _color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
|
||||
QColor qcolor;
|
||||
QStringList listColor = color.split(QChar(','));
|
||||
QStringList listColor = _color.split(QChar(','));
|
||||
while (listColor.count() < 4)
|
||||
listColor.append(QString("0"));
|
||||
qcolor.setRed(listColor[0].toInt());
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QColor>
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class GraphicalItem;
|
||||
}
|
||||
@ -28,6 +29,15 @@ class GraphicalItem;
|
||||
class GraphicalItem : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString comment READ comment WRITE setName)
|
||||
Q_PROPERTY(QString bar READ bar WRITE setBar)
|
||||
Q_PROPERTY(QString activeColor READ activeColor WRITE setActiveColor)
|
||||
Q_PROPERTY(QString inactiveColor READ inactiveColor WRITE setInactiveColor)
|
||||
Q_PROPERTY(Type type READ type WRITE setType)
|
||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
|
||||
Q_PROPERTY(int height READ height WRITE setHeight)
|
||||
Q_PROPERTY(int width READ width WRITE setWidth)
|
||||
|
||||
public:
|
||||
enum Direction {
|
||||
@ -43,30 +53,32 @@ public:
|
||||
explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~GraphicalItem();
|
||||
QString getImage(const float value);
|
||||
QString fileName();
|
||||
QString image(const float value);
|
||||
// get methods
|
||||
QString getFileName();
|
||||
QString getName();
|
||||
QString getComment();
|
||||
QString getBar();
|
||||
QString getActiveColor();
|
||||
QString getInactiveColor();
|
||||
Type getType();
|
||||
QString getStrType();
|
||||
Direction getDirection();
|
||||
QString getStrDirection();
|
||||
int getHeight();
|
||||
int getWidth();
|
||||
QString name();
|
||||
QString comment();
|
||||
QString bar();
|
||||
QString activeColor();
|
||||
QString inactiveColor();
|
||||
Type type();
|
||||
QString strType();
|
||||
Direction direction();
|
||||
QString strDirection();
|
||||
int height();
|
||||
int width();
|
||||
// set methods
|
||||
void setName(const QString name = QString("none"));
|
||||
void setComment(const QString comment = QString("empty"));
|
||||
void setBar(const QString bar = QString("cpu"));
|
||||
void setActiveColor(const QString color = QString("0,0,0,130"));
|
||||
void setInactiveColor(const QString color = QString("255,255,255,130"));
|
||||
void setType(const QString type = QString("Horizontal"));
|
||||
void setDirection(const QString direction = QString("LeftToRight"));
|
||||
void setHeight(const int height = 100);
|
||||
void setWidth(const int width = 100);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setBar(const QString _bar = QString("cpu"));
|
||||
void setActiveColor(const QString _color = QString("0,0,0,130"));
|
||||
void setInactiveColor(const QString _color = QString("255,255,255,130"));
|
||||
void setType(const Type _type = Horizontal);
|
||||
void setStrType(const QString _type = QString("Horizontal"));
|
||||
void setDirection(const Direction _direction = LeftToRight);
|
||||
void setStrDirection(const QString _direction = QString("LeftToRight"));
|
||||
void setHeight(const int _height = 100);
|
||||
void setWidth(const int _width = 100);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
@ -78,21 +90,22 @@ private slots:
|
||||
void changeColor();
|
||||
|
||||
private:
|
||||
QColor stringToColor(const QString color);
|
||||
QString fileName;
|
||||
QStringList dirs;
|
||||
QColor stringToColor(const QString _color);
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
||||
Ui::GraphicalItem *ui;
|
||||
// properties
|
||||
QString _name = QString("none");
|
||||
QString _comment = QString("empty");
|
||||
QString _bar = QString("cpu");
|
||||
QString _activeColor = QString("0,0,0,130");
|
||||
QString _inactiveColor = QString("255,255,255,130");
|
||||
Type _type = Horizontal;
|
||||
Direction _direction = LeftToRight;
|
||||
int _height = 100;
|
||||
int _width = 100;
|
||||
QString m_name = QString("none");
|
||||
QString m_comment = QString("empty");
|
||||
QString m_bar = QString("cpu");
|
||||
QString m_activeColor = QString("0,0,0,130");
|
||||
QString m_inactiveColor = QString("255,255,255,130");
|
||||
Type m_type = Horizontal;
|
||||
Direction m_direction = LeftToRight;
|
||||
int m_height = 100;
|
||||
int m_width = 100;
|
||||
};
|
||||
|
||||
|
||||
#endif /* GRAPHICALITEM_H */
|
||||
|
@ -211,38 +211,25 @@ void ExtendedSysMon::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig)
|
||||
QMap<QString, QString> ExtendedSysMon::updateConfiguration(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("HDDTEMPCMD")) &&
|
||||
(key != QString("PKGCMD")))
|
||||
value.remove(QChar(' '));
|
||||
config[key] = value;
|
||||
}
|
||||
// update values
|
||||
// gpudev
|
||||
if (config[QString("GPUDEV")] == QString("disable"))
|
||||
config[QString("GPUDEV")] = QString("disable");
|
||||
else if (config[QString("GPUDEV")] == QString("auto"))
|
||||
config[QString("GPUDEV")] = getAutoGpu();
|
||||
else if ((config[QString("GPUDEV")] != QString("ati")) &&
|
||||
(config[QString("GPUDEV")] != QString("nvidia")))
|
||||
config[QString("GPUDEV")] = getAutoGpu();
|
||||
if (rawConfig[QString("GPUDEV")] == QString("disable"))
|
||||
rawConfig[QString("GPUDEV")] = QString("disable");
|
||||
else if (rawConfig[QString("GPUDEV")] == QString("auto"))
|
||||
rawConfig[QString("GPUDEV")] = getAutoGpu();
|
||||
else if ((rawConfig[QString("GPUDEV")] != QString("ati")) &&
|
||||
(rawConfig[QString("GPUDEV")] != QString("nvidia")))
|
||||
rawConfig[QString("GPUDEV")] = getAutoGpu();
|
||||
// hdddev
|
||||
if (config[QString("HDDDEV")] == QString("all"))
|
||||
config[QString("HDDDEV")] = getAllHdd();
|
||||
else if (config[QString("HDDDEV")] == QString("disable"))
|
||||
config[QString("HDDDEV")] = QString("");
|
||||
if (rawConfig[QString("HDDDEV")] == QString("all"))
|
||||
rawConfig[QString("HDDDEV")] = getAllHdd();
|
||||
else if (rawConfig[QString("HDDDEV")] == QString("disable"))
|
||||
rawConfig[QString("HDDDEV")] = QString("");
|
||||
else {
|
||||
QStringList deviceList = config[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
QStringList deviceList = rawConfig[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("/dev/[hms]d[a-z]$");
|
||||
for (int i=0; i<deviceList.count(); i++)
|
||||
@ -250,24 +237,24 @@ QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, Q
|
||||
(diskRegexp.indexIn(deviceList[i]) > -1))
|
||||
devices.append(deviceList[i]);
|
||||
if (devices.isEmpty())
|
||||
config[QString("HDDDEV")] = getAllHdd();
|
||||
rawConfig[QString("HDDDEV")] = getAllHdd();
|
||||
else
|
||||
config[QString("HDDDEV")] = devices.join(QChar(','));
|
||||
rawConfig[QString("HDDDEV")] = devices.join(QChar(','));
|
||||
}
|
||||
// pkgcmd
|
||||
for (int i=config[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
||||
i<config[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
|
||||
for (int i=rawConfig[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
||||
i<rawConfig[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
|
||||
i++)
|
||||
config[QString("PKGNULL")] += QString(",0");
|
||||
rawConfig[QString("PKGNULL")] += QString(",0");
|
||||
// player
|
||||
if ((config[QString("PLAYER")] != QString("mpd")) &&
|
||||
(config[QString("PLAYER")] != QString("mpris")))
|
||||
config[QString("PLAYER")] = QString("mpris");
|
||||
if ((rawConfig[QString("PLAYER")] != QString("mpd")) &&
|
||||
(rawConfig[QString("PLAYER")] != QString("mpris")))
|
||||
rawConfig[QString("PLAYER")] = QString("mpris");
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
for (int i=0; i<rawConfig.keys().count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" <<
|
||||
config.keys()[i] + QString("=") + config[config.keys()[i]];
|
||||
return config;
|
||||
rawConfig.keys()[i] + QString("=") + rawConfig[rawConfig.keys()[i]];
|
||||
return rawConfig;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
QString getAutoMpris();
|
||||
void initScripts();
|
||||
void readConfiguration();
|
||||
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
||||
QMap<QString, QString> updateConfiguration(QMap<QString, QString> rawConfig);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user