diff --git a/sources/awesome-widget-kde4/awesome-widget.h b/sources/awesome-widget-kde4/awesome-widget.h index dc716ee..d79a7cf 100644 --- a/sources/awesome-widget-kde4/awesome-widget.h +++ b/sources/awesome-widget-kde4/awesome-widget.h @@ -53,7 +53,6 @@ public: // de configuration QMap readDataEngineConfiguration(); void writeDataEngineConfiguration(const QMap settings); - QMap updateDataEngineConfiguration(const QMap rawConfig); public slots: // contextual actions diff --git a/sources/awesome-widget-kde4/configuration.cpp b/sources/awesome-widget-kde4/configuration.cpp index a2b6d64..5e2a003 100644 --- a/sources/awesome-widget-kde4/configuration.cpp +++ b/sources/awesome-widget-kde4/configuration.cpp @@ -47,15 +47,13 @@ QMap AwesomeWidget::readDataEngineConfiguration() rawConfig[QString("MPDADDRESS")] = QString("localhost"); rawConfig[QString("MPDPORT")] = QString("6600"); rawConfig[QString("MPRIS")] = QString("auto"); - rawConfig[QString("PKGCMD")] = QString("pacman -Qu"); - rawConfig[QString("PKGNULL")] = QString("0"); rawConfig[QString("PLAYER")] = QString("mpris"); QString fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf"); if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QFile configFile(fileName); if (!configFile.open(QIODevice::ReadOnly)) - return updateDataEngineConfiguration(rawConfig); + return rawConfig; QString fileStr; QStringList value; while (true) { @@ -73,7 +71,7 @@ QMap AwesomeWidget::readDataEngineConfiguration() } configFile.close(); - return updateDataEngineConfiguration(rawConfig); + return rawConfig; } @@ -81,7 +79,7 @@ void AwesomeWidget::writeDataEngineConfiguration(const QMap se { if (debug) qDebug() << PDEBUG; - QMap config = updateDataEngineConfiguration(settings); + QMap config = settings; QString fileName = KGlobal::dirs()->locateLocal("config", "plasma-dataengine-extsysmon.conf"); if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QFile configFile(fileName); @@ -94,35 +92,6 @@ void AwesomeWidget::writeDataEngineConfiguration(const QMap se } -QMap AwesomeWidget::updateDataEngineConfiguration(const QMap rawConfig) -{ - if (debug) qDebug() << PDEBUG; - - QMap config; - QString key, value; - // remove spaces and copy source map - for (int i=0; i -1) { for (int j=0; jbar() != QString("gpu")) continue; @@ -290,7 +290,7 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng } } } else if (sourceName == QString("gputemp")) { - values[QString("gputemp")] = QString("%1").arg(getTemp(data[QString("GPUTemp")].toFloat()), 4, 'f', 1); + values[QString("gputemp")] = QString("%1").arg(getTemp(data[QString("value")].toFloat()), 4, 'f', 1); } else if (sourceName.contains(mountFillRegExp)) { QString mount = sourceName; mount.remove(QString("partitions")); diff --git a/sources/awesome-widget-kf5/package/contents/ui/main.qml b/sources/awesome-widget-kf5/package/contents/ui/main.qml index b672611..b27a1e2 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/main.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/main.qml @@ -146,8 +146,8 @@ Item { PlasmaCore.ToolTipArea { id: rootTooltip mainItem: Text { - id: tooltip - textFormat: Text.RichText + id: tooltip + textFormat: Text.RichText } } } @@ -180,6 +180,8 @@ Item { } Plasmoid.onUserConfiguringChanged: { + if (debug) console.log("[main::onUserConfiguringChanged]") + // init submodule AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings) } diff --git a/sources/awesome-widget-kf5/plugin/awkeys.cpp b/sources/awesome-widget-kf5/plugin/awkeys.cpp index 535fcba..46d1480 100644 --- a/sources/awesome-widget-kf5/plugin/awkeys.cpp +++ b/sources/awesome-widget-kf5/plugin/awkeys.cpp @@ -122,10 +122,10 @@ QString AWKeys::parsePattern(const QString pattern) if (!ready) return pattern; QString parsed = pattern; - parsed.replace(QString(" "), QString(" ")); parsed.replace(QString("$$"), QString("$\\$\\")); for (int i=0; iimage(valueByKey(foundBars[i]).toFloat())); parsed.replace(QString("$\\$\\"), QString("$$")); diff --git a/sources/desktop-panel-kf5/package/contents/config/config.qml b/sources/desktop-panel-kf5/package/contents/config/config.qml index 5f62ce6..9f6f6c3 100644 --- a/sources/desktop-panel-kf5/package/contents/config/config.qml +++ b/sources/desktop-panel-kf5/package/contents/config/config.qml @@ -34,9 +34,15 @@ ConfigModel { } ConfigCategory { - name: i18n("Appearance") + name: i18n("Active desktop") icon: "preferences-desktop-theme" - source: "appearance.qml" + source: "activeapp.qml" + } + + ConfigCategory { + name: i18n("Inactive desktop") + icon: "preferences-desktop-theme" + source: "inactiveapp.qml" } ConfigCategory { diff --git a/sources/desktop-panel-kf5/package/contents/config/main.xml b/sources/desktop-panel-kf5/package/contents/config/main.xml index d779b52..39edfda 100644 --- a/sources/desktop-panel-kf5/package/contents/config/main.xml +++ b/sources/desktop-panel-kf5/package/contents/config/main.xml @@ -8,7 +8,7 @@ - [$fullmark$number/$total: $name] + [$mark$number/$total: $name] diff --git a/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml b/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml new file mode 100644 index 0000000..66624b1 --- /dev/null +++ b/sources/desktop-panel-kf5/package/contents/ui/activeapp.qml @@ -0,0 +1,219 @@ +/*************************************************************************** + * 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 index 1c1890a..6ea741d 100644 --- a/sources/desktop-panel-kf5/package/contents/ui/advanced.qml +++ b/sources/desktop-panel-kf5/package/contents/ui/advanced.qml @@ -17,9 +17,10 @@ import QtQuick 2.0 import QtQuick.Controls 1.3 as QtControls -import org.kde.plasma.core 2.0 as PlasmaCore +import QtQuick.Controls.Styles 1.3 as QtStyles +import QtQuick.Dialogs 1.1 as QtDialogs -import org.kde.plasma.private.awesomewidget 1.0 +import org.kde.plasma.private.desktoppanel 1.0 Item { @@ -29,46 +30,109 @@ Item { 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 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_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 + 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 @@ -87,16 +151,13 @@ Item { height: implicitHeight width: parent.width QtControls.Label { - height: parent.height + height: parent.heigth width: parent.width * 2 / 5 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - text: i18n("Custom time format") } - QtControls.TextField { - id: customTime + QtControls.CheckBox { + id: verticalLayout width: parent.width * 3 / 5 - text: plasmoid.configuration.customTime + text: i18n("Vertical layout") } } @@ -108,67 +169,16 @@ Item { 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") + text: i18n("Mark") } QtControls.ComboBox { - id: tempUnits + id: mark 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; - } - } - } + editable: true + model: ["#", "$", "%", "&", "*", "@", "¤", "¶", "·", "º", + plasmoid.configuration.mark] + currentIndex: model.length - 1 + onCurrentIndexChanged: cfg_mark = currentText } } @@ -180,96 +190,24 @@ Item { 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") + text: i18n("Panels to be hidden") } QtControls.Button { width: parent.width * 3 / 5 - text: i18n("Edit bars") - onClicked: AWKeys.editItem("graphicalitem") + text: i18n("Edit panels") + onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels) } } } - // 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) - } + 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]") - - // init submodule - AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings) } } diff --git a/sources/desktop-panel-kf5/package/contents/ui/appearance.qml b/sources/desktop-panel-kf5/package/contents/ui/appearance.qml deleted file mode 100644 index 45b62e5..0000000 --- a/sources/desktop-panel-kf5/package/contents/ui/appearance.qml +++ /dev/null @@ -1,402 +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 QtQuick.Controls.Styles 1.3 as QtStyles -import QtQuick.Dialogs 1.1 as QtDialogs - -import org.kde.plasma.private.desktoppanel 1.0 - - -Item { - id: appearancePage - 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_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 - property alias cfg_currentFontFamily: currentSelectFont.text - property alias cfg_currentFontSize: currentFontSize.value - property string cfg_currentFontWeight: currentFontWeight.currentText - property string cfg_currentFontStyle: currentFontStyle.currentText - property alias cfg_currentFontColor: currentSelectColor.text - - - Column { - id: pageColumn - width: units.gridUnit * 25 - QtControls.TabView { - height: parent.height - width: parent.width - QtControls.Tab { - title: i18n("Active desktop") - - QtLayouts.ColumnLayout { - 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: currentSelectFont - width: parent.width * 2 / 3 - text: plasmoid.configuration.currentFontFamily - onClicked: currentFontDialog.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: currentFontSize - 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: currentFontWeight - 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: currentFontStyle - 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: currentSelectColor - width: parent.width * 2 / 3 - style: QtStyles.ButtonStyle { - background: Rectangle { - color: plasmoid.configuration.currentFontColor - } - } - text: plasmoid.configuration.currentFontColor - onClicked: currentColorDialog.visible = true - } - } - } - - QtDialogs.ColorDialog { - id: currentColorDialog - title: i18n("Select a color") - color: currentSelectColor.text - onAccepted: currentSelectColor.text = currentColorDialog.color - } - - QtDialogs.FontDialog { - id: currentFontDialog - title: i18n("Select a font") - font: Qt.font({ family: currentSelectFont.text, pointSize: currentFontSize.value, weight: Font.Normal }) - onAccepted: { - currentSelectFont.text = currentFontDialog.font.family - currentFontSize.value = currentFontDialog.font.pointSize - currentFontStyle.currentIndex = currentFontDialog.font.italic ? 1 : 0 - currentFontWeight.currentIndex = weight[currentFontDialog.font.weight] - } - } - } - - QtControls.Tab { - title: i18n("Inactive desktop") - - QtLayouts.ColumnLayout { - 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/desktop-panel-kf5/package/contents/ui/inactiveapp.qml b/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml new file mode 100644 index 0000000..8c95377 --- /dev/null +++ b/sources/desktop-panel-kf5/package/contents/ui/inactiveapp.qml @@ -0,0 +1,218 @@ +/*************************************************************************** + * 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 index a9e9b11..fd236f8 100644 --- a/sources/desktop-panel-kf5/package/contents/ui/main.qml +++ b/sources/desktop-panel-kf5/package/contents/ui/main.qml @@ -30,9 +30,15 @@ Item { id: main property bool debug: DPAdds.isDebugEnabled() - property variant settings: { + property variant tooltipSettings: { + "tooltipColor": plasmoid.configuration.tooltipColor, + "tooltipType": plasmoid.configuration.tooltipType, + "tooltipWidth": plasmoid.configuration.tooltipWidth } + signal needUpdate + signal needTooltipUpdate + // init Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation @@ -40,8 +46,8 @@ Item { Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar - Layout.minimumHeight: text.height - Layout.minimumWidth: text.width + Layout.minimumWidth: width + Layout. minimumHeight: height Plasmoid.icon: "utilities-system-monitor" Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground" @@ -49,37 +55,116 @@ Item { // ui Grid { - columns: 1 + columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops() + rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1 - Text { - id: text - height: contentHeight - width: contentWidth - textFormat: Text.RichText - wrapMode: Text.NoWrap - - horizontalAlignment: general.align[plasmoid.configuration.textAlign] - verticalAlignment: Text.AlignVCenter - - color: plasmoid.configuration.fontColor - font.family: plasmoid.configuration.fontFamily - font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false - font.pointSize: plasmoid.configuration.fontSize - font.weight: general.fontWeight[plasmoid.configuration.fontWeight] - - text: plasmoid.configuration.text - - PlasmaCore.ToolTipArea { - id: rootTooltip - mainItem: Text { - id: tooltip + Repeater { + id: repeater + 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; i #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include @@ -47,6 +49,8 @@ DPAdds::DPAdds(QObject *parent) 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))); } @@ -64,6 +68,14 @@ bool DPAdds::isDebugEnabled() } +int DPAdds::currentDesktop() +{ + if (debug) qDebug() << PDEBUG; + + return KWindowSystem::currentDesktop(); +} + + QStringList DPAdds::dictKeys() { if (debug) qDebug() << PDEBUG; @@ -78,16 +90,37 @@ QStringList DPAdds::dictKeys() } +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 - // clear + 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); - DesktopWindowsInfo info = getInfoByDesktop(desktop); + 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(); @@ -104,20 +137,36 @@ QString DPAdds::toolTipImage(const int desktop) QPen pen = QPen(); pen.setWidthF(2.0 * info.desktop.width() / 400.0); pen.setColor(QColor(tooltipColor)); - for (int i=0; iaddLine(info.windows[i].left() + margin, info.windows[i].bottom() + margin, - info.windows[i].left() + margin, info.windows[i].top() + margin, pen); - toolTipScene->addLine(info.windows[i].left() + margin, info.windows[i].top() + margin, - info.windows[i].right() + margin, info.windows[i].top() + margin, pen); - toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].top() + margin, - info.windows[i].right() + margin, info.windows[i].bottom() + margin, pen); - toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].bottom() + margin, - info.windows[i].left() + margin, info.windows[i].bottom() + margin, pen); + 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")) { -// toolTip.setWindowsToPreview(info.desktopId); + 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")) { -// toolTip.setWindowsToPreview(info.winId); + 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); @@ -125,6 +174,9 @@ QString DPAdds::toolTipImage(const int desktop) QBuffer buffer(&byteArray); image.save(&buffer, "PNG"); + delete toolTipView; + delete toolTipScene; + return QString("").arg(QString(byteArray.toBase64())); } @@ -135,10 +187,10 @@ QString DPAdds::parsePattern(const QString pattern, const int desktop) QString parsed = pattern; QStringList keys = dictKeys(); - parsed.replace(QString(" "), QString(" ")); parsed.replace(QString("$$"), QString("$\\$\\")); for (int i=0; i tooltipData) +void DPAdds::setToolTipData(const QMap tooltipData) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData; @@ -181,24 +233,25 @@ void DPAdds::setToolTipData(const QMap< QString, QVariant > tooltipData) } -QString DPAdds::valueByKey(const QString key, const int desktop) +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 (KWindowSystem::currentDesktop() == desktop) + if (currentDesktop() == desktop) currentMark = mark; else currentMark = QString(""); if (key == QString("mark")) - return QString("%1").arg(currentMark, currentMark.count(), QLatin1Char(' ')); + 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(KWindowSystem::numberOfDesktops()); + return QString::number(numberOfDesktops()); else return QString(); } @@ -361,6 +414,15 @@ void DPAdds::changeDesktop(const int desktop) } +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; @@ -374,14 +436,18 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) for (int i=0; i DPAdds::getPanels() { if (debug) qDebug() << PDEBUG; - Plasma::Containment *containment = new Plasma::Containment(this, QVariantList()); +// Plasma::Corona *corona = new Plasma::Corona(this); QList panels; - for (int i=0; icorona()->containments().count(); i++) - if (containment->corona()->containments()[i]->containmentType() == - Plasma::Types::ContainmentType::PanelContainment) - panels.append(containment->corona()->containments()[i]); - delete containment; +// 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; } diff --git a/sources/desktop-panel-kf5/plugin/dpadds.h b/sources/desktop-panel-kf5/plugin/dpadds.h index 9fd8633..1a5f7e0 100644 --- a/sources/desktop-panel-kf5/plugin/dpadds.h +++ b/sources/desktop-panel-kf5/plugin/dpadds.h @@ -30,11 +30,16 @@ class DPAdds : public QObject { Q_OBJECT + typedef struct { + WId id; + QString name; + QRect rect; + } WindowData; + typedef struct { QRect desktop; - QList desktopId; - QList windows; - QList winId; + QList desktopsData; + QList windowsData; } DesktopWindowsInfo; public: @@ -42,14 +47,16 @@ public: ~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, const int desktop); + 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"); @@ -57,6 +64,7 @@ public: signals: void desktopChanged(); + void windowListChanged(); public slots: Q_INVOKABLE void changePanelsState(); @@ -65,6 +73,7 @@ public slots: private slots: void changeDesktop(const int desktop); + void changeWindowList(const WId window); private: DesktopWindowsInfo getInfoByDesktop(const int desktop); @@ -72,8 +81,10 @@ private: QString panelLocationToStr(Plasma::Types::Location location); // variables bool debug = false; - int oldState, tooltipWidth; - QString mark, tooltipColor, tooltipType; + int oldState, tooltipWidth = 200; + QString mark = QString("*"); + QString tooltipColor = QString("#000000"); + QString tooltipType = QString("none"); QList panelsToControl; };