From a53c5ec38c7ad42aa01bd99b25f331aeb66c30be Mon Sep 17 00:00:00 2001 From: arcan1s Date: Wed, 20 May 2015 00:36:48 +0300 Subject: [PATCH] drop kde4 from master --- arch/{PKGBUILD-kf5 => PKGBUILD} | 0 arch/PKGBUILD-git | 2 +- arch/PKGBUILD-kde4 | 43 - .../kdeplasma-applets-awesome-widgets.install | 11 - sources/CMakeLists.txt | 17 +- sources/awesome-widget-kde4/CMakeLists.txt | 45 - sources/awesome-widget-kde4/advanced.ui | 534 -------- sources/awesome-widget-kde4/appearance.ui | 237 ---- .../awesome-widget-kde4/awesome-widget.cpp | 503 ------- sources/awesome-widget-kde4/awesome-widget.h | 154 --- sources/awesome-widget-kde4/configuration.cpp | 1172 ----------------- sources/awesome-widget-kde4/customlabel.cpp | 97 -- sources/awesome-widget-kde4/customlabel.h | 45 - sources/awesome-widget-kde4/deconfig.ui | 440 ------- sources/awesome-widget-kde4/deinteraction.cpp | 606 --------- .../desktops/bar-template.desktop | 25 - sources/awesome-widget-kde4/graphicalitem.cpp | 523 -------- sources/awesome-widget-kde4/graphicalitem.h | 115 -- .../plasma-applet-awesomewidget.desktop | 25 - .../plasma_applet_awesome-widget.notifyrc | 14 - sources/awesome-widget-kde4/reinit.cpp | 166 --- sources/awesome-widget-kde4/tooltipconfig.ui | 295 ----- sources/awesome-widget-kde4/widget.ui | 228 ---- .../plugin/desktops/aw-bat-bar.desktop | 12 - .../plugin/desktops/aw-cpu-bar.desktop | 12 - .../plugin/desktops/aw-mem-bar.desktop | 12 - .../plugin/desktops/aw-swap-bar.desktop | 12 - .../plugin/graphicalitem.ui | 293 ----- .../CMakeLists.txt | 0 .../metadata.desktop | 0 .../package/contents/config/config.qml | 0 .../package/contents/config/main.xml | 0 .../package/contents/ui/about.qml | 0 .../package/contents/ui/advanced.qml | 0 .../package/contents/ui/appearance.qml | 0 .../package/contents/ui/dataengine.qml | 0 .../package/contents/ui/general.qml | 0 .../package/contents/ui/main.qml | 0 .../package/contents/ui/qmldir | 0 .../package/contents/ui/tooltip.qml | 0 .../package/contents/ui/widget.qml | 0 .../package/metadata.desktop | 0 .../plugin/CMakeLists.txt | 0 .../plugin/awactions.cpp | 0 .../plugin/awactions.h | 0 .../plugin/awesomewidget.cpp | 0 .../plugin/awesomewidget.h | 0 .../plugin/awkeys.cpp | 0 .../plugin/awkeys.h | 0 .../plugin/awtooltip.cpp | 0 .../plugin/awtooltip.h | 0 .../plugin}/desktops/aw-bat-bar.desktop | 0 .../plugin}/desktops/aw-cpu-bar.desktop | 0 .../plugin}/desktops/aw-mem-bar.desktop | 0 .../plugin}/desktops/aw-swap-bar.desktop | 0 .../plugin/graphicalitem.cpp | 0 .../plugin/graphicalitem.h | 0 .../plugin}/graphicalitem.ui | 0 ...let-org.kde.plasma.awesome-widget.notifyrc | 0 .../plugin/qmldir | 0 sources/desktop-panel-kde4/CMakeLists.txt | 34 - sources/desktop-panel-kde4/appearance.ui | 357 ----- sources/desktop-panel-kde4/desktop-panel.cpp | 634 --------- sources/desktop-panel-kde4/desktop-panel.h | 125 -- .../plasma-applet-desktoppanel.desktop | 25 - sources/desktop-panel-kde4/toggle.ui | 56 - sources/desktop-panel-kde4/widget.ui | 472 ------- .../CMakeLists.txt | 0 .../metadata.desktop | 0 .../package/contents/config/config.qml | 0 .../package/contents/config/main.xml | 0 .../package/contents/ui/about.qml | 0 .../package/contents/ui/activeapp.qml | 0 .../package/contents/ui/advanced.qml | 0 .../package/contents/ui/general.qml | 0 .../package/contents/ui/inactiveapp.qml | 0 .../package/contents/ui/main.qml | 0 .../package/contents/ui/qmldir | 0 .../package/contents/ui/widget.qml | 0 .../package/metadata.desktop | 0 .../plugin/CMakeLists.txt | 0 .../plugin/desktoppanel.cpp | 0 .../plugin/desktoppanel.h | 0 .../plugin/dpadds.cpp | 0 .../plugin/dpadds.h | 0 ...plet-org.kde.plasma.desktop-panel.notifyrc | 0 .../plugin/qmldir | 0 sources/extsysmon/CMakeLists.txt | 57 +- sources/extsysmon/extsysmon.cpp | 81 +- sources/translations/CMakeLists.txt | 12 +- .../awesome-widget/CMakeLists.txt | 6 +- .../translations/desktop-panel/CMakeLists.txt | 6 +- sources/version.h.in | 1 - 93 files changed, 47 insertions(+), 7457 deletions(-) rename arch/{PKGBUILD-kf5 => PKGBUILD} (100%) delete mode 100644 arch/PKGBUILD-kde4 delete mode 100644 arch/kdeplasma-applets-awesome-widgets.install delete mode 100644 sources/awesome-widget-kde4/CMakeLists.txt delete mode 100644 sources/awesome-widget-kde4/advanced.ui delete mode 100644 sources/awesome-widget-kde4/appearance.ui delete mode 100644 sources/awesome-widget-kde4/awesome-widget.cpp delete mode 100644 sources/awesome-widget-kde4/awesome-widget.h delete mode 100644 sources/awesome-widget-kde4/configuration.cpp delete mode 100644 sources/awesome-widget-kde4/customlabel.cpp delete mode 100644 sources/awesome-widget-kde4/customlabel.h delete mode 100644 sources/awesome-widget-kde4/deconfig.ui delete mode 100644 sources/awesome-widget-kde4/deinteraction.cpp delete mode 100644 sources/awesome-widget-kde4/desktops/bar-template.desktop delete mode 100644 sources/awesome-widget-kde4/graphicalitem.cpp delete mode 100644 sources/awesome-widget-kde4/graphicalitem.h delete mode 100644 sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop delete mode 100644 sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc delete mode 100644 sources/awesome-widget-kde4/reinit.cpp delete mode 100644 sources/awesome-widget-kde4/tooltipconfig.ui delete mode 100644 sources/awesome-widget-kde4/widget.ui delete mode 100644 sources/awesome-widget-kf5/plugin/desktops/aw-bat-bar.desktop delete mode 100644 sources/awesome-widget-kf5/plugin/desktops/aw-cpu-bar.desktop delete mode 100644 sources/awesome-widget-kf5/plugin/desktops/aw-mem-bar.desktop delete mode 100644 sources/awesome-widget-kf5/plugin/desktops/aw-swap-bar.desktop delete mode 100644 sources/awesome-widget-kf5/plugin/graphicalitem.ui rename sources/{awesome-widget-kf5 => awesome-widget}/CMakeLists.txt (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/metadata.desktop (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/config/config.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/config/main.xml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/about.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/advanced.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/appearance.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/dataengine.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/general.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/main.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/qmldir (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/tooltip.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/contents/ui/widget.qml (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/package/metadata.desktop (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/CMakeLists.txt (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awactions.cpp (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awactions.h (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awesomewidget.cpp (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awesomewidget.h (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awkeys.cpp (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awkeys.h (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awtooltip.cpp (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/awtooltip.h (100%) rename sources/{awesome-widget-kde4 => awesome-widget/plugin}/desktops/aw-bat-bar.desktop (100%) rename sources/{awesome-widget-kde4 => awesome-widget/plugin}/desktops/aw-cpu-bar.desktop (100%) rename sources/{awesome-widget-kde4 => awesome-widget/plugin}/desktops/aw-mem-bar.desktop (100%) rename sources/{awesome-widget-kde4 => awesome-widget/plugin}/desktops/aw-swap-bar.desktop (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/graphicalitem.cpp (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/graphicalitem.h (100%) rename sources/{awesome-widget-kde4 => awesome-widget/plugin}/graphicalitem.ui (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc (100%) rename sources/{awesome-widget-kf5 => awesome-widget}/plugin/qmldir (100%) delete mode 100644 sources/desktop-panel-kde4/CMakeLists.txt delete mode 100644 sources/desktop-panel-kde4/appearance.ui delete mode 100644 sources/desktop-panel-kde4/desktop-panel.cpp delete mode 100644 sources/desktop-panel-kde4/desktop-panel.h delete mode 100644 sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop delete mode 100644 sources/desktop-panel-kde4/toggle.ui delete mode 100644 sources/desktop-panel-kde4/widget.ui rename sources/{desktop-panel-kf5 => desktop-panel}/CMakeLists.txt (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/metadata.desktop (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/config/config.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/config/main.xml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/about.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/activeapp.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/advanced.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/general.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/inactiveapp.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/main.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/qmldir (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/contents/ui/widget.qml (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/package/metadata.desktop (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/CMakeLists.txt (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/desktoppanel.cpp (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/desktoppanel.h (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/dpadds.cpp (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/dpadds.h (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc (100%) rename sources/{desktop-panel-kf5 => desktop-panel}/plugin/qmldir (100%) diff --git a/arch/PKGBUILD-kf5 b/arch/PKGBUILD similarity index 100% rename from arch/PKGBUILD-kf5 rename to arch/PKGBUILD diff --git a/arch/PKGBUILD-git b/arch/PKGBUILD-git index ebfe9e1..0fadd1b 100644 --- a/arch/PKGBUILD-git +++ b/arch/PKGBUILD-git @@ -49,6 +49,6 @@ build () { } package() { - cd "${srcdir}/build" + cd "${srcdir}/${_pkgname}/build" make DESTDIR="${pkgdir}" install } diff --git a/arch/PKGBUILD-kde4 b/arch/PKGBUILD-kde4 deleted file mode 100644 index 64d5ad1..0000000 --- a/arch/PKGBUILD-kde4 +++ /dev/null @@ -1,43 +0,0 @@ -# Maintainer: Evgeniy Alekseev - -pkgname=kdeplasma-applets-awesome-widgets -_pkgname=awesome-widgets -pkgver=2.2.1 -pkgrel=1 -pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)" -arch=('i686' 'x86_64') -url="http://arcanis.name/projects/awesome-widgets" -license=('GPL3') -depends=('kdebase-workspace' 'lm_sensors') -optdepends=("amarok: for music player monitor" - "clementine: for music player monitor" - "catalyst: for GPU monitor" - "hddtemp: for HDD temperature monitor" - "smartmontools: for HDD temperature monitor" - "mpd: for music player monitor" - "nvidia-utils: for GPU monitor" - "qmmp: for music player monitor") -makedepends=('automoc4' 'cmake') -source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) -install=${pkgname}.install -md5sums=('74099a8150aa1992b8a168934878d928') -backup=('usr/share/config/plasma-dataengine-extsysmon.conf') - -prepare() { - rm -rf "${srcdir}/build" - mkdir "${srcdir}/build" -} - -build () { - cd "${srcdir}/build" - cmake -DBUILD_KDE4=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) \ - "../${_pkgname}" - make -} - -package() { - cd "${srcdir}/build" - make DESTDIR="${pkgdir}" install -} diff --git a/arch/kdeplasma-applets-awesome-widgets.install b/arch/kdeplasma-applets-awesome-widgets.install deleted file mode 100644 index 8a30fde..0000000 --- a/arch/kdeplasma-applets-awesome-widgets.install +++ /dev/null @@ -1,11 +0,0 @@ -post_install() { - kbuildsycoca4 > /dev/null 2>&1 -} - -post_upgrade() { - post_install "$1" -} - -post_remove() { - post_install "$1" -} diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index 6d482b5..93d3380 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -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 CMP0002 OLD) @@ -21,12 +21,6 @@ message (STATUS "Project: ${PROJECT_NAME}") message (STATUS "Version: ${PROJECT_VERSION}") message (STATUS "Build date: ${CURRENT_DATE}") -option (BUILD_KDE4 "Build on KDE4" OFF) -# update minimum cmake version -if (NOT BUILD_KDE4) - cmake_minimum_required (VERSION 2.8.12) -endif () - # flags if (CMAKE_COMPILER_IS_GNUCXX) set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11") @@ -45,13 +39,8 @@ configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ver set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) add_subdirectory (extsysmon) -if (BUILD_KDE4) - add_subdirectory (awesome-widget-kde4) - add_subdirectory (desktop-panel-kde4) -else () - add_subdirectory (awesome-widget-kf5) - add_subdirectory (desktop-panel-kf5) -endif () +add_subdirectory (awesome-widget) +add_subdirectory (desktop-panel) # translations add_subdirectory (translations) diff --git a/sources/awesome-widget-kde4/CMakeLists.txt b/sources/awesome-widget-kde4/CMakeLists.txt deleted file mode 100644 index 203841a..0000000 --- a/sources/awesome-widget-kde4/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# set project name -set (SUBPROJECT plasma_applet_awesome-widget) -set (PLUGIN_NAME ${SUBPROJECT}) -message (STATUS "Subproject ${SUBPROJECT}") - -# find required libaries -find_package (KDE4 REQUIRED) -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - -include (KDE4Defaults) -include_directories (${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/../ - ${PROJECT_TRDPARTY_DIR} - ../extsysmon - ${CMAKE_CURRENT_BINARY_DIR}/../extsysmon) - -# set sources -file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) -file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) -file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp - ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp - ../extsysmon/extscript.cpp - ../extsysmon/extupgrade.cpp) -set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h) -file (GLOB SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui) -file (GLOB SUBPROJECT_NOTIFY *.notifyrc) -set (SUBPROJECT_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops) - -# prepare -configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) - -# make -qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) -kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) -kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) -target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) - -# install -install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) -install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME}) -install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME}) diff --git a/sources/awesome-widget-kde4/advanced.ui b/sources/awesome-widget-kde4/advanced.ui deleted file mode 100644 index 1649d51..0000000 --- a/sources/awesome-widget-kde4/advanced.ui +++ /dev/null @@ -1,534 +0,0 @@ - - - AdvancedWindow - - - - 0 - 0 - 700 - 588 - - - - - 0 - 0 - - - - - 700 - 0 - - - - - 16777215 - 16777215 - - - - Advanced - - - - - - true - - - - - 0 - -250 - 675 - 822 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Enable popup on mouse click - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Enable background - - - - - - - - - - - - 0 - 0 - - - - Custom time format - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - $dddd - long weekday -$ddd - short weekday -$dd - day -$d - day w\o zero -$MMMM - long month -$MMM - short month -$MM - month -$M - month w\o zero -$yyyy - year -$yy - short year -$hh - hours (24 only) -$h - hours w\o zero (24 only) -$mm - minutes -$m - minutes w\o zero -$ss - seconds -$s - seconds w\o zero - - - - - - - - - - - - 0 - 0 - - - - Custom uptime format - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - $dd - uptime days -$d - uptime days without zero -$hh - uptime hours -$h - uptime hours without zero -$mm - uptime minutes -$m - uptime minutes without zero - - - - - - - - - - - Temperature units - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Celsius - - - - - Fahrenheit - - - - - Kelvin - - - - - Reaumur - - - - - cm^-1 - - - - - kJ/mol - - - - - kcal/mol - - - - - - - - - - - - - 200 - 0 - - - - Temperature devices - - - - - - - Editable - - - - - - - - - - - - 200 - 0 - - - - Fan devices - - - - - - - Editable - - - - - - - - - - - - 200 - 0 - - - - Mount points - - - - - - - Editable - - - - - - - - - - - - 200 - 0 - - - - HDD devices (speed) - - - - - - - Editable - - - - - - - - - - - - 200 - 0 - - - - HDD devices (temp) - - - - - - - Editable - - - - - - - - - - - Disable auto select device and set specified device - - - Qt::RightToLeft - - - Set network device - - - - - - - true - - - - - - - - - - - - 0 - 0 - - - - AC online tag - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Line, which returns when AC is online - - - - - - - - - - - - - - - 0 - 0 - - - - AC offline tag - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Line, which returns when AC is offline - - - - - - - - - - - - - - - - Bars - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add - - - - - - - - - Qt::CustomContextMenu - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Check for updates - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - diff --git a/sources/awesome-widget-kde4/appearance.ui b/sources/awesome-widget-kde4/appearance.ui deleted file mode 100644 index e602229..0000000 --- a/sources/awesome-widget-kde4/appearance.ui +++ /dev/null @@ -1,237 +0,0 @@ - - - AppearanceWindow - - - - 0 - 0 - 700 - 594 - - - - - 0 - 0 - - - - - 700 - 0 - - - - - 16777215 - 16777215 - - - - Appearance - - - - - - true - - - - - 0 - 0 - 684 - 578 - - - - - - - - - Time interval - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 1 - - - 10000 - - - 500 - - - 2000 - - - - - - - - - - - Font - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 180 - 0 - - - - - - - - - - - - Font size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 1 - - - 99 - - - 1 - - - 12 - - - - - - - - - - - Font color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Font style - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - normal - - - - - italic - - - - - - - - - - - - Font weight - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 100 - - - 900 - - - 100 - - - 400 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - KColorCombo - QComboBox -
kcolorcombo.h
-
-
- - -
diff --git a/sources/awesome-widget-kde4/awesome-widget.cpp b/sources/awesome-widget-kde4/awesome-widget.cpp deleted file mode 100644 index 0d908e3..0000000 --- a/sources/awesome-widget-kde4/awesome-widget.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "awesome-widget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "customlabel.h" -#include "graphicalitem.h" -#include -#include -#include "version.h" - - -AwesomeWidget::AwesomeWidget(QObject *parent, const QVariantList &args) - : Plasma::Applet(parent, args) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - if (debugEnv == QString("yes")) - debug = true; - else - debug = false; - - setBackgroundHints(DefaultBackground); - setAspectRatioMode(Plasma::IgnoreAspectRatio); - setHasConfigurationInterface(true); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - // text format init - formatLine.append(QString("")); - formatLine.append(QString("")); -} - - -AwesomeWidget::~AwesomeWidget() -{ - if (debug) qDebug() << PDEBUG; -} - - -void AwesomeWidget::checkUpdates() -{ - if (debug) qDebug() << PDEBUG; - - QNetworkAccessManager *manager = new QNetworkAccessManager(this); - connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyRecieved(QNetworkReply *))); - manager->get(QNetworkRequest(QUrl(VERSION_API))); -} - - -QList AwesomeWidget::contextualActions() -{ - if (debug) qDebug() << PDEBUG; - - return contextMenu; -} - - -void AwesomeWidget::createActions() -{ - if (debug) qDebug() << PDEBUG; - - contextMenu.clear(); - contextMenu.append(new QAction(QIcon::fromTheme(QString("utilities-system-monitor")), - i18n("Run ksysguard"), this)); - connect(contextMenu[0], SIGNAL(triggered(bool)), this, SLOT(showKsysguard())); - contextMenu.append(new QAction(QIcon::fromTheme(QString("text-x-readme")), - i18n("Show README"), this)); - connect(contextMenu[1], SIGNAL(triggered(bool)), this, SLOT(showReadme())); - contextMenu.append(new QAction(QIcon::fromTheme(QString("stock-refresh")), - i18n("Update text"), this)); - connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice())); - connect(contextMenu[2], SIGNAL(triggered(bool)), extsysmonEngine, SLOT(updateAllSources())); - connect(contextMenu[2], SIGNAL(triggered(bool)), sysmonEngine, SLOT(updateAllSources())); - contextMenu.append(new QAction(QIcon::fromTheme(QString("system-software-update")), - i18n("Check for updates"), this)); - connect(contextMenu[3], SIGNAL(triggered(bool)), this, SLOT(checkUpdates())); -} - - -QString AwesomeWidget::getNetworkDevice() -{ - if (debug) qDebug() << PDEBUG; - - QString device = QString("lo"); - if (configuration[QString("useCustomNetdev")].toInt() == 2) - device = configuration[QString("customNetdev")]; - else { - QList rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; itoUnicode(process.output).trimmed().toInt(); -} - - -float AwesomeWidget::getTemp(const float temp) -{ - if (debug) qDebug() << PDEBUG; - - float convertedTemp = temp; - if (configuration[QString("tempUnits")] == QString("Celsius")) - ; - else if (configuration[QString("tempUnits")] == QString("Fahrenheit")) - convertedTemp = temp * 9.0 / 5.0 + 32.0; - else if (configuration[QString("tempUnits")] == QString("Kelvin")) - convertedTemp = temp + 273.15; - else if (configuration[QString("tempUnits")] == QString("Reaumur")) - convertedTemp = temp * 0.8; - else if (configuration[QString("tempUnits")] == QString("cm^-1")) - convertedTemp = (temp + 273.15) * 0.695; - else if (configuration[QString("tempUnits")] == QString("kJ/mol")) - convertedTemp = (temp + 273.15) * 8.31; - else if (configuration[QString("tempUnits")] == QString("kcal/mol")) - convertedTemp = (temp + 273.15) * 1.98; - - return convertedTemp; -} - - -QStringList AwesomeWidget::getTimeKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList timeKeys; - timeKeys.append(QString("dddd")); - timeKeys.append(QString("ddd")); - timeKeys.append(QString("dd")); - timeKeys.append(QString("d")); - timeKeys.append(QString("MMMM")); - timeKeys.append(QString("MMM")); - timeKeys.append(QString("MM")); - timeKeys.append(QString("M")); - timeKeys.append(QString("yyyy")); - timeKeys.append(QString("yy")); - timeKeys.append(QString("hh")); - timeKeys.append(QString("h")); - timeKeys.append(QString("mm")); - timeKeys.append(QString("m")); - timeKeys.append(QString("ss")); - timeKeys.append(QString("s")); - - return timeKeys; -} - - -void AwesomeWidget::init() -{ - if (debug) qDebug() << PDEBUG; - - // dataengines - extsysmonEngine = dataEngine(QString("extsysmon")); - sysmonEngine = dataEngine(QString("systemmonitor")); - connect(sysmonEngine, SIGNAL(sourceAdded(QString)), this, SLOT(addDiskDevice(QString))); - timeEngine = dataEngine(QString("time")); - - // tooltip - toolTip = Plasma::ToolTipContent(); - toolTip.setMainText(QString("Awesome Widget")); - toolTip.setSubText(QString("")); - toolTipScene = new QGraphicsScene(); - toolTipView = new QGraphicsView(toolTipScene); - toolTipView->setStyleSheet(QString("background: transparent")); - toolTipView->setContentsMargins(0, 0, 0, 0); - toolTipView->setFrameShape(QFrame::NoFrame); - toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - Plasma::ToolTipManager::self()->setContent(this, toolTip); - - // body - createActions(); - mainLayout = new QGraphicsGridLayout(); - mainLayout->setContentsMargins(1, 1, 1, 1); - setLayout(mainLayout); - textLabel = new CustomLabel(this, debug); - textLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this); - pw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - textLabel->setAttribute(Qt::WA_TranslucentBackground, true); - pw->setWidget(textLabel); - mainLayout->addItem(pw, 0, 0); - - // read variables - configChanged(); - timer = new QTimer(this); - timer->setSingleShot(false); - timer->setInterval(configuration[QString("interval")].toInt()); - connect(timer, SIGNAL(timeout()), this, SLOT(updateText())); - connect(timer, SIGNAL(timeout()), this, SLOT(updateTooltip())); - timer->start(); - // check for updates - connect(this, SIGNAL(thereIsUpdates(QString)), this, SLOT(showUpdates(QString))); - if (configuration[QString("checkUpdates")].toInt() == 2) - checkUpdates(); -} - - -void AwesomeWidget::replyRecieved(QNetworkReply *reply) -{ - if (debug) qDebug() << PDEBUG; - - QString answer = reply->readAll(); - if (!answer.contains(QString("tag_name"))) return; - QString version = QString(VERSION); - if (debug) qDebug() << PDEBUG << answer; - for (int i=0; i -1) { - QStringList splitSource = source.split(QChar('/')); - QString device = splitSource[0] + QString("/") + splitSource[1]; - diskDevices.append(device); - } -} - - -QStringList AwesomeWidget::findKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList selectedKeys; - for (int i=0; i=0; i--) - allKeys.append(QString("cpucl") + QString::number(i)); - allKeys.append(QString("cpucl")); - // cpu - for (int i=counts[QString("cpu")]-1; i>=0; i--) - allKeys.append(QString("cpu") + QString::number(i)); - allKeys.append(QString("cpu")); - // temperature - for (int i=counts[QString("temp")]-1; i>=0; i--) - allKeys.append(QString("temp") + QString::number(i)); - for (int i=counts[QString("fan")]-1; i>=0; i--) - allKeys.append(QString("fan") + QString::number(i)); - // gputemp - allKeys.append(QString("gputemp")); - // gpu - allKeys.append(QString("gpu")); - // memory - allKeys.append(QString("memmb")); - allKeys.append(QString("memgb")); - allKeys.append(QString("memfreemb")); - allKeys.append(QString("memfreegb")); - allKeys.append(QString("memtotmb")); - allKeys.append(QString("memtotgb")); - allKeys.append(QString("memusedmb")); - allKeys.append(QString("memusedgb")); - allKeys.append(QString("mem")); - // swap - allKeys.append(QString("swapmb")); - allKeys.append(QString("swapgb")); - allKeys.append(QString("swapfreemb")); - allKeys.append(QString("swapfreegb")); - allKeys.append(QString("swaptotmb")); - allKeys.append(QString("swaptotgb")); - allKeys.append(QString("swap")); - // hdd - for (int i=counts[QString("mount")]-1; i>=0; i--) { - allKeys.append(QString("hddmb") + QString::number(i)); - allKeys.append(QString("hddgb") + QString::number(i)); - allKeys.append(QString("hddfreemb") + QString::number(i)); - allKeys.append(QString("hddfreegb") + QString::number(i)); - allKeys.append(QString("hddtotmb") + QString::number(i)); - allKeys.append(QString("hddtotgb") + QString::number(i)); - allKeys.append(QString("hdd") + QString::number(i)); - } - // hdd speed - for (int i=counts[QString("disk")]-1; i>=0; i--) { - allKeys.append(QString("hddr") + QString::number(i)); - allKeys.append(QString("hddw") + QString::number(i)); - } - // hdd temp - for (int i=counts[QString("hddtemp")]-1; i>=0; i--) { - allKeys.append(QString("hddtemp") + QString::number(i)); - allKeys.append(QString("hddtemp") + QString::number(i)); - } - // network - allKeys.append(QString("down")); - allKeys.append(QString("up")); - allKeys.append(QString("netdev")); - // battery - allKeys.append(QString("ac")); - for (int i=counts[QString("bat")]-1; i>=0; i--) - allKeys.append(QString("bat") + QString::number(i)); - allKeys.append(QString("bat")); - // player - allKeys.append(QString("album")); - allKeys.append(QString("artist")); - allKeys.append(QString("duration")); - allKeys.append(QString("progress")); - allKeys.append(QString("title")); - // ps - allKeys.append(QString("pscount")); - allKeys.append(QString("pstotal")); - allKeys.append(QString("ps")); - // package manager - for (int i=counts[QString("pkg")]-1; i>=0; i--) - allKeys.append(QString("pkgcount") + QString::number(i)); - // custom - for (int i=counts[QString("custom")]-1; i>=0; i--) - allKeys.append(QString("custom") + QString::number(i)); - // desktop - allKeys.append(QString("desktop")); - allKeys.append(QString("ndesktop")); - allKeys.append(QString("tdesktops")); - - return allKeys; -} - - -QStringList AwesomeWidget::findGraphicalItems() -{ - if (debug) qDebug() << PDEBUG; - - QStringList orderedKeys; - for (int i=0; iname() + graphicalItems[i]->bar()); - orderedKeys.sort(); - QStringList selectedKeys; - for (int i=orderedKeys.count()-1; i>=0; i--) - if (configuration[QString("text")].contains(QString("$") + orderedKeys[i])) { - if (debug) qDebug() << PDEBUG << ":" << "Found key" << orderedKeys[i]; - selectedKeys.append(orderedKeys[i]); - } - - return selectedKeys; -} - - -void AwesomeWidget::getGraphicalItems() -{ - if (debug) qDebug() << PDEBUG; - - graphicalItems.clear(); - // create directory at $HOME - QString localDir = KStandardDirs::locateLocal("data", "plasma_applet_awesome-widget/desktops"); - if (KStandardDirs::makeDir(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops"); - QStringList names; - for (int i=0; iname() + graphicalItems[i]->bar()) != tag) continue; - item = graphicalItems[i]; - break; - } - - return item; -} - - -void AwesomeWidget::showKsysguard() -{ - if (debug) qDebug() << PDEBUG; - - QString cmd = QString("ksysguard"); - 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; -} - - -void AwesomeWidget::showReadme() -{ - if (debug) qDebug() << PDEBUG; - - QDesktopServices::openUrl(QString("http://arcanis.name/projects/awesome-widgets/")); -} - - -void AwesomeWidget::showUpdates(QString version) -{ - if (debug) qDebug() << PDEBUG; - - QString text; - text += i18n("Current version : %1", QString(VERSION)) + QString("\n"); - text += i18n("New version : %1", version) + QString("\n\n"); - text += i18n("Click \"Ok\" to download"); - int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel); - switch (select) { - case QMessageBox::Ok: - QDesktopServices::openUrl(QString(RELEASES) + version); - break; - } -} - - -K_EXPORT_PLASMA_APPLET(awesome-widget, AwesomeWidget) diff --git a/sources/awesome-widget-kde4/awesome-widget.h b/sources/awesome-widget-kde4/awesome-widget.h deleted file mode 100644 index 57d69ae..0000000 --- a/sources/awesome-widget-kde4/awesome-widget.h +++ /dev/null @@ -1,154 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - - -#ifndef AWESOME_WIDGET_H -#define AWESOME_WIDGET_H - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -class CustomLabel; -class ExtScript; -class ExtUpgrade; -class GraphicalItem; -class QGraphicsGridLayout; -class QGraphicsScene; -class QNetworkReply; - -class AwesomeWidget : public Plasma::Applet -{ - Q_OBJECT - -public: - AwesomeWidget(QObject *parent, const QVariantList &args); - ~AwesomeWidget(); - QString getNetworkDevice(); - int getNumberCpus(); - float getTemp(const float temp); - QStringList getTimeKeys(); - void init(); - // de configuration - QMap readDataEngineConfiguration(); - void writeDataEngineConfiguration(const QMap settings); - -public slots: - // contextual actions - void showKsysguard(); - void showReadme(); - void showUpdates(QString version); - // dataengine - void addDiskDevice(const QString source); - void connectToEngine(); - void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); - void disconnectFromEngine(); - // configuration interface - void configAccepted(); - void configChanged(); - // update events - void sendNotification(const QString eventId, const QString message); - void updateNetworkDevice(const bool delay = true); - void updateText(const bool clear = false); - void updateTooltip(); - -private slots: - void checkUpdates(); - void reinit(); - void replyRecieved(QNetworkReply *reply); - // configuration interface - void addBar(); - void addCustomScript(); - void addPkgCommand(); - void contextMenuBars(const QPoint pos); - void contextMenuCustomCommand(const QPoint pos); - void contextMenuPkgCommand(const QPoint pos); - void copyBar(const QString original); - void copyCustomCommand(const QString original); - void copyPkgCommand(const QString original); - void editBar(QListWidgetItem *item); - void editCustomCommand(QListWidgetItem *item); - void editPkgCommand(QListWidgetItem *item); - void editFanItem(QListWidgetItem *item); - void editHddItem(QListWidgetItem *item); - void editHddSpeedItem(QListWidgetItem *item); - void editMountItem(QListWidgetItem *item); - void editTempItem(QListWidgetItem *item); - void setFontFormating(); - void setFormating(); - -signals: - void thereIsUpdates(QString version); - -protected: - QList contextualActions(); - void createConfigurationInterface(KConfigDialog *parent); - -private: - // functions - void createActions(); - QStringList findKeys(); - QStringList getKeys(); - QStringList findGraphicalItems(); - void getGraphicalItems(); - GraphicalItem *getItemByTag(const QString tag); - QList initScripts(); - QList initUpgrades(); - // ui - QGraphicsGridLayout *mainLayout = nullptr; - CustomLabel *textLabel = nullptr; - QTimer *timer = nullptr; - QList contextMenu; - // tooltip - Plasma::ToolTipContent toolTip; - QGraphicsScene *toolTipScene = nullptr; - QGraphicsView *toolTipView = nullptr; - // values - int networkDeviceUpdate = 0; - QMap counts; - QMap> tooltipValues; - QMap values; - // debug - bool debug; - // data engine - Plasma::DataEngine *extsysmonEngine = nullptr; - Plasma::DataEngine *sysmonEngine = nullptr; - Plasma::DataEngine *timeEngine = nullptr; - // configuration interface - Ui::About uiAboutConfig; - Ui::AdvancedWindow uiAdvancedConfig; - Ui::AppearanceWindow uiAppConfig; - Ui::ConfigWindow uiWidConfig; - Ui::DEWindow uiDEConfig; - Ui::TooltipWindow uiTooltipConfig; - // configuration - QMap configuration; - QStringList diskDevices, keys, formatLine, foundKeys; - QList graphicalItems; - QStringList foundBars; -}; - - -#endif /* AWESOME_WIDGET_H */ diff --git a/sources/awesome-widget-kde4/configuration.cpp b/sources/awesome-widget-kde4/configuration.cpp deleted file mode 100644 index b7646da..0000000 --- a/sources/awesome-widget-kde4/configuration.cpp +++ /dev/null @@ -1,1172 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "awesome-widget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "version.h" - - -QMap AwesomeWidget::readDataEngineConfiguration() -{ - if (debug) qDebug() << PDEBUG; - - QMap rawConfig; - rawConfig[QString("ACPIPATH")] = QString("/sys/class/power_supply/"); - 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("PLAYER")] = QString("mpris"); - - QString fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf"); - if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; - QFile configFile(fileName); - if (!configFile.open(QIODevice::ReadOnly)) - return rawConfig; - QString fileStr; - QStringList value; - while (true) { - fileStr = QString(configFile.readLine()).trimmed(); - if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue; - if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue; - if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue; - if (fileStr.contains(QChar('='))) { - value.clear(); - for (int i=1; i settings) -{ - if (debug) qDebug() << PDEBUG; - - QMap config = settings; - QString fileName = KGlobal::dirs()->locateLocal("config", "plasma-dataengine-extsysmon.conf"); - if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; - QFile configFile(fileName); - if (!configFile.open(QIODevice::WriteOnly)) return; - for (int i=0; isetPlainText(configuration[QString("text")]); - uiWidConfig.comboBox_tags->clear(); - uiWidConfig.comboBox_tags->addItems(getKeys()); - for (int i=0; iaddItem(graphicalItems[i]->name() + graphicalItems[i]->bar()); - - // advanced - if (configuration[QString("background")].toInt() == 0) - uiAdvancedConfig.checkBox_background->setCheckState(Qt::Unchecked); - else - uiAdvancedConfig.checkBox_background->setCheckState(Qt::Checked); - if (configuration[QString("popup")].toInt() == 0) - uiAdvancedConfig.checkBox_popup->setCheckState(Qt::Unchecked); - else - uiAdvancedConfig.checkBox_popup->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).trimmed(); - uiAdvancedConfig.listWidget_tempDevice->clear(); - for (int i=0; isetCheckState(Qt::Unchecked); - uiAdvancedConfig.listWidget_tempDevice->addItem(item); - } else if (device.contains(QString("RPM"))) { - QListWidgetItem *item = new QListWidgetItem(QString("lmsensors/") + sensor.split(QChar('\n'))[0] + QString("/") + - device.split(QChar(':'))[0].replace(QChar(' '), QChar('_'))); - item->setCheckState(Qt::Unchecked); - uiAdvancedConfig.listWidget_fanDevice->addItem(item); - } - } - } - for (int i=0; i items = uiAdvancedConfig.listWidget_tempDevice - ->findItems(configuration[QString("tempDevice")].split(QString("@@"))[i], Qt::MatchFixedString); - if ((items.isEmpty()) && - (!configuration[QString("tempDevice")].split(QString("@@"))[i].isEmpty())) { - QListWidgetItem *item = new QListWidgetItem(configuration[QString("tempDevice")].split(QString("@@"))[i]); - item->setCheckState(Qt::Checked); - uiAdvancedConfig.listWidget_tempDevice->addItem(item); - } else - for (int j=0; jsetCheckState(Qt::Checked); - } - for (int i=0; i items = uiAdvancedConfig.listWidget_fanDevice - ->findItems(configuration[QString("fanDevice")].split(QString("@@"))[i], Qt::MatchFixedString); - if ((items.isEmpty()) && - (!configuration[QString("fanDevice")].split(QString("@@"))[i].isEmpty())) { - QListWidgetItem *item = new QListWidgetItem(configuration[QString("fanDevice")].split(QString("@@"))[i]); - item->setCheckState(Qt::Checked); - uiAdvancedConfig.listWidget_fanDevice->addItem(item); - } else - for (int j=0; jsetCheckState(Qt::Checked); - } - cmd = QString("mount"); - if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; - process = runTask(cmd); - if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; - if (process.exitCode != 0) - if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed(); - uiAdvancedConfig.listWidget_mount->clear(); - for (int i=0; isetCheckState(Qt::Unchecked); - uiAdvancedConfig.listWidget_mount->addItem(item); - } - for (int i=0; i items = uiAdvancedConfig.listWidget_mount - ->findItems(configuration[QString("mount")].split(QString("@@"))[i], Qt::MatchFixedString); - if ((items.isEmpty()) && - (!configuration[QString("mount")].split(QString("@@"))[i].isEmpty())) { - QListWidgetItem *item = new QListWidgetItem(configuration[QString("mount")].split(QString("@@"))[i]); - item->setCheckState(Qt::Checked); - uiAdvancedConfig.listWidget_mount->addItem(item); - } else - for (int j=0; jsetCheckState(Qt::Checked); - } - uiAdvancedConfig.listWidget_hddSpeedDevice->clear(); - for (int i=0; isetCheckState(Qt::Unchecked); - uiAdvancedConfig.listWidget_hddSpeedDevice->addItem(item); - } - for (int i=0; i items = uiAdvancedConfig.listWidget_hddSpeedDevice - ->findItems(configuration[QString("disk")].split(QString("@@"))[i], Qt::MatchFixedString); - if ((items.isEmpty()) && - (!configuration[QString("disk")].split(QString("@@"))[i].isEmpty())) { - QListWidgetItem *item = new QListWidgetItem(configuration[QString("disk")].split(QString("@@"))[i]); - item->setCheckState(Qt::Checked); - uiAdvancedConfig.listWidget_hddSpeedDevice->addItem(item); - } else - for (int j=0; jsetCheckState(Qt::Checked); - } - 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).trimmed(); - uiAdvancedConfig.listWidget_hddDevice->clear(); - for (int i=0; isetCheckState(Qt::Unchecked); - uiAdvancedConfig.listWidget_hddDevice->addItem(item); - } - for (int i=0; i items = uiAdvancedConfig.listWidget_hddDevice - ->findItems(configuration[QString("hdd")].split(QString("@@"))[i], Qt::MatchFixedString); - if ((items.isEmpty()) && - (!configuration[QString("hdd")].split(QString("@@"))[i].isEmpty())) { - QListWidgetItem *item = new QListWidgetItem(configuration[QString("hdd")].split(QString("@@"))[i]); - item->setCheckState(Qt::Checked); - uiAdvancedConfig.listWidget_hddDevice->addItem(item); - } else - for (int j=0; jsetCheckState(Qt::Checked); - } - if (configuration[QString("useCustomNetdev")].toInt() == 0) - uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Unchecked); - else - uiAdvancedConfig.checkBox_netdev->setCheckState(Qt::Checked); - QList rawInterfaceList = QNetworkInterface::allInterfaces(); - QStringList interfaceList; - for (int i=0; iclear(); - uiAdvancedConfig.comboBox_netdev->addItems(interfaceList); - uiAdvancedConfig.comboBox_netdev->setCurrentIndex( - uiAdvancedConfig.comboBox_netdev->findText(configuration[QString("customNetdev")], - Qt::MatchFixedString)); - uiAdvancedConfig.lineEdit_acOnline->setText(configuration[QString("acOnline")]); - uiAdvancedConfig.lineEdit_acOffline->setText(configuration[QString("acOffline")]); - uiAdvancedConfig.listWidget_bars->clear(); - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Tag: %1", graphicalItems[i]->name() + graphicalItems[i]->bar())); - tooltip.append(i18n("Comment: %1", graphicalItems[i]->comment())); - item->setToolTip(tooltip.join(QChar('\n'))); - uiAdvancedConfig.listWidget_bars->addItem(item); - } - if (configuration[QString("checkUpdates")].toInt() == 0) - uiAdvancedConfig.checkBox_updates->setCheckState(Qt::Unchecked); - else - uiAdvancedConfig.checkBox_updates->setCheckState(Qt::Checked); - - // tooltip - uiTooltipConfig.spinBox_tooltipNum->setValue(configuration[QString("tooltipNumber")].toInt()); - if (configuration[QString("useTooltipBackground")].toInt() == 0) - uiTooltipConfig.checkBox_background->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_background->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_background->setColor(QColor(configuration[QString("tooltipBackground")])); - if (configuration[QString("cpuTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_cpu->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_cpu->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_cpu->setColor(QColor(configuration[QString("cpuColor")])); - if (configuration[QString("cpuclTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_cpuclock->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_cpuclock->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_cpuclock->setColor(QColor(configuration[QString("cpuclColor")])); - if (configuration[QString("memTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_mem->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_mem->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_mem->setColor(QColor(configuration[QString("memColor")])); - if (configuration[QString("swapTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_swap->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_swap->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_swap->setColor(QColor(configuration[QString("swapColor")])); - if (configuration[QString("downTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_down->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_down->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_down->setColor(QColor(configuration[QString("downColor")])); - uiTooltipConfig.kcolorcombo_up->setColor(QColor(configuration[QString("upColor")])); - if (configuration[QString("batteryTooltip")].toInt() == 0) - uiTooltipConfig.checkBox_battery->setCheckState(Qt::Unchecked); - else - uiTooltipConfig.checkBox_battery->setCheckState(Qt::Checked); - uiTooltipConfig.kcolorcombo_battery->setColor(QColor(configuration[QString("batteryColor")])); - uiTooltipConfig.kcolorcombo_batteryIn->setColor(QColor(configuration[QString("batteryInColor")])); - - // appearance - KConfigGroup cg = config(); - CFont font = CFont(cg.readEntry("fontFamily", "Terminus")); - font.setPointSize(cg.readEntry("fontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000"))); - font.setHtmlWeight(cg.readEntry("fontWeight", 400)); - font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic")); - uiAppConfig.spinBox_interval->setValue(configuration[QString("interval")].toInt()); - uiAppConfig.fontComboBox->setCurrentFont(font.toQFont()); - uiAppConfig.spinBox_size->setValue(font.pointSize()); - uiAppConfig.kcolorcombo->setColor(font.color()); - if (font.italic()) - uiAppConfig.comboBox_style->setCurrentIndex(1); - else - uiAppConfig.comboBox_style->setCurrentIndex(0); - uiAppConfig.spinBox_weight->setValue(font.htmlWeight()); - - // dataengine - QMap deSettings = readDataEngineConfiguration(); - uiDEConfig.lineEdit_acpi->setText(deSettings[QString("ACPIPATH")]); - QList externalScripts = initScripts(); - uiDEConfig.listWidget_custom->clear(); - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", externalScripts[i]->name())); - tooltip.append(i18n("Comment: %1", externalScripts[i]->comment())); - tooltip.append(i18n("Exec: %1", externalScripts[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_custom->addItem(item); - } - externalScripts.clear(); - 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).trimmed(); - uiDEConfig.comboBox_hdddev->clear(); - uiDEConfig.comboBox_hdddev->addItem(QString("all")); - uiDEConfig.comboBox_hdddev->addItem(QString("disable")); - for (int i=0; iaddItem(qoutput.split(QChar('\n'))[i]); - uiDEConfig.comboBox_hdddev->setCurrentIndex( - uiDEConfig.comboBox_hdddev->findText(deSettings[QString("HDDDEV")], Qt::MatchFixedString)); - uiDEConfig.lineEdit_hddtempCmd->setText(deSettings[QString("HDDTEMPCMD")]); - uiDEConfig.lineEdit_mpdaddress->setText(deSettings[QString("MPDADDRESS")]); - uiDEConfig.spinBox_mpdport->setValue(deSettings[QString("MPDPORT")].toInt()); - uiDEConfig.comboBox_mpris->addItem(deSettings[QString("MPRIS")]); - uiDEConfig.comboBox_mpris->setCurrentIndex(uiDEConfig.comboBox_mpris->count() - 1); - QList externalUpgrade = initUpgrades(); - uiDEConfig.listWidget_pkgCommand->clear(); - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", externalUpgrade[i]->name())); - tooltip.append(i18n("Comment: %1", externalUpgrade[i]->comment())); - tooltip.append(i18n("Exec: %1", externalUpgrade[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_pkgCommand->addItem(item); - } - externalUpgrade.clear(); - uiDEConfig.comboBox_playerSelect->setCurrentIndex( - uiDEConfig.comboBox_playerSelect->findText(deSettings[QString("PLAYER")], Qt::MatchFixedString)); - - // about - uiAboutConfig.label_name->setText(QString(NAME)); - uiAboutConfig.label_version->setText(i18n("Version %1\n(build date %2)", QString(VERSION), QString(BUILD_DATE))); - uiAboutConfig.label_description->setText(i18n("A set of minimalistic plasmoid widgets")); - uiAboutConfig.label_links->setText(i18n("Links:") + QString("
") + - QString("%2
").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) + - QString("%2
").arg(QString(REPOSITORY)).arg(i18n("Repository")) + - QString("%2
").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) + - QString("%2
").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) + - QString("%2").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages"))); - uiAboutConfig.label_license->setText(QString("© %1 %3
").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + - i18n("This software is licensed under %1", QString(LICENSE)) + QString("
")); - // 2nd tab - QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts); - for (int i=0; i%1 (%2 license)") - .arg(trdPartyList[i].split(QChar(','))[0]) - .arg(trdPartyList[i].split(QChar(','))[1]) - .arg(trdPartyList[i].split(QChar(','))[2]); - uiAboutConfig.label_translators->setText(i18n("Translators: %1", QString(TRANSLATORS))); - uiAboutConfig.label_trdparty->setText(i18n("This software uses: %1", trdPartyList.join(QString(", ")))); - - 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")); - parent->addPage(aboutWidget, i18n("About"), QString("help-about")); - - connect(uiAdvancedConfig.listWidget_fanDevice, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editFanItem(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_hddDevice, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editHddItem(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_hddSpeedDevice, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editHddSpeedItem(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_mount, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editMountItem(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_tempDevice, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editTempItem(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_bars, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editBar(QListWidgetItem *))); - connect(uiAdvancedConfig.listWidget_bars, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(contextMenuBars(QPoint))); - connect(uiDEConfig.listWidget_custom, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editCustomCommand(QListWidgetItem *))); - connect(uiDEConfig.listWidget_custom, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(contextMenuCustomCommand(QPoint))); - connect(uiDEConfig.listWidget_pkgCommand, SIGNAL(itemActivated(QListWidgetItem *)), - this, SLOT(editPkgCommand(QListWidgetItem *))); - connect(uiDEConfig.listWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(contextMenuPkgCommand(QPoint))); - connect(uiAdvancedConfig.pushButton_bars, SIGNAL(clicked(bool)), this, SLOT(addBar())); - connect(uiDEConfig.pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustomScript())); - connect(uiDEConfig.pushButton_pkgCommand, SIGNAL(clicked(bool)), this, SLOT(addPkgCommand())); - connect(uiWidConfig.pushButton_tags, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_br, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_font, SIGNAL(clicked(bool)), this, SLOT(setFontFormating())); - connect(uiWidConfig.pushButton_bold, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_italic, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_underline, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_strike, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_left, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_center, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_right, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_fill, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); -} - - -void AwesomeWidget::configAccepted() -{ - if (debug) qDebug() << PDEBUG; - QStringList items; - - disconnectFromEngine(); - KConfigGroup cg = config(); - - // widget - cg.writeEntry("text", uiWidConfig.textEdit_elements->toPlainText()); - - // advanced - cg.writeEntry("background", QString::number(uiAdvancedConfig.checkBox_background->checkState())); - cg.writeEntry("popup", QString::number(uiAdvancedConfig.checkBox_popup->checkState())); - cg.writeEntry("customTime", uiAdvancedConfig.lineEdit_timeFormat->text()); - cg.writeEntry("customUptime", uiAdvancedConfig.lineEdit_uptimeFormat->text()); - cg.writeEntry("tempUnits", uiAdvancedConfig.comboBox_tempUnits->currentText()); - items.clear(); - for (int i=0; icount(); i++) - if (uiAdvancedConfig.listWidget_tempDevice->item(i)->checkState() == Qt::Checked) - items.append(uiAdvancedConfig.listWidget_tempDevice->item(i)->text()); - cg.writeEntry("tempDevice", items.join(QString("@@"))); - items.clear(); - for (int i=0; icount(); i++) - if (uiAdvancedConfig.listWidget_fanDevice->item(i)->checkState() == Qt::Checked) - items.append(uiAdvancedConfig.listWidget_fanDevice->item(i)->text()); - cg.writeEntry("fanDevice", items.join(QString("@@"))); - items.clear(); - for (int i=0; icount(); i++) - if (uiAdvancedConfig.listWidget_mount->item(i)->checkState() == Qt::Checked) - items.append(uiAdvancedConfig.listWidget_mount->item(i)->text()); - cg.writeEntry("mount", items.join(QString("@@"))); - items.clear(); - for (int i=0; icount(); i++) - if (uiAdvancedConfig.listWidget_hddDevice->item(i)->checkState() == Qt::Checked) - items.append(uiAdvancedConfig.listWidget_hddDevice->item(i)->text()); - cg.writeEntry("hdd", items.join(QString("@@"))); - items.clear(); - for (int i=0; icount(); i++) - if (uiAdvancedConfig.listWidget_hddSpeedDevice->item(i)->checkState() == Qt::Checked) - items.append(uiAdvancedConfig.listWidget_hddSpeedDevice->item(i)->text()); - cg.writeEntry("disk", items.join(QString("@@"))); - cg.writeEntry("useCustomNetdev", QString::number(uiAdvancedConfig.checkBox_netdev->checkState())); - cg.writeEntry("customNetdev", uiAdvancedConfig.comboBox_netdev->currentText()); - cg.writeEntry("acOnline", uiAdvancedConfig.lineEdit_acOnline->text()); - cg.writeEntry("acOffline", uiAdvancedConfig.lineEdit_acOffline->text()); - cg.writeEntry("checkUpdates", QString::number(uiAdvancedConfig.checkBox_updates->checkState())); - - // tooltip - cg.writeEntry("tooltipNumber", QString::number(uiTooltipConfig.spinBox_tooltipNum->value())); - cg.writeEntry("useTooltipBackground", QString::number(uiTooltipConfig.checkBox_background->checkState())); - cg.writeEntry("tooltipBackground", uiTooltipConfig.kcolorcombo_background->color().name()); - cg.writeEntry("cpuTooltip", QString::number(uiTooltipConfig.checkBox_cpu->checkState())); - cg.writeEntry("cpuColor", uiTooltipConfig.kcolorcombo_cpu->color().name()); - cg.writeEntry("cpuclTooltip", QString::number(uiTooltipConfig.checkBox_cpuclock->checkState())); - cg.writeEntry("cpuclColor", uiTooltipConfig.kcolorcombo_cpuclock->color().name()); - cg.writeEntry("memTooltip", QString::number(uiTooltipConfig.checkBox_mem->checkState())); - cg.writeEntry("memColor", uiTooltipConfig.kcolorcombo_mem->color().name()); - cg.writeEntry("swapTooltip", QString::number(uiTooltipConfig.checkBox_swap->checkState())); - cg.writeEntry("swapColor", uiTooltipConfig.kcolorcombo_swap->color().name()); - cg.writeEntry("downTooltip", QString::number(uiTooltipConfig.checkBox_down->checkState())); - cg.writeEntry("downColor", uiTooltipConfig.kcolorcombo_down->color().name()); - cg.writeEntry("upColor", uiTooltipConfig.kcolorcombo_up->color().name()); - cg.writeEntry("batteryTooltip", QString::number(uiTooltipConfig.checkBox_battery->checkState())); - cg.writeEntry("batteryColor", uiTooltipConfig.kcolorcombo_battery->color().name()); - cg.writeEntry("batteryInColor", uiTooltipConfig.kcolorcombo_batteryIn->color().name()); - - // appearance - cg.writeEntry("interval", QString::number(uiAppConfig.spinBox_interval->value())); - cg.writeEntry("fontFamily", uiAppConfig.fontComboBox->currentFont().family()); - cg.writeEntry("fontSize", QString::number(uiAppConfig.spinBox_size->value())); - cg.writeEntry("fontColor", uiAppConfig.kcolorcombo->color().name()); - cg.writeEntry("fontStyle", uiAppConfig.comboBox_style->currentText()); - cg.writeEntry("fontWeight", QString::number(uiAppConfig.spinBox_weight->value())); - - // dataengine - QMap deSettings; - deSettings[QString("ACPIPATH")] = uiDEConfig.lineEdit_acpi->text(); - deSettings[QString("GPUDEV")] = uiDEConfig.comboBox_gpudev->currentText(); - deSettings[QString("HDDDEV")] = uiDEConfig.comboBox_hdddev->currentText(); - deSettings[QString("HDDTEMPCMD")] = uiDEConfig.lineEdit_hddtempCmd->text(); - deSettings[QString("MPDADDRESS")] = uiDEConfig.lineEdit_mpdaddress->text(); - deSettings[QString("MPDPORT")] = QString::number(uiDEConfig.spinBox_mpdport->value()); - deSettings[QString("MPRIS")] = uiDEConfig.comboBox_mpris->currentText(); - deSettings[QString("PLAYER")] = uiDEConfig.comboBox_playerSelect->currentText(); - writeDataEngineConfiguration(deSettings); -} - - -void AwesomeWidget::configChanged() -{ - if (debug) qDebug() << PDEBUG; - - KConfigGroup cg = config(); - - // widget - configuration[QString("text")] = cg.readEntry("text", "[cpu: $cpu%] [mem: $mem%] [swap: $swap%] [$netdev: $down/$upKB/s]"); - - // advanced - configuration[QString("background")] = cg.readEntry("background", "2"); - configuration[QString("popup")] = cg.readEntry("popup", "2"); - configuration[QString("customTime")] = cg.readEntry("customTime", "$hh:$mm"); - configuration[QString("customUptime")] = cg.readEntry("customUptime", "$dd,$hh,$mm"); - configuration[QString("tempUnits")] = cg.readEntry("tempUnits", "Celsius"); - configuration[QString("tempDevice")] = cg.readEntry("tempDevice", ""); - configuration[QString("fanDevice")] = cg.readEntry("fanDevice", ""); - configuration[QString("mount")] = cg.readEntry("mount", "/"); - configuration[QString("hdd")] = cg.readEntry("hdd", "/dev/sda"); - configuration[QString("disk")] = cg.readEntry("disk", "disk/sda_(8:0)"); - configuration[QString("useCustomNetdev")] = cg.readEntry("useCustomNetdev", "0"); - configuration[QString("customNetdev")] = cg.readEntry("customNetdev", "lo"); - configuration[QString("acOnline")] = cg.readEntry("acOnline", "(*)"); - configuration[QString("acOffline")] = cg.readEntry("acOffline", "( )"); - configuration[QString("checkUpdates")] = cg.readEntry("checkUpdates", "2"); - - // tooltip - tooltipValues.clear(); - configuration[QString("tooltipNumber")] = cg.readEntry("tooltipNumber", "100"); - configuration[QString("useTooltipBackground")] = cg.readEntry("useTooltipBackground", "2"); - configuration[QString("tooltipBackground")] = cg.readEntry("tooltipBackground", "#ffffff"); - configuration[QString("cpuTooltip")] = cg.readEntry("cpuTooltip", "2"); - if (configuration[QString("cpuTooltip")].toInt() == 2) { - tooltipValues[QString("cpu")].append(0.0); - tooltipValues[QString("cpu")].append(0.01); - } - configuration[QString("cpuColor")] = cg.readEntry("cpuColor", "#ff0000"); - configuration[QString("cpuclTooltip")] = cg.readEntry("cpuclTooltip", "2"); - if (configuration[QString("cpuclTooltip")].toInt() == 2) { - tooltipValues[QString("cpucl")].append(0.0); - tooltipValues[QString("cpucl")].append(0.01); - } - configuration[QString("cpuclColor")] = cg.readEntry("cpuclColor", "#00ff00"); - configuration[QString("memTooltip")] = cg.readEntry("memTooltip", "2"); - if (configuration[QString("memTooltip")].toInt() == 2) { - tooltipValues[QString("mem")].append(0.0); - tooltipValues[QString("mem")].append(0.01); - } - configuration[QString("memColor")] = cg.readEntry("memColor", "#0000ff"); - configuration[QString("swapTooltip")] = cg.readEntry("swapTooltip", "2"); - if (configuration[QString("swapTooltip")].toInt() == 2) { - tooltipValues[QString("swap")].append(0.0); - tooltipValues[QString("swap")].append(0.01); - } - configuration[QString("swapColor")] = cg.readEntry("swapColor", "#ffff00"); - configuration[QString("downTooltip")] = cg.readEntry("downTooltip", "2"); - if (configuration[QString("downTooltip")].toInt() == 2) { - tooltipValues[QString("down")].append(0.0); - tooltipValues[QString("down")].append(0.01); - tooltipValues[QString("up")].append(0.0); - tooltipValues[QString("up")].append(0.01); - } - configuration[QString("downColor")] = cg.readEntry("downColor", "#00ffff"); - configuration[QString("upColor")] = cg.readEntry("upColor", "#ff00ff"); - configuration[QString("batteryTooltip")] = cg.readEntry("batteryTooltip", "2"); - if (configuration[QString("batteryTooltip")].toInt() == 2) { - tooltipValues[QString("bat")].append(0.0); - tooltipValues[QString("bat")].append(0.01); - } - configuration[QString("batteryColor")] = cg.readEntry("batteryColor", "#008800"); - configuration[QString("batteryInColor")] = cg.readEntry("batteryInColor", "#880000"); - - // appearance - configuration[QString("interval")] = cg.readEntry("interval", "1000"); - CFont font = CFont(cg.readEntry("fontFamily", "Terminus")); - font.setPointSize(cg.readEntry("fontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000"))); - font.setHtmlWeight(cg.readEntry("fontWeight", 400)); - font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic")); - QString fontStyle; - if (font.italic()) - fontStyle = QString("italic"); - else - fontStyle = QString("normal"); - formatLine[0] = QString("\ - ") - .arg(font.family()) - .arg(font.pointSize()) - .arg(font.htmlWeight()) - .arg(fontStyle) - .arg(font.color().name()); - formatLine[1] = QString(""); - - // counts - QMap deSettings = readDataEngineConfiguration(); - counts[QString("bat")] = 0; - QStringList acpiDevices = QDir(deSettings[QString("ACPIPATH")]).entryList(QDir::Dirs | QDir::NoDotAndDotDot); - QRegExp batRegexp = QRegExp(QString("BAT.*")); - for (int i=0; iname() == QString("bar%1").arg(number)) { - number++; - exit = false; - break; - } - if (exit) break; - } - QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - QStringList bars; - bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*"))))); - bars.append(keys.filter((QRegExp(QString("^gpu$"))))); - bars.append(keys.filter((QRegExp(QString("^mem$"))))); - bars.append(keys.filter((QRegExp(QString("^swap$"))))); - bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*"))))); - bars.append(keys.filter((QRegExp(QString("^bat.*"))))); - - GraphicalItem *item = new GraphicalItem(0, name, dirs, debug); - item->setName(QString("bar%1").arg(number)); - - if (item->showConfiguration(bars) == 1) { - getGraphicalItems(); - QListWidgetItem *widgetItem = new QListWidgetItem(item->fileName()); - QStringList tooltip; - tooltip.append(i18n("Tag: %1", item->name() + item->bar())); - tooltip.append(i18n("Comment: %1", item->comment())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiAdvancedConfig.listWidget_bars->addItem(widgetItem); - uiAdvancedConfig.listWidget_bars->sortItems(); - } - delete item; -} - - -void AwesomeWidget::addCustomScript() -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - ExtScript *script = new ExtScript(0, name, dirs, debug); - - if (script->showConfiguration() == 1) { - QListWidgetItem *widgetItem = new QListWidgetItem(script->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", script->name())); - tooltip.append(i18n("Comment: %1", script->comment())); - tooltip.append(i18n("Exec: %1", script->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_custom->addItem(widgetItem); - uiDEConfig.listWidget_custom->sortItems(); - } - delete script; -} - - -void AwesomeWidget::addPkgCommand() -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug); - - if (upgrade->showConfiguration() == 1) { - QListWidgetItem *widgetItem = new QListWidgetItem(upgrade->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", upgrade->name())); - tooltip.append(i18n("Comment: %1", upgrade->comment())); - tooltip.append(i18n("Exec: %1", upgrade->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_pkgCommand->addItem(widgetItem); - uiDEConfig.listWidget_pkgCommand->sortItems(); - } - delete upgrade; -} - - -void AwesomeWidget::contextMenuBars(const QPoint pos) -{ - if (debug) qDebug() << PDEBUG; - if (uiAdvancedConfig.listWidget_bars->currentItem() == 0) return; - - QMenu menu(uiAdvancedConfig.listWidget_bars); - QAction *edit = menu.addAction(QIcon::fromTheme("document-edit"), i18n("Edit")); - QAction *copy = menu.addAction(QIcon::fromTheme("edit-copy"), i18n("Copy")); - QAction *remove = menu.addAction(QIcon::fromTheme("edit-delete"), i18n("Remove")); - QAction *action = menu.exec(uiAdvancedConfig.listWidget_bars->viewport()->mapToGlobal(pos)); - if (action == edit) - editBar(uiAdvancedConfig.listWidget_bars->currentItem()); - else if (action == copy) - copyBar(uiAdvancedConfig.listWidget_bars->currentItem()->text()); - else if (action == remove) - for (int i=0; ifileName() != uiAdvancedConfig.listWidget_bars->currentItem()->text()) - continue; - if (graphicalItems[i]->tryDelete()) { - graphicalItems.removeAt(i); - uiAdvancedConfig.listWidget_bars->takeItem(uiAdvancedConfig.listWidget_bars->currentRow()); - } - break; - } -} - - -void AwesomeWidget::contextMenuCustomCommand(const QPoint pos) -{ - if (debug) qDebug() << PDEBUG; - if (uiDEConfig.listWidget_custom->currentItem() == 0) return; - - QMenu menu(uiDEConfig.listWidget_custom); - QAction *edit = menu.addAction(QIcon::fromTheme("document-edit"), i18n("Edit")); - QAction *copy = menu.addAction(QIcon::fromTheme("edit-copy"), i18n("Copy")); - QAction *remove = menu.addAction(QIcon::fromTheme("edit-delete"), i18n("Remove")); - QAction *action = menu.exec(uiDEConfig.listWidget_custom->viewport()->mapToGlobal(pos)); - if (action == edit) - editCustomCommand(uiDEConfig.listWidget_custom->currentItem()); - else if (action == copy) - copyCustomCommand(uiDEConfig.listWidget_custom->currentItem()->text()); - else if (action == remove) { - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); - ExtScript *script = new ExtScript(0, uiDEConfig.listWidget_custom->currentItem()->text(), dirs, debug); - if (script->tryDelete()) - uiDEConfig.listWidget_custom->takeItem(uiDEConfig.listWidget_custom->currentRow()); - delete script; - } -} - - -void AwesomeWidget::contextMenuPkgCommand(const QPoint pos) -{ - if (debug) qDebug() << PDEBUG; - if (uiDEConfig.listWidget_pkgCommand->currentItem() == 0) return; - - QMenu menu(uiDEConfig.listWidget_pkgCommand); - QAction *edit = menu.addAction(QIcon::fromTheme("document-edit"), i18n("Edit")); - QAction *copy = menu.addAction(QIcon::fromTheme("edit-copy"), i18n("Copy")); - QAction *remove = menu.addAction(QIcon::fromTheme("edit-delete"), i18n("Remove")); - QAction *action = menu.exec(uiDEConfig.listWidget_pkgCommand->viewport()->mapToGlobal(pos)); - if (action == edit) - editPkgCommand(uiDEConfig.listWidget_pkgCommand->currentItem()); - else if (action == copy) - copyPkgCommand(uiDEConfig.listWidget_pkgCommand->currentItem()->text()); - else if (action == remove) { - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade"); - ExtUpgrade *upgrade = new ExtUpgrade(0, uiDEConfig.listWidget_pkgCommand->currentItem()->text(), dirs, debug); - if (upgrade->tryDelete()) - uiDEConfig.listWidget_pkgCommand->takeItem(uiDEConfig.listWidget_pkgCommand->currentRow()); - delete upgrade; - } -} - - -void AwesomeWidget::copyBar(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - int number = 0; - while (true) { - bool exit = true; - for (int i=0; iname() == QString("bar%1").arg(number)) { - number++; - exit = false; - break; - } - if (exit) break; - } - QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - QStringList bars; - bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*"))))); - bars.append(keys.filter((QRegExp(QString("^gpu$"))))); - bars.append(keys.filter((QRegExp(QString("^mem$"))))); - bars.append(keys.filter((QRegExp(QString("^swap$"))))); - bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*"))))); - bars.append(keys.filter((QRegExp(QString("^bat.*"))))); - - GraphicalItem *originalItem = nullptr; - for (int i=0; ifileName() != original) continue; - originalItem = graphicalItems[i]; - break; - } - GraphicalItem *item = new GraphicalItem(0, name, dirs, debug); - item->setName(QString("bar%1").arg(number)); - item->setComment(originalItem->comment()); - item->setBar(originalItem->bar()); - item->setActiveColor(originalItem->activeColor()); - item->setInactiveColor(originalItem->inactiveColor()); - item->setType(originalItem->type()); - item->setDirection(originalItem->direction()); - item->setHeight(originalItem->height()); - item->setWidth(originalItem->width()); - delete originalItem; - - if (item->showConfiguration(bars) == 1) { - getGraphicalItems(); - QListWidgetItem *widgetItem = new QListWidgetItem(item->fileName()); - QStringList tooltip; - tooltip.append(i18n("Tag: %1", item->name() + item->bar())); - tooltip.append(i18n("Comment: %1", item->comment())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiAdvancedConfig.listWidget_bars->addItem(widgetItem); - uiAdvancedConfig.listWidget_bars->sortItems(); - } - delete item; -} - - -void AwesomeWidget::copyCustomCommand(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - ExtScript *originalScript = new ExtScript(0, original, dirs, debug); - ExtScript *script = new ExtScript(0, name, dirs, debug); - script->setActive(originalScript->isActive()); - script->setComment(originalScript->comment()); - script->setExecutable(originalScript->executable()); - script->setHasOutput(originalScript->hasOutput()); - script->setInterval(originalScript->interval()); - script->setName(originalScript->name()); - script->setPrefix(originalScript->prefix()); - script->setRedirect(originalScript->redirect()); - delete originalScript; - - if (script->showConfiguration() == 1) { - QListWidgetItem *widgetItem = new QListWidgetItem(script->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", script->name())); - tooltip.append(i18n("Comment: %1", script->comment())); - tooltip.append(i18n("Exec: %1", script->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_custom->addItem(widgetItem); - uiDEConfig.listWidget_custom->sortItems(); - } - delete script; -} - - -void AwesomeWidget::copyPkgCommand(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade"); - bool ok; - QString name = QInputDialog::getText(0, i18n("Enter file name"), - i18n("File name"), QLineEdit::Normal, - QString(""), &ok); - if ((!ok) || (name.isEmpty())) return; - if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); - - ExtUpgrade *originalUpgrade = new ExtUpgrade(0, original, dirs, debug); - ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug); - upgrade->setActive(originalUpgrade->isActive()); - upgrade->setComment(originalUpgrade->comment()); - upgrade->setExecutable(originalUpgrade->executable()); - upgrade->setName(originalUpgrade->name()); - upgrade->setNull(originalUpgrade->null()); - upgrade->setInterval(originalUpgrade->interval()); - delete originalUpgrade; - - if (upgrade->showConfiguration() == 1) { - QListWidgetItem *widgetItem = new QListWidgetItem(upgrade->fileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", upgrade->name())); - tooltip.append(i18n("Comment: %1", upgrade->comment())); - tooltip.append(i18n("Exec: %1", upgrade->executable())); - widgetItem->setToolTip(tooltip.join(QChar('\n'))); - uiDEConfig.listWidget_pkgCommand->addItem(widgetItem); - uiDEConfig.listWidget_pkgCommand->sortItems(); - } - delete upgrade; -} - - -void AwesomeWidget::editBar(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - if (item == nullptr) return; - - QStringList bars; - bars.append(keys.filter((QRegExp(QString("^cpu(?!cl).*"))))); - bars.append(keys.filter((QRegExp(QString("^gpu$"))))); - bars.append(keys.filter((QRegExp(QString("^mem$"))))); - bars.append(keys.filter((QRegExp(QString("^swap$"))))); - bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*"))))); - bars.append(keys.filter((QRegExp(QString("^bat.*"))))); - - for (int i=0; ifileName() != item->text()) continue; - graphicalItems[i]->showConfiguration(bars); - break; - } -} - - -void AwesomeWidget::editCustomCommand(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - if (item == nullptr) return; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); - ExtScript *script = new ExtScript(0, item->text(), dirs, debug); - script->showConfiguration(); -} - - -void AwesomeWidget::editPkgCommand(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - if (item == nullptr) return; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade"); - ExtUpgrade *upgrade = new ExtUpgrade(0, item->text(), dirs, debug); - upgrade->showConfiguration(); -} - - -void AwesomeWidget::editFanItem(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - - uiAdvancedConfig.listWidget_fanDevice->openPersistentEditor(item); -} - - -void AwesomeWidget::editHddItem(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - - uiAdvancedConfig.listWidget_hddDevice->openPersistentEditor(item); -} - - -void AwesomeWidget::editHddSpeedItem(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - - uiAdvancedConfig.listWidget_hddSpeedDevice->openPersistentEditor(item); -} - - -void AwesomeWidget::editMountItem(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - - uiAdvancedConfig.listWidget_mount->openPersistentEditor(item); -} - - -void AwesomeWidget::editTempItem(QListWidgetItem *item) -{ - if (debug) qDebug() << PDEBUG; - - uiAdvancedConfig.listWidget_tempDevice->openPersistentEditor(item); -} - - -QList AwesomeWidget::initScripts() -{ - if (debug) qDebug() << PDEBUG; - - QList externalScripts; - // create directory at $HOME - QString localDir = KStandardDirs::locateLocal("data", "awesomewidgets/scripts"); - if (KStandardDirs::makeDir(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); - QStringList names; - for (int i=0; i AwesomeWidget::initUpgrades() -{ - if (debug) qDebug() << PDEBUG; - - QList externalUpgrade; - // create directory at $HOME - QString localDir = KStandardDirs::locateLocal("data", "awesomewidgets/upgrade"); - if (KStandardDirs::makeDir(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade"); - QStringList names; - for (int i=0; icurrentFont().family(), - uiAppConfig.spinBox_size->value(), - 400, false, uiAppConfig.kcolorcombo->color()); - CFont font = CFontDialog::getFont(i18n("Select font"), defaultFont, - false, false); - if (font != defaultFont) { - QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText(); - uiWidConfig.textEdit_elements->insertPlainText(QString("") - .arg(font.color().name()).arg(font.family()).arg(font.pointSize()) + - selectedText + QString("")); - } -} - - -void AwesomeWidget::setFormating() -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Sender" << sender(); - - QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText(); - if (sender() == uiWidConfig.pushButton_tags) - uiWidConfig.textEdit_elements->insertPlainText(QString("$") + uiWidConfig.comboBox_tags->currentText()); - else if (sender() == uiWidConfig.pushButton_br) - uiWidConfig.textEdit_elements->insertPlainText(QString("
\n")); - else if (sender() == uiWidConfig.pushButton_bold) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_italic) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_underline) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_strike) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_left) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_center) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_right) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_fill) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); -} diff --git a/sources/awesome-widget-kde4/customlabel.cpp b/sources/awesome-widget-kde4/customlabel.cpp deleted file mode 100644 index 3854022..0000000 --- a/sources/awesome-widget-kde4/customlabel.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "customlabel.h" - -#include -#include - -#include "awesome-widget.h" -#include -#include - - -CustomLabel::CustomLabel(AwesomeWidget *wid, const bool debugCmd) - : QLabel(0), - widget(wid), - debug(debugCmd) -{ - setWordWrap(false); -} - - -CustomLabel::~CustomLabel() -{ - if (debug) qDebug() << PDEBUG; -} - - -void CustomLabel::setPopupEnabled(const bool state) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "State" << state; - - enablePopup = state; -} - - -void CustomLabel::mousePressEvent(QMouseEvent *event) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button(); - - if ((enablePopup) && (event->button() == Qt::LeftButton)) { - QString cmd, text; - TaskResult process; - - // kernel - cmd = QString("uname -rsm"); - 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; - text += QString("Kernel: %1
").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed()); - // hostname - cmd = QString("uname -n"); - 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; - text += QString("Hostname: %1
").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed()); - // whoami - cmd = QString("whoami"); - 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; - text += QString("Whoami: %1
").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed()); - // uptime - cmd = QString("uptime"); - 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; - text += QString("Uptime: %1").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed()); - - widget->sendNotification(QString("system"), text); - } - emit(QWidget::mousePressEvent(event)); -} diff --git a/sources/awesome-widget-kde4/customlabel.h b/sources/awesome-widget-kde4/customlabel.h deleted file mode 100644 index 4386606..0000000 --- a/sources/awesome-widget-kde4/customlabel.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#ifndef CUSTOMLABEL_H -#define CUSTOMLABEL_H - -#include - - -class AwesomeWidget; - -class CustomLabel : public QLabel -{ - Q_OBJECT - -public: - CustomLabel(AwesomeWidget *wid, const bool debugCmd = false); - ~CustomLabel(); - void setPopupEnabled(const bool state); - -protected: - void mousePressEvent(QMouseEvent *event); - -private: - AwesomeWidget *widget; - bool debug; - bool enablePopup = true; -}; - - -#endif /* CUSTOMLABEL_H */ diff --git a/sources/awesome-widget-kde4/deconfig.ui b/sources/awesome-widget-kde4/deconfig.ui deleted file mode 100644 index d2d807f..0000000 --- a/sources/awesome-widget-kde4/deconfig.ui +++ /dev/null @@ -1,440 +0,0 @@ - - - DEWindow - - - - 0 - 0 - 700 - 582 - - - - - 0 - 0 - - - - - 700 - 0 - - - - - 16777215 - 16777215 - - - - DE - - - - - - true - - - - - 0 - 0 - 684 - 566 - - - - - - - - - - 0 - 0 - - - - hddtemp cmd - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - GPU device - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - auto - - - - - disable - - - - - nvidia - - - - - ati - - - - - - - - - - - - HDD - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - 0 - 0 - - - - Music player - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - mpris - - - - - mpd - - - - - - - - - - - - MPD port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 0 - - - 50000 - - - 100 - - - 6600 - - - - - - - - - - - - 0 - 0 - - - - MPD address - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 0 - 0 - - - - ACPI path - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - "/sys/class/power_supply/" by default - - - - - - - - - - - <b>NOTE:</b> Player DBus interface should be an active - - - Qt::AlignCenter - - - - - - - - - - 0 - 0 - - - - MPRIS player name - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - true - - - - auto - - - - - amarok - - - - - audacious - - - - - clementine - - - - - deadbeef - - - - - vlc - - - - - qmmp - - - - - xmms2 - - - - - - - - - - - - - - - - Custom scripts - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add - - - - - - - - - Qt::CustomContextMenu - - - - - - - - - - - - - Package manager - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Add - - - - - - - - - Qt::CustomContextMenu - - - - - - - - - - - - - - diff --git a/sources/awesome-widget-kde4/deinteraction.cpp b/sources/awesome-widget-kde4/deinteraction.cpp deleted file mode 100644 index 5c42a7d..0000000 --- a/sources/awesome-widget-kde4/deinteraction.cpp +++ /dev/null @@ -1,606 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "awesome-widget.h" - -#include -#include - -#include "graphicalitem.h" -#include - - -void AwesomeWidget::connectToEngine() -{ - if (debug) qDebug() << PDEBUG; - QRegExp regExp; - - // battery - regExp = QRegExp(QString("(^|bar[0-9].*)(ac|bat.*)")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("batteryTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) - extsysmonEngine->connectSource(QString("battery"), - this, configuration[QString("interval")].toInt()); - // cpu - regExp = QRegExp(QString("(^|bar[0-9].*)cpu(?!cl).*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("cpuTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->connectSource(QString("cpu/system/TotalLoad"), - this, configuration[QString("interval")].toInt()); - for (int i=0; iconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/TotalLoad"), - this, configuration[QString("interval")].toInt()); - } - // cpuclock - regExp = QRegExp(QString("cpucl.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("cpuclTooltip")].toInt() == 2)) { - sysmonEngine->connectSource(QString("cpu/system/AverageClock"), - this, configuration[QString("interval")].toInt()); - for (int i=0; iconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/clock"), - this, configuration[QString("interval")].toInt()); - } - // custom command - regExp = QRegExp(QString("custom.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("custom"), - this, configuration[QString("interval")].toInt()); - // desktop - regExp = QRegExp(QString(".*desktop.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("desktop"), - this, configuration[QString("interval")].toInt()); - // disk speed - regExp = QRegExp(QString("hdd[rw].*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; iconnectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/rblk"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/wblk"), - this, configuration[QString("interval")].toInt()); - } - // fan - regExp = QRegExp(QString("fan.*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; iconnectSource(configuration[QString("fanDevice")].split(QString("@@"))[i], - this, configuration[QString("interval")].toInt()); - // gpu - regExp = QRegExp(QString("(^|bar[0-9].*)gpu")); - if ((foundKeys.indexOf(regExp) > -1) || - (foundBars.indexOf(regExp) > -1)) - extsysmonEngine->connectSource(QString("gpu"), - this, configuration[QString("interval")].toInt()); - // gputemp - regExp = QRegExp(QString("gputemp")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("gputemp"), - this, configuration[QString("interval")].toInt()); - // mount - regExp = QRegExp(QString("(^|bar[0-9].*)hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb).*")); - if ((foundKeys.indexOf(regExp) > -1) || - (foundBars.indexOf(regExp) > -1)) - for (int i=0; iconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/filllevel"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/freespace"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/usedspace"), - this, configuration[QString("interval")].toInt()); - } - // hddtemp - regExp = QRegExp(QString("hddtemp.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("hddtemp"), - this, configuration[QString("interval")].toInt()); - // memory - regExp = QRegExp(QString("(^|bar[0-9].*)mem.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("memTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->connectSource(QString("mem/physical/free"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("mem/physical/used"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("mem/physical/application"), - this, configuration[QString("interval")].toInt()); - } - // network - networkDeviceUpdate = 0; - regExp = QRegExp(QString("(down|up|netdev)")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("downTooltip")].toInt() == 2)) { - sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), - this, configuration[QString("interval")].toInt()); - } - // package manager - regExp = QRegExp(QString("pkgcount.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("pkg"), - this, configuration[QString("interval")].toInt()); - // player - regExp = QRegExp(QString("(album|artist|duration|progress|title)")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("player"), - this, configuration[QString("interval")].toInt()); - // ps - regExp = QRegExp(QString("ps.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->connectSource(QString("ps"), - this, configuration[QString("interval")].toInt()); - // swap - regExp = QRegExp(QString("(^|bar[0-9].*)swap.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("swapTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->connectSource(QString("mem/swap/free"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("mem/swap/used"), - this, configuration[QString("interval")].toInt()); - } - // temp - regExp = QRegExp(QString("temp.*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; iconnectSource(configuration[QString("tempDevice")].split(QString("@@"))[i], - this, configuration[QString("interval")].toInt()); - // time - regExp = QRegExp(QString("(^|iso|short|long|c)time")); - if (foundKeys.indexOf(regExp) > -1) - timeEngine->connectSource(QString("Local"), - this, 1000); - // uptime - regExp = QRegExp(QString("(^|c)uptime")); - if (foundKeys.indexOf(regExp) > -1) - sysmonEngine->connectSource(QString("system/uptime"), - this, configuration[QString("interval")].toInt()); -} - - -void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName; - - // regular expressions - QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad")); - QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock")); - QRegExp hddrRegExp = QRegExp(QString("disk/.*/Rate/rblk")); - QRegExp hddwRegExp = QRegExp(QString("disk/.*/Rate/wblk")); - QRegExp mountFillRegExp = QRegExp(QString("partitions/.*/filllevel")); - QRegExp mountFreeRegExp = QRegExp(QString("partitions/.*/freespace")); - QRegExp mountUsedRegExp = QRegExp(QString("partitions/.*/usedspace")); - QRegExp netRecRegExp = QRegExp(QString("network/interfaces/.*/receiver/data")); - QRegExp netTransRegExp = QRegExp(QString("network/interfaces/.*/transmitter/data")); - QRegExp tempRegExp = QRegExp(QString("lmsensors/.*")); - - if (data.keys().isEmpty()) return; - if (sourceName == QString("battery")) { - for (int i=0; i -1) { - for (int j=0; jbar() != data.keys()[i]) continue; - values[foundBars[j]] = values[data.keys()[i]]; - } - } - } - } - if ((configuration[QString("batteryTooltip")].toInt() == 2) && - (!isnan(data[QString("bat")].toFloat()))) { - if (tooltipValues[QString("bat")].count() > configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("bat")].takeFirst(); - if (data[QString("ac")].toBool()) - tooltipValues[QString("bat")].append(data[QString("bat")].toFloat()); - else - tooltipValues[QString("bat")].append(-data[QString("bat")].toFloat()); - } - } else if (sourceName == QString("cpu/system/TotalLoad")) { - values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) { - for (int j=0; jbar() != QString("cpu")) continue; - values[foundBars[j]] = QString("%1").arg(data[QString("value")].toFloat()); - } - } - if ((configuration[QString("cpuTooltip")].toInt() == 2) && - (!isnan(data[QString("value")].toFloat()))) { - if (tooltipValues[QString("cpu")].count() > configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("cpu")].takeFirst(); - tooltipValues[QString("cpu")].append(data[QString("value")].toFloat()); - } - } else if (sourceName.contains(cpuRegExp)) { - QString number = sourceName; - number.remove(QString("cpu/cpu")); - number.remove(QString("/TotalLoad")); - values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) { - for (int j=0; jbar() != (QString("cpu") + number)) continue; - values[foundBars[j]] = values[QString("cpu") + number]; - } - } - } else if (sourceName == QString("cpu/system/AverageClock")) { - values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - if ((configuration[QString("cpuclTooltip")].toInt() == 2) && - (!isnan(data[QString("value")].toFloat()))) { - if (tooltipValues[QString("cpucl")].count() > configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("cpucl")].takeFirst(); - tooltipValues[QString("cpucl")].append(data[QString("value")].toFloat()); - } - } else if (sourceName.contains(cpuclRegExp)) { - QString number = sourceName; - number.remove(QString("cpu/cpu")); - number.remove(QString("/clock")); - values[QString("cpucl") + number] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - } else if (sourceName == QString("custom")) { - for (int i=0; i -1) { - for (int j=0; jbar() != QString("gpu")) continue; - values[foundBars[j]] = values[QString("gpu")]; - } - } - } else if (sourceName == QString("gputemp")) { - values[QString("gputemp")] = QString("%1").arg(getTemp(data[QString("value")].toFloat()), 4, 'f', 1); - } else if (sourceName.contains(mountFillRegExp)) { - QString mount = sourceName; - mount.remove(QString("partitions")); - mount.remove(QString("/filllevel")); - for (int i=0; i -1) { - for (int j=0; jbar() != (QString("hdd") + QString::number(i))) continue; - values[foundBars[j]] = values[QString("hdd") + QString::number(i)]; - } - } - } - } else if (sourceName.contains(mountFreeRegExp)) { - QString mount = sourceName; - mount.remove(QString("partitions")); - mount.remove(QString("/freespace")); - for (int i=0; i configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("mem")].takeFirst(); - tooltipValues[QString("mem")].append(values[QString("mem")].toFloat()); - } - if (foundBars.indexOf(QRegExp(QString("bar[0-9].*mem"))) > -1) { - for (int j=0; jbar() != QString("mem")) continue; - values[foundBars[j]] = values[QString("mem")]; - } - } - } else if (sourceName.contains(netRecRegExp)) { - values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - if ((configuration[QString("downTooltip")].toInt() == 2) && - (!isnan(data[QString("value")].toFloat()))) { - if (tooltipValues[QString("down")].count() > configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("down")].takeFirst(); - tooltipValues[QString("down")].append(data[QString("value")].toFloat()); - } - networkDeviceUpdate++; - if (networkDeviceUpdate >= 30) { - networkDeviceUpdate = 0; - if (configuration[QString("useCustomNetdev")].toInt() == 0) { - sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this); - sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this); - updateNetworkDevice(false); - sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), - this, configuration[QString("interval")].toInt()); - sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), - this, configuration[QString("interval")].toInt()); - } - } - } else if (sourceName.contains(netTransRegExp)) { - values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - if ((configuration[QString("downTooltip")].toInt() == 2) && - (!isnan(data[QString("value")].toFloat()))) { - if (tooltipValues[QString("up")].count() > configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("up")].takeFirst(); - tooltipValues[QString("up")].append(data[QString("value")].toFloat()); - } - } else if (sourceName == QString("pkg")) { - for (int i=0; i configuration[QString("tooltipNumber")].toInt()) - tooltipValues[QString("swap")].takeFirst(); - tooltipValues[QString("swap")].append(values[QString("swap")].toFloat()); - } - if (foundBars.indexOf(QRegExp(QString("bar[0-9].*swap"))) > -1) { - for (int j=0; jbar() != QString("swap")) continue; - values[foundBars[j]] = values[QString("swap")]; - } - } - } else if (sourceName.contains(tempRegExp)) { - if (data[QString("units")].toString() == QString("rpm")) { - for (int i=0; i -1) || - (configuration[QString("batteryTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) - extsysmonEngine->disconnectSource(QString("battery"), this); - // cpu - regExp = QRegExp(QString("(^|bar[0-9].*)cpu(?!cl).*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("cpuTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->disconnectSource(QString("cpu/system/TotalLoad"), this); - for (int i=0; idisconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/TotalLoad"), this); - } - // cpuclock - regExp = QRegExp(QString("cpucl.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("cpuclTooltip")].toInt() == 2)) { - sysmonEngine->disconnectSource(QString("cpu/system/AverageClock"), this); - for (int i=0; idisconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/clock"), this); - } - // custom command - regExp = QRegExp(QString("custom.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("custom"), this); - // desktop - regExp = QRegExp(QString(".*desktop.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("desktop"), this); - // disk speed - regExp = QRegExp(QString("hdd[rw].*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; idisconnectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/rblk"), this); - sysmonEngine->disconnectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/wblk"), this); - } - // fan - regExp = QRegExp(QString("fan.*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; idisconnectSource(configuration[QString("fanDevice")].split(QString("@@"))[i], this); - // gpu - regExp = QRegExp(QString("(^|bar[0-9].*)gpu")); - if ((foundKeys.indexOf(regExp) > -1) || - (foundBars.indexOf(regExp) > -1)) - extsysmonEngine->disconnectSource(QString("gpu"), this); - // gputemp - regExp = QRegExp(QString("gputemp")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("gputemp"), this); - // mount - regExp = QRegExp(QString("(^|bar[0-9].*)hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb).*")); - if ((foundKeys.indexOf(regExp) > -1) || - (foundBars.indexOf(regExp) > -1)) - for (int i=0; idisconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/filllevel"), this); - sysmonEngine->disconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/freespace"), this); - sysmonEngine->disconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/usedspace"), this); - } - // hddtemp - regExp = QRegExp(QString("hddtemp.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("hddtemp"), this); - // memory - regExp = QRegExp(QString("(^|bar[0-9].*)mem.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("memTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->disconnectSource(QString("mem/physical/free"), this); - sysmonEngine->disconnectSource(QString("mem/physical/used"), this); - sysmonEngine->disconnectSource(QString("mem/physical/application"), this); - } - // network - regExp = QRegExp(QString("(down|up|netdev)")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("downTooltip")].toInt() == 2)) { - sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this); - sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this); - } - // package manager - regExp = QRegExp(QString("pkgcount.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("pkg"), this); - // player - regExp = QRegExp(QString("(album|artist|duration|progress|title)")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("player"), this); - // ps - regExp = QRegExp(QString("ps.*")); - if (foundKeys.indexOf(regExp) > -1) - extsysmonEngine->disconnectSource(QString("ps"), this); - // swap - regExp = QRegExp(QString("(^|bar[0-9].*)swap.*")); - if ((foundKeys.indexOf(regExp) > -1) || - (configuration[QString("swapTooltip")].toInt() == 2) || - (foundBars.indexOf(regExp) > -1)) { - sysmonEngine->disconnectSource(QString("mem/swap/free"), this); - sysmonEngine->disconnectSource(QString("mem/swap/used"), this); - } - // temp - regExp = QRegExp(QString("temp.*")); - if (foundKeys.indexOf(regExp) > -1) - for (int i=0; idisconnectSource(configuration[QString("tempDevice")].split(QString("@@"))[i], this); - // time - regExp = QRegExp(QString("(^|iso|short|long|c)time")); - if (foundKeys.indexOf(regExp) > -1) - timeEngine->disconnectSource(QString("Local"), this); - // uptime - regExp = QRegExp(QString("(^|c)uptime")); - if (foundKeys.indexOf(regExp) > -1) - sysmonEngine->disconnectSource(QString("system/uptime"), this); -} diff --git a/sources/awesome-widget-kde4/desktops/bar-template.desktop b/sources/awesome-widget-kde4/desktops/bar-template.desktop deleted file mode 100644 index 2f696e1..0000000 --- a/sources/awesome-widget-kde4/desktops/bar-template.desktop +++ /dev/null @@ -1,25 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -# name should be barN and uniq -Name=bar100500 -Comment=Template for the AW bars -# value to show. Supported types are -# cpu, cpu[0-9], mem, swap, bat -X-AW-Value=cpu -# active color, RGBA -# you should use double quotes -X-AW-ActiveColor="0,0,0,255" -# inactive color, RGBA -# you should use double quotes -X-AW-InactiveColor="255,255,255,255" -# bar type. Supported types are -# Horizontal, Vertical, Circle -X-AW-Type=Horizontal -# direction. LeftToRight or RightToLeft -X-AW-Direction=LeftToRight -# height in pixels -X-AW-Height=25 -# width in pixels -X-AW-Width=100 -# API version -X-AW-ApiVersion=1 diff --git a/sources/awesome-widget-kde4/graphicalitem.cpp b/sources/awesome-widget-kde4/graphicalitem.cpp deleted file mode 100644 index 61231a2..0000000 --- a/sources/awesome-widget-kde4/graphicalitem.cpp +++ /dev/null @@ -1,523 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "graphicalitem.h" -#include "ui_graphicalitem.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "version.h" - - -GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd) - : QDialog(parent), - m_fileName(desktopName), - m_dirs(directories), - debug(debugCmd), - ui(new Ui::GraphicalItem) -{ - readConfiguration(); - - ui->setupUi(this); - connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor())); - connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor())); -} - - -GraphicalItem::~GraphicalItem() -{ - if (debug) qDebug() << PDEBUG; - - delete ui; -} - - -QString GraphicalItem::image(const float value) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Value" << value; - if (m_bar == QString("none")) return QString(""); - - QColor active = stringToColor(m_activeColor); - QColor inactive = stringToColor(m_inactiveColor); - float percent = value / 100.0; - int scale[2] = {1, 1}; - QPen pen = QPen(); - QGraphicsScene *scene = new QGraphicsScene(); - scene->setBackgroundBrush(QBrush(Qt::NoBrush)); - QGraphicsView *view = new QGraphicsView(scene); - view->setStyleSheet(QString("background: transparent")); - view->setContentsMargins(0, 0, 0, 0); - view->setFrameShape(QFrame::NoFrame); - view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view->resize(m_width + 5.0, m_height + 5.0); - - // paint - switch(m_type) { - case Vertical: - pen.setWidth(m_width); - // inactive - pen.setColor(inactive); - 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 * 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 * static_cast(m_direction) + 1; - break; - case Circle: - QGraphicsEllipseItem *circle; - pen.setWidth(1.0); - // inactive - pen.setColor(inactive); - 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, 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 * static_cast(m_direction) + 1; - break; - default: - pen.setWidth(m_height); - // inactive - pen.setColor(inactive); - 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 * m_height, 0.5 * m_height, - percent * m_width - 0.5 * m_height, 0.5 * m_height, pen); - // scale - scale[0] = -2 * static_cast(m_direction) + 1; - break; - } - - // convert - QPixmap pixmap = QPixmap::grabWidget(view).transformed(QTransform().scale(scale[0], scale[1])); - QByteArray byteArray; - QBuffer buffer(&byteArray); - pixmap.save(&buffer, "PNG"); - QString url = QString("").arg(QString(byteArray.toBase64())); - delete view; - delete scene; - - return url; -} - - -QString GraphicalItem::fileName() -{ - if (debug) qDebug() << PDEBUG; - - return m_fileName; -} - - -int GraphicalItem::apiVersion() -{ - if (debug) qDebug() << PDEBUG; - - return m_apiVersion; -} - - -QString GraphicalItem::name() -{ - if (debug) qDebug() << PDEBUG; - - return m_name; -} - - -QString GraphicalItem::comment() -{ - if (debug) qDebug() << PDEBUG; - - return m_comment; -} - - -QString GraphicalItem::bar() -{ - if (debug) qDebug() << PDEBUG; - - return m_bar; -} - - -QString GraphicalItem::activeColor() -{ - if (debug) qDebug() << PDEBUG; - - return m_activeColor; -} - - -QString GraphicalItem::inactiveColor() -{ - if (debug) qDebug() << PDEBUG; - - return m_inactiveColor; -} - - -GraphicalItem::Type GraphicalItem::type() -{ - if (debug) qDebug() << PDEBUG; - - return m_type; -} - - -QString GraphicalItem::strType() -{ - if (debug) qDebug() << PDEBUG; - - QString value; - switch(m_type) { - case Vertical: - value = QString("Vertical"); - break; - case Circle: - value = QString("Circle"); - break; - default: - value = QString("Horizontal"); - break; - } - - return value; -} - - -GraphicalItem::Direction GraphicalItem::direction() -{ - if (debug) qDebug() << PDEBUG; - - return m_direction; -} - - -QString GraphicalItem::strDirection() -{ - if (debug) qDebug() << PDEBUG; - - QString value; - switch (m_direction) { - case RightToLeft: - value = QString("RightToLeft"); - break; - default: - value = QString("LeftToRight"); - break; - } - - return value; -} - - -int GraphicalItem::height() -{ - if (debug) qDebug() << PDEBUG; - - return m_height; -} - - -int GraphicalItem::width() -{ - if (debug) qDebug() << PDEBUG; - - return m_width; -} - - -void GraphicalItem::setApiVersion(const int _apiVersion) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion; - - m_apiVersion = _apiVersion; -} - - -void GraphicalItem::setName(const QString _name) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Name" << _name; - - m_name = _name; -} - - -void GraphicalItem::setComment(const QString _comment) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment; - - m_comment = _comment; -} - - -void GraphicalItem::setBar(const QString _bar) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "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.*"))))) - m_bar = QString("none"); - else - m_bar = _bar; -} - - -void GraphicalItem::setActiveColor(const QString _color) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Color" << _color; - - 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 - setType(Horizontal); -} - - -void GraphicalItem::setDirection(const Direction _direction) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction; - - m_direction = _direction; -} - - -void GraphicalItem::setStrDirection(const QString _direction) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction; - - 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; -} - - -void GraphicalItem::readConfiguration() -{ - if (debug) qDebug() << PDEBUG; - - 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"), m_name).toString()); - setComment(settings.value(QString("Comment"), m_comment).toString()); - setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt()); - 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(); - } -} - - -int GraphicalItem::showConfiguration(const QStringList tags) -{ - if (debug) qDebug() << PDEBUG; - - ui->label_nameValue->setText(m_name); - ui->lineEdit_comment->setText(m_comment); - ui->comboBox_value->addItems(tags); - ui->comboBox_value->addItem(m_bar); - ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1); - ui->pushButton_activeColor->setText(m_activeColor); - ui->pushButton_inactiveColor->setText(m_inactiveColor); - ui->comboBox_type->setCurrentIndex(static_cast(m_type)); - ui->comboBox_direction->setCurrentIndex(static_cast(m_direction)); - ui->spinBox_height->setValue(m_height); - ui->spinBox_width->setValue(m_width); - - int ret = exec(); - if (ret != 1) return ret; - - setName(ui->label_nameValue->text()); - setComment(ui->lineEdit_comment->text()); - setApiVersion(AWGIAPI); - setBar(ui->comboBox_value->currentText()); - setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&'))); - setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&'))); - setStrType(ui->comboBox_type->currentText()); - setStrDirection(ui->comboBox_direction->currentText()); - setHeight(ui->spinBox_height->value()); - setWidth(ui->spinBox_width->value()); - - writeConfiguration(); - return ret; -} - - -int GraphicalItem::tryDelete() -{ - if (debug) qDebug() << PDEBUG; - - for (int i=0; itext()); - QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"), - QColorDialog::ShowAlphaChannel); - if (!newColor.isValid()) return; - - QStringList colorText; - colorText.append(QString("%1").arg(newColor.red())); - colorText.append(QString("%1").arg(newColor.green())); - colorText.append(QString("%1").arg(newColor.blue())); - colorText.append(QString("%1").arg(newColor.alpha())); - dynamic_cast(sender())->setText(colorText.join(QChar(','))); -} - - -QColor GraphicalItem::stringToColor(const QString _color) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Color" << _color; - - QColor qcolor; - QStringList listColor = _color.split(QChar(',')); - while (listColor.count() < 4) - listColor.append(QString("0")); - qcolor.setRed(listColor[0].toInt()); - qcolor.setGreen(listColor[1].toInt()); - qcolor.setBlue(listColor[2].toInt()); - qcolor.setAlpha(listColor[3].toInt()); - - return qcolor; -} diff --git a/sources/awesome-widget-kde4/graphicalitem.h b/sources/awesome-widget-kde4/graphicalitem.h deleted file mode 100644 index b2f154a..0000000 --- a/sources/awesome-widget-kde4/graphicalitem.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#ifndef GRAPHICALITEM_H -#define GRAPHICALITEM_H - -#include -#include - - -namespace Ui { -class GraphicalItem; -} - -class GraphicalItem : public QDialog -{ - Q_OBJECT - Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion) - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString comment READ comment WRITE setComment) - 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 { - LeftToRight = 0, - RightToLeft - }; - enum Type { - Horizontal = 0, - Vertical, - Circle - }; - - explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(), - const QStringList directories = QStringList(), const bool debugCmd = false); - ~GraphicalItem(); - QString fileName(); - QString image(const float value); - // get methods - int apiVersion(); - 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 setApiVersion(const int _apiVersion = 0); - 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(); - int showConfiguration(const QStringList tags = QStringList()); - int tryDelete(); - void writeConfiguration(); - -private slots: - void changeColor(); - -private: - QColor stringToColor(const QString _color); - QString m_fileName; - QStringList m_dirs; - bool debug; - Ui::GraphicalItem *ui; - // properties - int m_apiVersion = 0; - 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 */ diff --git a/sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop b/sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop deleted file mode 100644 index 69cd79e..0000000 --- a/sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop +++ /dev/null @@ -1,25 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Awesome Widget -Comment=A minimalistic Plasmoid -Comment[en]=A minimalistic Plasmoid -Comment[es]=Un plasmoide minimalista -Comment[es]=Un script Plasmoïde minimaliste -Comment[pt_BR]=Um script Plasmoid -Comment[ru]=Минималистичный плазмоид -Comment[uk]=Мінімалістичний плазмоїд -X-KDE-ServiceTypes=Plasma/Applet -Type=Service -Icon=utilities-system-monitor - -X-KDE-Library=plasma_applet_awesome-widget - -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis -X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=awesome-widget -X-KDE-PluginInfo-Version=@PROJECT_VERSION@ -X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/ -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPLv3 -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc b/sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc deleted file mode 100644 index 5cca673..0000000 --- a/sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc +++ /dev/null @@ -1,14 +0,0 @@ -[Global] -IconName=system -Name=Awesome Widget -Comment=Awesome widget information - -[Event/system] -Name=System information -Comment=System information -Action=Popup - -[Event/tag] -Name=Tag information -Comment=Tag information -Action=Popup diff --git a/sources/awesome-widget-kde4/reinit.cpp b/sources/awesome-widget-kde4/reinit.cpp deleted file mode 100644 index 1599961..0000000 --- a/sources/awesome-widget-kde4/reinit.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "awesome-widget.h" - -#include -#include -#include -#include -#include - -#include "customlabel.h" -#include "graphicalitem.h" -#include - - -void AwesomeWidget::reinit() -{ - if (debug) qDebug() << PDEBUG; - - if (configuration[QString("background")].toInt() == 0) - setBackgroundHints(NoBackground); - if (configuration[QString("popup")].toInt() == 0) - textLabel->setPopupEnabled(false); - else - textLabel->setPopupEnabled(true); - updateText(true); - - keys = getKeys(); - foundKeys = findKeys(); - getGraphicalItems(); - foundBars = findGraphicalItems(); - updateNetworkDevice(false); - connectToEngine(); -} - - -void AwesomeWidget::sendNotification(const QString eventId, const QString message) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Event" << eventId; - if (debug) qDebug() << PDEBUG << ":" << "Message" << message; - - KNotification *notification = new KNotification(eventId); - notification->setComponentData(KComponentData("plasma_applet_awesome-widget")); - notification->setTitle(QString("Awesome Widget ::: ") + eventId); - notification->setText(message); - notification->sendEvent(); - delete notification; -} - - -void AwesomeWidget::updateNetworkDevice(const bool delay) -{ - if (debug) qDebug() << PDEBUG; - - if (delay) - networkDeviceUpdate = 30; - else - values[QString("netdev")] = getNetworkDevice(); -} - - -void AwesomeWidget::updateText(const bool clear) -{ - if (debug) qDebug() << PDEBUG; - - QString text = configuration[QString("text")]; - if (!clear) { - text.replace(QString("$$"), QString("$\\$\\")); - for (int i=0; iimage(values[foundBars[i]].toFloat())); - text.replace(QString("$\\$\\"), QString("$$")); - } - textLabel->setText(formatLine[0] + text + formatLine[1]); - mainLayout->itemAt(0, 0)->updateGeometry(); - updateGeometry(); -} - - -void AwesomeWidget::updateTooltip() -{ - if (debug) qDebug() << PDEBUG; - - toolTipView->resize(100.0 * counts[QString("tooltip")], 105.0); - // boundaries - QMap boundaries; - boundaries[QString("cpu")] = 100.0; - boundaries[QString("cpucl")] = 4000.0; - boundaries[QString("mem")] = 100.0; - boundaries[QString("swap")] = 100.0; - boundaries[QString("down")] = 1.0; - if (configuration[QString("downTooltip")].toInt() == 2) { - for (int i=0; iclear(); - QPen pen = QPen(); - if (configuration[QString("useTooltipBackground")].toInt() == 2) - toolTipScene->setBackgroundBrush(QColor(configuration[QString("tooltipBackground")])); - else - toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush)); - bool down = false; - bool isBattery = false; - QStringList trueKeys; - if (tooltipValues.contains(QString("cpu"))) trueKeys.append(QString("cpu")); - if (tooltipValues.contains(QString("cpucl"))) trueKeys.append(QString("cpucl")); - if (tooltipValues.contains(QString("mem"))) trueKeys.append(QString("mem")); - if (tooltipValues.contains(QString("swap"))) trueKeys.append(QString("swap")); - if (tooltipValues.contains(QString("down"))) trueKeys.append(QString("down")); - if (tooltipValues.contains(QString("up"))) trueKeys.append(QString("up")); - if (tooltipValues.contains(QString("bat"))) trueKeys.append(QString("bat")); - for (int i=0; i 0) - pen.setColor(QColor(configuration[QString("batteryColor")])); - else - pen.setColor(QColor(configuration[QString("batteryInColor")])); - } - toolTipScene->addLine(x1, y1, x2, y2, pen); - } - if (trueKeys[i] == QString("down")) down = true; - } - - toolTip.setImage(QPixmap::grabWidget(toolTipView)); - Plasma::ToolTipManager::self()->setContent(this, toolTip); -} diff --git a/sources/awesome-widget-kde4/tooltipconfig.ui b/sources/awesome-widget-kde4/tooltipconfig.ui deleted file mode 100644 index f7b52f3..0000000 --- a/sources/awesome-widget-kde4/tooltipconfig.ui +++ /dev/null @@ -1,295 +0,0 @@ - - - TooltipWindow - - - - 0 - 0 - 700 - 594 - - - - - 0 - 0 - - - - - 700 - 0 - - - - - 16777215 - 16777215 - - - - Tooltip - - - - - - CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox fully checked. - - - Qt::AlignCenter - - - true - - - - - - - true - - - - - 0 - 0 - 684 - 542 - - - - - - - - - Number of values for tooltips - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 50 - - - 1000 - - - 25 - - - 100 - - - - - - - - - - - Qt::RightToLeft - - - Background - - - true - - - - - - - - - - - - - - Qt::RightToLeft - - - CPU color - - - true - - - - - - - - - - - - - - Qt::RightToLeft - - - CPU clock color - - - true - - - - - - - - - - - - - - Qt::RightToLeft - - - Memory color - - - true - - - - - - - - - - - - - - Qt::RightToLeft - - - Swap color - - - true - - - - - - - - - - - - - - Qt::RightToLeft - - - Download speed color - - - true - - - - - - - - - - - - - - Upload speed color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Qt::RightToLeft - - - Battery active color - - - true - - - - - - - - - - - - - - Battery inactive color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Qt::Vertical - - - - 20 - 289 - - - - - - - - - - - - - KColorCombo - QComboBox -
kcolorcombo.h
-
-
- - -
diff --git a/sources/awesome-widget-kde4/widget.ui b/sources/awesome-widget-kde4/widget.ui deleted file mode 100644 index a8b8f22..0000000 --- a/sources/awesome-widget-kde4/widget.ui +++ /dev/null @@ -1,228 +0,0 @@ - - - ConfigWindow - - - - 0 - 0 - 700 - 600 - - - - - 0 - 0 - - - - - 700 - 600 - - - - - 16777215 - 16777215 - - - - Widget - - - - - - Detailed information may be found on <a href="http://arcanis.name/projects/awesome-widgets/">project homepage</a> - - - Qt::AlignCenter - - - true - - - - - - - - - Font - - - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - - Ctrl+B - - - - - - - - - - - - Ctrl+I - - - - - - - - - - - - Ctrl+U - - - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - - - - Add - - - - - - - - - QTextEdit::NoWrap - - - false - - - - - - - - diff --git a/sources/awesome-widget-kf5/plugin/desktops/aw-bat-bar.desktop b/sources/awesome-widget-kf5/plugin/desktops/aw-bat-bar.desktop deleted file mode 100644 index 71fe557..0000000 --- a/sources/awesome-widget-kf5/plugin/desktops/aw-bat-bar.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=bar3 -Comment=Simple bat bar -X-AW-Value=bat -X-AW-ActiveColor="0,0,0,255" -X-AW-InactiveColor="255,255,255,255" -X-AW-Type=Horizontal -X-AW-Direction=LeftToRight -X-AW-Height=25 -X-AW-Width=100 -X-AW-ApiVersion=1 diff --git a/sources/awesome-widget-kf5/plugin/desktops/aw-cpu-bar.desktop b/sources/awesome-widget-kf5/plugin/desktops/aw-cpu-bar.desktop deleted file mode 100644 index b1bfe3c..0000000 --- a/sources/awesome-widget-kf5/plugin/desktops/aw-cpu-bar.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=bar0 -Comment=Simple cpu bar -X-AW-Value=cpu -X-AW-ActiveColor="0,0,0,255" -X-AW-InactiveColor="255,255,255,255" -X-AW-Type=Horizontal -X-AW-Direction=LeftToRight -X-AW-Height=25 -X-AW-Width=100 -X-AW-ApiVersion=1 diff --git a/sources/awesome-widget-kf5/plugin/desktops/aw-mem-bar.desktop b/sources/awesome-widget-kf5/plugin/desktops/aw-mem-bar.desktop deleted file mode 100644 index da4971b..0000000 --- a/sources/awesome-widget-kf5/plugin/desktops/aw-mem-bar.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=bar1 -Comment=Simple mem bar -X-AW-Value=mem -X-AW-ActiveColor="0,0,0,255" -X-AW-InactiveColor="255,255,255,255" -X-AW-Type=Horizontal -X-AW-Direction=LeftToRight -X-AW-Height=25 -X-AW-Width=100 -X-AW-ApiVersion=1 diff --git a/sources/awesome-widget-kf5/plugin/desktops/aw-swap-bar.desktop b/sources/awesome-widget-kf5/plugin/desktops/aw-swap-bar.desktop deleted file mode 100644 index bc62658..0000000 --- a/sources/awesome-widget-kf5/plugin/desktops/aw-swap-bar.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=bar2 -Comment=Simple swap bar -X-AW-Value=swap -X-AW-ActiveColor="0,0,0,255" -X-AW-InactiveColor="255,255,255,255" -X-AW-Type=Horizontal -X-AW-Direction=LeftToRight -X-AW-Height=25 -X-AW-Width=100 -X-AW-ApiVersion=1 diff --git a/sources/awesome-widget-kf5/plugin/graphicalitem.ui b/sources/awesome-widget-kf5/plugin/graphicalitem.ui deleted file mode 100644 index a5afb71..0000000 --- a/sources/awesome-widget-kf5/plugin/graphicalitem.ui +++ /dev/null @@ -1,293 +0,0 @@ - - - GraphicalItem - - - - 0 - 0 - 416 - 325 - - - - Configuration - - - - - - - - Name - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Comment - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Value - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - - - - - - - - - Active color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - - - - Inactive color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - - - - Type - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - Horizontal - - - - - Vertical - - - - - Circle - - - - - - - - - - - - Direction - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - LeftToRight - - - - - RightToLeft - - - - - - - - - - - - Height - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 2000 - - - 25 - - - - - - - - - - - Width - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 2000 - - - 25 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - GraphicalItem - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - GraphicalItem - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/sources/awesome-widget-kf5/CMakeLists.txt b/sources/awesome-widget/CMakeLists.txt similarity index 100% rename from sources/awesome-widget-kf5/CMakeLists.txt rename to sources/awesome-widget/CMakeLists.txt diff --git a/sources/awesome-widget-kf5/metadata.desktop b/sources/awesome-widget/metadata.desktop similarity index 100% rename from sources/awesome-widget-kf5/metadata.desktop rename to sources/awesome-widget/metadata.desktop diff --git a/sources/awesome-widget-kf5/package/contents/config/config.qml b/sources/awesome-widget/package/contents/config/config.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/config/config.qml rename to sources/awesome-widget/package/contents/config/config.qml diff --git a/sources/awesome-widget-kf5/package/contents/config/main.xml b/sources/awesome-widget/package/contents/config/main.xml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/config/main.xml rename to sources/awesome-widget/package/contents/config/main.xml diff --git a/sources/awesome-widget-kf5/package/contents/ui/about.qml b/sources/awesome-widget/package/contents/ui/about.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/about.qml rename to sources/awesome-widget/package/contents/ui/about.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml b/sources/awesome-widget/package/contents/ui/advanced.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/advanced.qml rename to sources/awesome-widget/package/contents/ui/advanced.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml b/sources/awesome-widget/package/contents/ui/appearance.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/appearance.qml rename to sources/awesome-widget/package/contents/ui/appearance.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml b/sources/awesome-widget/package/contents/ui/dataengine.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/dataengine.qml rename to sources/awesome-widget/package/contents/ui/dataengine.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/general.qml b/sources/awesome-widget/package/contents/ui/general.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/general.qml rename to sources/awesome-widget/package/contents/ui/general.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/main.qml b/sources/awesome-widget/package/contents/ui/main.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/main.qml rename to sources/awesome-widget/package/contents/ui/main.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/qmldir b/sources/awesome-widget/package/contents/ui/qmldir similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/qmldir rename to sources/awesome-widget/package/contents/ui/qmldir diff --git a/sources/awesome-widget-kf5/package/contents/ui/tooltip.qml b/sources/awesome-widget/package/contents/ui/tooltip.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/tooltip.qml rename to sources/awesome-widget/package/contents/ui/tooltip.qml diff --git a/sources/awesome-widget-kf5/package/contents/ui/widget.qml b/sources/awesome-widget/package/contents/ui/widget.qml similarity index 100% rename from sources/awesome-widget-kf5/package/contents/ui/widget.qml rename to sources/awesome-widget/package/contents/ui/widget.qml diff --git a/sources/awesome-widget-kf5/package/metadata.desktop b/sources/awesome-widget/package/metadata.desktop similarity index 100% rename from sources/awesome-widget-kf5/package/metadata.desktop rename to sources/awesome-widget/package/metadata.desktop diff --git a/sources/awesome-widget-kf5/plugin/CMakeLists.txt b/sources/awesome-widget/plugin/CMakeLists.txt similarity index 100% rename from sources/awesome-widget-kf5/plugin/CMakeLists.txt rename to sources/awesome-widget/plugin/CMakeLists.txt diff --git a/sources/awesome-widget-kf5/plugin/awactions.cpp b/sources/awesome-widget/plugin/awactions.cpp similarity index 100% rename from sources/awesome-widget-kf5/plugin/awactions.cpp rename to sources/awesome-widget/plugin/awactions.cpp diff --git a/sources/awesome-widget-kf5/plugin/awactions.h b/sources/awesome-widget/plugin/awactions.h similarity index 100% rename from sources/awesome-widget-kf5/plugin/awactions.h rename to sources/awesome-widget/plugin/awactions.h diff --git a/sources/awesome-widget-kf5/plugin/awesomewidget.cpp b/sources/awesome-widget/plugin/awesomewidget.cpp similarity index 100% rename from sources/awesome-widget-kf5/plugin/awesomewidget.cpp rename to sources/awesome-widget/plugin/awesomewidget.cpp diff --git a/sources/awesome-widget-kf5/plugin/awesomewidget.h b/sources/awesome-widget/plugin/awesomewidget.h similarity index 100% rename from sources/awesome-widget-kf5/plugin/awesomewidget.h rename to sources/awesome-widget/plugin/awesomewidget.h diff --git a/sources/awesome-widget-kf5/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp similarity index 100% rename from sources/awesome-widget-kf5/plugin/awkeys.cpp rename to sources/awesome-widget/plugin/awkeys.cpp diff --git a/sources/awesome-widget-kf5/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h similarity index 100% rename from sources/awesome-widget-kf5/plugin/awkeys.h rename to sources/awesome-widget/plugin/awkeys.h diff --git a/sources/awesome-widget-kf5/plugin/awtooltip.cpp b/sources/awesome-widget/plugin/awtooltip.cpp similarity index 100% rename from sources/awesome-widget-kf5/plugin/awtooltip.cpp rename to sources/awesome-widget/plugin/awtooltip.cpp diff --git a/sources/awesome-widget-kf5/plugin/awtooltip.h b/sources/awesome-widget/plugin/awtooltip.h similarity index 100% rename from sources/awesome-widget-kf5/plugin/awtooltip.h rename to sources/awesome-widget/plugin/awtooltip.h diff --git a/sources/awesome-widget-kde4/desktops/aw-bat-bar.desktop b/sources/awesome-widget/plugin/desktops/aw-bat-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-bat-bar.desktop rename to sources/awesome-widget/plugin/desktops/aw-bat-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-cpu-bar.desktop b/sources/awesome-widget/plugin/desktops/aw-cpu-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-cpu-bar.desktop rename to sources/awesome-widget/plugin/desktops/aw-cpu-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-mem-bar.desktop b/sources/awesome-widget/plugin/desktops/aw-mem-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-mem-bar.desktop rename to sources/awesome-widget/plugin/desktops/aw-mem-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-swap-bar.desktop b/sources/awesome-widget/plugin/desktops/aw-swap-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-swap-bar.desktop rename to sources/awesome-widget/plugin/desktops/aw-swap-bar.desktop diff --git a/sources/awesome-widget-kf5/plugin/graphicalitem.cpp b/sources/awesome-widget/plugin/graphicalitem.cpp similarity index 100% rename from sources/awesome-widget-kf5/plugin/graphicalitem.cpp rename to sources/awesome-widget/plugin/graphicalitem.cpp diff --git a/sources/awesome-widget-kf5/plugin/graphicalitem.h b/sources/awesome-widget/plugin/graphicalitem.h similarity index 100% rename from sources/awesome-widget-kf5/plugin/graphicalitem.h rename to sources/awesome-widget/plugin/graphicalitem.h diff --git a/sources/awesome-widget-kde4/graphicalitem.ui b/sources/awesome-widget/plugin/graphicalitem.ui similarity index 100% rename from sources/awesome-widget-kde4/graphicalitem.ui rename to sources/awesome-widget/plugin/graphicalitem.ui diff --git a/sources/awesome-widget-kf5/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc b/sources/awesome-widget/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc similarity index 100% rename from sources/awesome-widget-kf5/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc rename to sources/awesome-widget/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc diff --git a/sources/awesome-widget-kf5/plugin/qmldir b/sources/awesome-widget/plugin/qmldir similarity index 100% rename from sources/awesome-widget-kf5/plugin/qmldir rename to sources/awesome-widget/plugin/qmldir diff --git a/sources/desktop-panel-kde4/CMakeLists.txt b/sources/desktop-panel-kde4/CMakeLists.txt deleted file mode 100644 index 6eadf8d..0000000 --- a/sources/desktop-panel-kde4/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# set project name -set (SUBPROJECT plasma_applet_desktop-panel) -message (STATUS "Subproject ${SUBPROJECT}") - -# find required libaries -find_package (KDE4 REQUIRED) -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - -include (KDE4Defaults) -include_directories (${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/../ - ${PROJECT_TRDPARTY_DIR}) - -# set sources -set (PLUGIN_NAME ${SUBPROJECT}) -file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) -file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) -file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp) -file (GLOB SUBPROJECT_UI *.ui) - -# prepare -configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) - -# make -kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) -kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE}) -target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) - -# install -install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/sources/desktop-panel-kde4/appearance.ui b/sources/desktop-panel-kde4/appearance.ui deleted file mode 100644 index cb3f472..0000000 --- a/sources/desktop-panel-kde4/appearance.ui +++ /dev/null @@ -1,357 +0,0 @@ - - - AppearanceWidget - - - - 0 - 0 - 480 - 343 - - - - - 480 - 320 - - - - Apearance - - - - - - 0 - - - - Active desktop - - - - - - true - - - - - 0 - 0 - 448 - 289 - - - - - - - - - Font - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Font size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 7 - - - 48 - - - 12 - - - - - - - - - - - Font color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Font weight - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 100 - - - 900 - - - 100 - - - 400 - - - - - - - - - - - Font style - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - normal - - - - - italic - - - - - - - - - - Qt::Vertical - - - - 20 - 119 - - - - - - - - - - - - - Inactive desktop - - - - - - true - - - - - 0 - 0 - 448 - 289 - - - - - - - - - Font - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Font size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 7 - - - 48 - - - 12 - - - - - - - - - - - Font color - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Font weight - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 100 - - - 900 - - - 100 - - - 400 - - - - - - - - - - - Font style - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - normal - - - - - italic - - - - - - - - - - Qt::Vertical - - - - 20 - 119 - - - - - - - - - - - - - - - - - KColorCombo - QComboBox -
kcolorcombo.h
-
-
- - -
diff --git a/sources/desktop-panel-kde4/desktop-panel.cpp b/sources/desktop-panel-kde4/desktop-panel.cpp deleted file mode 100644 index 178a866..0000000 --- a/sources/desktop-panel-kde4/desktop-panel.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - -#include "desktop-panel.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num, const bool debugCmd) - : QLabel(0), - debug(debugCmd), - number(num), - widget(wid) -{ - if (debug) qDebug() << PDEBUG << ":" << "Init label" << number; -} - - -CustomPlasmaLabel::~CustomPlasmaLabel() -{ - if (debug) qDebug() << PDEBUG; -} - - -int CustomPlasmaLabel::getNumber() -{ - if (debug) qDebug() << PDEBUG; - - return number; -} - - -void CustomPlasmaLabel::enterEvent(QEvent *event) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Event" << event->type(); - - if (event->type() == QEvent::Enter) - widget->paintTooltip(number); - - emit(QLabel::enterEvent(event)); -} - - -void CustomPlasmaLabel::mousePressEvent(QMouseEvent *event) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button(); - - if (event->button() == Qt::LeftButton) - widget->setCurrentDesktop(number); - emit(QLabel::mousePressEvent(event)); -} - - - -DesktopPanel::DesktopPanel(QObject *parent, const QVariantList &args) - : Plasma::Applet(parent, args) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - if (debugEnv == QString("yes")) - debug = true; - else - debug = false; - - setBackgroundHints(DefaultBackground); - setAspectRatioMode(Plasma::IgnoreAspectRatio); - setHasConfigurationInterface(true); - // text format init - currentFormatLine.append(QString("")); - currentFormatLine.append(QString("")); - formatLine.append(QString("")); - formatLine.append(QString("")); -} - - -DesktopPanel::~DesktopPanel() -{ - if (debug) qDebug() << PDEBUG; -} - - -void DesktopPanel::init() -{ - if (debug) qDebug() << PDEBUG; - - layout = new QGraphicsGridLayout(); - layout->setContentsMargins(1, 1, 1, 1); - setLayout(layout); - - // tooltip - toolTip = Plasma::ToolTipContent(); - toolTipScene = new QGraphicsScene(); - toolTipView = new QGraphicsView(toolTipScene); - toolTipView->setStyleSheet(QString("background: transparent")); - toolTipView->setContentsMargins(0, 0, 0, 0); - toolTipView->setFrameShape(QFrame::NoFrame); - toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - Plasma::ToolTipManager::self()->setContent(this, toolTip); - - // read variables - configChanged(); - connect(this, SIGNAL(activate()), this, SLOT(changePanelsState())); - connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(updateText(int))); -} - - -DesktopPanel::DesktopWindowsInfo DesktopPanel::getInfoByDesktop(const int num) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Number" << num; - - - DesktopWindowsInfo info; - info.desktop = KWindowSystem::workArea(num); - - QList windows = KWindowSystem::windows(); - for (int i=0; i DesktopPanel::getPanels() -{ - if (debug) qDebug() << PDEBUG; - - QList panels; - for (int i=0; icorona()->containments().count(); i++) - if (containment()->corona()->containments()[i]->containmentType() == Plasma::Containment::PanelContainment) - panels.append(containment()->corona()->containments()[i]); - - return panels; -} - - -QString DesktopPanel::panelLocationToStr(Plasma::Location loc) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Location" << loc; - - switch (loc) { - case Plasma::TopEdge: - return i18n("Top Edge"); - case Plasma::BottomEdge: - return i18n("Bottom Edge"); - case Plasma::LeftEdge: - return i18n("Left Edge"); - case Plasma::RightEdge: - return i18n("Right Edge"); - default: - return i18n("Unknown Position (%1)", loc); - } -} - - -QString DesktopPanel::parsePattern(const QString rawLine, const int num) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Raw line" << rawLine; - if (debug) qDebug() << PDEBUG << ":" << "Number" << num; - - QString line, fullMark, mark; - line = rawLine; - if (KWindowSystem::currentDesktop() == num + 1) - mark = configuration[QString("mark")]; - else - mark = QString(""); - fullMark = QString("%1").arg(mark, configuration[QString("mark")].count(), QLatin1Char(' ')); - if (line.contains(QString("$fullmark"))) - line.replace(QString("$fullmark"), fullMark); - if (line.contains(QString("$mark"))) - line.replace(QString("$mark"), mark); - if (line.contains(QString("$name"))) - line.replace(QString("$name"), desktopNames[num]); - if (line.contains(QString("$number"))) - line.replace(QString("$number"), QString::number(num + 1)); - if (line.contains(QString("$total"))) - line.replace(QString("$total"), QString::number(desktopNames.count())); - - return line; -} - - -void DesktopPanel::reinit() -{ - if (debug) qDebug() << PDEBUG; - - // clear - // labels - for (int i=0; iremoveItem(proxyWidgets[i]); - proxyWidgets[i]->setWidget(0); - delete labels[i]; - delete proxyWidgets[i]; - } - labels.clear(); - proxyWidgets.clear(); - desktopNames.clear(); - - // add - int total = KWindowSystem::numberOfDesktops(); - for (int i=1; isetWordWrap(false); - labels[i]->setAttribute(Qt::WA_TranslucentBackground, true); - proxyWidgets[i]->setWidget(labels[i]); - if (configuration[QString("layout")].toInt() == 0) - layout->addItem(proxyWidgets[i], 0, i); - else - layout->addItem(proxyWidgets[i], i, 0); - } - - updateText(KWindowSystem::currentDesktop()); - for (int i=0; iadjustSize(); - proxyWidgets[i]->setGeometry(labels[i]->geometry()); - } - emit(KWindowSystem::setCurrentDesktop(KWindowSystem::currentDesktop())); -} - - -void DesktopPanel::changePanelsState() -{ - if (debug) qDebug() << PDEBUG; - - QList panels = getPanels(); - for (int i=0; iview()->isVisible(); - int winId = panels[i]->view()->winId(); - if (wasVisible) { - if (debug) qDebug() << PDEBUG << ":" << "Hide panel"; - KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState); - oldState = oldInfo.state(); - panels[i]->view()->setVisible(false); - } else { - if (debug) qDebug() << PDEBUG << ":" << "Show panel"; - panels[i]->view()->setVisible(true); - KWindowSystem::clearState(winId, NET::KeepAbove); - KWindowSystem::setState(winId, oldState | NET::StaysOnTop); - KWindowSystem::setOnAllDesktops(winId, true); - } - } -} - - -void DesktopPanel::paintTooltip(const int active) -{ - if (debug) qDebug() << PDEBUG; - if (active == activeTooltip) return; - - // prepare - // clear - toolTip.setImage(0); - toolTip.setWindowsToPreview(QList()); - activeTooltip = active; - DesktopWindowsInfo info = getInfoByDesktop(active + 1); - float margin = 5.0 * info.desktop.width() / 400.0; - toolTipView->resize(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin); - toolTipScene->clear(); - toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush)); - // borders - toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin); - toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin, - info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin); - toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin, - info.desktop.width() + 2.0 * margin, 0); - toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0); - - if (configuration[QString("tooltipType")].toInt() == 1) { - // only contours - QPen pen = QPen(); - pen.setWidthF(2.0 * info.desktop.width() / 400.0); - pen.setColor(QColor(configuration[QString("tooltipColor")])); - for (int i=0; iaddLine(info.windows[i].left() + margin, info.windows[i].bottom() + margin, - info.windows[i].left() + margin, info.windows[i].top() + margin, pen); - toolTipScene->addLine(info.windows[i].left() + margin, info.windows[i].top() + margin, - info.windows[i].right() + margin, info.windows[i].top() + margin, pen); - toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].top() + margin, - info.windows[i].right() + margin, info.windows[i].bottom() + margin, pen); - toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].bottom() + margin, - info.windows[i].left() + margin, info.windows[i].bottom() + margin, pen); - } - toolTip.setImage(QPixmap::grabWidget(toolTipView).scaledToWidth(configuration[QString("tooltipWidth")].toInt())); - } else if (configuration[QString("tooltipType")].toInt() == 2) { - // clean desktop - toolTip.setWindowsToPreview(info.desktopId); - } else { - // desktop preview - toolTip.setWindowsToPreview(info.winId); - } - - Plasma::ToolTipManager::self()->setContent(this, toolTip); -} - - -void DesktopPanel::setCurrentDesktop(const int number) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Set desktop" << number + 1; - - KWindowSystem::setCurrentDesktop(number + 1); -} - - -void DesktopPanel::updateText(const int active) -{ - if (debug) qDebug() << PDEBUG; - - QString line, text; - for (int i=0; isetText(text); - } - int height = 0; - int width = 0; - for (int i=0; iadjustSize(); - proxyWidgets[i]->setGeometry(labels[i]->geometry()); - if (configuration[QString("layout")].toInt() == 0) { - width += proxyWidgets[i]->geometry().width(); - if (height < proxyWidgets[i]->geometry().height()) - height = proxyWidgets[i]->geometry().height(); - } else { - height += proxyWidgets[i]->geometry().height(); - if (width < proxyWidgets[i]->geometry().width()) - width = proxyWidgets[i]->geometry().width(); - } - } - layout->setMinimumSize(width, height); -} - - -// configuration interface -void DesktopPanel::createConfigurationInterface(KConfigDialog *parent) -{ - if (debug) qDebug() << PDEBUG; - - QWidget *appWidget = new QWidget; - uiAppConfig.setupUi(appWidget); - QWidget *configWidget = new QWidget; - uiWidConfig.setupUi(configWidget); - QWidget *toggleWidget = new QWidget; - uiToggleConfig.setupUi(toggleWidget); - - uiWidConfig.textEdit_elements->setPlainText(configuration[QString("pattern")]); - if (configuration[QString("tooltip")].toInt() == 0) - uiWidConfig.checkBox_tooltip->setCheckState(Qt::Unchecked); - else - uiWidConfig.checkBox_tooltip->setCheckState(Qt::Checked); - uiWidConfig.comboBox_tooltipType->setCurrentIndex(configuration[QString("tooltipType")].toInt()); - uiWidConfig.spinBox_tooltip->setValue(configuration[QString("tooltipWidth")].toInt()); - uiWidConfig.kcolorcombo_tooltipColor->setColor(QColor(configuration[QString("tooltipColor")])); - if (configuration[QString("background")].toInt() == 0) - uiWidConfig.checkBox_background->setCheckState(Qt::Unchecked); - else - uiWidConfig.checkBox_background->setCheckState(Qt::Checked); - if (configuration[QString("layout")].toInt() == 0) - uiWidConfig.checkBox_layout->setCheckState(Qt::Unchecked); - else - uiWidConfig.checkBox_layout->setCheckState(Qt::Checked); - uiWidConfig.comboBox_mark->setItemText(uiWidConfig.comboBox_mark->count()-1, configuration[QString("mark")]); - uiWidConfig.comboBox_mark->setCurrentIndex(uiWidConfig.comboBox_mark->count()-1); - - KConfigGroup cg = config(); - CFont font(cg.readEntry("currentFontFamily", "Terminus")); - font.setPointSize(cg.readEntry("currentFontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000"))); - font.setHtmlWeight(cg.readEntry("currentFontWeight", 400)); - font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic")); - uiAppConfig.fontComboBox_fontActive->setCurrentFont(font.toQFont()); - uiAppConfig.spinBox_fontSizeActive->setValue(font.pointSize()); - uiAppConfig.kcolorcombo_fontColorActive->setColor(font.color()); - if (font.italic()) - uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(1); - else - uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(0); - uiAppConfig.spinBox_fontWeightActive->setValue(font.htmlWeight()); - - font = CFont(cg.readEntry("fontFamily", "Terminus")); - font.setPointSize(cg.readEntry("fontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000"))); - font.setHtmlWeight(cg.readEntry("fontWeight", 400)); - font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic")); - uiAppConfig.fontComboBox_fontInactive->setCurrentFont(font.toQFont()); - uiAppConfig.spinBox_fontSizeInactive->setValue(font.pointSize()); - uiAppConfig.kcolorcombo_fontColorInactive->setColor(font.color()); - if (font.italic()) - uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(1); - else - uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(0); - uiAppConfig.spinBox_fontWeightInactive->setValue(font.htmlWeight()); - - uiToggleConfig.listWidget_list->clear(); - QList panels = getPanels(); - for (int i=0; ilocation()), uiToggleConfig.listWidget_list); - item->setFlags(item->flags() | Qt::ItemIsUserCheckable); - if ((configuration[QString("panels")].split(QChar(',')) - .contains(QString::number(i))) || - (configuration[QString("panels")] == QString("-1"))) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); - } - - parent->addPage(configWidget, i18n("Widget"), Applet::icon()); - parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme")); - parent->addPage(toggleWidget, i18n("Toggle panels"), QString("plasma")); - - connect(uiWidConfig.pushButton_tags, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_br, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_font, SIGNAL(clicked(bool)), this, SLOT(setFontFormating())); - connect(uiWidConfig.pushButton_bold, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_italic, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_underline, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_strike, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_left, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_center, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_right, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - connect(uiWidConfig.pushButton_fill, SIGNAL(clicked(bool)), this, SLOT(setFormating())); - - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); -} - - -void DesktopPanel::configAccepted() -{ - if (debug) qDebug() << PDEBUG; - - KConfigGroup cg = config(); - - cg.writeEntry("pattern", uiWidConfig.textEdit_elements->toPlainText()); - cg.writeEntry("tooltip", QString::number(uiWidConfig.checkBox_tooltip->checkState())); - cg.writeEntry("tooltipType", QString::number(uiWidConfig.comboBox_tooltipType->currentIndex())); - cg.writeEntry("tooltipWidth", QString::number(uiWidConfig.spinBox_tooltip->value())); - cg.writeEntry("tooltipColor", uiWidConfig.kcolorcombo_tooltipColor->color().name()); - cg.writeEntry("background", QString::number(uiWidConfig.checkBox_background->checkState())); - cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState())); - cg.writeEntry("mark", uiWidConfig.comboBox_mark->currentText()); - - cg.writeEntry("currentFontFamily", uiAppConfig.fontComboBox_fontActive->currentFont().family()); - cg.writeEntry("currentFontSize", uiAppConfig.spinBox_fontSizeActive->value()); - cg.writeEntry("currentFontColor", uiAppConfig.kcolorcombo_fontColorActive->color().name()); - cg.writeEntry("currentFontWeight", uiAppConfig.spinBox_fontWeightActive->value()); - cg.writeEntry("currentFontStyle", uiAppConfig.comboBox_fontStyleActive->currentText()); - - cg.writeEntry("fontFamily", uiAppConfig.fontComboBox_fontInactive->currentFont().family()); - cg.writeEntry("fontSize", uiAppConfig.spinBox_fontSizeInactive->value()); - cg.writeEntry("fontColor", uiAppConfig.kcolorcombo_fontColorInactive->color().name()); - cg.writeEntry("fontWeight", uiAppConfig.spinBox_fontWeightInactive->value()); - cg.writeEntry("fontStyle", uiAppConfig.comboBox_fontStyleInactive->currentText()); - - QStringList indexes; - for (int i=0; icount(); i++) - if (uiToggleConfig.listWidget_list->item(i)->checkState() == Qt::Checked) - indexes.append(QString::number(i)); - if (indexes.count() == uiToggleConfig.listWidget_list->count()) - cg.writeEntry("panels", QString("-1")); - else - cg.writeEntry("panels", indexes.join(QChar(','))); -} - - -void DesktopPanel::configChanged() -{ - if (debug) qDebug() << PDEBUG; - - KConfigGroup cg = config(); - - configuration[QString("pattern")] = cg.readEntry("pattern", "[$fullmark$number/$total: $name]"); - configuration[QString("tooltip")] = cg.readEntry("tooltip", "2"); - configuration[QString("tooltipType")] = cg.readEntry("tooltipType", "0"); - configuration[QString("tooltipWidth")] = cg.readEntry("tooltipWidth", "200"); - configuration[QString("tooltipColor")] = cg.readEntry("tooltipColor", "#ffffff"); - configuration[QString("background")] = cg.readEntry("background", "2"); - configuration[QString("layout")] = cg.readEntry("layout", "0"); - configuration[QString("mark")] = cg.readEntry("mark", "¤"); - configuration[QString("panels")] = cg.readEntry("panels", "-1"); - - CFont font = CFont(cg.readEntry("currentFontFamily", "Terminus")); - font.setPointSize(cg.readEntry("currentFontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000"))); - font.setHtmlWeight(cg.readEntry("currentFontWeight", 400)); - font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic")); - QString fontStyle; - if (font.italic()) - fontStyle = QString("italic"); - else - fontStyle = QString("normal"); - currentFormatLine[0] = QString("\ - ") - .arg(font.family()) - .arg(font.pointSize()) - .arg(font.htmlWeight()) - .arg(fontStyle) - .arg(font.color().name()); - currentFormatLine[1] = QString(""); - - font = CFont(cg.readEntry("fontFamily", "Terminus")); - font.setPointSize(cg.readEntry("fontSize", 10)); - font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000"))); - font.setHtmlWeight(cg.readEntry("fontWeight", 400)); - font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic")); - if (font.italic()) - fontStyle = QString("italic"); - else - fontStyle = QString("normal"); - formatLine[0] = QString("\ - ") - .arg(font.family()) - .arg(font.pointSize()) - .arg(font.htmlWeight()) - .arg(fontStyle) - .arg(font.color().name()); - formatLine[1] = QString(""); - - reinit(); -} - - -void DesktopPanel::setFontFormating() -{ - if (debug) qDebug() << PDEBUG; - - CFont defaultFont = CFont(uiAppConfig.fontComboBox_fontInactive->currentFont().family(), - uiAppConfig.spinBox_fontSizeInactive->value(), - 400, false, uiAppConfig.kcolorcombo_fontColorInactive->color()); - CFont font = CFontDialog::getFont(i18n("Select font"), defaultFont, - false, false); - QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText(); - uiWidConfig.textEdit_elements->insertPlainText(QString("") - .arg(font.color().name()).arg(font.family()).arg(font.pointSize()) + - selectedText + QString("")); -} - - -void DesktopPanel::setFormating() -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Sender" << sender(); - - QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText(); - if (sender() == uiWidConfig.pushButton_tags) - uiWidConfig.textEdit_elements->insertPlainText(QString("$") + uiWidConfig.comboBox_tags->currentText()); - else if (sender() == uiWidConfig.pushButton_br) - uiWidConfig.textEdit_elements->insertPlainText(QString("
\n")); - else if (sender() == uiWidConfig.pushButton_bold) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_italic) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_underline) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_strike) - uiWidConfig.textEdit_elements->insertPlainText(QString("") + selectedText + QString("")); - else if (sender() == uiWidConfig.pushButton_left) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_center) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_right) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); - else if (sender() == uiWidConfig.pushButton_fill) - uiWidConfig.textEdit_elements->insertPlainText(QString("

") + selectedText + QString("

")); -} - - -#include "desktop-panel.moc" diff --git a/sources/desktop-panel-kde4/desktop-panel.h b/sources/desktop-panel-kde4/desktop-panel.h deleted file mode 100644 index 8c4ae57..0000000 --- a/sources/desktop-panel-kde4/desktop-panel.h +++ /dev/null @@ -1,125 +0,0 @@ -/*************************************************************************** - * This file is part of awesome-widgets * - * * - * awesome-widgets 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. * - * * - * awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ * - ***************************************************************************/ - - -#ifndef DESKTOP_PANEL_H -#define DESKTOP_PANEL_H - -#include -#include -#include - -#include -#include -#include - - -class QGraphicsGridLayout; -class QGraphicsProxyWidget; -class QGraphicsScene; -class DesktopPanel; - - -class CustomPlasmaLabel : public QLabel -{ - Q_OBJECT - -public: - CustomPlasmaLabel(DesktopPanel *wid, - const int num, - const bool debugCmd = false); - ~CustomPlasmaLabel(); - int getNumber(); - -protected: - void enterEvent(QEvent *event); - void mousePressEvent(QMouseEvent *event); - -private: - // debug - bool debug; - // variables - int number; - DesktopPanel *widget; -}; - - -class DesktopPanel : public Plasma::Applet -{ - Q_OBJECT - - typedef struct { - QRect desktop; - QList desktopId; - QList windows; - QList winId; - } DesktopWindowsInfo; - -public: - DesktopPanel(QObject *parent, const QVariantList &args); - ~DesktopPanel(); - void init(); - DesktopWindowsInfo getInfoByDesktop(const int num); - QString parsePattern(const QString rawLine, const int num); - -public slots: - // configuration interface - void configAccepted(); - void configChanged(); - // events - void changePanelsState(); - void paintTooltip(const int active); - void setCurrentDesktop(const int number); - -private slots: - void reinit(); - void setFontFormating(); - void setFormating(); - void updateText(const int active); - -protected: - void createConfigurationInterface(KConfigDialog *parent); - -private: - // functions - QList getPanels(); - QString panelLocationToStr(Plasma::Location loc); - // ui - QGraphicsGridLayout *layout = nullptr; - QList proxyWidgets; - QList labels; - // tooltip - Plasma::ToolTipContent toolTip; - QGraphicsScene *toolTipScene = nullptr; - QGraphicsView *toolTipView = nullptr; - // debug - bool debug; - int activeTooltip = -1; - int oldState = 0; - // configuration interface - Ui::AppearanceWidget uiAppConfig; - Ui::ConfigWindow uiWidConfig; - Ui::ToggleWindow uiToggleConfig; - // configuration - QMap configuration; - QStringList desktopNames, currentFormatLine, formatLine; -}; - -K_EXPORT_PLASMA_APPLET(desktop-panel, DesktopPanel) - - -#endif /* DESKTOP_PANEL_H */ diff --git a/sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop b/sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop deleted file mode 100644 index 0a23639..0000000 --- a/sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop +++ /dev/null @@ -1,25 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Desktop Panel -Comment=A minimalistic Plasmoid -Comment[en]=A minimalistic Plasmoid -Comment[es]=Un plasmoide minimalista -Comment[es]=Un script Plasmoïde minimaliste -Comment[pt_BR]=Um script Plasmoid -Comment[ru]=Минималистичный плазмоид -Comment[uk]=Мінімалістичний плазмоїд -X-KDE-ServiceTypes=Plasma/Applet -Type=Service -Icon=utilities-system-monitor - -X-KDE-Library=plasma_applet_desktop-panel - -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis -X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=desktop-panel -X-KDE-PluginInfo-Version=@PROJECT_VERSION@ -X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/ -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPLv3 -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/sources/desktop-panel-kde4/toggle.ui b/sources/desktop-panel-kde4/toggle.ui deleted file mode 100644 index 87a8c4d..0000000 --- a/sources/desktop-panel-kde4/toggle.ui +++ /dev/null @@ -1,56 +0,0 @@ - - - ToggleWindow - - - - 0 - 0 - 480 - 343 - - - - - 480 - 320 - - - - Toggle - - - - - - true - - - - - 0 - 0 - 464 - 327 - - - - - - - To control panels please set widget shortcut. - - - - - - - - - - - - - - - diff --git a/sources/desktop-panel-kde4/widget.ui b/sources/desktop-panel-kde4/widget.ui deleted file mode 100644 index 8d9248b..0000000 --- a/sources/desktop-panel-kde4/widget.ui +++ /dev/null @@ -1,472 +0,0 @@ - - - ConfigWindow - - - - 0 - 0 - 721 - 420 - - - - - 700 - 320 - - - - Widget - - - - - - - - Mark - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - A mark which will be shown if this desktop is active - - - true - - - - # - - - - - $ - - - - - % - - - - - & - - - - - * - - - - - @ - - - - - ¤ - - - - - - - - - - · - - - - - º - - - - - × - - - - - - - - - - - - - - - (current) - - - - - - - - - - - - Font - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - ../awesome-widget../awesome-widget - - - Ctrl+B - - - - - - - - ../awesome-widget../awesome-widget - - - Ctrl+I - - - - - - - - ../awesome-widget../awesome-widget - - - Ctrl+U - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - - ../awesome-widget../awesome-widget - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - fullmark - - - - - mark - - - - - name - - - - - number - - - - - total - - - - - - - - Add - - - - - - - - - QTextEdit::NoWrap - - - false - - - - - - - - - Tooltip width - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - px - - - 100 - - - 1000 - - - 25 - - - - - - - - - - - Window border color on tooltip - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Enable background - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Vertical layout - - - - - - - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - Enable tooltip - - - - - - - - 0 - 0 - - - - - Windows - - - - - Contours - - - - - Clean desktop - - - - - - - - - - - KColorCombo - QComboBox -
kcolorcombo.h
-
-
- - -
diff --git a/sources/desktop-panel-kf5/CMakeLists.txt b/sources/desktop-panel/CMakeLists.txt similarity index 100% rename from sources/desktop-panel-kf5/CMakeLists.txt rename to sources/desktop-panel/CMakeLists.txt diff --git a/sources/desktop-panel-kf5/metadata.desktop b/sources/desktop-panel/metadata.desktop similarity index 100% rename from sources/desktop-panel-kf5/metadata.desktop rename to sources/desktop-panel/metadata.desktop diff --git a/sources/desktop-panel-kf5/package/contents/config/config.qml b/sources/desktop-panel/package/contents/config/config.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/config/config.qml rename to sources/desktop-panel/package/contents/config/config.qml diff --git a/sources/desktop-panel-kf5/package/contents/config/main.xml b/sources/desktop-panel/package/contents/config/main.xml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/config/main.xml rename to sources/desktop-panel/package/contents/config/main.xml diff --git a/sources/desktop-panel-kf5/package/contents/ui/about.qml b/sources/desktop-panel/package/contents/ui/about.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/about.qml rename to sources/desktop-panel/package/contents/ui/about.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml b/sources/desktop-panel/package/contents/ui/activeapp.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/activeapp.qml rename to sources/desktop-panel/package/contents/ui/activeapp.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/advanced.qml b/sources/desktop-panel/package/contents/ui/advanced.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/advanced.qml rename to sources/desktop-panel/package/contents/ui/advanced.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/general.qml b/sources/desktop-panel/package/contents/ui/general.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/general.qml rename to sources/desktop-panel/package/contents/ui/general.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml b/sources/desktop-panel/package/contents/ui/inactiveapp.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml rename to sources/desktop-panel/package/contents/ui/inactiveapp.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/main.qml b/sources/desktop-panel/package/contents/ui/main.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/main.qml rename to sources/desktop-panel/package/contents/ui/main.qml diff --git a/sources/desktop-panel-kf5/package/contents/ui/qmldir b/sources/desktop-panel/package/contents/ui/qmldir similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/qmldir rename to sources/desktop-panel/package/contents/ui/qmldir diff --git a/sources/desktop-panel-kf5/package/contents/ui/widget.qml b/sources/desktop-panel/package/contents/ui/widget.qml similarity index 100% rename from sources/desktop-panel-kf5/package/contents/ui/widget.qml rename to sources/desktop-panel/package/contents/ui/widget.qml diff --git a/sources/desktop-panel-kf5/package/metadata.desktop b/sources/desktop-panel/package/metadata.desktop similarity index 100% rename from sources/desktop-panel-kf5/package/metadata.desktop rename to sources/desktop-panel/package/metadata.desktop diff --git a/sources/desktop-panel-kf5/plugin/CMakeLists.txt b/sources/desktop-panel/plugin/CMakeLists.txt similarity index 100% rename from sources/desktop-panel-kf5/plugin/CMakeLists.txt rename to sources/desktop-panel/plugin/CMakeLists.txt diff --git a/sources/desktop-panel-kf5/plugin/desktoppanel.cpp b/sources/desktop-panel/plugin/desktoppanel.cpp similarity index 100% rename from sources/desktop-panel-kf5/plugin/desktoppanel.cpp rename to sources/desktop-panel/plugin/desktoppanel.cpp diff --git a/sources/desktop-panel-kf5/plugin/desktoppanel.h b/sources/desktop-panel/plugin/desktoppanel.h similarity index 100% rename from sources/desktop-panel-kf5/plugin/desktoppanel.h rename to sources/desktop-panel/plugin/desktoppanel.h diff --git a/sources/desktop-panel-kf5/plugin/dpadds.cpp b/sources/desktop-panel/plugin/dpadds.cpp similarity index 100% rename from sources/desktop-panel-kf5/plugin/dpadds.cpp rename to sources/desktop-panel/plugin/dpadds.cpp diff --git a/sources/desktop-panel-kf5/plugin/dpadds.h b/sources/desktop-panel/plugin/dpadds.h similarity index 100% rename from sources/desktop-panel-kf5/plugin/dpadds.h rename to sources/desktop-panel/plugin/dpadds.h diff --git a/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc b/sources/desktop-panel/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc similarity index 100% rename from sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc rename to sources/desktop-panel/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc diff --git a/sources/desktop-panel-kf5/plugin/qmldir b/sources/desktop-panel/plugin/qmldir similarity index 100% rename from sources/desktop-panel-kf5/plugin/qmldir rename to sources/desktop-panel/plugin/qmldir diff --git a/sources/extsysmon/CMakeLists.txt b/sources/extsysmon/CMakeLists.txt index 1496b55..ab2ca19 100644 --- a/sources/extsysmon/CMakeLists.txt +++ b/sources/extsysmon/CMakeLists.txt @@ -4,28 +4,20 @@ set (PLUGIN_NAME ${SUBPROJECT}) message (STATUS "Subproject ${SUBPROJECT}") # find required libaries -if (BUILD_KDE4) - find_package (KDE4 REQUIRED) - include (KDE4Defaults) +find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml) +find_package (ECM 0.0.11 REQUIRED NO_MODULE) +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem) - add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - set (KDE_INCLUDE ${KDE4_INCLUDES}) -else () - find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml) - find_package (ECM 0.0.11 REQUIRED NO_MODULE) - set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) - find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem) +include (KDEInstallDirs) +include (KDECMakeSettings) +include (KDECompilerSettings) - include (KDEInstallDirs) - include (KDECMakeSettings) - include (KDECompilerSettings) - - add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} - ${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS}) - set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS}) - set (KDE_INCLUDE ${Plasma_INCLUDE_DIR}) -endif () +add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} + ${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS}) +set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS}) +set (KDE_INCLUDE ${Plasma_INCLUDE_DIR}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} @@ -49,26 +41,15 @@ set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade) configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) # make -if (BUILD_KDE4) - qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) - kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) - kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) - target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} - ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY}) -else () - qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) - qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI}) - add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE}) - target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem - ${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES}) - kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) -endif () +qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) +qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI}) +add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE}) +target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem + ${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES}) +kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) # install -if (BUILD_KDE4) - install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -else () - install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) +install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) endif () install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp index 0eedca6..f0da21f 100644 --- a/sources/extsysmon/extsysmon.cpp +++ b/sources/extsysmon/extsysmon.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -42,14 +43,6 @@ #include "extupgrade.h" #include "version.h" -// KF5-KDE4 compability -#ifdef BUILD_KDE4 -#include -#include -#else -#include -#endif /* BUILD_KDE4 */ - ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args) : Plasma::DataEngine(parent, args) @@ -137,25 +130,15 @@ void ExtendedSysMon::initQuotes() if (debug) qDebug() << PDEBUG; // create directory at $HOME and create dirs list - QString localDir; - QStringList dirs; -#ifdef BUILD_KDE4 - localDir = KStandardDirs::locateLocal("data", "awesomewidgets/quotes"); - if (KStandardDirs::makeDir(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/quotes"); -#else - localDir = QString("%1/awesomewidgets/quotes") - .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); + QString localDir = QString("%1/awesomewidgets/quotes") + .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); QDir localDirectory; if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/quotes"), - QStandardPaths::LocateDirectory); -#endif /* BUILD_KDE4 */ + QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QString("awesomewidgets/quotes"), + QStandardPaths::LocateDirectory); QStringList names; for (int i=0; ifindDirs("data", "awesomewidgets/scripts"); -#else - localDir = QString("%1/awesomewidgets/scripts") - .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); + QString localDir = QString("%1/awesomewidgets/scripts") + .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); QDir localDirectory; if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/scripts"), - QStandardPaths::LocateDirectory); -#endif /* BUILD_KDE4 */ + QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QString("awesomewidgets/scripts"), + QStandardPaths::LocateDirectory); QStringList names; for (int i=0; ifindDirs("data", "awesomewidgets/upgrade"); -#else - localDir = QString("%1/awesomewidgets/upgrade") - .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); + QString localDir = QString("%1/awesomewidgets/upgrade") + .arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); QDir localDirectory; if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/upgrade"), - QStandardPaths::LocateDirectory); -#endif /* BUILD_KDE4 */ + QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QString("awesomewidgets/upgrade"), + QStandardPaths::LocateDirectory); QStringList names; for (int i=0; ifindResource("config", "plasma-dataengine-extsysmon.conf"); -#else - fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf")); -#endif /* BUILD_KDE4 */ + QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, + QString("plasma-dataengine-extsysmon.conf")); if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QSettings settings(fileName, QSettings::IniFormat); QMap rawConfig; @@ -763,10 +722,6 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) } -#ifdef BUILD_KDE4 -K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon) -#else K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json") -#endif /* BUILD_KDE4 */ #include "extsysmon.moc" diff --git a/sources/translations/CMakeLists.txt b/sources/translations/CMakeLists.txt index b2c7357..f02e852 100644 --- a/sources/translations/CMakeLists.txt +++ b/sources/translations/CMakeLists.txt @@ -1,13 +1,9 @@ find_package(Gettext REQUIRED) -if (BUILD_KDE4) - find_package (KDE4 REQUIRED) -else () - 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 (KF5 REQUIRED COMPONENTS I18n) - include (KDEInstallDirs) -endif () +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 (KF5 REQUIRED COMPONENTS I18n) +include (KDEInstallDirs) add_subdirectory (awesome-widget) add_subdirectory (desktop-panel) diff --git a/sources/translations/awesome-widget/CMakeLists.txt b/sources/translations/awesome-widget/CMakeLists.txt index 00b0c06..573d989 100644 --- a/sources/translations/awesome-widget/CMakeLists.txt +++ b/sources/translations/awesome-widget/CMakeLists.txt @@ -1,8 +1,4 @@ -if (BUILD_KDE4) - set (MO_NAME plasma_applet_awesome-widget.mo) -else () - set (MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo) -endif () +set (MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo) file (GLOB _po_files *.po) set (_gmoFiles) diff --git a/sources/translations/desktop-panel/CMakeLists.txt b/sources/translations/desktop-panel/CMakeLists.txt index 2880a63..e513588 100644 --- a/sources/translations/desktop-panel/CMakeLists.txt +++ b/sources/translations/desktop-panel/CMakeLists.txt @@ -1,8 +1,4 @@ -if (BUILD_KDE4) - set (MO_NAME plasma_applet_desktop-panel.mo) -else () - set (MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo) -endif () +set (MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo) file (GLOB _po_files *.po) set (_gmoFiles) diff --git a/sources/version.h.in b/sources/version.h.in index a4ed748..c7909cf 100644 --- a/sources/version.h.in +++ b/sources/version.h.in @@ -35,6 +35,5 @@ // cmake properties #define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" #define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -#cmakedefine BUILD_KDE4 #endif /* VERSION_H */