initialstart: Port to FormCard

This commit is contained in:
Carl Schwan 2023-09-21 21:02:47 +02:00
parent c039bcef86
commit d8f3146de5
No known key found for this signature in database
GPG key ID: 02325448204E452A
7 changed files with 167 additions and 205 deletions

View file

@ -8,7 +8,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.plasma.components 3.0 as PlasmaComponents import QtQuick.Controls as QQC2
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kirigami as Kirigami import org.kde.kirigami as Kirigami
@ -37,10 +37,9 @@ Kirigami.Icon {
} }
// implementation // implementation
source: icon source: icon
PlasmaComponents.BusyIndicator { QQC2.BusyIndicator {
id: connectingIndicator id: connectingIndicator
anchors.fill: parent anchors.fill: parent

View file

@ -53,10 +53,10 @@ int main(int argc, char *argv[])
aboutData.addAuthor(i18n("Devin Lin"), QString(), QStringLiteral("devin@kde.org")); aboutData.addAuthor(i18n("Devin Lin"), QString(), QStringLiteral("devin@kde.org"));
KAboutData::setApplicationData(aboutData); KAboutData::setApplicationData(aboutData);
QQmlApplicationEngine *engine = new QQmlApplicationEngine; QQmlApplicationEngine engine;
engine->rootContext()->setContextObject(new KLocalizedContext{engine}); engine.rootContext()->setContextObject(new KLocalizedContext{&engine});
Wizard *wizard = new Wizard{nullptr, engine}; Wizard *wizard = new Wizard{nullptr, &engine};
wizard->setTestingMode(testWizard); wizard->setTestingMode(testWizard);
wizard->load(); wizard->load();
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
return wizard; return wizard;
}); });
engine->load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("start-here-symbolic"))); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("start-here-symbolic")));

View file

@ -1,13 +1,13 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
import QtQuick.Layouts 1.15 import QtQuick.Layouts
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1 as FormCard
import org.kde.plasma.mm 1.0 as PlasmaMM import org.kde.plasma.mm 1 as PlasmaMM
Item { Item {
id: root id: root
@ -61,18 +61,13 @@ Item {
} }
} }
MobileForm.FormCard { FormCard.FormCard {
visible: PlasmaMM.SignalIndicator.modemAvailable && PlasmaMM.SignalIndicator.mobileDataSupported visible: PlasmaMM.SignalIndicator.modemAvailable && PlasmaMM.SignalIndicator.mobileDataSupported
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormSwitchDelegate {
spacing: 0
MobileForm.FormSwitchDelegate {
Layout.fillWidth: true
text: i18n("Mobile Data") text: i18n("Mobile Data")
checked: PlasmaMM.SignalIndicator.mobileDataEnabled checked: PlasmaMM.SignalIndicator.mobileDataEnabled
onCheckedChanged: { onCheckedChanged: {
@ -82,18 +77,13 @@ Item {
} }
} }
} }
}
MobileForm.FormCard { FormCard.FormCard {
visible: PlasmaMM.SignalIndicator.modemAvailable && !PlasmaMM.SignalIndicator.simEmpty visible: PlasmaMM.SignalIndicator.modemAvailable && !PlasmaMM.SignalIndicator.simEmpty
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
ListView { ListView {
id: listView id: listView
@ -105,7 +95,7 @@ Item {
model: PlasmaMM.SignalIndicator.profiles model: PlasmaMM.SignalIndicator.profiles
delegate: MobileForm.FormRadioDelegate { delegate: FormCard.FormRadioDelegate {
width: listView.width width: listView.width
text: modelData.name text: modelData.name
description: modelData.apn description: modelData.apn
@ -136,7 +126,7 @@ Item {
} }
} }
MobileForm.FormButtonDelegate { FormCard.FormButtonDelegate {
icon.name: "list-add" icon.name: "list-add"
text: i18n("Add APN") text: i18n("Add APN")
onClicked: { onClicked: {
@ -146,7 +136,4 @@ Item {
} }
} }
} }
}
} }

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.plasma.mobileinitialstart.prepare 1.0 as Prepare import org.kde.plasma.mobileinitialstart.prepare 1.0 as Prepare
import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.plasma5support 2.0 as P5Support
@ -82,19 +82,13 @@ Item {
text: i18n("Adjust the screen brightness to be comfortable for the installation process.") text: i18n("Adjust the screen brightness to be comfortable for the installation process.")
} }
MobileForm.FormCard { FormCard.FormCard {
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.AbstractFormDelegate {
spacing: 0 background: null
MobileForm.AbstractFormDelegate {
Layout.fillWidth: true
background: Item {}
contentItem: RowLayout { contentItem: RowLayout {
spacing: Kirigami.Units.gridUnit spacing: Kirigami.Units.gridUnit
@ -122,7 +116,6 @@ Item {
} }
} }
} }
}
Label { Label {
Layout.leftMargin: Kirigami.Units.gridUnit Layout.leftMargin: Kirigami.Units.gridUnit
@ -135,20 +128,15 @@ Item {
text: i18n("Adjust the size of elements on the screen.") text: i18n("Adjust the size of elements on the screen.")
} }
MobileForm.FormCard { FormCard.FormCard {
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormComboBoxDelegate {
spacing: 0
MobileForm.FormComboBoxDelegate {
id: displayScaling id: displayScaling
Layout.fillWidth: true
text: i18n("Display Scaling") text: i18n("Display Scaling")
displayMode: MobileForm.FormComboBoxDelegate.Dialog displayMode: FormCard.FormComboBoxDelegate.Dialog
currentIndex: Prepare.PrepareUtil.scalingOptions.indexOf(Prepare.PrepareUtil.scaling.toString() + "%"); currentIndex: Prepare.PrepareUtil.scalingOptions.indexOf(Prepare.PrepareUtil.scaling.toString() + "%");
model: Prepare.PrepareUtil.scalingOptions model: Prepare.PrepareUtil.scalingOptions
@ -158,5 +146,4 @@ Item {
} }
} }
} }
}
} }

View file

@ -6,7 +6,7 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.plasma.mobileinitialstart.time 1.0 as Time import org.kde.plasma.mobileinitialstart.time 1.0 as Time
Item { Item {
@ -36,16 +36,13 @@ Item {
text: i18n("Select your time zone and preferred time format.") text: i18n("Select your time zone and preferred time format.")
} }
MobileForm.FormCard { FormCard.FormCard {
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout { FormCard.FormSwitchDelegate {
spacing: 0
MobileForm.FormSwitchDelegate {
Layout.fillWidth: true Layout.fillWidth: true
text: i18n("24-Hour Format") text: i18n("24-Hour Format")
checked: Time.TimeUtil.is24HourTime checked: Time.TimeUtil.is24HourTime
@ -56,21 +53,18 @@ Item {
} }
} }
} }
}
MobileForm.FormCard { FormCard.FormCard {
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
ListView { ListView {
clip: true
id: listView id: listView
clip: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
model: Time.TimeUtil.timeZones model: Time.TimeUtil.timeZones
@ -99,7 +93,7 @@ Item {
} }
} }
delegate: MobileForm.FormRadioDelegate { delegate: FormCard.FormRadioDelegate {
required property string timeZoneId required property string timeZoneId
width: ListView.view.width width: ListView.view.width
@ -115,6 +109,5 @@ Item {
} }
} }
} }
}
} }

View file

@ -8,10 +8,10 @@ import QtQuick.Controls 2.15 as Controls
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.kirigami 2.2 as Kirigami import org.kde.kirigami 2.2 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.ksvg 1.0 as KSvg import org.kde.ksvg 1.0 as KSvg
MobileForm.AbstractFormDelegate { FormCard.AbstractFormDelegate {
topPadding: Kirigami.Units.smallSpacing topPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing bottomPadding: Kirigami.Units.smallSpacing

View file

@ -2,12 +2,12 @@
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org> // SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15 import QtQuick
import QtQuick.Controls 2.15 import QtQuick.Controls
import QtQuick.Layouts 1.15 import QtQuick.Layouts
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
import org.kde.plasma.mobileinitialstart.wifi 1.0 as WiFi import org.kde.plasma.mobileinitialstart.wifi 1.0 as WiFi
@ -68,16 +68,13 @@ Item {
text: i18n("Connect to a WiFi network for network access.") text: i18n("Connect to a WiFi network for network access.")
} }
MobileForm.FormCard { FormCard.FormCard {
maximumWidth: root.cardWidth maximumWidth: root.cardWidth
Layout.fillHeight: true Layout.fillHeight: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
ListView { ListView {
id: listView id: listView
currentIndex: -1 currentIndex: -1
@ -111,7 +108,6 @@ Item {
} }
} }
} }
}
} }