summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/WelcomePage.qml
blob: af74d013d06e02bbbe09d54c2de0499e87fc330c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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()
        }
    }
}