diff options
Diffstat (limited to 'kodereviewer/qml/WelcomePage.qml')
-rw-r--r-- | kodereviewer/qml/WelcomePage.qml | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/kodereviewer/qml/WelcomePage.qml b/kodereviewer/qml/WelcomePage.qml new file mode 100644 index 0000000..af74d01 --- /dev/null +++ b/kodereviewer/qml/WelcomePage.qml @@ -0,0 +1,117 @@ +import QtCore +import QtQuick 6.7 +import QtQuick.Controls 6 as QQC2 +import QtQuick.Layouts 6.7 + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard +import org.kde.kirigamiaddons.settings as KirigamiSettings + +import org.deprecated.kodereviewer + +FormCard.FormCardPage { + id: root + + title: "Welcome" + + property int projectCount: projectModel.rowCount() + + signal projectSelected(Project project) + + ProjectModel { + id: projectModel + + onModelReset: { + projectCount = projectModel.rowCount() + } + } + + Component { + id: addRepositoryPage + AddRepositoryPage { + onAccepted: (url, name, owner, displayName) => { + projectModel.add(displayName, owner, url) + applicationWindow().pageStack.pop() + } + } + } + KirigamiSettings.ConfigurationView { + id: configuration + + window: applicationWindow() as Kirigami.ApplicationWindow + + modules: [ + KirigamiSettings.ConfigurationModule { + moduleId: "appearance" + text: i18nc("@action:button", "General") + icon.name: "preferences-system-symbolic" + page: () => Qt.createComponent("SettingsPage.qml") + }, + KirigamiSettings.ConfigurationModule { + moduleId: "about" + text: i18nc("@action:button", "About Kode Reviewer") + icon.name: "help-about" + page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage") + category: i18nc("@title:group", "About") + }, + KirigamiSettings.ConfigurationModule { + moduleId: "aboutkde" + text: i18nc("@action:button", "About KDE") + icon.name: "kde" + page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDE") + category: i18nc("@title:group", "About") + } + ] + } + + Kirigami.Heading { + id: welcomeMessage + + text: "Welcome to Kode Reviewer" + + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: Kirigami.Units.largeSpacing + } + + FormCard.FormHeader { + id: existingProjectsHeader + title: "Existing projects" + visible: root.projectCount > 0 + } + + FormCard.FormCard { + visible: existingProjectsHeader.visible + + Repeater { + id: loadedProjects + model: projectModel + delegate: FormCard.FormButtonDelegate { + required property string name + required property string url + required property int index + text: name + description: url + onClicked: root.projectSelected(projectModel.get(index)) + } + } + } + + FormCard.FormHeader { + title: "Add new project" + } + + FormCard.FormCard { + FormCard.FormButtonDelegate { + text: "Add new project" + onClicked: applicationWindow().pageStack.push(addRepositoryPage) + } + } + + FormCard.FormCard { + FormCard.FormButtonDelegate { + text: "Settings" + icon.name: 'settings-configure-symbolic' + onClicked: configuration.open() + } + } +} |