mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
port dataengine to kf5
This commit is contained in:
parent
adcf6c942f
commit
3e709f549d
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8.12)
|
||||||
|
|
||||||
cmake_policy (SET CMP0003 OLD)
|
cmake_policy (SET CMP0003 OLD)
|
||||||
cmake_policy (SET CMP0002 OLD)
|
cmake_policy (SET CMP0002 OLD)
|
||||||
@ -38,5 +38,5 @@ configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ver
|
|||||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||||
|
|
||||||
add_subdirectory (ext-sysmon)
|
add_subdirectory (ext-sysmon)
|
||||||
add_subdirectory (awesome-widget)
|
#add_subdirectory (awesome-widget)
|
||||||
add_subdirectory (desktop-panel)
|
#add_subdirectory (desktop-panel)
|
||||||
|
@ -14,7 +14,7 @@ else ()
|
|||||||
find_package (Qt5 REQUIRED COMPONENTS Widgets)
|
find_package (Qt5 REQUIRED COMPONENTS Widgets)
|
||||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
find_package(KF5 REQUIRED COMPONENTS Plasma Service)
|
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||||
|
|
||||||
include (KDEInstallDirs)
|
include (KDEInstallDirs)
|
||||||
include (KDECMakeSettings)
|
include (KDECMakeSettings)
|
||||||
@ -23,10 +23,7 @@ else ()
|
|||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
${Qt5Widgets_INCLUDE_DIRS})
|
${Qt5Widgets_INCLUDE_DIRS})
|
||||||
set (KDE_INCLUDE ${ConfigCore_INCLUDE_DIR}
|
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||||
${CoreAddons_INCLUDE_DIR}
|
|
||||||
${Plasma_INCLUDE_DIR}
|
|
||||||
${Service_INCLUDE_DIR})
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
@ -58,7 +55,7 @@ else ()
|
|||||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||||
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem ${Qt5Widgets_LIBRARIES})
|
||||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "extsysmon.h"
|
#include "extsysmon.h"
|
||||||
|
|
||||||
#include <Plasma/DataContainer>
|
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
|
#include <Plasma/DataContainer>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -27,6 +27,7 @@
|
|||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include <extscript.h>
|
#include <extscript.h>
|
||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
@ -123,12 +124,27 @@ void ExtendedSysMon::initScripts()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
// create directory at $HOME
|
// create directory at $HOME and create dirs list
|
||||||
QString localDir = KStandardDirs::locateLocal("data", "plasma_engine_extsysmon/scripts");
|
QString localDir;
|
||||||
|
QStringList dirs;
|
||||||
|
#ifdef BUILD_KDE4
|
||||||
|
localDir = KStandardDirs::locateLocal("data", "plasma_engine_extsysmon/scripts");
|
||||||
if (KStandardDirs::makeDir(localDir))
|
if (KStandardDirs::makeDir(localDir))
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
dirs = KGlobal::dirs()->findDirs("data", "plasma_engine_extsysmon/scripts");
|
||||||
|
#else
|
||||||
|
localDir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) +
|
||||||
|
QString("/plasma_engine_extsysmon/scripts");
|
||||||
|
QDir localDirectory;
|
||||||
|
if (localDirectory.mkdir(localDir))
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||||
|
|
||||||
|
dirs = QStandardPaths::locateAll(QStandardPaths::DataLocation,
|
||||||
|
QString("plasma_engine_extsysmon/scripts"),
|
||||||
|
QStandardPaths::LocateDirectory);
|
||||||
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
QStringList names;
|
QStringList names;
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
for (int i=0; i<dirs.count(); i++) {
|
||||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
||||||
@ -168,42 +184,28 @@ void ExtendedSysMon::readConfiguration()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
// pre-setup
|
QString fileName;
|
||||||
QMap<QString, QString> rawConfig;
|
#ifdef BUILD_KDE4
|
||||||
rawConfig[QString("ACPIPATH")] = QString("/sys/class/power_supply/");
|
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf");
|
||||||
rawConfig[QString("GPUDEV")] = QString("auto");
|
#else
|
||||||
rawConfig[QString("HDDDEV")] = QString("all");
|
fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||||
rawConfig[QString("HDDTEMPCMD")] = QString("sudo hddtemp");
|
#endif /* BUILD_KDE4 */
|
||||||
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", "plasma-dataengine-extsysmon.conf");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QFile configFile(fileName);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
if (!configFile.open(QIODevice::ReadOnly)) {
|
QMap<QString, QString> rawConfig;
|
||||||
configuration = updateConfiguration(rawConfig);
|
|
||||||
return;
|
settings.beginGroup(QString("Configuration"));
|
||||||
}
|
rawConfig[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/")).toString();
|
||||||
QString fileStr;
|
rawConfig[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto")).toString();
|
||||||
QStringList value;
|
rawConfig[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all")).toString();
|
||||||
while (true) {
|
rawConfig[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp")).toString();
|
||||||
fileStr = QString(configFile.readLine()).trimmed();
|
rawConfig[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost")).toString();
|
||||||
if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
|
rawConfig[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600")).toString();
|
||||||
if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
|
rawConfig[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto")).toString();
|
||||||
if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
|
rawConfig[QString("PKGCMD")] = settings.value(QString("PKGCMD"), QString("pacman -Qu")).toString();
|
||||||
if (fileStr.contains(QChar('='))) {
|
rawConfig[QString("PKGNULL")] = settings.value(QString("PKGNULL"), QString("0")).toString();
|
||||||
value.clear();
|
rawConfig[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris")).toString();
|
||||||
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
settings.endGroup();
|
||||||
value.append(fileStr.split(QChar('='))[i]);
|
|
||||||
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
|
||||||
}
|
|
||||||
if (configFile.atEnd()) break;
|
|
||||||
}
|
|
||||||
configFile.close();
|
|
||||||
|
|
||||||
configuration = updateConfiguration(rawConfig);
|
configuration = updateConfiguration(rawConfig);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,11 @@
|
|||||||
ACPIPATH=/sys/class/power_supply/
|
ACPIPATH=/sys/class/power_supply/
|
||||||
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'disable' or 'auto'
|
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'disable' or 'auto'
|
||||||
GPUDEV=auto
|
GPUDEV=auto
|
||||||
# Set block device for hddtemp comma separated or use 'all' or 'disable'
|
# HDD temperature
|
||||||
|
## Set block device for hddtemp comma separated or use 'all' or 'disable'
|
||||||
HDDDEV=all
|
HDDDEV=all
|
||||||
|
# cmd
|
||||||
|
HDDTEMPCMD=sudo hddtemp
|
||||||
# mpd server settings
|
# mpd server settings
|
||||||
MPDADDRESS=localhost
|
MPDADDRESS=localhost
|
||||||
MPDPORT=6600
|
MPDPORT=6600
|
||||||
|
Loading…
Reference in New Issue
Block a user