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