diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index ef434d6..587e31c 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -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") @@ -42,13 +36,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-kf5/CMakeLists.txt b/sources/awesome-widget-kf5/CMakeLists.txt deleted file mode 100644 index 54e4dbe..0000000 --- a/sources/awesome-widget-kf5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# set project name -set (SUBPROJECT plasma_applet_awesome-widget) -message (STATUS "Subproject ${SUBPROJECT}") - -# prepare -configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop) - -find_package (ECM 0.0.12 REQUIRED NO_MODULE) -set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) - -find_package (Qt5 REQUIRED COMPONENTS Core Network Qml) -find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma) - -include (KDEInstallDirs) -include (KDECMakeSettings) -include (KDECompilerSettings) - -add_subdirectory (plugin) -plasma_install_package (package org.kde.plasma.awesomewidget) diff --git a/sources/awesome-widget-kf5/metadata.desktop b/sources/awesome-widget-kf5/metadata.desktop deleted file mode 100644 index e87c445..0000000 --- a/sources/awesome-widget-kf5/metadata.desktop +++ /dev/null @@ -1,28 +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-ServiceTypes=Plasma/Applet -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-Plasma-RemoteLocation= - -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis -X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget -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-kf5/package/contents/config/config.qml b/sources/awesome-widget-kf5/package/contents/config/config.qml deleted file mode 100644 index ad08409..0000000 --- a/sources/awesome-widget-kf5/package/contents/config/config.qml +++ /dev/null @@ -1,59 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 - -import org.kde.plasma.configuration 2.0 - - -ConfigModel { - ConfigCategory { - name: i18n("Widget") - icon: "utilities-system-monitor" - source: "widget.qml" - } - - ConfigCategory { - name: i18n("Advanced") - icon: "system-run" - source: "advanced.qml" - } - - ConfigCategory { - name: i18n("Tooltip") - icon: "preferences-desktop-color" - source: "tooltip.qml" - } - - ConfigCategory { - name: i18n("Appearance") - icon: "preferences-desktop-theme" - source: "appearance.qml" - } - - ConfigCategory { - name: i18n("DataEngine") - icon: "utilities-system-monitor" - source: "dataengine.qml" - } - - ConfigCategory { - name: i18n("About") - icon: "help-about" - source: "about.qml" - } -} diff --git a/sources/awesome-widget-kf5/package/contents/config/main.xml b/sources/awesome-widget-kf5/package/contents/config/main.xml deleted file mode 100644 index 1bb2b8c..0000000 --- a/sources/awesome-widget-kf5/package/contents/config/main.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - [cpu: $cpu%] [mem: $mem%] [swap: $swap%] [$netdev: $down/$upKB/s] - - - - - - - true - - - true - - - $hh:$mm - - - $dd,$hh,$mm - - - Celsius - - - (*) - - - ( ) - - - true - - - - - - 100 - - - true - - - #ffffff - - - true - - - #ff0000 - - - true - - - #00ff00 - - - true - - - #0000ff - - - true - - - #ffff00 - - - true - - - #00ffff - - - #ff00ff - - - true - - - #008800 - - - #880000 - - - - - - - 1000 - - - center - - - Terminus - - - 12 - - - #000000 - - - normal - - - normal - - - - diff --git a/sources/awesome-widget-kf5/package/contents/ui/about.qml b/sources/awesome-widget-kf5/package/contents/ui/about.qml deleted file mode 100644 index 2356434..0000000 --- a/sources/awesome-widget-kf5/package/contents/ui/about.qml +++ /dev/null @@ -1,99 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Layouts 1.0 as QtLayouts - -import org.kde.plasma.private.awesomewidget 1.0 - - -Item { - id: aboutPage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: AWKeys.isDebugEnabled() - - - Column { - id: pageColumn - width: units.gridUnit * 25 - QtControls.TabView { - height: parent.height - width: parent.width - QtControls.Tab { - title: i18n("About") - - QtLayouts.ColumnLayout { - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - text: AWActions.getAboutText("header") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignJustify - text: AWActions.getAboutText("description") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignLeft - textFormat: Text.RichText - text: AWActions.getAboutText("links") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - font.capitalization: Font.SmallCaps - horizontalAlignment: Text.AlignHCenter - textFormat: Text.RichText - text: AWActions.getAboutText("copy") - } - } - } - - QtControls.Tab { - title: i18n("Acknowledgment") - - QtLayouts.ColumnLayout { - QtControls.Label { - QtLayouts.Layout.fillWidth: true - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignJustify - text: AWActions.getAboutText("translators") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignJustify - textFormat: Text.RichText - text: AWActions.getAboutText("3rdparty") - } - } - } - } - } - - Component.onCompleted: { - if (debug) console.log("[about::onCompleted]") - } -} diff --git a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml deleted file mode 100644 index 8d660d9..0000000 --- a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml +++ /dev/null @@ -1,290 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import org.kde.plasma.core 2.0 as PlasmaCore - -import org.kde.plasma.private.awesomewidget 1.0 - - -Item { - id: advancedPage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: AWKeys.isDebugEnabled() - property variant settings: { - "customTime": plasmoid.configuration.customTime, - "customUptime": plasmoid.configuration.customUptime, - "tempUnits": plasmoid.configuration.tempUnits, - "acOnline": plasmoid.configuration.acOnline, - "acOffline": plasmoid.configuration.acOffline - } - property variant tooltipSettings: { - "tooltipNumber": plasmoid.configuration.tooltipNumber, - "useTooltipBackground": plasmoid.configuration.useTooltipBackground, - "tooltipBackgroung": plasmoid.configuration.tooltipBackgroung, - "cpuTooltip": plasmoid.configuration.cpuTooltip, - "cpuclTooltip": plasmoid.configuration.cpuclTooltip, - "memTooltip": plasmoid.configuration.memTooltip, - "swapTooltip": plasmoid.configuration.swapTooltip, - "downTooltip": plasmoid.configuration.downTooltip, - "upTooltip": plasmoid.configuration.downTooltip, - "batTooltip": plasmoid.configuration.batTooltip, - "cpuTooltipColor": plasmoid.configuration.cpuTooltipColor, - "cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor, - "memTooltipColor": plasmoid.configuration.memTooltipColor, - "swapTooltipColor": plasmoid.configuration.swapTooltipColor, - "downTooltipColor": plasmoid.configuration.downTooltipColor, - "upTooltipColor": plasmoid.configuration.upTooltipColor, - "batTooltipColor": plasmoid.configuration.batTooltipColor, - "batInTooltipColor": plasmoid.configuration.batInTooltipColor - } - - property alias cfg_notify: notify.checked - property alias cfg_background: background.checked - property alias cfg_customTime: customTime.text - property alias cfg_customUptime: customUptime.text - property string cfg_tempUnits: tempUnits.currentText - property alias cfg_acOnline: acOnline.text - property alias cfg_acOffline: acOffline.text - - - Column { - id: pageColumn - width: units.gridUnit * 25 - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.heigth - width: parent.width * 2 / 5 - } - QtControls.CheckBox { - id: notify - width: parent.width * 3 / 5 - text: i18n("Enable notifications") - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.heigth - width: parent.width * 2 / 5 - } - QtControls.CheckBox { - id: background - width: parent.width * 3 / 5 - text: i18n("Enable background") - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Custom time format") - } - QtControls.TextField { - id: customTime - width: parent.width * 3 / 5 - text: plasmoid.configuration.customTime - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Custom uptime format") - } - QtControls.TextField { - id: customUptime - width: parent.width * 3 / 5 - text: plasmoid.configuration.customUptime - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Temperature units") - } - QtControls.ComboBox { - id: tempUnits - width: parent.width * 3 / 5 - textRole: "label" - model: [ - { - 'label': i18n("Celsius"), - 'name': "Celsius" - }, - { - 'label': i18n("Fahrenheit"), - 'name': "Fahrenheit" - }, - { - 'label': i18n("Kelvin"), - 'name': "Kelvin" - }, - { - 'label': i18n("Reaumur"), - 'name': "Reaumur" - }, - { - 'label': i18n("cm^-1"), - 'name': "cm^-1" - }, - { - 'label': i18n("kJ/mol"), - 'name': "kJ/mol" - }, - { - 'label': i18n("kcal/mol"), - 'name': "kcal/mol" - } - ] - onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.tempUnits) { - tempUnits.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("AC online tag") - } - QtControls.TextField { - id: acOnline - width: parent.width * 3 / 5 - text: plasmoid.configuration.acOnline - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("AC offline tag") - } - QtControls.TextField { - id: acOffline - width: parent.width * 3 / 5 - text: plasmoid.configuration.acOffline - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Bars") - } - QtControls.Button { - width: parent.width * 3 / 5 - text: i18n("Edit bars") - onClicked: AWKeys.editItem("graphicalitem") - } - } - } - - // we need to initializate DataEngines here too - // because we need to get keys and values - PlasmaCore.DataSource { - id: systemmonitorDE - engine: "systemmonitor" - connectedSources: systemmonitorDE.sources - interval: 5000 - - onNewData: { - if (debug) console.log("[advanced::onNewData] : Update source " + sourceName) - - AWKeys.setDataBySource(sourceName, data, settings) - } - } - - PlasmaCore.DataSource { - id: extsysmonDE - engine: "extsysmon" - connectedSources: ["battery", "custom", "desktop", "netdev", "gpu", - "gputemp", "hddtemp", "pkg", "player", "ps", "update"] - interval: 5000 - - onNewData: { - if (debug) console.log("[advanced::onNewData] : Update source " + sourceName) - - AWKeys.setDataBySource(sourceName, data, settings) - } - } - - PlasmaCore.DataSource { - id: timeDE - engine: "time" - connectedSources: ["Local"] - interval: 5000 - - onNewData: { - if (debug) console.log("[advanced::onNewData] : Update source " + sourceName) - - AWKeys.setDataBySource(sourceName, data, settings) - } - } - - Component.onCompleted: { - if (debug) console.log("[advanced::onCompleted]") - - // init submodule - AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings) - } -} diff --git a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml b/sources/awesome-widget-kf5/package/contents/ui/appearance.qml deleted file mode 100644 index 0ca5464..0000000 --- a/sources/awesome-widget-kf5/package/contents/ui/appearance.qml +++ /dev/null @@ -1,239 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Controls.Styles 1.3 as QtStyles -import QtQuick.Dialogs 1.1 as QtDialogs - -import org.kde.plasma.private.awesomewidget 1.0 - - -Item { - id: appearancePage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: AWKeys.isDebugEnabled() - property variant weight: { - 25: 0, - 50: 1, - 63: 3, - 75: 4, - 87: 5 - } - - property alias cfg_interval: update.value - property alias cfg_fontFamily: selectFont.text - property alias cfg_fontSize: fontSize.value - property string cfg_fontWeight: fontWeight.currentText - property string cfg_fontStyle: fontStyle.currentText - property alias cfg_fontColor: selectColor.text - - - Column { - id: pageColumn - width: units.gridUnit * 25 - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Time interval") - } - QtControls.SpinBox { - id: update - width: parent.width * 2 / 3 - minimumValue: 1000 - maximumValue: 10000 - stepSize: 500 - value: plasmoid.configuration.interval - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font") - } - QtControls.Button { - id: selectFont - width: parent.width * 2 / 3 - text: plasmoid.configuration.fontFamily - onClicked: fontDialog.visible = true - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font size") - } - QtControls.SpinBox { - id: fontSize - width: parent.width * 2 / 3 - minimumValue: 8 - maximumValue: 32 - stepSize: 1 - value: plasmoid.configuration.fontSize - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font weight") - } - QtControls.ComboBox { - id: fontWeight - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("light"), - 'name': "light" - }, - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("demi bold"), - 'name': "demibold" - }, - { - 'label': i18n("bold"), - 'name': "bold" - }, - { - 'label': i18n("black"), - 'name': "black" - } - ] - onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.fontWeight) { - fontWeight.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font style") - } - QtControls.ComboBox { - id: fontStyle - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("italic"), - 'name': "italic" - } - ] - onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.fontStyle) { - fontStyle.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font color") - } - QtControls.Button { - id: selectColor - width: parent.width * 2 / 3 - style: QtStyles.ButtonStyle { - background: Rectangle { - color: plasmoid.configuration.fontColor - } - } - text: plasmoid.configuration.fontColor - onClicked: colorDialog.visible = true - } - } - } - - QtDialogs.ColorDialog { - id: colorDialog - title: i18n("Select a color") - color: selectColor.text - onAccepted: selectColor.text = colorDialog.color - } - - QtDialogs.FontDialog { - id: fontDialog - title: i18n("Select a font") - font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal }) - onAccepted: { - selectFont.text = fontDialog.font.family - fontSize.value = fontDialog.font.pointSize - fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0 - fontWeight.currentIndex = weight[fontDialog.font.weight] - } - } - - Component.onCompleted: { - if (debug) console.log("[appearance::onCompleted]") - } -} diff --git a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml b/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml deleted file mode 100644 index 4e18e59..0000000 --- a/sources/awesome-widget-kf5/package/contents/ui/dataengine.qml +++ /dev/null @@ -1,271 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 as QtControls -import QtQuick.Dialogs 1.1 as QtDialogs -import QtQuick.Layouts 1.0 as QtLayouts -import QtQuick.Controls.Styles 1.3 as QtStyles - -import org.kde.plasma.private.awesomewidget 1.0 - - -Item { - id: dataenginePage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: AWKeys.isDebugEnabled() - property variant tooltipSettings: { - "tooltipNumber": plasmoid.configuration.tooltipNumber, - "useTooltipBackground": plasmoid.configuration.useTooltipBackground, - "tooltipBackgroung": plasmoid.configuration.tooltipBackgroung, - "cpuTooltip": plasmoid.configuration.cpuTooltip, - "cpuclTooltip": plasmoid.configuration.cpuclTooltip, - "memTooltip": plasmoid.configuration.memTooltip, - "swapTooltip": plasmoid.configuration.swapTooltip, - "downTooltip": plasmoid.configuration.downTooltip, - "upTooltip": plasmoid.configuration.downTooltip, - "batTooltip": plasmoid.configuration.batTooltip, - "cpuTooltipColor": plasmoid.configuration.cpuTooltipColor, - "cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor, - "memTooltipColor": plasmoid.configuration.memTooltipColor, - "swapTooltipColor": plasmoid.configuration.swapTooltipColor, - "downTooltipColor": plasmoid.configuration.downTooltipColor, - "upTooltipColor": plasmoid.configuration.upTooltipColor, - "batTooltipColor": plasmoid.configuration.batTooltipColor, - "batInTooltipColor": plasmoid.configuration.batInTooltipColor - } - - property variant cfg_dataengine: AWActions.readDataEngineConfiguration() - - Column { - id: pageColumn - width: units.gridUnit * 25 - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("ACPI path") - } - QtControls.TextField { - width: parent.width * 3 / 5 - text: cfg_dataengine["ACPIPATH"] - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Custom scripts") - } - QtControls.Button { - width: parent.width * 3 / 5 - text: i18n("Edit scripts") - onClicked: AWKeys.editItem("extscript") - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("GPU device") - } - QtControls.ComboBox { - id: gpuDev - width: parent.width * 3 / 5 - model: ["auto", "disable", "ati", "nvidia"] - onCurrentIndexChanged: cfg_dataengine["GPUDEV"] = gpuDev.currentText - Component.onCompleted: { - for (var i=0; iproject homepage") - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Button { - text: i18n("Font") - iconName: "font" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Font button") - - var defaultFont = { - "color": plasmoid.configuration.fontColor, - "family": plasmoid.configuration.fontFamily, - "size": plasmoid.configuration.fontSize - } - var font = AWActions.getFont(defaultFont) - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + - selected + "") - } - } - QtControls.Button { - iconName: "format-indent-more" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Indent button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, selected + "
\n") - } - } - - QtControls.Button { - iconName: "format-text-bold" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Bold button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-italic" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Italic button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-underline" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Underline button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-strikethrough" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Strike button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - - QtControls.Button { - iconName: "format-justify-left" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Left button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "

" + selected + "" + selected + "" + selected + "" + selected + " -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "extscript.h" -#include "graphicalitem.h" -#include "version.h" - - -AWActions::AWActions(QObject *parent) - : QObject(parent) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - debug = (debugEnv == QString("yes")); -} - - -AWActions::~AWActions() -{ - if (debug) qDebug() << PDEBUG; -} - - -void AWActions::checkUpdates() -{ - if (debug) qDebug() << PDEBUG; - - QNetworkAccessManager *manager = new QNetworkAccessManager(this); - connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(versionReplyRecieved(QNetworkReply *))); - - manager->get(QNetworkRequest(QUrl(VERSION_API))); -} - - -void AWActions::runCmd(const QString cmd) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd; - - QProcess command; - sendNotification(QString("Info"), i18n("Run %1", cmd)); - - command.startDetached(cmd); -} - - -void AWActions::sendEmail() -{ - if (debug) qDebug() << PDEBUG; -} - - -void AWActions::showReadme() -{ - if (debug) qDebug() << PDEBUG; - - QDesktopServices::openUrl(QString(HOMEPAGE)); -} - - -QString AWActions::getAboutText(const QString type) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Type" << type; - - QString text; - if (type == QString("header")) - text = QString(NAME); - else if (type == QString("description")) - text = i18n("A set of minimalistic plasmoid widgets"); - else if (type == QString("links")) - text = 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")) + - QString("%2").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages")); - else if (type == QString("copy")) - text = QString("© %1 %3
").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + - i18n("This software is licensed under %1", QString(LICENSE)) + QString("
"); - else if (type == QString("translators")) - text = i18n("Translators: %1", QString(TRANSLATORS)); - else if (type == QString("3rdparty")) { - 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]); - text = i18n("This software uses: %1", trdPartyList.join(QString(", "))); - } - - return text; -} - - -QMap AWActions::getFont(const QMap defaultFont) -{ - if (debug) qDebug() << PDEBUG; - - QMap fontMap; - CFont defaultCFont = CFont(defaultFont[QString("family")].toString(), - defaultFont[QString("size")].toInt(), - 400, false, defaultFont[QString("color")].toString()); - CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, - false, false); - fontMap[QString("color")] = font.color().name(); - fontMap[QString("family")] = font.family(); - fontMap[QString("size")] = font.pointSize(); - - return fontMap; -} - - -QMap AWActions::readDataEngineConfiguration() -{ - if (debug) qDebug() << PDEBUG; - - QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf")); - if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; - QSettings settings(fileName, QSettings::IniFormat); - QMap configuration; - - settings.beginGroup(QString("Configuration")); - configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/")); - configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto")); - configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all")); - configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp")); - configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost")); - configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600")); - configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto")); - configuration[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris")); - settings.endGroup(); - - return configuration; -} - - -void AWActions::writeDataEngineConfiguration(const QMap configuration) -{ - if (debug) qDebug() << PDEBUG; - - QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/plasma-dataengine-extsysmon.conf"); - QSettings settings(fileName, QSettings::IniFormat); - if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName(); - - settings.beginGroup(QString("Configuration")); - settings.setValue(QString("ACPIPATH"), configuration[QString("ACPIPATH")]); - settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]); - settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]); - settings.setValue(QString("HDDTEMPCMD"), configuration[QString("HDDTEMPCMD")]); - settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]); - settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]); - settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]); - settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]); - settings.endGroup(); - - settings.sync(); -} - - -void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup) -{ - if ((eventId == QString("event")) && (!enablePopup)) return; - - KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: ") + eventId, message); - notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget")); -} - - -void AWActions::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; - } -} - - -void AWActions::versionReplyRecieved(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 -#include -#include - - -class QNetworkReply; - -class AWActions : public QObject -{ - Q_OBJECT - -public: - AWActions(QObject *parent = 0); - ~AWActions(); - - Q_INVOKABLE void checkUpdates(); - Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true")); - Q_INVOKABLE void sendEmail(); - Q_INVOKABLE void showReadme(); - // configuration slots - Q_INVOKABLE QString getAboutText(const QString type = "header"); - Q_INVOKABLE QMap getFont(const QMap defaultFont); - // dataengine - Q_INVOKABLE QMap readDataEngineConfiguration(); - Q_INVOKABLE void writeDataEngineConfiguration(const QMap configuration); - -public slots: - Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, const bool enablePopup = false); - -private slots: - void showUpdates(QString version); - void versionReplyRecieved(QNetworkReply *reply); - -private: - // variables - bool debug = false; -}; - - -#endif /* AWACTIONS_H */ diff --git a/sources/awesome-widget-kf5/plugin/awesomewidget.cpp b/sources/awesome-widget-kf5/plugin/awesomewidget.cpp deleted file mode 100644 index 5166107..0000000 --- a/sources/awesome-widget-kf5/plugin/awesomewidget.cpp +++ /dev/null @@ -1,50 +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 "awesomewidget.h" - -#include - -#include "awactions.h" -#include "awkeys.h" - - -static QObject *awactions_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine); - Q_UNUSED(scriptEngine); - - return new AWActions(); -} - - -static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine); - Q_UNUSED(scriptEngine); - - return new AWKeys(); -} - - -void AWPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget")); - - qmlRegisterSingletonType(uri, 1, 0, "AWActions", awactions_singletontype_provider); - qmlRegisterSingletonType(uri, 1, 0, "AWKeys", awkeys_singletontype_provider); -} diff --git a/sources/awesome-widget-kf5/plugin/awesomewidget.h b/sources/awesome-widget-kf5/plugin/awesomewidget.h deleted file mode 100644 index c4c8922..0000000 --- a/sources/awesome-widget-kf5/plugin/awesomewidget.h +++ /dev/null @@ -1,37 +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 AWPLUGIN_H -#define AWPLUGIN_H - -#include - - -class QQmlEngine; - -class AWPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); -}; - - -#endif /* AWPLUGIN_H */ diff --git a/sources/awesome-widget-kf5/plugin/awkeys.cpp b/sources/awesome-widget-kf5/plugin/awkeys.cpp deleted file mode 100644 index 463fc09..0000000 --- a/sources/awesome-widget-kf5/plugin/awkeys.cpp +++ /dev/null @@ -1,1325 +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 "awkeys.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "awactions.h" -#include "awtooltip.h" -#include "extscript.h" -#include "extupgrade.h" -#include "graphicalitem.h" -#include "version.h" - - -AWKeys::AWKeys(QObject *parent) - : QObject(parent) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - debug = (debugEnv == QString("yes")); - - dialog = new QDialog(0); - widgetDialog = new QListWidget(dialog); - dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close, - Qt::Vertical, dialog); - copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole); - createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole); - deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole); - QHBoxLayout *layout = new QHBoxLayout(dialog); - layout->addWidget(widgetDialog); - layout->addWidget(dialogButtons); - dialog->setLayout(layout); - connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this, SLOT(editItemButtonPressed(QAbstractButton *))); - connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject())); -} - - -AWKeys::~AWKeys() -{ - if (debug) qDebug() << PDEBUG; - - delete toolTip; - delete createButton; - delete copyButton; - delete deleteButton; - delete dialogButtons; - delete widgetDialog; - delete dialog; - - graphicalItems.clear(); - extScripts.clear(); - extUpgrade.clear(); -} - - -void AWKeys::initKeys(const QString pattern, - const QMap tooltipParams, - const bool popup) -{ - if (debug) qDebug() << PDEBUG; - - // clear - extScripts.clear(); - extUpgrade.clear(); - graphicalItems.clear(); - keys.clear(); - foundBars.clear(); - foundKeys.clear(); - if (toolTip != nullptr) delete toolTip; - - // init - extScripts = getExtScripts(); - extUpgrade = getExtUpgrade(); - graphicalItems = getGraphicalItems(); - keys = dictKeys(); - foundBars = findGraphicalItems(pattern); - foundKeys = findKeys(pattern); - toolTip = new AWToolTip(this, tooltipParams); - - ready = true; - enablePopup = popup; -} - - -bool AWKeys::isDebugEnabled() -{ - if (debug) qDebug() << PDEBUG; - - return debug; -} - - -QString AWKeys::parsePattern(const QString pattern) -{ - if (debug) qDebug() << PDEBUG; - if (!ready) return pattern; - - QString parsed = pattern; - parsed.replace(QString("$$"), QString("$\\$\\")); - for (int i=0; iimage(valueByKey(foundBars[i]).toFloat())); - parsed.replace(QString("$\\$\\"), QString("$$")); - - return parsed; -} - - -QString AWKeys::toolTipImage() -{ - if(debug) qDebug() << PDEBUG; - - if (!ready) return QString(); - - QPixmap tooltip = toolTip->image(); - QByteArray byteArray; - QBuffer buffer(&byteArray); - tooltip.save(&buffer, "PNG"); - - return QString("").arg(QString(byteArray.toBase64())); -} - - -QSize AWKeys::toolTipSize() -{ - if (debug) qDebug() << PDEBUG; - - return toolTip->getSize(); -} - - -bool AWKeys::addDevice(const QString source) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << source; - - QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)")); - QRegExp fanRegexp = QRegExp(QString("lmsensors/.*/fan.*")); - QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel")); - QRegExp tempRegexp = QRegExp(QString("lmsensors/.*temp.*/.*")); - - if (diskRegexp.indexIn(source) > -1) { - QString device = source; - device.remove(QString("/Rate/rblk")); - diskDevices.append(device); - } else if (fanRegexp.indexIn(source) > -1) - fanDevices.append(source); - else if (mountRegexp.indexIn(source) > -1) { - QString device = source; - device.remove(QString("partitions")).remove(QString("/filllevel")); - mountDevices.append(device); - } else if (tempRegexp.indexIn(source) > -1) - tempDevices.append(source); - - // check sources to be connected - if ((source.endsWith(QString("/TotalLoad"))) || - (source.endsWith(QString("/clock"))) || - (source.endsWith(QString("/AverageClock"))) || - (source.endsWith(QString("/Rate/rblk"))) || - (source.endsWith(QString("/Rate/wblk"))) || - (source.endsWith(QString("/filllevel"))) || - (source.endsWith(QString("/freespace"))) || - (source.endsWith(QString("/usedspace"))) || - (source.endsWith(QString("/receiver/data"))) || - (source.endsWith(QString("/receiver/data"))) || - (source.endsWith(QString("/transmitter/data"))) || - (source.startsWith(QString("lmsensors/"))) || - (source.startsWith(QString("mem/physical/"))) || - (source.startsWith(QString("mem/swap/"))) || - (source == QString("system/uptime")) || - (source == QString("Local")) || - (source == QString("battery")) || - (source == QString("custom")) || - (source == QString("desktop")) || - (source == QString("netdev")) || - (source == QString("gpu")) || - (source == QString("gputemp")) || - (source == QString("hddtemp")) || - (source == QString("pkg")) || - (source == QString("player")) || - (source == QString("ps")) || - (source == QString("update"))) - return true; - else { - if (debug) qDebug() << PDEBUG << ":" << "Source" << source << "not found"; - return false; - } -} - - -QStringList AWKeys::dictKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList allKeys; - // time - allKeys.append(QString("time")); - allKeys.append(QString("isotime")); - allKeys.append(QString("shorttime")); - allKeys.append(QString("longtime")); - allKeys.append(QString("ctime")); - // uptime - allKeys.append(QString("uptime")); - allKeys.append(QString("cuptime")); - // cpuclock - for (int i=numberCpus()-1; i>=0; i--) - allKeys.append(QString("cpucl") + QString::number(i)); - allKeys.append(QString("cpucl")); - // cpu - for (int i=numberCpus()-1; i>=0; i--) - allKeys.append(QString("cpu") + QString::number(i)); - allKeys.append(QString("cpu")); - // temperature - for (int i=tempDevices.count()-1; i>=0; i--) - allKeys.append(QString("temp") + QString::number(i)); - for (int i=fanDevices.count()-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=mountDevices.count()-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=diskDevices.count()-1; i>=0; i--) { - allKeys.append(QString("hddr") + QString::number(i)); - allKeys.append(QString("hddw") + QString::number(i)); - } - // hdd temp - for (int i=getHddDevices().count()-1; i>=0; i--) { - allKeys.append(QString("hddtemp") + QString::number(i)); - allKeys.append(QString("hddtemp") + QString::number(i)); - } - // network - for (int i=getNetworkDevices().count()-1; i>=0; i--) { - allKeys.append(QString("down") + QString::number(i)); - allKeys.append(QString("up") + QString::number(i)); - } - allKeys.append(QString("down")); - allKeys.append(QString("up")); - allKeys.append(QString("netdev")); - // battery - allKeys.append(QString("ac")); - QStringList allBatteryDevices = QDir(QString("/sys/class/power_supply")) - .entryList(QDir::Dirs | QDir::NoDotAndDotDot, - QDir::Name); - for (int i=allBatteryDevices.filter(QRegExp(QString("BAT.*"))).count()-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=extUpgrade.count()-1; i>=0; i--) - allKeys.append(QString("pkgcount") + QString::number(i)); - // custom - for (int i=extScripts.count()-1; i>=0; i--) - allKeys.append(QString("custom") + QString::number(i)); - // desktop - allKeys.append(QString("desktop")); - allKeys.append(QString("ndesktop")); - allKeys.append(QString("tdesktops")); - // bars - QStringList graphicalItemsKeys; - for (int i=0; iname() + graphicalItems[i]->bar()); - graphicalItemsKeys.sort(); - for (int i=graphicalItemsKeys.count()-1; i>=0; i--) - allKeys.append(graphicalItemsKeys[i]); - - return allKeys; -} - - -QStringList AWKeys::getDiskDevices() -{ - if (debug) qDebug() << PDEBUG; - - diskDevices.sort(); - - return diskDevices; -} - - -QStringList AWKeys::getFanDevices() -{ - if (debug) qDebug() << PDEBUG; - - fanDevices.sort(); - - return fanDevices; -} - - -QStringList AWKeys::getHddDevices(const bool needAbstract) -{ - if (debug) qDebug() << PDEBUG; - - QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name); - QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$"))); - for (int i=0; i rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; i data, - const QMap params) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName; - - if (sourceName == QString("update")) return true; - - // checking - if (!checkKeys(data)) return false; - if (!ready) return false; - - // 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 (sourceName == QString("battery")) { - // battery - for (int i=0; isetData(QString("batTooltip"), data[data.keys()[i]].toFloat(), data[QString("ac")].toBool()); - } - } - } else if (sourceName == QString("cpu/system/TotalLoad")) { - // cpu - // notification - if ((data[QString("value")].toFloat() >= 90.0) && (values[QString("cpu")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High CPU load"), enablePopup); - // value - values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - toolTip->setData(QString("cpuTooltip"), data[QString("value")].toFloat()); - } else if (sourceName.contains(cpuRegExp)) { - // cpus - QString number = sourceName; - number.remove(QString("cpu/cpu")).remove(QString("/TotalLoad")); - values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - } else if (sourceName == QString("cpu/system/AverageClock")) { - // cpucl - values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - toolTip->setData(QString("cpuclTooltip"), data[QString("value")].toFloat()); - } else if (sourceName.contains(cpuclRegExp)) { - // cpucls - QString number = sourceName; - number.remove(QString("cpu/cpu")).remove(QString("/clock")); - values[QString("cpucl") + number] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0); - } else if (sourceName == QString("custom")) { - // custom - for (int i=0; i= 90.0) && (values[QString("gpu")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High GPU load"), enablePopup); - // value - values[QString("gpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - } else if (sourceName == QString("gputemp")) { - // gpu temperature - values[QString("gputemp")] = QString("%1").arg( - temperature(data[QString("value")].toFloat(), params[QString("tempUnits")].toString()), 4, 'f', 1); - } else if (sourceName.contains(mountFillRegExp)) { - // fill level - QString mount = sourceName; - mount.remove(QString("partitions")).remove(QString("/filllevel")); - for (int i=0; i= 90.0) && (values[QString("hdd") + QString::number(i)].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount), enablePopup); - values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); - break; - } - } else if (sourceName.contains(mountFreeRegExp)) { - // free space - QString mount = sourceName; - mount.remove(QString("partitions")).remove(QString("/freespace")); - for (int i=0; i= 90.0) && (values[QString("mem")].toFloat() < 90.0)) - AWActions::sendNotification(QString("event"), i18n("High memory usage"), enablePopup); - // value - values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1); - toolTip->setData(QString("memTooltip"), values[QString("mem")].toFloat()); - } else if (sourceName == QString("netdev")) { - // network device - // notification - if (values[QString("netdev")] != data[QString("value")].toString()) - AWActions::sendNotification(QString("event"), i18n("Network device has been changed to %1", - data[QString("value")].toString()), - enablePopup); - // value - values[QString("netdev")] = data[QString("value")].toString(); - } else if (sourceName.contains(netRecRegExp)) { - // download speed - QString device = sourceName; - device.remove(QString("network/interfaces/")).remove(QString("/receiver/data")); - QStringList allNetworkDevices = getNetworkDevices(); - for (int i=0; isetData(QString("downTooltip"), data[QString("value")].toFloat()); - } - } else if (sourceName.contains(netTransRegExp)) { - // upload speed - QString device = sourceName; - device.remove(QString("network/interfaces/")).remove(QString("/transmitter/data")); - QStringList allNetworkDevices = getNetworkDevices(); - for (int i=0; isetData(QString("upTooltip"), data[QString("value")].toFloat()); - } - } else if (sourceName == QString("pkg")) { - // package manager - for (int i=0; i 0.0) && (values[QString("swap")].toFloat() == 0.0)) - AWActions::sendNotification(QString("event"), i18n("Swap is used"), enablePopup); - // value - values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1); - toolTip->setData(QString("swapTooltip"), values[QString("swap")].toFloat()); - } else if (sourceName.contains(tempRegExp)) { - // temperature devices - if (data[QString("units")].toString() == QString("rpm")) { - for (int i=0; i"); - message += i18n("Value: %1", valueByKey(tag)); - - return AWActions::sendNotification(QString("tag"), message); -} - - -QString AWKeys::infoByKey(QString key) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; - - key.remove(QRegExp(QString("^bar[0-9]{1,}"))); - if (key.startsWith(QString("custom"))) - return QString("%1").arg(extScripts[key.remove(QString("custom")).toInt()]->executable()); - else if (key.contains(QRegExp(QString("^hdd[rw]")))) - return QString("%1").arg(diskDevices[key.remove(QRegExp(QString("hdd[rw]"))).toInt()]); - else if (key.startsWith(QString("fan"))) - return QString("%1").arg(fanDevices[key.remove(QString("fan")).toInt()]); - else if (key.contains(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))) - return QString("%1").arg(mountDevices[key.remove(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))).toInt()]); - else if (key.startsWith(QString("hddtemp"))) - return QString("%1").arg(getHddDevices()[key.remove(QString("hddtemp")).toInt()]); - else if (key.contains(QRegExp(QString("^(down|up)[0-9]")))) - return QString("%1").arg(getNetworkDevices()[key.remove(QRegExp(QString("^(down|up)"))).toInt()]); - else if (key.startsWith(QString("pkgcount"))) - return QString("%1").arg(extUpgrade[key.remove(QString("pkgcount")).toInt()]->executable()); - else if (key.startsWith(QString("temp"))) - return QString("%1").arg(tempDevices[key.remove(QString("temp")).toInt()]); - - return QString("(none)"); -} - - -QString AWKeys::valueByKey(QString key) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; - - key.remove(QRegExp(QString("^bar[0-9]{1,}"))); - - return values[key]; -} - - -void AWKeys::editItem(const QString type) -{ - if (debug) qDebug() << PDEBUG; - - widgetDialog->clear(); - if (type == QString("graphicalitem")) { - requestedItem = RequestedGraphicalItem; - 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'))); - widgetDialog->addItem(item); - } - } else if (type == QString("extscript")) { - requestedItem = RequestedExtScript; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", extScripts[i]->name())); - tooltip.append(i18n("Comment: %1", extScripts[i]->comment())); - tooltip.append(i18n("Exec: %1", extScripts[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } else if (type == QString("extupgrade")) { - requestedItem = RequestedExtUpgrade; - for (int i=0; ifileName()); - QStringList tooltip; - tooltip.append(i18n("Name: %1", extUpgrade[i]->name())); - tooltip.append(i18n("Comment: %1", extUpgrade[i]->comment())); - tooltip.append(i18n("Exec: %1", extUpgrade[i]->executable())); - item->setToolTip(tooltip.join(QChar('\n'))); - widgetDialog->addItem(item); - } - } - - int ret = dialog->exec(); - if (debug) qDebug() << PDEBUG << ":" << "Dialog returns" << ret; - requestedItem = Nothing; -} - - -void AWKeys::editItemButtonPressed(QAbstractButton *button) -{ - if (debug) qDebug() << PDEBUG; - - QListWidgetItem *item = widgetDialog->currentItem(); - if (dynamic_cast(button) == copyButton) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtScript: - copyScript(current); - break; - case RequestedExtUpgrade: - copyUpgrade(current); - break; - case RequestedGraphicalItem: - copyBar(current); - break; - case Nothing: - default: - break; - } - } else if (dynamic_cast(button) == createButton) { - switch (requestedItem) { - case RequestedExtScript: - copyScript(QString("")); - break; - case RequestedExtUpgrade: - copyUpgrade(QString("")); - break; - case RequestedGraphicalItem: - copyBar(QString("")); - break; - case Nothing: - default: - break; - } - } else if (dynamic_cast(button) == deleteButton) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtScript: - for (int i=0; ifileName() != current) continue; - if (extScripts[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - extScripts.clear(); - extScripts = getExtScripts(); - } - break; - } - break; - case RequestedExtUpgrade: - for (int i=0; ifileName() != current) continue; - if (extUpgrade[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - extUpgrade.clear(); - extUpgrade = getExtUpgrade(); - } - break; - } - break; - case RequestedGraphicalItem: - for (int i=0; ifileName() != current) continue; - if (graphicalItems[i]->tryDelete() == 1) { - widgetDialog->takeItem(widgetDialog->row(item)); - graphicalItems.clear(); - graphicalItems = getGraphicalItems(); - } - break; - } - break; - case Nothing: - default: - break; - } - } else if (dialogButtons->buttonRole(button) == QDialogButtonBox::AcceptRole) { - if (item == nullptr) return; - QString current = item->text(); - switch (requestedItem) { - case RequestedExtScript: - for (int i=0; ifileName() != current) continue; - extScripts[i]->showConfiguration(); - break; - } - break; - case RequestedExtUpgrade: - for (int i=0; ifileName() != current) continue; - extUpgrade[i]->showConfiguration(); - break; - } - break; - case RequestedGraphicalItem: - for (int i=0; ifileName() != current) continue; - graphicalItems[i]->showConfiguration(); - break; - } - break; - case Nothing: - default: - break; - } - } -} - - -void AWKeys::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 = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/desktops"), - QStandardPaths::LocateDirectory); - 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.*"))))); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (graphicalItems[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - GraphicalItem *item = new GraphicalItem(0, name, dirs, debug); - item->setName(QString("bar%1").arg(number)); - if (originalItem != -1) { - item->setComment(graphicalItems[originalItem]->comment()); - item->setBar(graphicalItems[originalItem]->bar()); - item->setActiveColor(graphicalItems[originalItem]->activeColor()); - item->setInactiveColor(graphicalItems[originalItem]->inactiveColor()); - item->setType(graphicalItems[originalItem]->type()); - item->setDirection(graphicalItems[originalItem]->direction()); - item->setHeight(graphicalItems[originalItem]->height()); - item->setWidth(graphicalItems[originalItem]->width()); - } - - if (item->showConfiguration(bars) == 1) { - graphicalItems.clear(); - graphicalItems = 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'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete item; -} - - -void AWKeys::copyScript(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/scripts"), - QStandardPaths::LocateDirectory); - 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"); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (extScripts[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - ExtScript *script = new ExtScript(0, name, dirs, debug); - if (originalItem != -1) { - script->setActive(extScripts[originalItem]->isActive()); - script->setComment(extScripts[originalItem]->comment()); - script->setExecutable(extScripts[originalItem]->executable()); - script->setHasOutput(extScripts[originalItem]->hasOutput()); - script->setInterval(extScripts[originalItem]->interval()); - script->setName(extScripts[originalItem]->name()); - script->setPrefix(extScripts[originalItem]->prefix()); - script->setRedirect(extScripts[originalItem]->redirect()); - } - - if (script->showConfiguration() == 1) { - extScripts.clear(); - extScripts = getExtScripts(); - 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'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete script; -} - - -void AWKeys::copyUpgrade(const QString original) -{ - if (debug) qDebug() << PDEBUG; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/upgrade"), - QStandardPaths::LocateDirectory); - 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"); - - int originalItem = -1; - for (int i=0; ifileName() != original) || - (extUpgrade[i]->fileName() != name)) - continue; - originalItem = i; - break; - } - ExtUpgrade *upgrade = new ExtUpgrade(0, name, dirs, debug); - if (originalItem != -1) { - upgrade->setActive(extUpgrade[originalItem]->isActive()); - upgrade->setComment(extUpgrade[originalItem]->comment()); - upgrade->setExecutable(extUpgrade[originalItem]->executable()); - upgrade->setName(extUpgrade[originalItem]->name()); - upgrade->setNull(extUpgrade[originalItem]->null()); - upgrade->setInterval(extUpgrade[originalItem]->interval()); - } - - if (upgrade->showConfiguration() == 1) { - extUpgrade.clear(); - extUpgrade = getExtUpgrade(); - 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'))); - widgetDialog->addItem(widgetItem); - widgetDialog->sortItems(); - } - delete upgrade; -} - - -bool AWKeys::checkKeys(const QMap data) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Data" << data; - - return (data.count() != 0); -} - - -QString AWKeys::networkDevice() -{ - if (debug) qDebug() << PDEBUG; - - QString device = QString("lo"); - QList rawInterfaceList = QNetworkInterface::allInterfaces(); - for (int i=0; iname() + graphicalItems[i]->bar()); - orderedKeys.sort(); - - QStringList selectedKeys; - for (int i=orderedKeys.count()-1; i>=0; i--) - if (pattern.contains(QString("$") + orderedKeys[i])) { - if (debug) qDebug() << PDEBUG << ":" << "Found key" << orderedKeys[i]; - selectedKeys.append(orderedKeys[i]); - } - - return selectedKeys; -} - - -QStringList AWKeys::findKeys(const QString pattern) -{ - QStringList selectedKeys; - for (int i=0; i AWKeys::getExtScripts() -{ - if (debug) qDebug() << PDEBUG; - - QList externalScripts; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/scripts"); - QDir localDirectory; - if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/scripts"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; i AWKeys::getExtUpgrade() -{ - if (debug) qDebug() << PDEBUG; - - QList externalUpgrade; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/upgrade"); - QDir localDirectory; - if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir))) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/upgrade"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; i AWKeys::getGraphicalItems() -{ - if (debug) qDebug() << PDEBUG; - - QList items; - // create directory at $HOME - QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/desktops"); - QDir localDirectory; - if (localDirectory.mkpath(localDir)) - if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; - - QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QString("awesomewidgets/desktops"), - QStandardPaths::LocateDirectory); - QStringList names; - for (int i=0; iname() + graphicalItems[i]->bar()) != tag) continue; - item = graphicalItems[i]; - break; - } - - return item; -} - - -QStringList AWKeys::getTimeKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList keys; - keys.append(QString("dddd")); - keys.append(QString("ddd")); - keys.append(QString("dd")); - keys.append(QString("d")); - keys.append(QString("MMMM")); - keys.append(QString("MMM")); - keys.append(QString("MM")); - keys.append(QString("M")); - keys.append(QString("yyyy")); - keys.append(QString("yy")); - keys.append(QString("hh")); - keys.append(QString("h")); - keys.append(QString("mm")); - keys.append(QString("m")); - keys.append(QString("ss")); - keys.append(QString("s")); - - return keys; -} diff --git a/sources/awesome-widget-kf5/plugin/awkeys.h b/sources/awesome-widget-kf5/plugin/awkeys.h deleted file mode 100644 index 1989459..0000000 --- a/sources/awesome-widget-kf5/plugin/awkeys.h +++ /dev/null @@ -1,121 +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 AWKEYS_H -#define AWKEYS_H - -#include -#include -#include -#include -#include -#include -#include -#include - - -class AWToolTip; -class ExtScript; -class ExtUpgrade; -class GraphicalItem; - -class AWKeys : public QObject -{ - Q_OBJECT - - enum RequestedItem { - Nothing, - RequestedGraphicalItem, - RequestedExtScript, - RequestedExtUpgrade - }; - -public: - AWKeys(QObject *parent = 0); - ~AWKeys(); - - Q_INVOKABLE void initKeys(const QString pattern, - const QMap tooltipParams, - const bool popup = false); - Q_INVOKABLE bool isDebugEnabled(); - Q_INVOKABLE QString parsePattern(const QString pattern); - Q_INVOKABLE QString toolTipImage(); - Q_INVOKABLE QSize toolTipSize(); - // keys - Q_INVOKABLE bool addDevice(const QString source); - Q_INVOKABLE QStringList dictKeys(); - Q_INVOKABLE QStringList getDiskDevices(); - Q_INVOKABLE QStringList getFanDevices(); - Q_INVOKABLE QStringList getHddDevices(const bool needAbstract = false); - Q_INVOKABLE QStringList getMountDevices(); - Q_INVOKABLE QStringList getNetworkDevices(); - Q_INVOKABLE QStringList getTempDevices(); - Q_INVOKABLE bool setDataBySource(const QString sourceName, - const QMap data, - const QMap params); - // values - Q_INVOKABLE void graphicalValueByKey(); - Q_INVOKABLE QString infoByKey(QString key); - Q_INVOKABLE QString valueByKey(QString key); - // configuration - Q_INVOKABLE void editItem(const QString type); - -private slots: - void editItemButtonPressed(QAbstractButton *button); - void copyBar(const QString original); - void copyScript(const QString original); - void copyUpgrade(const QString original); - -private: - // methods - bool checkKeys(const QMap data); - QString networkDevice(); - int numberCpus(); - float temperature(const float temp, const QString units = QString("Celsius")); - // find methods - QStringList findGraphicalItems(const QString pattern); - QStringList findKeys(const QString pattern); - // get methods - QList getExtScripts(); - QList getExtUpgrade(); - QList getGraphicalItems(); - GraphicalItem *getItemByTag(const QString tag); - QStringList getTimeKeys(); - AWToolTip *toolTip = nullptr; - // graphical elements - QDialog *dialog = nullptr; - QListWidget *widgetDialog = nullptr; - QDialogButtonBox *dialogButtons = nullptr; - QPushButton *copyButton = nullptr; - QPushButton *createButton = nullptr; - QPushButton *deleteButton = nullptr; - RequestedItem requestedItem = Nothing; - // variables - bool debug = false; - bool enablePopup = false; - bool ready = false; - QList graphicalItems; - QList extScripts; - QList extUpgrade; - QStringList foundBars, foundKeys, keys; - QMap values; - QStringList diskDevices, fanDevices, mountDevices, tempDevices; -}; - - -#endif /* AWKEYS_H */ diff --git a/sources/awesome-widget-kf5/plugin/awtooltip.cpp b/sources/awesome-widget-kf5/plugin/awtooltip.cpp deleted file mode 100644 index 72bb43b..0000000 --- a/sources/awesome-widget-kf5/plugin/awtooltip.cpp +++ /dev/null @@ -1,155 +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 "awtooltip.h" - -#include -#include -#include - -#include - - -AWToolTip::AWToolTip(QObject *parent, - QMap settings) - : QObject(parent), - configuration(settings) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - debug = (debugEnv == QString("yes")); - - 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); - - counts += configuration[QString("cpuTooltip")].toInt(); - counts += configuration[QString("cpuclTooltip")].toInt(); - counts += configuration[QString("memTooltip")].toInt(); - counts += configuration[QString("swapTooltip")].toInt(); - counts += configuration[QString("downTooltip")].toInt(); - counts += configuration[QString("batTooltip")].toInt(); - - boundaries[QString("cpuTooltip")] = 100.0; - boundaries[QString("cpuclTooltip")] = 4000.0; - boundaries[QString("memTooltip")] = 100.0; - boundaries[QString("swapTooltip")] = 100.0; - boundaries[QString("downTooltip")] = 1.0; - boundaries[QString("upTooltip")] = 1.0; - boundaries[QString("batTooltip")] = 100.0; - size.setHeight(105.0); - size.setWidth(100.0 * counts); - - if (configuration[QString("cpuTooltip")].toBool()) requiredKeys.append(QString("cpuTooltip")); - if (configuration[QString("cpuclTooltip")].toBool()) requiredKeys.append(QString("cpuclTooltip")); - if (configuration[QString("memTooltip")].toBool()) requiredKeys.append(QString("memTooltip")); - if (configuration[QString("swapTooltip")].toBool()) requiredKeys.append(QString("swapTooltip")); - if (configuration[QString("downTooltip")].toBool()) requiredKeys.append(QString("downTooltip")); - if (configuration[QString("upTooltip")].toBool()) requiredKeys.append(QString("upTooltip")); - if (configuration[QString("batTooltip")].toBool()) requiredKeys.append(QString("batTooltip")); -} - - -AWToolTip::~AWToolTip() -{ - if (debug) qDebug() << PDEBUG; - - delete toolTipView; - delete toolTipScene; -} - - -QSize AWToolTip::getSize() -{ - if (debug) qDebug() << PDEBUG; - - return size; -} - - -QPixmap AWToolTip::image() -{ - if (debug) qDebug() << PDEBUG; - - toolTipView->resize(size); - // create image - toolTipScene->clear(); - QPen pen = QPen(); - // background - if (configuration[QString("useTooltipBackground")].toBool()) - toolTipScene->setBackgroundBrush(QBrush(QColor(configuration[QString("tooltipBackground")].toString()))); - else - toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush)); - bool down = false; - for (int i=0; i(data[requiredKeys[i]].count()); - float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]); - if (requiredKeys[i] != QString("batTooltip")) - pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString())); - float shift = i * 100.0; - if (down) shift -= 100.0; - for (int j=0; j 0) - pen.setColor(QColor(configuration[QString("batTooltipColor")].toString())); - else - pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString())); - } - toolTipScene->addLine(x1, y1, x2, y2, pen); - } - if (requiredKeys[i] == QString("downTooltip")) down = true; - } - - return toolTipView->grab(); -} - - -void AWToolTip::setData(const QString source, float value, const bool ac) -{ - if (debug) qDebug() << PDEBUG; - - if (data[source].count() == 0) - data[source].append(0.0); - else if (data[source].count() > configuration[QString("tooltipNumber")].toInt()) - data[source].takeFirst(); - if (isnan(value)) value = 0.0; - - if (ac) - data[source].append(value); - else - data[source].append(-value); - - if ((source == QString("downTooltip")) || (source == QString("upTooltip"))) { - for (int i=0; i -#include -#include -#include -#include -#include - - -class AWToolTip : public QObject -{ - Q_OBJECT - -public: - AWToolTip(QObject *parent = 0, - QMap settings = QMap()); - ~AWToolTip(); - - QSize getSize(); - QPixmap image(); - void setData(const QString source, float value, - const bool ac = true); - -private: - // ui - QGraphicsScene *toolTipScene = nullptr; - QGraphicsView *toolTipView = nullptr; - // variables - bool debug = false; - int counts = 0; - QMap configuration; - QMap boundaries; - QMap> data; - QStringList requiredKeys; - QSize size; -}; - - -#endif /* AWTOOLTIP_H */ 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/desktops/bar-template.desktop b/sources/awesome-widget-kf5/plugin/desktops/bar-template.desktop deleted file mode 100644 index 2f696e1..0000000 --- a/sources/awesome-widget-kf5/plugin/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-kf5/plugin/graphicalitem.cpp b/sources/awesome-widget-kf5/plugin/graphicalitem.cpp deleted file mode 100644 index 5c03fa8..0000000 --- a/sources/awesome-widget-kf5/plugin/graphicalitem.cpp +++ /dev/null @@ -1,525 +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 - -#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 = view->grab().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-kf5/plugin/graphicalitem.h b/sources/awesome-widget-kf5/plugin/graphicalitem.h deleted file mode 100644 index b2f154a..0000000 --- a/sources/awesome-widget-kf5/plugin/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-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/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc b/sources/awesome-widget-kf5/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc deleted file mode 100644 index 44462c1..0000000 --- a/sources/awesome-widget-kf5/plugin/plasma-applet-org.kde.plasma.awesome-widget.notifyrc +++ /dev/null @@ -1,24 +0,0 @@ -[Global] -IconName=system -Name=Awesome Widget -Comment=Awesome widget notifications - -[info] -Name=Information -Comment=Information -Action=Popup - -[Event/event] -Name=Event -Comment=Some event occurs -Action=Popup - -[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-kf5/plugin/qmldir b/sources/awesome-widget-kf5/plugin/qmldir deleted file mode 100644 index 8a3ed27..0000000 --- a/sources/awesome-widget-kf5/plugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kde.plasma.private.awesomewidget - -plugin awplugin diff --git a/sources/awesome-widget-kde4/CMakeLists.txt b/sources/awesome-widget/CMakeLists.txt similarity index 100% rename from sources/awesome-widget-kde4/CMakeLists.txt rename to sources/awesome-widget/CMakeLists.txt diff --git a/sources/awesome-widget-kde4/advanced.ui b/sources/awesome-widget/advanced.ui similarity index 100% rename from sources/awesome-widget-kde4/advanced.ui rename to sources/awesome-widget/advanced.ui diff --git a/sources/awesome-widget-kde4/appearance.ui b/sources/awesome-widget/appearance.ui similarity index 100% rename from sources/awesome-widget-kde4/appearance.ui rename to sources/awesome-widget/appearance.ui diff --git a/sources/awesome-widget-kde4/awesome-widget.cpp b/sources/awesome-widget/awesome-widget.cpp similarity index 100% rename from sources/awesome-widget-kde4/awesome-widget.cpp rename to sources/awesome-widget/awesome-widget.cpp diff --git a/sources/awesome-widget-kde4/awesome-widget.h b/sources/awesome-widget/awesome-widget.h similarity index 100% rename from sources/awesome-widget-kde4/awesome-widget.h rename to sources/awesome-widget/awesome-widget.h diff --git a/sources/awesome-widget-kde4/configuration.cpp b/sources/awesome-widget/configuration.cpp similarity index 100% rename from sources/awesome-widget-kde4/configuration.cpp rename to sources/awesome-widget/configuration.cpp diff --git a/sources/awesome-widget-kde4/customlabel.cpp b/sources/awesome-widget/customlabel.cpp similarity index 100% rename from sources/awesome-widget-kde4/customlabel.cpp rename to sources/awesome-widget/customlabel.cpp diff --git a/sources/awesome-widget-kde4/customlabel.h b/sources/awesome-widget/customlabel.h similarity index 100% rename from sources/awesome-widget-kde4/customlabel.h rename to sources/awesome-widget/customlabel.h diff --git a/sources/awesome-widget-kde4/deconfig.ui b/sources/awesome-widget/deconfig.ui similarity index 100% rename from sources/awesome-widget-kde4/deconfig.ui rename to sources/awesome-widget/deconfig.ui diff --git a/sources/awesome-widget-kde4/deinteraction.cpp b/sources/awesome-widget/deinteraction.cpp similarity index 100% rename from sources/awesome-widget-kde4/deinteraction.cpp rename to sources/awesome-widget/deinteraction.cpp diff --git a/sources/awesome-widget-kde4/desktops/aw-bat-bar.desktop b/sources/awesome-widget/desktops/aw-bat-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-bat-bar.desktop rename to sources/awesome-widget/desktops/aw-bat-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-cpu-bar.desktop b/sources/awesome-widget/desktops/aw-cpu-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-cpu-bar.desktop rename to sources/awesome-widget/desktops/aw-cpu-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-mem-bar.desktop b/sources/awesome-widget/desktops/aw-mem-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-mem-bar.desktop rename to sources/awesome-widget/desktops/aw-mem-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/aw-swap-bar.desktop b/sources/awesome-widget/desktops/aw-swap-bar.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/aw-swap-bar.desktop rename to sources/awesome-widget/desktops/aw-swap-bar.desktop diff --git a/sources/awesome-widget-kde4/desktops/bar-template.desktop b/sources/awesome-widget/desktops/bar-template.desktop similarity index 100% rename from sources/awesome-widget-kde4/desktops/bar-template.desktop rename to sources/awesome-widget/desktops/bar-template.desktop diff --git a/sources/awesome-widget-kde4/graphicalitem.cpp b/sources/awesome-widget/graphicalitem.cpp similarity index 100% rename from sources/awesome-widget-kde4/graphicalitem.cpp rename to sources/awesome-widget/graphicalitem.cpp diff --git a/sources/awesome-widget-kde4/graphicalitem.h b/sources/awesome-widget/graphicalitem.h similarity index 100% rename from sources/awesome-widget-kde4/graphicalitem.h rename to sources/awesome-widget/graphicalitem.h diff --git a/sources/awesome-widget-kde4/graphicalitem.ui b/sources/awesome-widget/graphicalitem.ui similarity index 100% rename from sources/awesome-widget-kde4/graphicalitem.ui rename to sources/awesome-widget/graphicalitem.ui diff --git a/sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop b/sources/awesome-widget/plasma-applet-awesomewidget.desktop similarity index 100% rename from sources/awesome-widget-kde4/plasma-applet-awesomewidget.desktop rename to sources/awesome-widget/plasma-applet-awesomewidget.desktop diff --git a/sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc b/sources/awesome-widget/plasma_applet_awesome-widget.notifyrc similarity index 100% rename from sources/awesome-widget-kde4/plasma_applet_awesome-widget.notifyrc rename to sources/awesome-widget/plasma_applet_awesome-widget.notifyrc diff --git a/sources/awesome-widget-kde4/reinit.cpp b/sources/awesome-widget/reinit.cpp similarity index 100% rename from sources/awesome-widget-kde4/reinit.cpp rename to sources/awesome-widget/reinit.cpp diff --git a/sources/awesome-widget-kde4/tooltipconfig.ui b/sources/awesome-widget/tooltipconfig.ui similarity index 100% rename from sources/awesome-widget-kde4/tooltipconfig.ui rename to sources/awesome-widget/tooltipconfig.ui diff --git a/sources/awesome-widget-kde4/widget.ui b/sources/awesome-widget/widget.ui similarity index 100% rename from sources/awesome-widget-kde4/widget.ui rename to sources/awesome-widget/widget.ui diff --git a/sources/desktop-panel-kf5/CMakeLists.txt b/sources/desktop-panel-kf5/CMakeLists.txt deleted file mode 100644 index 52810f7..0000000 --- a/sources/desktop-panel-kf5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# set project name -set (SUBPROJECT plasma_applet_desktop-panel) -message (STATUS "Subproject ${SUBPROJECT}") - -# prepare -configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop) - -find_package (ECM 0.0.12 REQUIRED NO_MODULE) -set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) - -find_package (Qt5 REQUIRED COMPONENTS Core Qml) -find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem) - -include (KDEInstallDirs) -include (KDECMakeSettings) -include (KDECompilerSettings) - -add_subdirectory (plugin) -plasma_install_package (package org.kde.plasma.desktoppanel) diff --git a/sources/desktop-panel-kf5/metadata.desktop b/sources/desktop-panel-kf5/metadata.desktop deleted file mode 100644 index 87fa8fa..0000000 --- a/sources/desktop-panel-kf5/metadata.desktop +++ /dev/null @@ -1,28 +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-ServiceTypes=Plasma/Applet -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-Plasma-RemoteLocation= - -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis -X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel -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-kf5/package/contents/config/config.qml b/sources/desktop-panel-kf5/package/contents/config/config.qml deleted file mode 100644 index 9f6f6c3..0000000 --- a/sources/desktop-panel-kf5/package/contents/config/config.qml +++ /dev/null @@ -1,53 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 - -import org.kde.plasma.configuration 2.0 - - -ConfigModel { - ConfigCategory { - name: i18n("Widget") - icon: "utilities-system-monitor" - source: "widget.qml" - } - - ConfigCategory { - name: i18n("Advanced") - icon: "system-run" - source: "advanced.qml" - } - - ConfigCategory { - name: i18n("Active desktop") - icon: "preferences-desktop-theme" - source: "activeapp.qml" - } - - ConfigCategory { - name: i18n("Inactive desktop") - icon: "preferences-desktop-theme" - source: "inactiveapp.qml" - } - - ConfigCategory { - name: i18n("About") - icon: "help-about" - source: "about.qml" - } -} diff --git a/sources/desktop-panel-kf5/package/contents/config/main.xml b/sources/desktop-panel-kf5/package/contents/config/main.xml deleted file mode 100644 index 39edfda..0000000 --- a/sources/desktop-panel-kf5/package/contents/config/main.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - [$mark$number/$total: $name] - - - - - - - windows - - - 200 - - - #ffffff - - - true - - - false - - - ¤ - - - -1 - - - - - - - center - - - Terminus - - - 12 - - - #000000 - - - normal - - - normal - - - - center - - - Terminus - - - 12 - - - #ff0000 - - - normal - - - normal - - - - diff --git a/sources/desktop-panel-kf5/package/contents/ui/about.qml b/sources/desktop-panel-kf5/package/contents/ui/about.qml deleted file mode 100644 index 746ed6f..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/about.qml +++ /dev/null @@ -1,99 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Layouts 1.0 as QtLayouts - -import org.kde.plasma.private.desktoppanel 1.0 - - -Item { - id: aboutPage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: DPAdds.isDebugEnabled() - - - Column { - id: pageColumn - width: units.gridUnit * 25 - QtControls.TabView { - height: parent.height - width: parent.width - QtControls.Tab { - title: i18n("About") - - QtLayouts.ColumnLayout { - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignHCenter - text: DPAdds.getAboutText("header") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignJustify - text: DPAdds.getAboutText("description") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignLeft - textFormat: Text.RichText - text: DPAdds.getAboutText("links") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - font.capitalization: Font.SmallCaps - horizontalAlignment: Text.AlignHCenter - textFormat: Text.RichText - text: DPAdds.getAboutText("copy") - } - } - } - - QtControls.Tab { - title: i18n("Acknowledgment") - - QtLayouts.ColumnLayout { - QtControls.Label { - QtLayouts.Layout.fillWidth: true - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignJustify - text: DPAdds.getAboutText("translators") - } - - QtControls.Label { - QtLayouts.Layout.fillWidth: true - horizontalAlignment: Text.AlignJustify - textFormat: Text.RichText - text: DPAdds.getAboutText("3rdparty") - } - } - } - } - } - - Component.onCompleted: { - if (debug) console.log("[about::onCompleted]") - } -} diff --git a/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml b/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml deleted file mode 100644 index 66624b1..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml +++ /dev/null @@ -1,219 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Controls.Styles 1.3 as QtStyles -import QtQuick.Dialogs 1.1 as QtDialogs - -import org.kde.plasma.private.desktoppanel 1.0 - - -Item { - id: activeAppearancePage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: DPAdds.isDebugEnabled() - property variant weight: { - 25: 0, - 50: 1, - 63: 3, - 75: 4, - 87: 5 - } - - property alias cfg_currentFontFamily: selectFont.text - property alias cfg_currentFontSize: fontSize.value - property string cfg_currentFontWeight: fontWeight.currentText - property string cfg_currentFontStyle: fontStyle.currentText - property alias cfg_currentFontColor: selectColor.text - - - Column { - id: pageColumn - width: units.gridUnit * 25 - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font") - } - QtControls.Button { - id: selectFont - width: parent.width * 2 / 3 - text: plasmoid.configuration.currentFontFamily - onClicked: fontDialog.visible = true - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font size") - } - QtControls.SpinBox { - id: fontSize - width: parent.width * 2 / 3 - minimumValue: 8 - maximumValue: 32 - stepSize: 1 - value: plasmoid.configuration.currentFontSize - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font weight") - } - QtControls.ComboBox { - id: fontWeight - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("light"), - 'name': "light" - }, - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("demi bold"), - 'name': "demibold" - }, - { - 'label': i18n("bold"), - 'name': "bold" - }, - { - 'label': i18n("black"), - 'name': "black" - } - ] - onCurrentIndexChanged: cfg_currentFontWeight = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.currentFontWeight) { - currentFontWeight.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font style") - } - QtControls.ComboBox { - id: fontStyle - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("italic"), - 'name': "italic" - } - ] - onCurrentIndexChanged: cfg_currentFontStyle = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.currentFontStyle) { - currentFontStyle.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font color") - } - QtControls.Button { - id: selectColor - width: parent.width * 2 / 3 - style: QtStyles.ButtonStyle { - background: Rectangle { - color: plasmoid.configuration.currentFontColor - } - } - text: plasmoid.configuration.currentFontColor - onClicked: colorDialog.visible = true - } - } - } - - QtDialogs.ColorDialog { - id: colorDialog - title: i18n("Select a color") - color: selectColor.text - onAccepted: selectColor.text = colorDialog.color - } - - QtDialogs.FontDialog { - id: fontDialog - title: i18n("Select a font") - font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal }) - onAccepted: { - selectFont.text = fontDialog.font.family - fontSize.value = fontDialog.font.pointSize - fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0 - fontWeight.currentIndex = weight[fontDialog.font.weight] - } - } - - Component.onCompleted: { - if (debug) console.log("[activeapp::onCompleted]") - } -} diff --git a/sources/desktop-panel-kf5/package/contents/ui/advanced.qml b/sources/desktop-panel-kf5/package/contents/ui/advanced.qml deleted file mode 100644 index 9cf7605..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/advanced.qml +++ /dev/null @@ -1,213 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Controls.Styles 1.3 as QtStyles -import QtQuick.Dialogs 1.1 as QtDialogs - -import org.kde.plasma.private.desktoppanel 1.0 - - -Item { - id: advancedPage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: DPAdds.isDebugEnabled() - - property string cfg_tooltipType: tooltipType.currentText - property alias cfg_tooltipWidth: tooltipWidth.value - property alias cfg_tooltipColor: tooltipColor.text - property alias cfg_background: background.checked - property alias cfg_verticalLayout: verticalLayout.checked - property string cfg_mark: mark.currentText - - - Column { - id: pageColumn - width: units.gridUnit * 25 - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Tooltip type") - } - QtControls.ComboBox { - id: tooltipType - width: parent.width * 3 / 5 - textRole: "label" - model: [ - { - 'label': i18n("contours"), - 'name': "contours" - }, - { - 'label': i18n("windows"), - 'name': "windows" - }, - { - 'label': i18n("clean desktop"), - 'name': "clean" - }, - { - 'label': i18n("names"), - 'name': "names" - }, - { - 'label': i18n("none"), - 'name': "none" - } - ] - onCurrentIndexChanged: cfg_tooltipType = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.tooltipType) { - tooltipType.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Tooltip width") - } - QtControls.SpinBox { - id: tooltipWidth - width: parent.width * 3 / 5 - minimumValue: 100 - maximumValue: 1000 - stepSize: 50 - value: plasmoid.configuration.tooltipWidth - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font color") - } - QtControls.Button { - id: tooltipColor - width: parent.width * 3 / 5 - style: QtStyles.ButtonStyle { - background: Rectangle { - color: plasmoid.configuration.tooltipColor - } - } - text: plasmoid.configuration.tooltipColor - onClicked: colorDialog.visible = true - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.heigth - width: parent.width * 2 / 5 - } - QtControls.CheckBox { - id: background - width: parent.width * 3 / 5 - text: i18n("Enable background") - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.heigth - width: parent.width * 2 / 5 - } - QtControls.CheckBox { - id: verticalLayout - width: parent.width * 3 / 5 - text: i18n("Vertical layout") - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Mark") - } - QtControls.ComboBox { - id: mark - width: parent.width * 3 / 5 - editable: true - model: ["#", "$", "%", "&", "*", "@", "¤", "¶", "·", "º", - plasmoid.configuration.mark] - currentIndex: model.length - 1 - onCurrentIndexChanged: cfg_mark = currentText - } - } - -// Row { -// height: implicitHeight -// width: parent.width -// QtControls.Label { -// height: parent.height -// width: parent.width * 2 / 5 -// horizontalAlignment: Text.AlignRight -// verticalAlignment: Text.AlignVCenter -// text: i18n("Panels to be hidden") -// } -// QtControls.Button { -// width: parent.width * 3 / 5 -// text: i18n("Edit panels") -// onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels) -// } -// } - } - - QtDialogs.ColorDialog { - id: colorDialog - title: i18n("Select a color") - color: tooltipColor.text - onAccepted: tooltipColor.text = colorDialog.color - } - - Component.onCompleted: { - if (debug) console.log("[advanced::onCompleted]") - } -} diff --git a/sources/desktop-panel-kf5/package/contents/ui/general.qml b/sources/desktop-panel-kf5/package/contents/ui/general.qml deleted file mode 100644 index dc26a78..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/general.qml +++ /dev/null @@ -1,36 +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/ * - ***************************************************************************/ - -pragma Singleton -import QtQuick 2.0 - - -QtObject { - property variant fontWeight: { - "light": Font.Light, - "normal": Font.Normal, - "demibold": Font.DemiBold, - "bold": Font.Bold, - "black": Font.Black - } - property variant align: { - "left": Text.AlignLeft, - "center": Text.AlignHCenter, - "right": Text.AlignRight, - "justify": Text.AlignJustify - } -} diff --git a/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml b/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml deleted file mode 100644 index 8c95377..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml +++ /dev/null @@ -1,218 +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/ * - ***************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Controls.Styles 1.3 as QtStyles -import QtQuick.Dialogs 1.1 as QtDialogs - -import org.kde.plasma.private.desktoppanel 1.0 - - -Item { - id: inactiveAppearancePage - width: childrenRect.width - height: childrenRect.height - implicitWidth: pageColumn.implicitWidth - implicitHeight: pageColumn.implicitHeight - - property bool debug: AWKeys.isDebugEnabled() - property variant weight: { - 25: 0, - 50: 1, - 63: 3, - 75: 4, - 87: 5 - } - - property alias cfg_fontFamily: selectFont.text - property alias cfg_fontSize: fontSize.value - property string cfg_fontWeight: fontWeight.currentText - property string cfg_fontStyle: fontStyle.currentText - property alias cfg_fontColor: selectColor.text - - - Column { - id: pageColumn - width: units.gridUnit * 25 - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font") - } - QtControls.Button { - id: selectFont - width: parent.width * 2 / 3 - text: plasmoid.configuration.fontFamily - onClicked: fontDialog.visible = true - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font size") - } - QtControls.SpinBox { - id: fontSize - width: parent.width * 2 / 3 - minimumValue: 8 - maximumValue: 32 - stepSize: 1 - value: plasmoid.configuration.fontSize - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font weight") - } - QtControls.ComboBox { - id: fontWeight - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("light"), - 'name': "light" - }, - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("demi bold"), - 'name': "demibold" - }, - { - 'label': i18n("bold"), - 'name': "bold" - }, - { - 'label': i18n("black"), - 'name': "black" - } - ] - onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.fontWeight) { - fontWeight.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font style") - } - QtControls.ComboBox { - id: fontStyle - width: parent.width * 2 / 3 - textRole: "label" - model: [ - { - 'label': i18n("normal"), - 'name': "normal" - }, - { - 'label': i18n("italic"), - 'name': "italic" - } - ] - onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"] - Component.onCompleted: { - for (var i = 0; i < model.length; i++) { - if (model[i]["name"] == plasmoid.configuration.fontStyle) { - fontStyle.currentIndex = i; - } - } - } - } - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Label { - height: parent.height - width: parent.width / 3 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Font color") - } - QtControls.Button { - id: selectColor - width: parent.width * 2 / 3 - style: QtStyles.ButtonStyle { - background: Rectangle { - color: plasmoid.configuration.fontColor - } - } - text: plasmoid.configuration.fontColor - onClicked: colorDialog.visible = true - } - } - } - - QtDialogs.ColorDialog { - id: colorDialog - title: i18n("Select a color") - color: selectColor.text - onAccepted: selectColor.text = colorDialog.color - } - - QtDialogs.FontDialog { - id: fontDialog - title: i18n("Select a font") - font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal }) - onAccepted: { - selectFont.text = fontDialog.font.family - fontSize.value = fontDialog.font.pointSize - fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0 - fontWeight.currentIndex = weight[fontDialog.font.weight] - } - } - - Component.onCompleted: { - if (debug) console.log("[inactiveapp::onCompleted]") - } -} diff --git a/sources/desktop-panel-kf5/package/contents/ui/main.qml b/sources/desktop-panel-kf5/package/contents/ui/main.qml deleted file mode 100644 index 1b65503..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/main.qml +++ /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/ * - ***************************************************************************/ - -import QtQuick 2.4 -import QtQuick.Controls 1.3 as QtControls -import QtQuick.Layouts 1.1 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents - -import org.kde.plasma.private.desktoppanel 1.0 -import "." - - -Item { - id: main - - property bool debug: DPAdds.isDebugEnabled() - property variant tooltipSettings: { - "tooltipColor": plasmoid.configuration.tooltipColor, - "tooltipType": plasmoid.configuration.tooltipType, - "tooltipWidth": plasmoid.configuration.tooltipWidth - } - - signal needUpdate - signal needTooltipUpdate - - - // init - Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation - Plasmoid.compactRepresentation: Plasmoid.fullRepresentation - - Plasmoid.icon: "utilities-system-monitor" - Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground" - - - // ui - Grid { - columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops() - rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1 - - Repeater { - id: repeater - height: implicitHeight - width: implicitWidth - model: DPAdds.numberOfDesktops() - Text { - id: text - height: contentHeight - width: contentWidth - textFormat: Text.RichText - wrapMode: Text.NoWrap - - verticalAlignment: Text.AlignVCenter - - text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1) - property alias tooltip: tooltip - - MouseArea { - hoverEnabled: true - anchors.fill: parent - onClicked: DPAdds.setCurrentDesktop(index + 1); - onEntered: needTooltipUpdate() - } - - PlasmaCore.ToolTipArea { - height: tooltip.height - width: tooltip.width - mainItem: Text { - id: tooltip - height: contentHeight - width: contentWidth - textFormat: Text.RichText - } - } - } - } - } - - Timer { - id: timer - interval: 1000 - onTriggered: needUpdate() - } - - onNeedUpdate: { - if (debug) console.log("[main::onNeedUpdate]") - - var newHeight = 0 - var newWidth = 0 - for (var i=0; iproject homepage") - } - - Row { - height: implicitHeight - width: parent.width - QtControls.Button { - text: i18n("Font") - iconName: "font" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Font button") - - var defaultFont = { - "color": plasmoid.configuration.fontColor, - "family": plasmoid.configuration.fontFamily, - "size": plasmoid.configuration.fontSize - } - var font = DPAdds.getFont(defaultFont) - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + - selected + "") - } - } - QtControls.Button { - iconName: "format-indent-more" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Indent button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, selected + "
\n") - } - } - - QtControls.Button { - iconName: "format-text-bold" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Bold button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-italic" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Italic button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-underline" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Underline button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - QtControls.Button { - iconName: "format-text-strikethrough" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Strike button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "" + selected + "") - } - } - - QtControls.Button { - iconName: "format-justify-left" - - onClicked: { - if (debug) console.log("[widget::onClicked] : Left button") - - var pos = textPattern.cursorPosition - var selected = textPattern.selectedText - textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) - textPattern.insert(pos, "

" + selected + "" + selected + "" + selected + "" + selected + " - -#include "dpadds.h" - - -static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine); - Q_UNUSED(scriptEngine); - - return new DPAdds(); -} - - -void DPPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel")); - - qmlRegisterSingletonType(uri, 1, 0, "DPAdds", dpadds_singletontype_provider); -} diff --git a/sources/desktop-panel-kf5/plugin/desktoppanel.h b/sources/desktop-panel-kf5/plugin/desktoppanel.h deleted file mode 100644 index 0887bcb..0000000 --- a/sources/desktop-panel-kf5/plugin/desktoppanel.h +++ /dev/null @@ -1,37 +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 DPPLUGIN_H -#define DPPLUGIN_H - -#include - - -class QQmlEngine; - -class DPPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); -}; - - -#endif /* DPPLUGIN_H */ diff --git a/sources/desktop-panel-kf5/plugin/dpadds.cpp b/sources/desktop-panel-kf5/plugin/dpadds.cpp deleted file mode 100644 index b6a6f18..0000000 --- a/sources/desktop-panel-kf5/plugin/dpadds.cpp +++ /dev/null @@ -1,489 +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 "dpadds.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "version.h" - - -DPAdds::DPAdds(QObject *parent) - : QObject(parent) -{ - // debug - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); - QString debugEnv = environment.value(QString("DEBUG"), QString("no")); - debug = (debugEnv == QString("yes")); - - connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(changeDesktop(int))); - connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SLOT(changeWindowList(WId))); - connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(changeWindowList(WId))); -} - - -DPAdds::~DPAdds() -{ - if (debug) qDebug() << PDEBUG; -} - - -bool DPAdds::isDebugEnabled() -{ - if (debug) qDebug() << PDEBUG; - - return debug; -} - - -int DPAdds::currentDesktop() -{ - if (debug) qDebug() << PDEBUG; - - return KWindowSystem::currentDesktop(); -} - - -QStringList DPAdds::dictKeys() -{ - if (debug) qDebug() << PDEBUG; - - QStringList allKeys; - allKeys.append(QString("mark")); - allKeys.append(QString("name")); - allKeys.append(QString("number")); - allKeys.append(QString("total")); - - return allKeys; -} - - -int DPAdds::numberOfDesktops() -{ - if (debug) qDebug() << PDEBUG; - - return KWindowSystem::numberOfDesktops(); -} - - -QString DPAdds::toolTipImage(const int desktop) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; - if (tooltipType == QString("none")) return QString(); - - // prepare - DesktopWindowsInfo info = getInfoByDesktop(desktop); - if (tooltipType == QString("names")) { - QStringList windowList; - for (int i=0; i

  • ") + windowList.join(QString("
  • ")) + QString("
  • "); - } - // init - QGraphicsScene *toolTipScene = new QGraphicsScene(); - QGraphicsView *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); - // update - 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 (tooltipType == QString("contours")) { - QPen pen = QPen(); - pen.setWidthF(2.0 * info.desktop.width() / 400.0); - pen.setColor(QColor(tooltipColor)); - for (int i=0; iaddLine(rect.left() + margin, rect.bottom() + margin, - rect.left() + margin, rect.top() + margin, pen); - toolTipScene->addLine(rect.left() + margin, rect.top() + margin, - rect.right() + margin, rect.top() + margin, pen); - toolTipScene->addLine(rect.right() + margin, rect.top() + margin, - rect.right() + margin, rect.bottom() + margin, pen); - toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin, - rect.left() + margin, rect.bottom() + margin, pen); - } - } else if (tooltipType == QString("clean")) { - QScreen *screen = QGuiApplication::primaryScreen(); - for (int i=0; igrabWindow(info.desktopsData[i].id); - toolTipScene->addPixmap(desktop) - ->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top()); - } - } else if (tooltipType == QString("windows")) { - QScreen *screen = QGuiApplication::primaryScreen(); - for (int i=0; igrabWindow(info.desktopsData[i].id); - toolTipScene->addPixmap(desktop) - ->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top()); - } - for (int i=0; igrabWindow(info.windowsData[i].id); - toolTipScene->addPixmap(window) - ->setOffset(info.windowsData[i].rect.left(), info.windowsData[i].rect.top()); - } - } - - QPixmap image = toolTipView->grab().scaledToWidth(tooltipWidth); - QByteArray byteArray; - QBuffer buffer(&byteArray); - image.save(&buffer, "PNG"); - - delete toolTipView; - delete toolTipScene; - - return QString("").arg(QString(byteArray.toBase64())); -} - - -QString DPAdds::parsePattern(const QString pattern, const int desktop) -{ - if (debug) qDebug() << PDEBUG; - - QString parsed = pattern; - QStringList keys = dictKeys(); - parsed.replace(QString("$$"), QString("$\\$\\")); - for (int i=0; i tooltipData) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData; - - tooltipColor = tooltipData[QString("tooltipColor")].toString(); - tooltipType = tooltipData[QString("tooltipType")].toString(); - tooltipWidth = tooltipData[QString("tooltipWidth")].toInt(); -} - - -QString DPAdds::valueByKey(const QString key, int desktop) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key; - if (desktop == -1) desktop = currentDesktop(); - - QString currentMark; - if (currentDesktop() == desktop) - currentMark = mark; - else - currentMark = QString(""); - if (key == QString("mark")) - return QString("%1").arg(currentMark, mark.count(), QLatin1Char(' ')); - else if (key == QString("name")) - return KWindowSystem::desktopName(desktop); - else if (key == QString("number")) - return QString::number(desktop); - else if (key == QString("total")) - return QString::number(numberOfDesktops()); - else - return QString(); -} - - -QString DPAdds::editPanelsToContol(const QString current) -{ - if (debug) qDebug() << PDEBUG; - - // paint - QDialog *dialog = new QDialog(0); - QListWidget *widget = new QListWidget(dialog); - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close, - Qt::Vertical, dialog); - QHBoxLayout *layout = new QHBoxLayout(dialog); - layout->addWidget(widget); - layout->addWidget(buttons); - dialog->setLayout(layout); - connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject())); - connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept())); - - // fill - QList panels = getPanels(); - for (int i=0; ilocation()), widget); - if ((current.split(QChar(',')).contains(QString::number(i))) || - (current == QString("-1"))) - item->setCheckState(Qt::Checked); - else - item->setCheckState(Qt::Unchecked); - } - - // exec - QString value; - QStringList indexes; - int ret = dialog->exec(); - switch (ret) { - case QDialog::Accepted: - for (int i=0; icount(); i++) - if (widget->item(i)->checkState() == Qt::Checked) - indexes.append(QString::number(i)); - if (indexes.count() == widget->count()) - value = QString("-1"); - else - value = indexes.join(QChar(',')); - break; - default: - value = current; - break; - } - - return value; -} - - -QString DPAdds::getAboutText(const QString type) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Type" << type; - - QString text; - if (type == QString("header")) - text = QString(NAME); - else if (type == QString("description")) - text = i18n("A set of minimalistic plasmoid widgets"); - else if (type == QString("links")) - text = 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")) + - QString("%2").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages")); - else if (type == QString("copy")) - text = QString("© %1 %3
    ").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + - i18n("This software is licensed under %1", QString(LICENSE)) + QString("
    "); - else if (type == QString("translators")) - text = i18n("Translators: %1", QString(TRANSLATORS)); - else if (type == QString("3rdparty")) { - 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]); - text = i18n("This software uses: %1", trdPartyList.join(QString(", "))); - } - - return text; -} - - -QMap DPAdds::getFont(const QMap defaultFont) -{ - if (debug) qDebug() << PDEBUG; - - QMap fontMap; - CFont defaultCFont = CFont(defaultFont[QString("family")].toString(), - defaultFont[QString("size")].toInt(), - 400, false, defaultFont[QString("color")].toString()); - CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, - false, false); - fontMap[QString("color")] = font.color().name(); - fontMap[QString("family")] = font.family(); - fontMap[QString("size")] = font.pointSize(); - - return fontMap; -} - - -void DPAdds::changePanelsState() -{ - if (debug) qDebug() << PDEBUG; - if (panelsToControl.isEmpty()) return; - - 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); -// } -// } - panels.clear(); -} - - -void DPAdds::sendNotification(const QString eventId, const QString message) -{ - KNotification *notification = KNotification::event(eventId, QString("Desktop Panel ::: ") + eventId, message); - notification->setComponentName(QString("plasma-applet-org.kde.plasma.desktop-panel")); -} - - -void DPAdds::setCurrentDesktop(const int desktop) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; - - KWindowSystem::setCurrentDesktop(desktop); -} - - -void DPAdds::changeDesktop(const int desktop) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; - - emit(desktopChanged()); -} - - -void DPAdds::changeWindowList(const WId window) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Window" << window; - - emit(windowListChanged()); -} - - -DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop; - - - DesktopWindowsInfo info; - info.desktop = KWindowSystem::workArea(desktop); - - QList windows = KWindowSystem::windows(); - for (int i=0; i DPAdds::getPanels() -{ - if (debug) qDebug() << PDEBUG; - -// Plasma::Corona *corona = new Plasma::Corona(this); - QList panels; -// for (int i=0; icontainments().count(); i++) -// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment) -// panels.append(corona->containments()[i]); -// delete corona; - - return panels; -} - - -QString DPAdds::panelLocationToStr(Plasma::Types::Location location) -{ - if (debug) qDebug() << PDEBUG; - if (debug) qDebug() << PDEBUG << ":" << "Location" << location; - - switch (location) { - case Plasma::Types::Location::TopEdge: - return i18n("Top Edge"); - case Plasma::Types::Location::BottomEdge: - return i18n("Bottom Edge"); - case Plasma::Types::Location::LeftEdge: - return i18n("Left Edge"); - case Plasma::Types::Location::RightEdge: - return i18n("Right Edge"); - default: - return i18n("Unknown location (%1)", location); - } -} diff --git a/sources/desktop-panel-kf5/plugin/dpadds.h b/sources/desktop-panel-kf5/plugin/dpadds.h deleted file mode 100644 index 1a5f7e0..0000000 --- a/sources/desktop-panel-kf5/plugin/dpadds.h +++ /dev/null @@ -1,92 +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 DPADDS_H -#define DPADDS_H - -#include - -#include -#include -#include - - -class DPAdds : public QObject -{ - Q_OBJECT - - typedef struct { - WId id; - QString name; - QRect rect; - } WindowData; - - typedef struct { - QRect desktop; - QList desktopsData; - QList windowsData; - } DesktopWindowsInfo; - -public: - DPAdds(QObject *parent = 0); - ~DPAdds(); - - Q_INVOKABLE bool isDebugEnabled(); - Q_INVOKABLE int currentDesktop(); - Q_INVOKABLE QStringList dictKeys(); - Q_INVOKABLE int numberOfDesktops(); - Q_INVOKABLE QString toolTipImage(const int desktop); - Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop); - // values - Q_INVOKABLE void setMark(const QString newMark); - Q_INVOKABLE void setPanelsToControl(const QString newPanels); - Q_INVOKABLE void setToolTipData(const QMap tooltipData); - Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1); - // configuration slots - Q_INVOKABLE QString editPanelsToContol(const QString current); - Q_INVOKABLE QString getAboutText(const QString type = "header"); - Q_INVOKABLE QMap getFont(const QMap defaultFont); - -signals: - void desktopChanged(); - void windowListChanged(); - -public slots: - Q_INVOKABLE void changePanelsState(); - Q_INVOKABLE static void sendNotification(const QString eventId, const QString message); - Q_INVOKABLE void setCurrentDesktop(const int desktop); - -private slots: - void changeDesktop(const int desktop); - void changeWindowList(const WId window); - -private: - DesktopWindowsInfo getInfoByDesktop(const int desktop); - QList getPanels(); - QString panelLocationToStr(Plasma::Types::Location location); - // variables - bool debug = false; - int oldState, tooltipWidth = 200; - QString mark = QString("*"); - QString tooltipColor = QString("#000000"); - QString tooltipType = QString("none"); - QList panelsToControl; -}; - - -#endif /* DPADDS_H */ diff --git a/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc b/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc deleted file mode 100644 index 30b8a0e..0000000 --- a/sources/desktop-panel-kf5/plugin/plasma-applet-org.kde.plasma.desktop-panel.notifyrc +++ /dev/null @@ -1,24 +0,0 @@ -[Global] -IconName=system -Name=Desktop Panel -Comment=Desktop panel notifications - -[info] -Name=Information -Comment=Information -Action=Popup - -[Event/event] -Name=Event -Comment=Some event occurs -Action=Popup - -[Event/system] -Name=System information -Comment=System information -Action=Popup - -[Event/tag] -Name=Tag information -Comment=Tag information -Action=Popup diff --git a/sources/desktop-panel-kf5/plugin/qmldir b/sources/desktop-panel-kf5/plugin/qmldir deleted file mode 100644 index b49440a..0000000 --- a/sources/desktop-panel-kf5/plugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kde.plasma.private.desktoppanel - -plugin dpplugin diff --git a/sources/desktop-panel-kde4/CMakeLists.txt b/sources/desktop-panel/CMakeLists.txt similarity index 100% rename from sources/desktop-panel-kde4/CMakeLists.txt rename to sources/desktop-panel/CMakeLists.txt diff --git a/sources/desktop-panel-kde4/appearance.ui b/sources/desktop-panel/appearance.ui similarity index 100% rename from sources/desktop-panel-kde4/appearance.ui rename to sources/desktop-panel/appearance.ui diff --git a/sources/desktop-panel-kde4/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp similarity index 100% rename from sources/desktop-panel-kde4/desktop-panel.cpp rename to sources/desktop-panel/desktop-panel.cpp diff --git a/sources/desktop-panel-kde4/desktop-panel.h b/sources/desktop-panel/desktop-panel.h similarity index 100% rename from sources/desktop-panel-kde4/desktop-panel.h rename to sources/desktop-panel/desktop-panel.h diff --git a/sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop b/sources/desktop-panel/plasma-applet-desktoppanel.desktop similarity index 100% rename from sources/desktop-panel-kde4/plasma-applet-desktoppanel.desktop rename to sources/desktop-panel/plasma-applet-desktoppanel.desktop diff --git a/sources/desktop-panel-kde4/toggle.ui b/sources/desktop-panel/toggle.ui similarity index 100% rename from sources/desktop-panel-kde4/toggle.ui rename to sources/desktop-panel/toggle.ui diff --git a/sources/desktop-panel-kde4/widget.ui b/sources/desktop-panel/widget.ui similarity index 100% rename from sources/desktop-panel-kde4/widget.ui rename to sources/desktop-panel/widget.ui diff --git a/sources/extsysmon/CMakeLists.txt b/sources/extsysmon/CMakeLists.txt index 57a7bc6..31604cc 100644 --- a/sources/extsysmon/CMakeLists.txt +++ b/sources/extsysmon/CMakeLists.txt @@ -4,30 +4,11 @@ set (PLUGIN_NAME ${SUBPROJECT}) message (STATUS "Subproject ${SUBPROJECT}") # find required libaries -if (BUILD_KDE4) - find_package (KDE4 REQUIRED) - include (KDE4Defaults) +find_package (KDE4 REQUIRED) +include (KDE4Defaults) - add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - set (KDE_INCLUDE ${KDE4_INCLUDES}) -else () - find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets) - 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) - - add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} - ${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}) - set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} - ${Qt5DBus_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS}) - set (KDE_INCLUDE ${Plasma_INCLUDE_DIR}) -endif () +add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +set (KDE_INCLUDE ${KDE4_INCLUDES}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} @@ -50,26 +31,13 @@ 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}) -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}) - kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) -endif () +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}) # install -if (BUILD_KDE4) - install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -else () - install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) -endif () +install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}) diff --git a/sources/extsysmon/extscript.cpp b/sources/extsysmon/extscript.cpp index 8828d09..180f428 100644 --- a/sources/extsysmon/extscript.cpp +++ b/sources/extsysmon/extscript.cpp @@ -308,8 +308,8 @@ QString ExtScript::run() } // update value - times++; if (times >= m_interval) times = 0; + times++; return value; } diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp index bab11e3..43ddf9b 100644 --- a/sources/extsysmon/extsysmon.cpp +++ b/sources/extsysmon/extsysmon.cpp @@ -41,13 +41,8 @@ #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) @@ -127,23 +122,11 @@ void ExtendedSysMon::initScripts() // create directory at $HOME and create dirs list QString localDir; QStringList dirs; -#ifdef BUILD_KDE4 localDir = KStandardDirs::locateLocal("data", "awesomewidgets/scripts"); if (KStandardDirs::makeDir(localDir)) if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir; dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts"); -#else - localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/scripts"); - 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 names; for (int i=0; ifindDirs("data", "awesomewidgets/upgrade"); -#else - localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QString("/awesomewidgets/upgrade"); - 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 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 */ if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QSettings settings(fileName, QSettings::IniFormat); QMap rawConfig; @@ -706,10 +673,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/extsysmon/extupgrade.cpp b/sources/extsysmon/extupgrade.cpp index 18aed2f..c17f9c6 100644 --- a/sources/extsysmon/extupgrade.cpp +++ b/sources/extsysmon/extupgrade.cpp @@ -215,8 +215,8 @@ int ExtUpgrade::run() } // update value - times++; if (times >= m_interval) times = 0; + times++; return value; } diff --git a/sources/translations/CMakeLists.txt b/sources/translations/CMakeLists.txt index b2c7357..c191d2b 100644 --- a/sources/translations/CMakeLists.txt +++ b/sources/translations/CMakeLists.txt @@ -1,13 +1,6 @@ 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 (KDE4 REQUIRED) 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..a5a0e2d 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_awesome-widget.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..b61b258 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_desktop-panel.mo) file (GLOB _po_files *.po) set (_gmoFiles) diff --git a/sources/version.h.in b/sources/version.h.in index 0807c6a..a0c54fe 100644 --- a/sources/version.h.in +++ b/sources/version.h.in @@ -30,6 +30,5 @@ // cmake properties #define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" #define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -#cmakedefine BUILD_KDE4 #endif /* VERSION_H */