Commit 76eba93b authored by Marco Martin's avatar Marco Martin

Port to QQC2 and FormLayout

Summary: No big visible changes, but simplifies and modernizes the code

Test Plan: used all functionality of the systray config dialog

Reviewers: #plasma, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: ngraham, abetts, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17212
parent d9532e80
......@@ -18,13 +18,13 @@
*/
import QtQuick 2.0
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Controls 2.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami
Item {
id: iconsPage
......@@ -43,96 +43,81 @@ Item {
property alias cfg_miscellaneousShown: miscellaneous.checked
property var cfg_extraItems: []
SystemPalette {
id: palette
}
QtControls.CheckBox {
id: dummyCheckbox
visible: false
}
QtLayouts.ColumnLayout {
Kirigami.FormLayout {
id: pageColumn
anchors.left: parent.left
PlasmaExtras.Heading {
level: 2
text: i18n("Categories")
color: palette.text
anchors {
left: parent.left
right: parent.right
}
Item {
width: height
height: units.gridUnit / 2
}
QtLayouts.ColumnLayout {
spacing: units.smallSpacing * 2
QtControls.CheckBox {
id: applicationStatus
text: i18n("Application Status")
}
QtControls.CheckBox {
id: communications
text: i18n("Communications")
}
QtControls.CheckBox {
id: systemServices
text: i18n("System Services")
}
QtControls.CheckBox {
id: hardwareControl
text: i18n("Hardware Control")
}
QtControls.CheckBox {
id: miscellaneous
text: i18n("Miscellaneous")
}
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Categories")
}
Item {
width: height
height: units.gridUnit
QtControls.CheckBox {
id: applicationStatus
text: i18n("Application Status")
}
QtControls.CheckBox {
id: communications
text: i18n("Communications")
}
PlasmaExtras.Heading {
level: 2
text: i18n("Extra Items")
color: palette.text
QtControls.CheckBox {
id: systemServices
text: i18n("System Services")
}
QtControls.CheckBox {
id: hardwareControl
text: i18n("Hardware Control")
}
QtControls.CheckBox {
id: miscellaneous
text: i18n("Miscellaneous")
}
Item {
width: height
height: units.gridUnit / 2
Kirigami.FormData.isSection: true
Kirigami.FormData.label: i18n("Extra Items")
}
QtLayouts.ColumnLayout {
spacing: units.smallSpacing * 2
QtControls.CheckBox {
id: dummyCheckbox
visible: false
}
Repeater {
model: plasmoid.nativeInterface.availablePlasmoids
delegate: QtControls.CheckBox {
QtLayouts.Layout.minimumWidth: childrenRect.width
checked: cfg_extraItems.indexOf(plugin) != -1
onCheckedChanged: {
var index = cfg_extraItems.indexOf(plugin);
if (checked) {
if (index == -1) {
cfg_extraItems.push(plugin);
}
} else {
if (index > -1) {
cfg_extraItems.splice(index, 1);
}
}
configurationChanged() // qml cannot detect changes inside an Array
}
QtLayouts.RowLayout {
anchors.verticalCenter: parent.verticalCenter
x: dummyCheckbox.width
QIconItem {
icon: decoration
width: units.iconSizes.small
height: width
Repeater {
model: plasmoid.nativeInterface.availablePlasmoids
delegate: QtControls.CheckBox {
QtLayouts.Layout.minimumWidth: childrenRect.width
checked: cfg_extraItems.indexOf(plugin) != -1
implicitWidth: itemLayout.width + itemLayout.x
onCheckedChanged: {
var index = cfg_extraItems.indexOf(plugin);
if (checked) {
if (index == -1) {
cfg_extraItems.push(plugin);
}
QtControls.Label {
text: display
} else {
if (index > -1) {
cfg_extraItems.splice(index, 1);
}
}
configurationChanged() // qml cannot detect changes inside an Array
}
QtLayouts.RowLayout {
id: itemLayout
anchors.verticalCenter: parent.verticalCenter
x: dummyCheckbox.width
QIconItem {
icon: model.decoration
width: units.iconSizes.small
height: width
}
QtControls.Label {
text: model.display
}
}
}
}
......
......@@ -30,6 +30,7 @@ import org.kde.kquickcontrolsaddons 2.0
import org.kde.kconfig 1.0 // for KAuthorized
import org.kde.draganddrop 2.0 as DragDrop
import org.kde.kcm 1.1 as KCM
import org.kde.kirigami 2.5 as Kirigami
ColumnLayout {
id: root
......@@ -89,8 +90,11 @@ ColumnLayout {
}
QtControls.ComboBox {
id: resizeComboBox
property int textLength: 24
width: theme.mSize(theme.defaultFont).width * textLength
TextMetrics {
id: resizeTextMetrics
text: resizeComboBox.currentText
}
width: resizeTextMetrics.width + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 2
model: [
{
'label': i18nd("plasma_wallpaper_org.kde.image", "Scaled and Cropped"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment