mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
start work on desktop panel
This commit is contained in:
parent
bb88892125
commit
681fec4cac
@ -43,6 +43,7 @@ if (BUILD_KDE4)
|
|||||||
add_subdirectory (desktop-panel-kde4)
|
add_subdirectory (desktop-panel-kde4)
|
||||||
else ()
|
else ()
|
||||||
add_subdirectory (awesome-widget-kf5)
|
add_subdirectory (awesome-widget-kf5)
|
||||||
|
add_subdirectory (desktop-panel-kf5)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# translations
|
# translations
|
||||||
|
@ -80,13 +80,13 @@
|
|||||||
<entry name="upTooltipColor" type="string">
|
<entry name="upTooltipColor" type="string">
|
||||||
<default>#ff00ff</default>
|
<default>#ff00ff</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="batteryTooltip" type="bool">
|
<entry name="batTooltip" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="batteryTooltipColor" type="string">
|
<entry name="batTooltipColor" type="string">
|
||||||
<default>#008800</default>
|
<default>#008800</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="batteryInTooltipColor" type="string">
|
<entry name="batInTooltipColor" type="string">
|
||||||
<default>#880000</default>
|
<default>#880000</default>
|
||||||
</entry>
|
</entry>
|
||||||
</group>
|
</group>
|
||||||
|
@ -47,15 +47,15 @@ Item {
|
|||||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
"downTooltip": plasmoid.configuration.downTooltip,
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
"upTooltip": plasmoid.configuration.downTooltip,
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias cfg_background: background.checked
|
property alias cfg_background: background.checked
|
||||||
|
@ -21,7 +21,6 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
|
|||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -22,7 +22,6 @@ import QtQuick.Layouts 1.0 as QtLayouts
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -43,15 +42,15 @@ Item {
|
|||||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
"downTooltip": plasmoid.configuration.downTooltip,
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
"upTooltip": plasmoid.configuration.downTooltip,
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
}
|
}
|
||||||
|
|
||||||
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
|
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
|
||||||
|
@ -47,15 +47,15 @@ Item {
|
|||||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
"downTooltip": plasmoid.configuration.downTooltip,
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
"upTooltip": plasmoid.configuration.downTooltip,
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
}
|
}
|
||||||
|
|
||||||
signal needUpdate
|
signal needUpdate
|
||||||
@ -111,7 +111,7 @@ Item {
|
|||||||
id: timeDE
|
id: timeDE
|
||||||
engine: "time"
|
engine: "time"
|
||||||
connectedSources: ["Local"]
|
connectedSources: ["Local"]
|
||||||
interval: plasmoid.configuration.interval
|
interval: 1000
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
@ -21,7 +21,6 @@ import QtQuick.Controls.Styles 1.3 as QtStyles
|
|||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -47,9 +46,9 @@ Item {
|
|||||||
property alias cfg_downTooltip: downTooltip.checked
|
property alias cfg_downTooltip: downTooltip.checked
|
||||||
property alias cfg_downTooltipColor: downTooltipColor.text
|
property alias cfg_downTooltipColor: downTooltipColor.text
|
||||||
property alias cfg_upTooltipColor: upTooltipColor.text
|
property alias cfg_upTooltipColor: upTooltipColor.text
|
||||||
property alias cfg_batteryTooltip: batteryTooltip.checked
|
property alias cfg_batTooltip: batTooltip.checked
|
||||||
property alias cfg_batteryTooltipColor: batteryTooltipColor.text
|
property alias cfg_batTooltipColor: batTooltipColor.text
|
||||||
property alias cfg_batteryInTooltipColor: batteryInTooltipColor.text
|
property alias cfg_batInTooltipColor: batInTooltipColor.text
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@ -430,13 +429,13 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width * 2 / 5 - batteryTooltip.width
|
width: parent.width * 2 / 5 - batTooltip.width
|
||||||
horizontalAlignment: Text.AlignRight
|
horizontalAlignment: Text.AlignRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: i18n("Battery active color")
|
text: i18n("Battery active color")
|
||||||
}
|
}
|
||||||
QtControls.CheckBox {
|
QtControls.CheckBox {
|
||||||
id: batteryTooltip
|
id: batTooltip
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
style: QtStyles.CheckBoxStyle {
|
style: QtStyles.CheckBoxStyle {
|
||||||
@ -458,22 +457,22 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: batteryTooltipColor
|
id: batTooltipColor
|
||||||
width: parent.width * 3 / 5
|
width: parent.width * 3 / 5
|
||||||
style: QtStyles.ButtonStyle {
|
style: QtStyles.ButtonStyle {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: plasmoid.configuration.batteryTooltipColor
|
color: plasmoid.configuration.batTooltipColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text: plasmoid.configuration.batteryTooltipColor
|
text: plasmoid.configuration.batTooltipColor
|
||||||
onClicked: batteryTooltipColorDialog.visible = true
|
onClicked: batTooltipColorDialog.visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
QtDialogs.ColorDialog {
|
QtDialogs.ColorDialog {
|
||||||
id: batteryTooltipColorDialog
|
id: batTooltipColorDialog
|
||||||
title: i18n("Select a color")
|
title: i18n("Select a color")
|
||||||
color: batteryTooltipColor.text
|
color: batTooltipColor.text
|
||||||
onAccepted: batteryTooltipColor.text = batteryTooltipColorDialog.color
|
onAccepted: batTooltipColor.text = batTooltipColorDialog.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,22 +487,22 @@ Item {
|
|||||||
text: i18n("Battery inactive color")
|
text: i18n("Battery inactive color")
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: batteryInTooltipColor
|
id: batInTooltipColor
|
||||||
width: parent.width * 3 / 5
|
width: parent.width * 3 / 5
|
||||||
style: QtStyles.ButtonStyle {
|
style: QtStyles.ButtonStyle {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: plasmoid.configuration.batteryInTooltipColor
|
color: plasmoid.configuration.batInTooltipColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text: plasmoid.configuration.batteryInTooltipColor
|
text: plasmoid.configuration.batInTooltipColor
|
||||||
onClicked: batteryInTooltipColorDialog.visible = true
|
onClicked: batInTooltipColorDialog.visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
QtDialogs.ColorDialog {
|
QtDialogs.ColorDialog {
|
||||||
id: batteryInTooltipColorDialog
|
id: batInTooltipColorDialog
|
||||||
title: i18n("Select a color")
|
title: i18n("Select a color")
|
||||||
color: batteryInTooltipColor.text
|
color: batInTooltipColor.text
|
||||||
onAccepted: batteryInTooltipColor.text = batteryInTooltipColorDialog.color
|
onAccepted: batInTooltipColor.text = batInTooltipColorDialog.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
import "."
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -48,15 +47,15 @@ Item {
|
|||||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
"downTooltip": plasmoid.configuration.downTooltip,
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
"upTooltip": plasmoid.configuration.downTooltip,
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
"batteryTooltip": plasmoid.configuration.batteryTooltip,
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
"batteryTooltipColor": plasmoid.configuration.batteryTooltipColor,
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
"batteryInTooltipColor": plasmoid.configuration.batteryInTooltipColor
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias cfg_text: textPattern.text
|
property alias cfg_text: textPattern.text
|
||||||
|
@ -51,7 +51,7 @@ AWToolTip::AWToolTip(QObject *parent,
|
|||||||
counts += configuration[QString("memTooltip")].toInt();
|
counts += configuration[QString("memTooltip")].toInt();
|
||||||
counts += configuration[QString("swapTooltip")].toInt();
|
counts += configuration[QString("swapTooltip")].toInt();
|
||||||
counts += configuration[QString("downTooltip")].toInt();
|
counts += configuration[QString("downTooltip")].toInt();
|
||||||
counts += configuration[QString("batteryTooltip")].toInt();
|
counts += configuration[QString("batTooltip")].toInt();
|
||||||
|
|
||||||
boundaries[QString("cpuTooltip")] = 100.0;
|
boundaries[QString("cpuTooltip")] = 100.0;
|
||||||
boundaries[QString("cpuclTooltip")] = 4000.0;
|
boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||||
@ -108,10 +108,7 @@ QPixmap AWToolTip::image()
|
|||||||
for (int i=0; i<requiredKeys.count(); i++) {
|
for (int i=0; i<requiredKeys.count(); i++) {
|
||||||
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||||
if (requiredKeys[i] == QString("batTooltip"))
|
isBattery = (requiredKeys[i] == QString("batTooltip"));
|
||||||
isBattery = true;
|
|
||||||
else
|
|
||||||
isBattery = false;
|
|
||||||
if (!isBattery) pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
|
if (!isBattery) pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
|
||||||
float shift = i * 100.0;
|
float shift = i * 100.0;
|
||||||
if (down) shift -= 100.0;
|
if (down) shift -= 100.0;
|
||||||
@ -122,9 +119,9 @@ QPixmap AWToolTip::image()
|
|||||||
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
|
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
|
||||||
if (isBattery) {
|
if (isBattery) {
|
||||||
if (data[requiredKeys[i]][j+1] > 0)
|
if (data[requiredKeys[i]][j+1] > 0)
|
||||||
pen.setColor(QColor(configuration[QString("batteryColor")].toString()));
|
pen.setColor(QColor(configuration[QString("batTooltipColor")].toString()));
|
||||||
else
|
else
|
||||||
pen.setColor(QColor(configuration[QString("batteryInColor")].toString()));
|
pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString()));
|
||||||
}
|
}
|
||||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||||
}
|
}
|
||||||
|
16
sources/desktop-panel-kf5/CMakeLists.txt
Normal file
16
sources/desktop-panel-kf5/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# set project name
|
||||||
|
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||||
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
|
find_package (Qt5 REQUIRED COMPONENTS Core 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)
|
47
sources/desktop-panel-kf5/package/contents/config/config.qml
Normal file
47
sources/desktop-panel-kf5/package/contents/config/config.qml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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("Appearance")
|
||||||
|
icon: "preferences-desktop-theme"
|
||||||
|
source: "appearance.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("About")
|
||||||
|
icon: "help-about"
|
||||||
|
source: "about.qml"
|
||||||
|
}
|
||||||
|
}
|
84
sources/desktop-panel-kf5/package/contents/config/main.xml
Normal file
84
sources/desktop-panel-kf5/package/contents/config/main.xml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||||
|
<kcfgfile name=""/>
|
||||||
|
|
||||||
|
<group name="Widget">
|
||||||
|
<!-- widget -->
|
||||||
|
<entry name="text" type="string">
|
||||||
|
<default>[$fullmark$number/$total: $name]</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Advanced">
|
||||||
|
<!-- advanced -->
|
||||||
|
<entry name="tooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipType" type="string">
|
||||||
|
<default>windows</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipWidth" type="int">
|
||||||
|
<default>200</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipColor" type="string">
|
||||||
|
<default>#ffffff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="background" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="verticalLayout" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="mark" type="string">
|
||||||
|
<default>¤</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="panels" type="int">
|
||||||
|
<default>-1</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Appearance">
|
||||||
|
<!-- appearance -->
|
||||||
|
<entry name="textAlign" type="string">
|
||||||
|
<default>center</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontFamily" type="string">
|
||||||
|
<default>Terminus</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontSize" type="int">
|
||||||
|
<default>12</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontColor" type="string">
|
||||||
|
<default>#000000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontWeight" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontStyle" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<!-- current -->
|
||||||
|
<entry name="currentTextAlign" type="string">
|
||||||
|
<default>center</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontFamily" type="string">
|
||||||
|
<default>Terminus</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontSize" type="int">
|
||||||
|
<default>12</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontColor" type="string">
|
||||||
|
<default>#ff0000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontWeight" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontStyle" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</kcfg>
|
99
sources/desktop-panel-kf5/package/contents/ui/about.qml
Normal file
99
sources/desktop-panel-kf5/package/contents/ui/about.qml
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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]")
|
||||||
|
}
|
||||||
|
}
|
275
sources/desktop-panel-kf5/package/contents/ui/advanced.qml
Normal file
275
sources/desktop-panel-kf5/package/contents/ui/advanced.qml
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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_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: 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)
|
||||||
|
}
|
||||||
|
}
|
402
sources/desktop-panel-kf5/package/contents/ui/appearance.qml
Normal file
402
sources/desktop-panel-kf5/package/contents/ui/appearance.qml
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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]")
|
||||||
|
}
|
||||||
|
}
|
36
sources/desktop-panel-kf5/package/contents/ui/general.qml
Normal file
36
sources/desktop-panel-kf5/package/contents/ui/general.qml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
85
sources/desktop-panel-kf5/package/contents/ui/main.qml
Normal file
85
sources/desktop-panel-kf5/package/contents/ui/main.qml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 settings: {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// init
|
||||||
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||||
|
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||||
|
|
||||||
|
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
|
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
|
Layout.minimumHeight: text.height
|
||||||
|
Layout.minimumWidth: text.width
|
||||||
|
|
||||||
|
Plasmoid.icon: "utilities-system-monitor"
|
||||||
|
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||||
|
|
||||||
|
|
||||||
|
// ui
|
||||||
|
Grid {
|
||||||
|
columns: 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
|
||||||
|
textFormat: Text.RichText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[main::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
1
sources/desktop-panel-kf5/package/contents/ui/qmldir
Normal file
1
sources/desktop-panel-kf5/package/contents/ui/qmldir
Normal file
@ -0,0 +1 @@
|
|||||||
|
singleton general general.qml
|
234
sources/desktop-panel-kf5/package/contents/ui/widget.qml
Normal file
234
sources/desktop-panel-kf5/package/contents/ui/widget.qml
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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.private.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: widgetPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_text: textPattern.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
width: units.gridUnit * 25
|
||||||
|
QtControls.Label {
|
||||||
|
width: parent.width
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||||
|
}
|
||||||
|
|
||||||
|
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, "<span style=\"color:" + font.color +
|
||||||
|
"; font-family:'" + font.family +
|
||||||
|
"'; font-size:" + font.size + "pt;\">" +
|
||||||
|
selected + "</span>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 + "<br>\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, "<b>" + selected + "</b>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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, "<i>" + selected + "</i>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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, "<u>" + selected + "</u>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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, "<s>" + selected + "</s>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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, "<p align=\"left\">" + selected + "</p")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Center button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Right button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Justify button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: tags
|
||||||
|
width: parent.width - addTagButton.width - showValueButton.width
|
||||||
|
model: ADAdds.dictKeys()
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: addTagButton
|
||||||
|
text: i18n("Add")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Add tag button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, selected + "$" + tags.currentText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: showValueButton
|
||||||
|
text: i18n("Show value")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||||
|
|
||||||
|
var message = i18n("Tag: %1", tags.currentText)
|
||||||
|
message += "<br>"
|
||||||
|
message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText))
|
||||||
|
message += "<br>"
|
||||||
|
message += i18n("Info: %1", DPAdds.infoByKey(tags.currentText))
|
||||||
|
DPAdds.sendNotification("tag", message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.TextArea {
|
||||||
|
id: textPattern
|
||||||
|
width: parent.width
|
||||||
|
textFormat: TextEdit.PlainText
|
||||||
|
text: plasmoid.configuration.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
28
sources/desktop-panel-kf5/package/metadata.desktop
Normal file
28
sources/desktop-panel-kf5/package/metadata.desktop
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[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
|
33
sources/desktop-panel-kf5/plugin/CMakeLists.txt
Normal file
33
sources/desktop-panel-kf5/plugin/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
set (PLUGIN_NAME dpplugin)
|
||||||
|
|
||||||
|
add_definitions (${Qt5Core_DEFINITIONS})
|
||||||
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
|
${Qt5Qml_INCLUDE_DIRS})
|
||||||
|
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||||
|
${Qt5Qml_LIBRARIES})
|
||||||
|
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||||
|
${Notifications_INCLUDE_DIR}
|
||||||
|
${Plasma_INCLUDE_DIR})
|
||||||
|
set (Kf5_LIBRARIES KF5::I18n
|
||||||
|
KF5::Notifications
|
||||||
|
KF5::Plasma
|
||||||
|
KF5::WindowSystem)
|
||||||
|
|
||||||
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${PROJECT_TRDPARTY_DIR}
|
||||||
|
${Qt_INCLUDE}
|
||||||
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
|
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||||
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||||
|
|
||||||
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||||
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||||
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
39
sources/desktop-panel-kf5/plugin/desktoppanel.cpp
Normal file
39
sources/desktop-panel-kf5/plugin/desktoppanel.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 "desktoppanel.h"
|
||||||
|
|
||||||
|
#include <QtQml>
|
||||||
|
|
||||||
|
#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<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
||||||
|
}
|
37
sources/desktop-panel-kf5/plugin/desktoppanel.h
Normal file
37
sources/desktop-panel-kf5/plugin/desktoppanel.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
|
||||||
|
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 */
|
255
sources/desktop-panel-kf5/plugin/dpadds.cpp
Normal file
255
sources/desktop-panel-kf5/plugin/dpadds.cpp
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 <KI18n/KLocalizedString>
|
||||||
|
#include <KNotifications/KNotification>
|
||||||
|
#include <KWindowSystem/KWindowSystem>
|
||||||
|
#include <Plasma/Corona>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
|
#include <fontdialog/fontdialog.h>
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DPAdds::~DPAdds()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DPAdds::isDebugEnabled()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList DPAdds::dictKeys()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QStringList allKeys;
|
||||||
|
allKeys.append(QString("fullmark"));
|
||||||
|
allKeys.append(QString("mark"));
|
||||||
|
allKeys.append(QString("name"));
|
||||||
|
allKeys.append(QString("number"));
|
||||||
|
allKeys.append(QString("total"));
|
||||||
|
|
||||||
|
return allKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::parsePattern(const QString pattern, const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString parsed = pattern;
|
||||||
|
QStringList keys = dictKeys();
|
||||||
|
parsed.replace(QString(" "), QString(" "));
|
||||||
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
|
for (int i=0; i<keys.count(); i++)
|
||||||
|
parsed.replace(QString("$") + keys[i], valueByKey(keys[i], desktop));
|
||||||
|
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::valueByKey(const QString key, const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
|
||||||
|
|
||||||
|
QString currentMark;
|
||||||
|
if (KWindowSystem::currentDesktop() == desktop)
|
||||||
|
currentMark = mark;
|
||||||
|
else
|
||||||
|
currentMark = QString("");
|
||||||
|
if (key == QString("fullmark"))
|
||||||
|
return QString("%1").arg(currentMark, currentMark.count(), QLatin1Char(' '));
|
||||||
|
else if (key == QString("mark"))
|
||||||
|
return currentMark;
|
||||||
|
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());
|
||||||
|
else
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
|
||||||
|
else if (type == QString("copy"))
|
||||||
|
text = QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||||
|
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>");
|
||||||
|
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<trdPartyList.count(); i++)
|
||||||
|
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%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<QString, QVariant> DPAdds::getFont(const QMap<QString, QVariant> defaultFont)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QMap<QString, QVariant> 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 == QString("-1")) return;
|
||||||
|
|
||||||
|
// QList<Plasma::Containment *> panels = getPanels();
|
||||||
|
// for (int i=0; i<panels.count(); i++) {
|
||||||
|
// if (!panelsToControl.split(QChar(',')).contains(QString::number(i))) continue;
|
||||||
|
// bool wasVisible = panels[i]->view()->isVisible();
|
||||||
|
// int winId = panels[i]->view()->winId();
|
||||||
|
// if (wasVisible) {
|
||||||
|
// if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
|
||||||
|
// KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
|
||||||
|
// oldState = oldInfo.state();
|
||||||
|
// panels[i]->view()->setVisible(false);
|
||||||
|
// } else {
|
||||||
|
// if (debug) qDebug() << PDEBUG << ":" << "Show panel";
|
||||||
|
// panels[i]->view()->setVisible(true);
|
||||||
|
// KWindowSystem::clearState(winId, NET::KeepAbove);
|
||||||
|
// KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
|
||||||
|
// KWindowSystem::setOnAllDesktops(winId, true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<Plasma::Containment *> DPAdds::getPanels()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
Plasma::Containment *containment = new Plasma::Containment(this, QVariantList());
|
||||||
|
QList<Plasma::Containment *> panels;
|
||||||
|
for (int i=0; i<containment->corona()->containments().count(); i++)
|
||||||
|
if (containment->corona()->containments()[i]->containmentType() ==
|
||||||
|
Plasma::Types::ContainmentType::PanelContainment)
|
||||||
|
panels.append(containment->corona()->containments()[i]);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
67
sources/desktop-panel-kf5/plugin/dpadds.h
Normal file
67
sources/desktop-panel-kf5/plugin/dpadds.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* 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 <Plasma/Containment>
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class DPAdds : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DPAdds(QObject *parent = 0);
|
||||||
|
~DPAdds();
|
||||||
|
|
||||||
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
|
Q_INVOKABLE QStringList dictKeys();
|
||||||
|
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop);
|
||||||
|
// values
|
||||||
|
Q_INVOKABLE QString valueByKey(const QString key, const int desktop);
|
||||||
|
// configuration slots
|
||||||
|
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||||
|
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void desktopChanged();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<Plasma::Containment *> getPanels();
|
||||||
|
QString panelLocationToStr(Plasma::Types::Location location);
|
||||||
|
// variables
|
||||||
|
bool debug = false;
|
||||||
|
int oldState;
|
||||||
|
QString mark, panelsToControl;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DPADDS_H */
|
@ -0,0 +1,24 @@
|
|||||||
|
[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
|
3
sources/desktop-panel-kf5/plugin/qmldir
Normal file
3
sources/desktop-panel-kf5/plugin/qmldir
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module org.kde.plasma.private.desktoppanel
|
||||||
|
|
||||||
|
plugin dpplugin
|
Loading…
Reference in New Issue
Block a user