Commit e9bd8a08 authored by Nate Graham's avatar Nate Graham
Browse files

Modernize KCM UI

Put the long inline labels in ContextualHelpButtons and use spacing
instead of lines.
parent fa885a36
Pipeline #222023 passed with stage
in 1 minute and 22 seconds
......@@ -8,7 +8,7 @@ import QtQuick 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.3 as QQC2
import org.kde.kirigami 2.14 as Kirigami
import org.kde.kcm 1.3
import org.kde.kcm 1.6
SimpleKCM {
id: root
......@@ -24,19 +24,20 @@ SimpleKCM {
implicitWidth: Kirigami.Units.gridUnit * 38
implicitHeight: Kirigami.Units.gridUnit * 35
ColumnLayout {
spacing: 0
Kirigami.FormLayout {
id: unattendedUpdatesLayout
Layout.fillWidth: true
QQC2.RadioButton {
Kirigami.FormData.label: i18n("Update software:")
text: i18n("Manually")
Kirigami.FormLayout {
width: parent.width
QQC2.RadioButton {
Kirigami.FormData.label: i18n("Update software:")
text: i18n("Manually")
QQC2.ButtonGroup.group: autoUpdatesGroup
checked: !kcm.updatesSettings.useUnattendedUpdates
}
RowLayout {
spacing: Kirigami.Units.smallSpacing
QQC2.ButtonGroup.group: autoUpdatesGroup
checked: !kcm.updatesSettings.useUnattendedUpdates
}
QQC2.RadioButton {
id: automaticallyRadio
text: i18n("Automatically")
......@@ -45,62 +46,63 @@ SimpleKCM {
checked: kcm.updatesSettings.useUnattendedUpdates
}
SettingStateBinding {
configObject: kcm.updatesSettings
settingName: "useUnattendedUpdates"
target: automaticallyRadio
ContextualHelpButton {
toolTipText: xi18nc("@info", "Software updates will be downloaded automatically when they become available. Updates for applications will be installed immediately, while system updates will be installed the next time the computer is restarted.")
}
}
QQC2.Label {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(Kirigami.Units.gridUnit * 25, Math.round(root.width * 0.6))
Item {
Kirigami.FormData.isSection: true
}
wrapMode: Text.WordWrap
visible: automaticallyRadio.checked
horizontalAlignment: Text.AlignHCenter
font: Kirigami.Theme.smallFont
text: xi18nc("@info", "Software updates will be downloaded automatically when they become available. Updates for applications will be installed immediately, while system updates will be installed the next time the computer is restarted.")
SettingStateBinding {
configObject: kcm.updatesSettings
settingName: "useUnattendedUpdates"
target: automaticallyRadio
}
Kirigami.FormLayout {
Layout.fillWidth: true
twinFormLayouts: unattendedUpdatesLayout
QQC2.ComboBox {
Kirigami.FormData.label: i18nc("@title:group", "Notification frequency:")
model: [
i18nc("@item:inlistbox", "Daily"),
i18nc("@item:inlistbox", "Weekly"),
i18nc("@item:inlistbox", "Monthly"),
i18nc("@item:inlistbox", "Never")
]
readonly property var options: [
60 * 60 * 24,
60 * 60 * 24 * 7,
60 * 60 * 24 * 30,
-1
]
currentIndex: {
let index = -1
for (const i in options) {
if (options[i] === kcm.updatesSettings.requiredNotificationInterval) {
index = i
}
QQC2.ComboBox {
Kirigami.FormData.label: i18nc("@title:group", "Notification frequency:")
model: [
i18nc("@item:inlistbox", "Daily"),
i18nc("@item:inlistbox", "Weekly"),
i18nc("@item:inlistbox", "Monthly"),
i18nc("@item:inlistbox", "Never")
]
readonly property var options: [
60 * 60 * 24,
60 * 60 * 24 * 7,
60 * 60 * 24 * 30,
-1
]
currentIndex: {
let index = -1
for (const i in options) {
if (options[i] === kcm.updatesSettings.requiredNotificationInterval) {
index = i
}
return index
}
onActivated: {
kcm.updatesSettings.requiredNotificationInterval = options[index]
}
SettingStateProxy {
id: settingState
configObject: kcm.updatesSettings
settingName: "requiredNotificationInterval"
}
return index
}
onActivated: {
kcm.updatesSettings.requiredNotificationInterval = options[index]
}
SettingStateProxy {
id: settingState
configObject: kcm.updatesSettings
settingName: "requiredNotificationInterval"
}
}
Item {
Kirigami.FormData.isSection: true
}
RowLayout {
spacing: Kirigami.Units.smallSpacing
Kirigami.FormData.label: i18n("Use offline updates:")
Item {
Kirigami.FormData.isSection: true
......@@ -108,7 +110,6 @@ SimpleKCM {
QQC2.CheckBox {
id: offlineUpdatesBox
Kirigami.FormData.label: i18n("Use offline updates:")
enabled: !kcm.discoverSettings.isUseOfflineUpdatesImmutable
checked: kcm.discoverSettings.useOfflineUpdates
onToggled: {
......@@ -116,21 +117,15 @@ SimpleKCM {
}
}
SettingStateBinding {
configObject: kcm.discoverSettings
settingName: "useOfflineUpdates"
target: offlineUpdatesBox
ContextualHelpButton {
toolTipText: i18n("Offline updates maximize system stability by applying changes while restarting the system. Using this update mode is strongly recommended.")
}
}
QQC2.Label {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(Kirigami.Units.gridUnit * 25, Math.round(root.width * 0.6))
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
font: Kirigami.Theme.smallFont
text: i18n("Offline updates maximize system stability by applying changes while restarting the system. Using this update mode is strongly recommended.")
SettingStateBinding {
configObject: kcm.discoverSettings
settingName: "useOfflineUpdates"
target: offlineUpdatesBox
}
}
}
Supports Markdown
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