diff --git a/sources/awesome-widget/package/contents/ui/about.qml b/sources/awesome-widget/package/contents/ui/about.qml
index 5b5d9a2..071da9b 100644
--- a/sources/awesome-widget/package/contents/ui/about.qml
+++ b/sources/awesome-widget/package/contents/ui/about.qml
@@ -16,27 +16,15 @@
***************************************************************************/
import QtQuick 2.15
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
-Item {
+KCM.SimpleKCM {
id: aboutPage
- // backend
- AWActions {
- id: awActions
- }
-
- width: childrenRect.width
- height: childrenRect.height
-
- property bool debug: awActions.isDebugEnabled()
AboutTab {
textProvider: awActions
}
-
- Component.onCompleted: {
- if (debug) console.debug()
- }
}
diff --git a/sources/awesome-widget/package/contents/ui/advanced.qml b/sources/awesome-widget/package/contents/ui/advanced.qml
index 7f77862..b3b7010 100644
--- a/sources/awesome-widget/package/contents/ui/advanced.qml
+++ b/sources/awesome-widget/package/contents/ui/advanced.qml
@@ -17,24 +17,19 @@
import QtQuick 2.15
import QtQuick.Controls
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
-Item {
+KCM.SimpleKCM {
id: advancedPage
+
// backend
AWActions {
id: awActions
}
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: pageColumn.implicitWidth
- implicitHeight: pageColumn.implicitHeight
-
- property bool debug: awActions.isDebugEnabled()
-
property alias cfg_background: background.checked
property alias cfg_translateStrings: translate.checked
property alias cfg_wrapNewLines: wrapNewLines.checked
@@ -55,7 +50,6 @@ Item {
property alias cfg_telemetryRemote: telemetryRemote.checked
property alias cfg_telemetryId: telemetryId.value
-
Column {
id: pageColumn
anchors.fill: parent
@@ -194,14 +188,18 @@ Item {
GroupBox {
width: parent.width
+ height: implicitHeight
title: i18n("Actions")
Column {
+ height: implicitHeight
width: parent.width
+
ButtonSelector {
value: i18n("Drop key cache")
onButtonActivated: awActions.dropCache()
}
+
ButtonSelector {
ExportDialog {
id: saveConfigAs
@@ -210,11 +208,12 @@ Item {
value: i18n("Export configuration")
onButtonActivated: saveConfigAs.open()
}
+
ButtonSelector {
ImportDialog {
id: loadConfigFrom
onConfigurationReceived: {
- for (var key in configuration)
+ for (const key in configuration)
plasmoid.configuration[key] = configuration[key]
}
}
@@ -225,15 +224,19 @@ Item {
}
GroupBox {
+ height: implicitHeight
width: parent.width
title: i18n("Telemetry")
Column {
+ height: implicitHeight
width: parent.width
+
CheckBoxSelector {
id: telemetryRemote
text: i18n("Enable remote telemetry")
}
+
IntegerSelector {
id: telemetryCount
maximumValue: 10000
@@ -242,6 +245,7 @@ Item {
text: i18n("History count")
value: plasmoid.configuration.telemetryCount
}
+
LineSelector {
id: telemetryId
text: i18n("Telemetry ID")
@@ -250,9 +254,4 @@ Item {
}
}
}
-
-
- Component.onCompleted: {
- if (debug) console.debug()
- }
}
diff --git a/sources/awesome-widget/package/contents/ui/appearance.qml b/sources/awesome-widget/package/contents/ui/appearance.qml
index de895e0..189c618 100644
--- a/sources/awesome-widget/package/contents/ui/appearance.qml
+++ b/sources/awesome-widget/package/contents/ui/appearance.qml
@@ -16,30 +16,21 @@
***************************************************************************/
import QtQuick 2.15
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
import "."
-Item {
+KCM.SimpleKCM {
id: appearancePage
- // backend
- AWActions {
- id: awActions
- }
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: pageColumn.implicitWidth
- implicitHeight: pageColumn.implicitHeight
-
- property bool debug: awActions.isDebugEnabled()
property variant weight: {
25: 0,
50: 1,
63: 3,
75: 4,
- 87: 5
+ 87: 5,
}
property alias cfg_fontFamily: font.value
@@ -106,9 +97,4 @@ Item {
value: plasmoid.configuration.textStyleColor
}
}
-
-
- Component.onCompleted: {
- if (debug) console.debug()
- }
}
diff --git a/sources/awesome-widget/package/contents/ui/dataengine.qml b/sources/awesome-widget/package/contents/ui/dataengine.qml
index 9b2ff95..f0c1ef6 100644
--- a/sources/awesome-widget/package/contents/ui/dataengine.qml
+++ b/sources/awesome-widget/package/contents/ui/dataengine.qml
@@ -17,36 +17,28 @@
import QtQuick 2.15
import QtQuick.Controls
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
-Item {
+KCM.SimpleKCM {
id: dataenginePage
+
// backend
AWKeys {
id: awKeys
}
- AWActions {
- id: awActions
- }
AWConfigHelper {
id: awConfig
}
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: pageColumn.implicitWidth
- implicitHeight: pageColumn.implicitHeight
-
- property bool debug: awActions.isDebugEnabled()
-
property variant cfg_dataengine: awConfig.readDataEngineConfiguration()
-
Column {
id: pageColumn
anchors.fill: parent
+const
GroupBox {
height: implicitHeight
width: parent.width
@@ -62,6 +54,7 @@ Item {
height: implicitHeight
width: parent.width
title: i18n("Player")
+
Column {
height: implicitHeight
width: parent.width
@@ -160,9 +153,11 @@ Item {
height: implicitHeight
width: parent.width
title: i18n("Extensions")
+
Column {
height: implicitHeight
width: parent.width
+
ButtonSelector {
value: i18n("Custom scripts")
onButtonActivated: awKeys.editItem("extscript")
@@ -193,8 +188,6 @@ Item {
Component.onCompleted: {
- if (debug) console.debug()
-
// init submodule
awKeys.updateCache()
@@ -204,8 +197,6 @@ Item {
}
Component.onDestruction: {
- if (debug) console.debug()
-
cfg_dataengine["MPRIS"] = mpris.editText
awConfig.writeDataEngineConfiguration(cfg_dataengine)
}
diff --git a/sources/awesome-widget/package/contents/ui/main.qml b/sources/awesome-widget/package/contents/ui/main.qml
index 04ff238..d2184d2 100644
--- a/sources/awesome-widget/package/contents/ui/main.qml
+++ b/sources/awesome-widget/package/contents/ui/main.qml
@@ -28,6 +28,7 @@ import "."
PlasmoidItem {
id: main
+
// backend
AWKeys {
id: awKeys
@@ -42,7 +43,6 @@ PlasmoidItem {
id: bugReport
}
- property bool debug: awActions.isDebugEnabled()
property variant tooltipSettings: {
"tooltipNumber": plasmoid.configuration.tooltipNumber,
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
@@ -72,15 +72,13 @@ PlasmoidItem {
signal needToolTipUpdate(string newText)
signal sizeUpdate
-
- Layout.fillWidth: PlasmoidItem.formFactor != PlasmaCore.Planar
- Layout.fillHeight: PlasmoidItem.formFactor != PlasmaCore.Planar
+ Layout.fillWidth: PlasmoidItem.formFactor !== PlasmaCore.Planar
+ Layout.fillHeight: PlasmoidItem.formFactor !== PlasmaCore.Planar
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Plasmoid.icon: "utilities-system-monitor"
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
-
// ui
Text {
id: text
@@ -94,7 +92,7 @@ PlasmoidItem {
color: plasmoid.configuration.fontColor
font.family: plasmoid.configuration.fontFamily
- font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
+ font.italic: plasmoid.configuration.fontStyle === "italic" ? true : false
font.pointSize: plasmoid.configuration.fontSize
font.weight: General.fontWeight[plasmoid.configuration.fontWeight]
@@ -124,8 +122,8 @@ PlasmoidItem {
}
onAccepted: {
- var tag = tagSelectorBox.editText
- var message = i18n("Tag: %1", tag)
+ const tag = tagSelectorBox.editText
+ let message = i18n("Tag: %1", tag)
message += "
"
message += i18n("Value: %1", awKeys.valueByKey(tag))
message += "
"
@@ -138,25 +136,33 @@ PlasmoidItem {
PlasmaCore.Action {
text: i18n("Request key")
icon.name: "utilities-system-monitor"
+ onTriggered: {
+ tagSelectorBox.model = awKeys.dictKeys(true)
+ tagSelector.open()
+ }
},
PlasmaCore.Action {
text: i18n("Show README")
icon.name: "text-x-readme"
+ onTriggered: awActions.showReadme()
},
PlasmaCore.Action {
text: i18n("Check updates")
icon.name: "system-software-update"
+ onTriggered: awActions.checkUpdates(true)
},
PlasmaCore.Action {
text: i18n("Report bug")
icon.name: "tools-report-bug"
+ onTriggered: {
+ bugReport.reset()
+ bugReport.open()
+ }
}
]
Component.onCompleted: {
- if (debug) console.debug()
-
// init submodule
Plasmoid.userConfiguringChanged(false)
// connect data
@@ -167,31 +173,25 @@ PlasmoidItem {
}
onNeedTextUpdate: newText => {
- if (debug) console.debug()
-
text.text = newText
sizeUpdate()
}
onNeedToolTipUpdate: newText => {
- if (debug) console.debug()
-
tooltip.text = newText
}
onSizeUpdate: {
- if (debug) console.debug()
// 16 is a magic number
// in other case plasmoid will increase own size on each update
-
- if (plasmoid.configuration.height == 0) {
+ if (plasmoid.configuration.height === 0) {
Layout.minimumHeight = text.contentHeight - 16
Layout.maximumHeight = -1
} else {
Layout.minimumHeight = plasmoid.configuration.height
Layout.maximumHeight = plasmoid.configuration.height
}
- if (plasmoid.configuration.width == 0) {
+ if (plasmoid.configuration.width === 0) {
Layout.minimumWidth = text.contentWidth - 16
Layout.maximumWidth = -1
} else {
@@ -202,7 +202,6 @@ PlasmoidItem {
Plasmoid.onUserConfiguringChanged: {
if (plasmoid.userConfiguring) return
- if (debug) console.debug()
// init submodule
awKeys.initDataAggregator(tooltipSettings)
@@ -217,7 +216,7 @@ PlasmoidItem {
awKeys.setAggregatorProperty("tempUnits", plasmoid.configuration.tempUnits)
awKeys.setAggregatorProperty("translate", plasmoid.configuration.translateStrings)
// update telemetry ID
- if (plasmoid.configuration.telemetryId.length == 0)
+ if (plasmoid.configuration.telemetryId.length === 0)
plasmoid.configuration.telemetryId = generateUuid()
// save telemetry
awTelemetryHandler.init(plasmoid.configuration.telemetryCount,
@@ -227,37 +226,10 @@ PlasmoidItem {
awTelemetryHandler.uploadTelemetry("awwidgetconfig", plasmoid.configuration.text)
}
-
- function action_checkUpdates() {
- if (debug) console.debug()
-
- return awActions.checkUpdates(true)
- }
-
- function action_showReadme() {
- if (debug) console.debug()
-
- return awActions.showReadme()
- }
-
- function action_reportBug() {
- if (debug) console.debug()
-
- bugReport.reset()
- bugReport.open()
- }
-
- function action_requestKey() {
- if (debug) console.debug()
-
- tagSelectorBox.model = awKeys.dictKeys(true)
- return tagSelector.open()
- }
-
// code from http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
function generateUuid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
+ let r = Math.random() * 16 | 0, v = c === "x" ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
diff --git a/sources/awesome-widget/package/contents/ui/tooltip.qml b/sources/awesome-widget/package/contents/ui/tooltip.qml
index ff1c539..ff0c637 100644
--- a/sources/awesome-widget/package/contents/ui/tooltip.qml
+++ b/sources/awesome-widget/package/contents/ui/tooltip.qml
@@ -17,23 +17,13 @@
import QtQuick 2.15
import QtQuick.Controls
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
-Item {
+KCM.SimpleKCM {
id: tooltipPage
- // backend
- AWActions {
- id: awActions
- }
-
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: pageColumn.implicitWidth
- implicitHeight: pageColumn.implicitHeight
-
- property bool debug: awActions.isDebugEnabled()
property alias cfg_tooltipNumber: tooltipNumber.value
property alias cfg_useTooltipBackground: useTooltipBackground.checked
@@ -53,7 +43,6 @@ Item {
property alias cfg_batTooltipColor: batTooltipColor.value
property alias cfg_batInTooltipColor: batInTooltipColor.value
-
Column {
id: pageColumn
anchors.fill: parent
@@ -178,11 +167,13 @@ Item {
Column {
width: parent.width
enabled: networkTooltipLabel.checked
+
ColorSelector {
id: downkbTooltipColor
text: i18n("Download speed color")
value: plasmoid.configuration.downkbTooltipColor
}
+
ColorSelector {
id: upkbTooltipColor
text: i18n("Upload speed color")
@@ -204,11 +195,13 @@ Item {
Column {
width: parent.width
enabled: batteryTooltipLabel.checked
+
ColorSelector {
id: batTooltipColor
text: i18n("Battery active color")
value: plasmoid.configuration.batTooltipColor
}
+
ColorSelector {
id: batInTooltipColor
text: i18n("Battery inactive color")
@@ -217,9 +210,4 @@ Item {
}
}
}
-
-
- Component.onCompleted: {
- if (debug) console.debug()
- }
}
diff --git a/sources/awesome-widget/package/contents/ui/widget.qml b/sources/awesome-widget/package/contents/ui/widget.qml
index 01eba2b..c65d3f4 100644
--- a/sources/awesome-widget/package/contents/ui/widget.qml
+++ b/sources/awesome-widget/package/contents/ui/widget.qml
@@ -16,13 +16,16 @@
***************************************************************************/
import QtQuick 2.15
+import QtQuick.Controls
+import org.kde.kcmutils as KCM
import org.kde.plasma.private.awesomewidget 1.0
import "."
-Item {
+KCM.SimpleKCM {
id: widgetPage
+
// backend
AWKeys {
id: awKeys
@@ -31,19 +34,11 @@ Item {
id: awActions
}
- width: childrenRect.width
- height: childrenRect.height
- implicitWidth: pageColumn.implicitWidth
- implicitHeight: pageColumn.implicitHeight
-
- property bool debug: awActions.isDebugEnabled()
-
property alias cfg_text: textPattern.text
property bool lock: true
signal needTextUpdate(string newText)
-
Column {
id: pageColumn
anchors.fill: parent
@@ -74,10 +69,7 @@ Item {
}
}
-
Component.onCompleted: {
- if (debug) console.debug()
-
awKeys.needTextToBeUpdated.connect(needTextUpdate)
// init submodule
awKeys.initKeys(plasmoid.configuration.text, plasmoid.configuration.interval,
@@ -92,7 +84,6 @@ Item {
onNeedTextUpdate: newText => {
if (lock) return
- if (debug) console.debug()
extensions.showMessage(newText)
lock = true
diff --git a/sources/qml/AWTextEditor.qml b/sources/qml/AWTextEditor.qml
index f77ab04..3b577c8 100644
--- a/sources/qml/AWTextEditor.qml
+++ b/sources/qml/AWTextEditor.qml
@@ -19,7 +19,7 @@ import QtQuick 2.15
import QtQuick.Controls
-Item {
+ScrollView {
width: parent.width
height: parent.height * 4 / 5
@@ -28,7 +28,6 @@ Item {
TextArea {
id: textArea
- anchors.fill: parent
textFormat: TextEdit.PlainText
Column {
@@ -50,9 +49,9 @@ Item {
}
onTextChanged: {
- var currentTag = getLastTag()
+ let currentTag = getLastTag()
// exit if there are spaces or empty
- if ((currentTag.indexOf(" ") != -1) || (currentTag.length == 0)) {
+ if ((currentTag.indexOf(" ") !== -1) || (currentTag.length === 0)) {
tooltip.visible = false
return
}
@@ -63,7 +62,7 @@ Item {
// show tooltip if found more than 1 or current text does not match
// tag found
tooltip.visible = ((tags.count > 1)
- || ((tags.count == 1) && (tags.model[0] != tooltip.substring)))
+ || ((tags.count === 1) && (tags.model[0] !== tooltip.substring)))
}
}
@@ -81,7 +80,7 @@ Item {
var substring = textArea.getText(0, textArea.cursorPosition)
// find last position of index in the given substring
var signIndex = substring.lastIndexOf('$') + 1
- if ((signIndex == 0) || (signIndex == textArea.cursorPosition))
+ if ((signIndex === 0) || (signIndex === textArea.cursorPosition))
return ""
// get current tag text
return substring.substr(signIndex)
@@ -90,14 +89,6 @@ Item {
function insert(text) {
textArea.insert(textArea.cursorPosition, text)
}
-
- function removeSelection() {
- textArea.remove(textArea.selectionStart, textArea.selectionEnd)
- }
-
- function selectedText() {
- return textArea.selectedText
- }
}