plasma6 alpha

This commit is contained in:
Flummi 2024-03-07 12:44:01 +01:00
parent 4adea966fa
commit 6290a78666
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817
9 changed files with 278 additions and 240 deletions

View File

@ -1,5 +1,5 @@
import QtQuick 2.0 import QtQuick
import org.kde.plasma.configuration 2.0 import org.kde.plasma.configuration
ConfigModel { ConfigModel {
ConfigCategory { ConfigCategory {
@ -7,9 +7,4 @@ ConfigModel {
icon: "configure" icon: "configure"
source: "config/general.qml" source: "config/general.qml"
} }
ConfigCategory {
name: i18n("Debug")
icon: "cab_view"
source: "config/debug.qml"
}
} }

View File

@ -29,7 +29,7 @@
<default>true</default> <default>true</default>
</entry> </entry>
<!-- debug -->
<entry name="debug_active" type="Bool"> <entry name="debug_active" type="Bool">
<default>false</default> <default>false</default>
</entry> </entry>

View File

@ -1,8 +1,8 @@
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.3 import QtQuick.Layouts
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.kirigami 2.14 as Kirigami import org.kde.kirigami as Kirigami
import "./lib/helper.js" as Helper import "./lib/helper.js" as Helper
@ -16,8 +16,6 @@ Item {
color: "transparent" color: "transparent"
border.color: PlasmaCore.Theme.textColor border.color: PlasmaCore.Theme.textColor
radius: 4 radius: 4
Plasmoid.toolTipMainText: "battery level: " + Helper.batteryLevel(batteryPercent)
Plasmoid.toolTipSubText: "polling rate: " + pollingrate + " seconds"
Item { Item {
anchors.fill: parent anchors.fill: parent

View File

@ -1,8 +1,8 @@
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.3 import QtQuick.Layouts
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core as PlasmaCore
import org.kde.kirigami 2.14 as Kirigami import org.kde.kirigami as Kirigami
import "./lib/helper.js" as Helper import "./lib/helper.js" as Helper

View File

@ -0,0 +1,212 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
import org.kde.kquickcontrols as KQControls
import org.kde.kcmutils as KCM
import "../lib/helper.js" as Helper
KCM.SimpleKCM {
id: root
/*property alias cfg_pollingrate: pollingrate.value
property alias cfg_batteryheight: batteryheight.value
property alias cfg_colorEmpty: colorEmpty.color
property alias cfg_colorHalf: colorHalf.color
property alias cfg_colorFull: colorFull.color
property alias cfg_notifications: notifications.checked
property alias cfg_batteryThreshold: batteryThreshold.value*/
Kirigami.FormLayout {
Slider {
from: 2
to: 60
stepSize: 2
KCM.SettingStateBinding {
configObject: KCM.plasmaSettings
settingName: "pollingrate"
}
}
}
/*Kirigami.FormLayout {
anchors.fill: parent
wideMode: false
GridLayout {
columns: 3
rows: 2
rowSpacing: 10
// first row
Text {
text: "polling rate:"
color: PlasmaCore.Theme.textColor
}
Slider {
id: pollingrate
value: 10
from: 2
to: 60
stepSize: 2
}
Text {
text: cfg_pollingrate + " seconds"
color: PlasmaCore.Theme.textColor
}
// second row
Text {
text: "battery height:"
color: PlasmaCore.Theme.textColor
}
Slider {
id: batteryheight
value: 8.0
from: 1
to: 10
stepSize: 1
}
Text {
text: cfg_batteryheight
color: PlasmaCore.Theme.textColor
}
}
// color config
GridLayout {
columns: 3
rows: 3
rowSpacing: 1
// first row
Text {
text: "empty:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorEmpty
color: cfg_colorEmpty
}
Text {
text: cfg_colorEmpty
color: PlasmaCore.Theme.textColor
}
// secod row
Text {
text: "half:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorHalf
color: cfg_colorHalf
}
Text {
text: cfg_colorHalf
color: PlasmaCore.Theme.textColor
}
// third row
Text {
text: "full:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorFull
color: cfg_colorFull
}
Text {
text: cfg_colorFull
color: PlasmaCore.Theme.textColor
}
}
// color gradient example
GridLayout {
columns: 10
rows: 1
rowSpacing: 0
Text {
text: "█"
color: Helper.interpolateColor(.1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.2, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.3, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.4, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.5, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.6, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.7, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.8, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.9, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor( 1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
}
GridLayout {
columns: 3
rows: 2
rowSpacing: 10
// first row
Text {
text: "notifications:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.CheckBox {
id: notifications
}
Text {
text: ""
}
// second row
Text {
text: "battery threshold:"
color: PlasmaCore.Theme.textColor
}
Slider {
id: batteryThreshold
value: 10
from: 1
to: 50
stepSize: 1
}
Text {
text: cfg_batteryThreshold
color: PlasmaCore.Theme.textColor
}
}
}*/
}

View File

@ -1,14 +1,15 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Layouts 1.3 import QtQuick.Controls 2.5
import org.kde.plasma.core 2.0 as PlasmaCore import QtQuick.Layouts 1.15
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.core as PlasmaCore
import QtQuick.Controls 2.5 as QQC2 import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami 2.4 as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kquickcontrols 2.0 as KQControls import org.kde.kquickcontrols as KQControls
import org.kde.kcmutils as KCM
import "../lib/helper.js" as Helper import "../lib/helper.js" as Helper
QQC2.Pane { KCM.SimpleKCM {
id: root id: root
property alias cfg_debug_active: debug_active.checked property alias cfg_debug_active: debug_active.checked
@ -40,11 +41,11 @@ QQC2.Pane {
text: "battery charge:" text: "battery charge:"
color: PlasmaCore.Theme.textColor color: PlasmaCore.Theme.textColor
} }
PlasmaComponents.Slider { Slider {
id: debug_charge id: debug_charge
value: 0 value: 0
minimumValue: -2 from: -2
maximumValue: 100 to: 100
stepSize: 1 stepSize: 1
} }
Text { Text {

View File

@ -1,199 +1,27 @@
import QtQuick 2.0 import QtQuick
import QtQuick.Layouts 1.3 import QtQuick.Controls
import org.kde.plasma.core 2.0 as PlasmaCore import QtQuick.Layouts
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.core as PlasmaCore
import QtQuick.Controls 2.5 as QQC2 import org.kde.kirigami as Kirigami
import org.kde.kirigami 2.4 as Kirigami import org.kde.kquickcontrols as KQControls
import org.kde.kquickcontrols 2.0 as KQControls import org.kde.kcmutils as KCM
import org.kde.plasma.components as PlasmaComponents3
import "../lib/helper.js" as Helper import "../lib/helper.js" as Helper
QQC2.Pane { KCM.SimpleKCM {
id: root id: root
property alias cfg_pollingrate: pollingrate.value property alias cfg_pollingrate: pollingrate.value
property alias cfg_batteryheight: batteryheight.value property alias cfg_pollingrateDefault: pollingrate.value
property alias cfg_colorEmpty: colorEmpty.color
property alias cfg_colorHalf: colorHalf.color
property alias cfg_colorFull: colorFull.color
property alias cfg_notifications: notifications.checked
property alias cfg_batteryThreshold: batteryThreshold.value
Kirigami.FormLayout { Kirigami.FormLayout {
anchors.fill: parent Slider {
wideMode: false
GridLayout {
columns: 3
rows: 2
rowSpacing: 10
// first row
Text {
text: "polling rate:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.Slider {
id: pollingrate id: pollingrate
value: 10 Layout.fillWidth: true
minimumValue: 2 from: 2
maximumValue: 60 to: 60
stepSize: 2 stepSize: 2
} }
Text {
text: cfg_pollingrate + " seconds"
color: PlasmaCore.Theme.textColor
}
// second row
Text {
text: "battery height:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.Slider {
id: batteryheight
value: 8.0
minimumValue: 1
maximumValue: 10
stepSize: 1
}
Text {
text: cfg_batteryheight
color: PlasmaCore.Theme.textColor
}
}
// color config
GridLayout {
columns: 3
rows: 3
rowSpacing: 1
// first row
Text {
text: "empty:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorEmpty
color: cfg_colorEmpty
}
Text {
text: cfg_colorEmpty
color: PlasmaCore.Theme.textColor
}
// secod row
Text {
text: "half:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorHalf
color: cfg_colorHalf
}
Text {
text: cfg_colorHalf
color: PlasmaCore.Theme.textColor
}
// third row
Text {
text: "full:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorFull
color: cfg_colorFull
}
Text {
text: cfg_colorFull
color: PlasmaCore.Theme.textColor
}
}
// color gradient example
GridLayout {
columns: 10
rows: 1
rowSpacing: 0
Text {
text: "█"
color: Helper.interpolateColor(.1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.2, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.3, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.4, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.5, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.6, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.7, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.8, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor(.9, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
Text {
text: "█"
color: Helper.interpolateColor( 1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
}
}
GridLayout {
columns: 3
rows: 2
rowSpacing: 10
// first row
Text {
text: "notifications:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.CheckBox {
id: notifications
}
Text {
text: ""
}
// second row
Text {
text: "battery threshold:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.Slider {
id: batteryThreshold
value: 10
minimumValue: 1
maximumValue: 50
stepSize: 1
}
Text {
text: cfg_batteryThreshold
color: PlasmaCore.Theme.textColor
}
}
} }
} }

View File

@ -1,14 +1,14 @@
import QtQuick 2.15 import QtQuick
import QtQuick.Layouts 1.3 import QtQuick.Layouts
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.kirigami as Kirigami
import org.kde.kirigami 2.14 as Kirigami import org.kde.plasma.plasma5support as Plasma5Support
import org.kde.notification 1.0 import org.kde.notification
import "./lib/helper.js" as Helper import "./lib/helper.js" as Helper
Item { PlasmoidItem {
id: main id: main
property int pollingrate: Plasmoid.configuration.pollingrate property int pollingrate: Plasmoid.configuration.pollingrate
@ -26,7 +26,7 @@ Item {
property int batteryPercent: -2 property int batteryPercent: -2
property bool notification_sent: false; property bool notification_sent: false;
PlasmaCore.DataSource { Plasma5Support.DataSource {
id: hsSource id: hsSource
engine: "executable" engine: "executable"
connectedSources: ["headsetcontrol -bc"] connectedSources: ["headsetcontrol -bc"]
@ -56,9 +56,12 @@ Item {
} }
} }
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation toolTipMainText: "battery level: " + Helper.batteryLevel(batteryPercent)
Plasmoid.fullRepresentation: FullRepresentation{} toolTipSubText: "polling rate: " + pollingrate + " seconds"
Plasmoid.compactRepresentation: CompactRepresentation{}
preferredRepresentation: compactRepresentation
fullRepresentation: FullRepresentation{}
compactRepresentation: CompactRepresentation{}
Notification { Notification {
id: notification id: notification

View File

@ -1,24 +1,25 @@
{ {
"KPackageStructure": "Plasma/Applet",
"KPlugin": { "KPlugin": {
"Name": "Headset Battery Widget",
"Description": "Headset Battery Widget",
"Icon": "battery",
"Category": "System Information",
"Authors": [{ "Authors": [{
"Email": "flummi@srv.fail", "Email": "flummi@srv.fail",
"Name": "Flummi" "Name": "Flummi"
}], }],
"Category": "System Information",
"Dependencies": [
],
"EnabledByDefault": true,
"Icon": "battery",
"Id": "org.kde.plasma.headsetcontrol-battery-widget", "Id": "org.kde.plasma.headsetcontrol-battery-widget",
"Name": "Headset Battery Widget", "License": "",
"Version": "1.6",
"EnabledByDefault": true,
"Website": "https://git.lat/Flummi/headsetcontrol-battery-widget",
"BugReportUrl": "https://git.lat/Flummi/headsetcontrol-battery-widget/issues",
"ServiceTypes": [ "ServiceTypes": [
"Plasma/Applet" "Plasma/Applet"
], ]
"Version": "1.5",
"Website": "https://git.lat/Flummi/headsetcontrol-battery-widget"
}, },
"X-Plasma-NotificationArea": true, "X-Plasma-NotificationArea": true,
"X-Plasma-NotificationAreaCategory": "Hardware", "X-Plasma-NotificationAreaCategory": "Hardware",
"X-Plasma-API": "declarativeappletscript", "X-Plasma-API-Minimum-Version": "6.0"
"X-Plasma-MainScript": "ui/main.qml"
} }