shift-shell/initialstart/modules/experienceprofile/contents/ui/main.qml
Marco Allegretti 42d41351e2 Add profile-aware initial setup
Detect the device class, stage the selected experience, and write the resulting setup choices through SetupState.

Load the new device and experience modules before the existing setup pages, and use the Shift icon on the finished page.
2026-05-11 10:03:07 +02:00

125 lines
4.5 KiB
QML

// SPDX-FileCopyrightText: 2026 Marco Allegretti
// SPDX-License-Identifier: EUPL-1.2
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.plasma.mobileinitialstart.initialstart
InitialStartModule {
name: i18n("Experience")
contentItem: Item {
id: root
readonly property real cardWidth: Math.min(Kirigami.Units.gridUnit * 30, root.width - Kirigami.Units.gridUnit * 2)
function profileLabel(profile) {
switch (profile) {
case "mobile":
return i18n("Touch home")
case "desktop":
return i18n("Desktop windows")
case "gaming":
return i18n("Gamepad gaming")
case "hybrid":
return i18n("Adaptive docked")
default:
return profile
}
}
ScrollView {
anchors {
fill: parent
topMargin: Kirigami.Units.gridUnit
}
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
contentWidth: -1
ColumnLayout {
width: root.width
spacing: Kirigami.Units.gridUnit
Label {
Layout.leftMargin: Kirigami.Units.gridUnit
Layout.rightMargin: Kirigami.Units.gridUnit
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: i18n("Choose how SHIFT should start after setup.")
}
FormCard.FormCard {
maximumWidth: root.cardWidth
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
FormCard.FormRadioDelegate {
text: i18n("Touch home")
description: i18n("Maximized apps for phones and small tablets.")
onClicked: SetupState.applyExperienceDefaults("mobile")
Binding on checked {
value: SetupState.experienceProfile === "mobile"
}
}
FormCard.FormRadioDelegate {
text: i18n("Desktop windows")
description: i18n("Windows, tiling, dock, and Overview.")
onClicked: SetupState.applyExperienceDefaults("desktop")
Binding on checked {
value: SetupState.experienceProfile === "desktop"
}
}
FormCard.FormRadioDelegate {
text: i18n("Gamepad gaming")
description: i18n("Game Center layout for handheld PCs.")
onClicked: SetupState.applyExperienceDefaults("gaming")
Binding on checked {
value: SetupState.experienceProfile === "gaming"
}
}
FormCard.FormRadioDelegate {
text: i18n("Adaptive docked")
description: i18n("Auto-hide panels for tablets and foldables.")
onClicked: SetupState.applyExperienceDefaults("hybrid")
Binding on checked {
value: SetupState.experienceProfile === "hybrid"
}
}
}
FormCard.FormCard {
maximumWidth: root.cardWidth
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
FormCard.FormTextDelegate {
text: i18n("Current selection")
description: i18n("%1. Windows: %2, Gaming: %3, Tiling: %4",
root.profileLabel(SetupState.experienceProfile),
SetupState.convergenceModeEnabled ? i18n("on") : i18n("off"),
SetupState.gamingModeEnabled ? i18n("on") : i18n("off"),
SetupState.dynamicTilingEnabled ? i18n("on") : i18n("off"))
}
}
Item {
Layout.fillHeight: true
}
}
}
}
}