diff --git a/applets/systemloadviewer/package/contents/ui/ColorSettings.qml b/applets/systemloadviewer/package/contents/ui/ColorSettings.qml
--- a/applets/systemloadviewer/package/contents/ui/ColorSettings.qml
+++ b/applets/systemloadviewer/package/contents/ui/ColorSettings.qml
@@ -18,14 +18,19 @@
* along with this program. If not, see
*/
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Layouts 1.0
+import QtQuick 2.5
+import QtQuick.Controls 2.5 as QQC2
+import QtQuick.Layouts 1.3
+
+import org.kde.kirigami 2.5 as Kirigami
import org.kde.kquickcontrols 2.0 as KQuickControls
ColumnLayout {
id: colorSettings
+ anchors.left: parent.left
+ anchors.right: parent.right
+
property alias cfg_memApplicationColor: memApplicationColorPicker.color
property alias cfg_memBuffersColor: memBuffersColorPicker.color
property alias cfg_cpuUserColor: cpuUserColorPicker.color
@@ -35,129 +40,97 @@
property alias cfg_swapUsedColor: swapUsedColorPicker.color
property alias cfg_cacheDirtyColor: cacheDirtyColorPicker.color
property alias cfg_cacheWritebackColor: cacheWritebackColorPicker.color
- property alias cfg_setColorsManually: setColorsManuallyGroupBox.checked
-
- GroupBox {
- id: setColorsManuallyGroupBox
- Layout.fillWidth: true
- flat: true
-
- title: i18nc("@option:check", "Set Colors Manually")
- checkable: true
-
- GridLayout {
- columns: 2
-
- Label {
- text: i18nc("@title:group", "CPU")
- Layout.columnSpan: 2
- font.bold: true
- }
-
- Label {
- text: i18nc("@label:chooser", "User:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cpuUserColorPicker
- }
-
- Label {
- text: i18nc("@label:chooser", "IOWait:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cpuIOWaitColorPicker
- }
-
- Label {
- text: i18nc("@label:chooser", "Sys:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cpuSysColorPicker
- }
-
- Label {
- text: i18nc("@label:chooser", "Nice:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cpuNiceColorPicker
- }
-
- Label {
- text: i18nc("@title:group", "Memory")
- Layout.columnSpan: 2
- font.bold: true
- }
-
-
- Label {
- text: i18nc("@label:chooser", "Application:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: memApplicationColorPicker
- }
-
- Label {
- text: i18nc("@label:chooser", "Buffers:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: memBuffersColorPicker
- }
-
- Label {
- text: i18nc("@title:group", "Swap")
- Layout.columnSpan: 2
- font.bold: true
- }
-
-
- Label {
- text: i18nc("@label:chooser", "Used swap:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: swapUsedColorPicker
- }
-
- Label {
- text: i18nc("@title:group", "Cache")
- Layout.columnSpan: 2
- font.bold: true
- }
-
- Label {
- text: i18nc("@label:chooser", "Dirty memory:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cacheDirtyColorPicker
- }
-
- Label {
- text: i18nc("@label:chooser", "Writeback memory:")
- Layout.alignment: Qt.AlignRight
- }
-
- KQuickControls.ColorButton {
- id: cacheWritebackColorPicker
- }
+ property alias cfg_setColorsManually: setColorsManually.checked
+
+ Kirigami.FormLayout {
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ QQC2.CheckBox {
+ id: setColorsManually
+ text: i18nc("@option:check", "Set Colors Manually")
}
}
- Item {
- Layout.fillHeight: true
+ Kirigami.FormLayout {
+ id: colors
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ enabled: setColorsManually.checked
+
+
+ Item {
+ Kirigami.FormData.isSection: true
+ Kirigami.FormData.label: i18nc("@title:group", "CPU")
+ }
+
+
+ KQuickControls.ColorButton {
+ id: cpuUserColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "User:")
+ }
+
+ KQuickControls.ColorButton {
+ id: cpuIOWaitColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "IOWait:")
+ }
+
+ KQuickControls.ColorButton {
+ id: cpuSysColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Sys:")
+ }
+
+ KQuickControls.ColorButton {
+ id: cpuNiceColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Nice:")
+ }
+
+
+ Item {
+ Kirigami.FormData.isSection: true
+ Kirigami.FormData.label: i18nc("@title:group", "Memory")
+ }
+
+
+ KQuickControls.ColorButton {
+ id: memApplicationColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Application:")
+ }
+
+ KQuickControls.ColorButton {
+ id: memBuffersColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Buffers:")
+ }
+
+
+ Item {
+ Kirigami.FormData.isSection: true
+ Kirigami.FormData.label: i18nc("@title:group", "Swap")
+ }
+
+
+ KQuickControls.ColorButton {
+ id: swapUsedColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Used swap:")
+ }
+
+
+ Item {
+ Kirigami.FormData.isSection: true
+ Kirigami.FormData.label: i18nc("@title:group", "Cache")
+ }
+
+
+ KQuickControls.ColorButton {
+ id: cacheDirtyColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Dirty memory:")
+ }
+
+ KQuickControls.ColorButton {
+ id: cacheWritebackColorPicker
+ Kirigami.FormData.label: i18nc("@label:chooser", "Writeback memory:")
+ }
}
}
diff --git a/applets/systemloadviewer/package/contents/ui/GeneralSettings.qml b/applets/systemloadviewer/package/contents/ui/GeneralSettings.qml
--- a/applets/systemloadviewer/package/contents/ui/GeneralSettings.qml
+++ b/applets/systemloadviewer/package/contents/ui/GeneralSettings.qml
@@ -18,139 +18,125 @@
* along with this program. If not, see
*/
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Layouts 1.0
+import QtQuick 2.5
+import QtQuick.Controls 1.4 as QQC1
+import QtQuick.Controls 2.5 as QQC2
+import QtQuick.Layouts 1.3
-ColumnLayout {
+import org.kde.kirigami 2.5 as Kirigami
+
+Kirigami.FormLayout {
id: generalSettings
+ anchors.left: parent.left
+ anchors.right: parent.right
+
property alias cfg_cpuActivated: cpuActivatedCheckBox.checked
property alias cfg_cpuAllActivated: cpuAllActivatedCheckBox.checked
property alias cfg_memoryActivated: memoryActivatedCheckBox.checked
property alias cfg_swapActivated: swapActivatedCheckBox.checked
property alias cfg_cacheActivated: cacheActivatedCheckBox.checked
property alias cfg_updateInterval: updateIntervalSpinBox.value
property int cfg_monitorType: plasmoid.configuration.monitorType
- onCfg_monitorTypeChanged: {
- switch (cfg_monitorType) {
- default: case 0: monitorTypeGroup.current = barMonitorRadio; break;
- case 1: monitorTypeGroup.current = circularMonitorRadio; break;
- case 2: monitorTypeGroup.current = compactBarMonitorRadio; break;
- }
+ QQC2.ButtonGroup {
+ id: monitorTypeGroup
}
- ExclusiveGroup {
- id: monitorTypeGroup
+ QQC2.CheckBox {
+ id: cpuActivatedCheckBox
+
+ Kirigami.FormData.label: i18nc("@label", "Show:")
+
+ text: i18nc("@option:check", "CPU monitor")
+ onCheckedChanged: if (!checked) {cpuAllActivatedCheckBox.checked = false;}
}
- GridLayout {
- columns: 2
+ RowLayout {
+ Layout.fillWidth: true
- Label {
- Layout.row: 0
- Layout.column: 0
- Layout.alignment: Qt.AlignRight
- text: i18nc("@label", "Show:")
+ Item {
+ width: units.GridUnit
}
+ QQC2.CheckBox {
+ id: cpuAllActivatedCheckBox
- CheckBox {
- id: cpuActivatedCheckBox
- Layout.row: 0
- Layout.column: 1
- text: i18nc("@option:check", "CPU monitor")
- onCheckedChanged: if (!checked) {cpuAllActivatedCheckBox.checked = false;}
- }
+ Layout.fillWidth: true
- Row {
- Layout.row: 1
- Layout.column: 1
- Item { height: 1; width: 50; }
- CheckBox {
- id: cpuAllActivatedCheckBox
- text: i18nc("@option:check", "CPUs separately")
- enabled: cpuActivatedCheckBox.checked && cfg_monitorType === 2
- }
+ text: i18nc("@option:check", "CPUs separately")
+ enabled: cpuActivatedCheckBox.checked && cfg_monitorType === 2
}
+ }
- CheckBox {
- id: memoryActivatedCheckBox
- Layout.row: 2
- Layout.column: 1
- text: i18nc("@option:check", "Memory monitor")
- }
+ QQC2.CheckBox {
+ id: memoryActivatedCheckBox
+ text: i18nc("@option:check", "Memory monitor")
+ }
- CheckBox {
- id: swapActivatedCheckBox
- Layout.row: 3
- Layout.column: 1
- text: i18nc("@option:check", "Swap monitor")
- }
+ QQC2.CheckBox {
+ id: swapActivatedCheckBox
+ text: i18nc("@option:check", "Swap monitor")
+ }
- CheckBox {
- id: cacheActivatedCheckBox
- Layout.row: 4
- Layout.column: 1
- text: i18nc("@option:check", "Cache monitor")
- }
+ QQC2.CheckBox {
+ id: cacheActivatedCheckBox
+ text: i18nc("@option:check", "Cache monitor")
+ }
- Label {
- Layout.row: 5
- Layout.column: 0
- Layout.alignment: Qt.AlignRight
- text: i18nc("@label", "Monitor type:")
- }
- RadioButton {
- id: barMonitorRadio
- Layout.row: 5
- Layout.column: 1
- exclusiveGroup: monitorTypeGroup
- text: i18nc("@option:radio", "Bar")
- onCheckedChanged: if (checked) {cfg_monitorType = 0; cpuAllActivatedCheckBox.checked = false;}
- }
+ Item {
+ Kirigami.FormData.isSection: true
+ }
- RadioButton {
- id: circularMonitorRadio
- Layout.row: 6
- Layout.column: 1
- exclusiveGroup: monitorTypeGroup
- text: i18nc("@option:radio", "Circular")
- onCheckedChanged: if (checked) {cfg_monitorType = 1; cpuAllActivatedCheckBox.checked = false;}
- }
- RadioButton {
- id: compactBarMonitorRadio
- Layout.row: 7
- Layout.column: 1
- exclusiveGroup: monitorTypeGroup
- text: i18nc("@option:radio", "Compact bar")
- onCheckedChanged: if (checked) cfg_monitorType = 2;
- }
+ QQC2.RadioButton {
+ id: barMonitorRadio
+ QQC2.ButtonGroup.group: monitorTypeGroup
- Label {
- Layout.row: 8
- Layout.column: 0
- Layout.alignment: Qt.AlignRight
- text: i18nc("@label:spinbox", "Update interval:")
- }
+ Kirigami.FormData.label: i18nc("@label", "Monitor type:")
- SpinBox {
- id: updateIntervalSpinBox
- Layout.row: 8
- Layout.column: 1
- decimals: 1
- stepSize: 0.1
- minimumValue: 0.1
- suffix: i18nc("@item:valuesuffix spacing to number + unit (seconds)", " s")
- }
+ text: i18nc("@option:radio", "Bar")
+
+ checked: cfg_monitorType == 0
+ onClicked: if (checked) {cfg_monitorType = 0; cpuAllActivatedCheckBox.checked = false;}
}
+ QQC2.RadioButton {
+ id: circularMonitorRadio
+ QQC2.ButtonGroup.group: monitorTypeGroup
+
+ text: i18nc("@option:radio", "Circular")
- Item { // tighten layout
- Layout.fillHeight: true
+ checked: cfg_monitorType == 1
+ onClicked: if (checked) {cfg_monitorType = 1; cpuAllActivatedCheckBox.checked = false;}
}
- Component.onCompleted: cfg_monitorTypeChanged()
+ QQC2.RadioButton {
+ id: compactBarMonitorRadio
+ QQC2.ButtonGroup.group: monitorTypeGroup
+
+ text: i18nc("@option:radio", "Compact bar")
+
+ checked: cfg_monitorType == 2
+ onClicked: if (checked) cfg_monitorType = 2;
+ }
+
+
+ Item {
+ Kirigami.FormData.isSection: true
+ }
+
+ // QQC2 SpinBox doesn't cleanly support non-integer values, which can be worked
+ // around, but the code is messy and the user experience is somewhat poor.
+ // So for now, we stick with the QQC1 SpinBox
+ QQC1.SpinBox {
+ id: updateIntervalSpinBox
+
+ Kirigami.FormData.label: i18nc("@label:spinbox", "Update interval:")
+
+ decimals: 1
+ stepSize: 0.1
+ minimumValue: 0.1
+ suffix: i18ncp("@item:valuesuffix spacing to number + unit (seconds)", " second", " seconds")
+ }
}