init
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import QtQuick
|
||||
import org.kde.plasma.configuration
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: i18n("General")
|
||||
icon: "configure"
|
||||
source: "configGeneral.qml"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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="General">
|
||||
<entry name="userText" type="String">
|
||||
<label>Text to display</label>
|
||||
<default>Hello KDE 6!</default>
|
||||
</entry>
|
||||
<entry name="showSeconds" type="Bool">
|
||||
<label>Show seconds</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
@@ -0,0 +1,28 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
import org.kde.kcmutils as KCM
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
KCM.SimpleKCM {
|
||||
property alias cfg_userText: userTextField.text
|
||||
property alias cfg_showSeconds: showSecondsCheckBox.checked
|
||||
|
||||
Kirigami.FormLayout {
|
||||
QQC2.TextField {
|
||||
id: userTextField
|
||||
|
||||
Kirigami.FormData.label: i18n("Display Text:")
|
||||
placeholderText: i18n("Enter text here")
|
||||
}
|
||||
|
||||
QQC2.CheckBox {
|
||||
id: showSecondsCheckBox
|
||||
|
||||
Kirigami.FormData.label: i18n("Options:")
|
||||
text: i18n("Show Seconds")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
import "cppbridge" as CppBridge
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.plasma.components as PlasmaComponents
|
||||
import org.kde.plasma.plasmoid
|
||||
|
||||
PlasmoidItem {
|
||||
id: root
|
||||
|
||||
// Properties accessed from configuration.
|
||||
// "qmllint" sees `plasmoid` as QObject here, but Plasma injects `configuration` at runtime.
|
||||
// qmllint disable missing-property
|
||||
property bool showSeconds: plasmoid.configuration.showSeconds
|
||||
// qmllint disable missing-property
|
||||
property string userText: plasmoid.configuration.userText
|
||||
property string cppTimeText: "Click the button to request time from C++."
|
||||
|
||||
// Widget Setup
|
||||
width: Kirigami.Units.gridUnit * 20
|
||||
height: Kirigami.Units.gridUnit * 20
|
||||
toolTipMainText: "Plasma 6 Starter"
|
||||
toolTipSubText: "Click to open full view"
|
||||
|
||||
CppBridge.TimeBridge {
|
||||
id: timeBridge
|
||||
}
|
||||
|
||||
// Define the full representation (popup or desktop widget)
|
||||
fullRepresentation: Item {
|
||||
Layout.minimumWidth: Kirigami.Units.gridUnit * 10
|
||||
Layout.minimumHeight: Kirigami.Units.gridUnit * 10
|
||||
Layout.preferredWidth: root.width
|
||||
Layout.preferredHeight: root.height
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Kirigami.Units.largeSpacing
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: root.userText
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: "Welcome to 6!"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
opacity: 0.7
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: root.cppTimeText
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
text: "Get from C++"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
onClicked: root.cppTimeText = timeBridge.currentTimeString(root.showSeconds)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Define the compact representation (icon in panel)
|
||||
compactRepresentation: Item {
|
||||
Kirigami.Icon {
|
||||
anchors.fill: parent
|
||||
source: "plasma"
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.expanded = !root.expanded
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"KPlugin": {
|
||||
"Name": "Plasma 6 Widget Starter",
|
||||
"Description": "A starter template for KDE Plasma 6 widgets",
|
||||
"Icon": "plasma",
|
||||
"Category": "Development",
|
||||
"Id": "org.kde.plasma.starter",
|
||||
"Version": "1.0",
|
||||
"Website": "https://github.com/yourusername/kde6-widget-starter",
|
||||
"License": "GPL-3.0+",
|
||||
"Authors": [
|
||||
{
|
||||
"Name": "Your Name",
|
||||
"Email": "your.email@example.com"
|
||||
}
|
||||
]
|
||||
},
|
||||
"X-Plasma-API-Minimum-Version": "6.0",
|
||||
"KPackageStructure": "Plasma/Applet"
|
||||
}
|
||||
Reference in New Issue
Block a user