mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-11-04 06:43:41 +00:00 
			
		
		
		
	massive qml edit
This commit is contained in:
		@ -16,27 +16,20 @@
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.15
 | 
			
		||||
import org.kde.kcmutils as KCM
 | 
			
		||||
 | 
			
		||||
import org.kde.plasma.private.desktoppanel 1.0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
KCM.SimpleKCM {
 | 
			
		||||
    id: aboutPage
 | 
			
		||||
 | 
			
		||||
    // backend
 | 
			
		||||
    DPAdds {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    width: childrenRect.width
 | 
			
		||||
    height: childrenRect.height
 | 
			
		||||
 | 
			
		||||
    property bool debug: awActions.isDebugEnabled()
 | 
			
		||||
 | 
			
		||||
    AboutTab {
 | 
			
		||||
        textProvider: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -16,24 +16,14 @@
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.15
 | 
			
		||||
import org.kde.kcmutils as KCM
 | 
			
		||||
 | 
			
		||||
import org.kde.plasma.private.desktoppanel 1.0
 | 
			
		||||
import "."
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
KCM.SimpleKCM {
 | 
			
		||||
    id: activeAppearancePage
 | 
			
		||||
    // backend
 | 
			
		||||
    DPAdds {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    width: childrenRect.width
 | 
			
		||||
    height: childrenRect.height
 | 
			
		||||
    implicitWidth: pageColumn.implicitWidth
 | 
			
		||||
    implicitHeight: pageColumn.implicitHeight
 | 
			
		||||
 | 
			
		||||
    property bool debug: dpAdds.isDebugEnabled()
 | 
			
		||||
 | 
			
		||||
    property alias cfg_currentFontFamily: font.value
 | 
			
		||||
    property alias cfg_currentFontSize: fontSize.value
 | 
			
		||||
@ -43,7 +33,6 @@ Item {
 | 
			
		||||
    property alias cfg_currentTextStyleColor: selectStyleColor.value
 | 
			
		||||
    property string cfg_currentTextStyle: textStyle.value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Column {
 | 
			
		||||
        id: pageColumn
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
@ -99,9 +88,4 @@ Item {
 | 
			
		||||
            value: plasmoid.configuration.currentTextStyleColor
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -17,23 +17,13 @@
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.15
 | 
			
		||||
import QtQuick.Controls
 | 
			
		||||
import org.kde.kcmutils as KCM
 | 
			
		||||
 | 
			
		||||
import org.kde.plasma.private.desktoppanel 1.0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
KCM.SimpleKCM {
 | 
			
		||||
    id: advancedPage
 | 
			
		||||
    // backend
 | 
			
		||||
    DPAdds {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    width: childrenRect.width
 | 
			
		||||
    height: childrenRect.height
 | 
			
		||||
    implicitWidth: pageColumn.implicitWidth
 | 
			
		||||
    implicitHeight: pageColumn.implicitHeight
 | 
			
		||||
 | 
			
		||||
    property bool debug: dpAdds.isDebugEnabled()
 | 
			
		||||
 | 
			
		||||
    property alias cfg_background: background.checked
 | 
			
		||||
    property alias cfg_verticalLayout: verticalLayout.checked
 | 
			
		||||
@ -44,7 +34,6 @@ Item {
 | 
			
		||||
    property alias cfg_tooltipWidth: tooltipWidth.value
 | 
			
		||||
    property alias cfg_tooltipColor: tooltipColor.value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Column {
 | 
			
		||||
        id: pageColumn
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
@ -82,48 +71,48 @@ Item {
 | 
			
		||||
            editable: true
 | 
			
		||||
            model: [
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '#',
 | 
			
		||||
                    'name': '#'
 | 
			
		||||
                    "label": "#",
 | 
			
		||||
                    "name": "#"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '$',
 | 
			
		||||
                    'name': '$'
 | 
			
		||||
                    "label": "$",
 | 
			
		||||
                    "name": "$"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '%',
 | 
			
		||||
                    'name': '%'
 | 
			
		||||
                    "label": "%",
 | 
			
		||||
                    "name": "%"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '&',
 | 
			
		||||
                    'name': '&'
 | 
			
		||||
                    "label": "&",
 | 
			
		||||
                    "name": "&"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '*',
 | 
			
		||||
                    'name': '*'
 | 
			
		||||
                    "label": "*",
 | 
			
		||||
                    "name": "*"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '@',
 | 
			
		||||
                    'name': '@'
 | 
			
		||||
                    "label": "@",
 | 
			
		||||
                    "name": "@"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '¤',
 | 
			
		||||
                    'name': '¤'
 | 
			
		||||
                    "label": "¤",
 | 
			
		||||
                    "name": "¤"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '¶',
 | 
			
		||||
                    'name': '¶'
 | 
			
		||||
                    "label": "¶",
 | 
			
		||||
                    "name": "¶"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': '·',
 | 
			
		||||
                    'name': '·'
 | 
			
		||||
                    "label": "·",
 | 
			
		||||
                    "name": "·"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': 'º',
 | 
			
		||||
                    'name': 'º'
 | 
			
		||||
                    "label": "º",
 | 
			
		||||
                    "name": "º"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    'label': plasmoid.configuration.mark,
 | 
			
		||||
                    'name': plasmoid.configuration.mark
 | 
			
		||||
                    "label": plasmoid.configuration.mark,
 | 
			
		||||
                    "name": plasmoid.configuration.mark
 | 
			
		||||
                }
 | 
			
		||||
            ]
 | 
			
		||||
            text: i18n("Mark")
 | 
			
		||||
@ -144,16 +133,16 @@ Item {
 | 
			
		||||
                    id: tooltipType
 | 
			
		||||
                    model: [
 | 
			
		||||
                        {
 | 
			
		||||
                            'label': i18n("contours"),
 | 
			
		||||
                            'name': "contours"
 | 
			
		||||
                            "label": i18n("contours"),
 | 
			
		||||
                            "name": "contours"
 | 
			
		||||
                        },
 | 
			
		||||
                        {
 | 
			
		||||
                            'label': i18n("names"),
 | 
			
		||||
                            'name': "names"
 | 
			
		||||
                            "label": i18n("names"),
 | 
			
		||||
                            "name": "names"
 | 
			
		||||
                        },
 | 
			
		||||
                        {
 | 
			
		||||
                            'label': i18n("none"),
 | 
			
		||||
                            'name': "none"
 | 
			
		||||
                            "label": i18n("none"),
 | 
			
		||||
                            "name": "none"
 | 
			
		||||
                        }
 | 
			
		||||
                    ]
 | 
			
		||||
                    text: i18n("Tooltip type")
 | 
			
		||||
@ -178,8 +167,4 @@ Item {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -16,24 +16,14 @@
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.15
 | 
			
		||||
import org.kde.kcmutils as KCM
 | 
			
		||||
 | 
			
		||||
import org.kde.plasma.private.desktoppanel 1.0
 | 
			
		||||
import "."
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
KCM.SimpleKCM {
 | 
			
		||||
    id: inactiveAppearancePage
 | 
			
		||||
    // backend
 | 
			
		||||
    DPAdds {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    width: childrenRect.width
 | 
			
		||||
    height: childrenRect.height
 | 
			
		||||
    implicitWidth: pageColumn.implicitWidth
 | 
			
		||||
    implicitHeight: pageColumn.implicitHeight
 | 
			
		||||
 | 
			
		||||
    property bool debug: dpAdds.isDebugEnabled()
 | 
			
		||||
 | 
			
		||||
    property alias cfg_fontFamily: font.value
 | 
			
		||||
    property alias cfg_fontSize: fontSize.value
 | 
			
		||||
@ -43,7 +33,6 @@ Item {
 | 
			
		||||
    property alias cfg_textStyleColor: selectStyleColor.value
 | 
			
		||||
    property string cfg_textStyle: textStyle.value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Column {
 | 
			
		||||
        id: pageColumn
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
@ -99,9 +88,4 @@ Item {
 | 
			
		||||
            value: plasmoid.configuration.textStyleColor
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,6 @@ PlasmoidItem {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    property bool debug: dpAdds.isDebugEnabled()
 | 
			
		||||
    property variant tooltipSettings: {
 | 
			
		||||
        "tooltipColor": plasmoid.configuration.tooltipColor,
 | 
			
		||||
        "tooltipType": plasmoid.configuration.tooltipType,
 | 
			
		||||
@ -43,14 +42,12 @@ PlasmoidItem {
 | 
			
		||||
    signal needTooltipUpdate
 | 
			
		||||
    signal sizeUpdate
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // init
 | 
			
		||||
    Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
 | 
			
		||||
 | 
			
		||||
    Plasmoid.icon: "utilities-system-monitor"
 | 
			
		||||
    Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // ui
 | 
			
		||||
    GridLayout {
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
@ -97,7 +94,6 @@ PlasmoidItem {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Timer {
 | 
			
		||||
        id: timer
 | 
			
		||||
        interval: 1000
 | 
			
		||||
@ -105,19 +101,16 @@ PlasmoidItem {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onNeedUpdate: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
 | 
			
		||||
        for (var i=0; i<repeater.count; i++) {
 | 
			
		||||
        for (let i = 0; i < repeater.count; i++) {
 | 
			
		||||
            if (!repeater.itemAt(i)) {
 | 
			
		||||
                if (debug) console.info("Nothing to do here yet", i)
 | 
			
		||||
                timer.start()
 | 
			
		||||
                return
 | 
			
		||||
            }
 | 
			
		||||
            repeater.itemAt(i).text = dpAdds.parsePattern(plasmoid.configuration.text, i)
 | 
			
		||||
            if (dpAdds.currentDesktop() == i) {
 | 
			
		||||
            if (dpAdds.currentDesktop() === i) {
 | 
			
		||||
                repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
 | 
			
		||||
                repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
 | 
			
		||||
                repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic"
 | 
			
		||||
                repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle === "italic"
 | 
			
		||||
                repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
 | 
			
		||||
                repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.currentFontWeight]
 | 
			
		||||
                repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.currentTextStyle]
 | 
			
		||||
@ -125,7 +118,7 @@ PlasmoidItem {
 | 
			
		||||
            } else {
 | 
			
		||||
                repeater.itemAt(i).color = plasmoid.configuration.fontColor
 | 
			
		||||
                repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
 | 
			
		||||
                repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic"
 | 
			
		||||
                repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle === "italic"
 | 
			
		||||
                repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
 | 
			
		||||
                repeater.itemAt(i).font.weight = General.fontWeight[plasmoid.configuration.fontWeight]
 | 
			
		||||
                repeater.itemAt(i).style = General.textStyle[plasmoid.configuration.textStyle]
 | 
			
		||||
@ -139,13 +132,11 @@ PlasmoidItem {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onNeedTooltipUpdate: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
 | 
			
		||||
        for (var i=0; i<repeater.count; i++) {
 | 
			
		||||
        for (let i = 0; i < repeater.count; i++) {
 | 
			
		||||
            repeater.itemAt(i).tooltip.text = dpAdds.toolTipImage(i)
 | 
			
		||||
            // resize text tooltip to content size
 | 
			
		||||
            // this hack does not work for images-based tooltips
 | 
			
		||||
            if (tooltipSettings.tooltipType == "names") {
 | 
			
		||||
            if (tooltipSettings.tooltipType === "names") {
 | 
			
		||||
                repeater.itemAt(i).tooltip.height = repeater.itemAt(i).tooltip.implicitHeight
 | 
			
		||||
                repeater.itemAt(i).tooltip.width = repeater.itemAt(i).tooltip.implicitWidth
 | 
			
		||||
            }
 | 
			
		||||
@ -153,11 +144,9 @@ PlasmoidItem {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    onSizeUpdate: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
 | 
			
		||||
        if (plasmoid.configuration.height == 0) {
 | 
			
		||||
            var newHeight = 0
 | 
			
		||||
            for (var i=0; i<repeater.count; i++)
 | 
			
		||||
        if (plasmoid.configuration.height === 0) {
 | 
			
		||||
            let newHeight = 0
 | 
			
		||||
            for (let i = 0; i < repeater.count; i++)
 | 
			
		||||
                newHeight += repeater.itemAt(i).contentHeight
 | 
			
		||||
            Layout.minimumHeight = newHeight
 | 
			
		||||
            Layout.maximumHeight = -1
 | 
			
		||||
@ -165,9 +154,9 @@ PlasmoidItem {
 | 
			
		||||
            Layout.minimumHeight = plasmoid.configuration.height
 | 
			
		||||
            Layout.maximumHeight = plasmoid.configuration.height
 | 
			
		||||
        }
 | 
			
		||||
        if (plasmoid.configuration.width == 0) {
 | 
			
		||||
            var newWidth = 0
 | 
			
		||||
            for (var i=0; i<repeater.count; i++)
 | 
			
		||||
        if (plasmoid.configuration.width === 0) {
 | 
			
		||||
            let newWidth = 0
 | 
			
		||||
            for (let i = 0; i < repeater.count; i++)
 | 
			
		||||
                newWidth += repeater.itemAt(i).contentWidth
 | 
			
		||||
            Layout.minimumWidth = newWidth
 | 
			
		||||
            Layout.maximumWidth = -1
 | 
			
		||||
@ -179,7 +168,6 @@ PlasmoidItem {
 | 
			
		||||
 | 
			
		||||
    Plasmoid.onUserConfiguringChanged: {
 | 
			
		||||
        if (plasmoid.userConfiguring) return
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
 | 
			
		||||
        dpAdds.setMark(plasmoid.configuration.mark)
 | 
			
		||||
        dpAdds.setToolTipData(tooltipSettings)
 | 
			
		||||
@ -188,8 +176,6 @@ PlasmoidItem {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
 | 
			
		||||
        // init submodule
 | 
			
		||||
        Plasmoid.userConfiguringChanged(false)
 | 
			
		||||
        dpAdds.desktopChanged.connect(needUpdate)
 | 
			
		||||
 | 
			
		||||
@ -16,28 +16,21 @@
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
import QtQuick 2.15
 | 
			
		||||
import org.kde.kcmutils as KCM
 | 
			
		||||
 | 
			
		||||
import org.kde.plasma.private.desktoppanel 1.0
 | 
			
		||||
import "."
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Item {
 | 
			
		||||
KCM.SimpleKCM {
 | 
			
		||||
    id: widgetPage
 | 
			
		||||
    // backend
 | 
			
		||||
    DPAdds {
 | 
			
		||||
        id: dpAdds
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
        anchors.fill: parent
 | 
			
		||||
@ -60,9 +53,4 @@ Item {
 | 
			
		||||
            backend: dpAdds
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Component.onCompleted: {
 | 
			
		||||
        if (debug) console.debug()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user