summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/PullRequestDescription.qml
blob: de5a679d40fb488f8a138bc7ba3d902342133bea (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
pragma ComponentBehavior: Bound
import QtQuick
import QtCore
import QtQuick.Controls as QQC2
import QtQuick.Layouts

import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

import org.deprecated.kodereviewer 1.0

ScrollView {
    id: root
    property var pullRequest: undefined
    anchors.fill: parent

    Kirigami.FormLayout {
        anchors.fill: parent
        implicitWidth: parent.width

        Kirigami.Heading {
            Layout.fillWidth: true
            Layout.alignment: Qt.AlignHCenter
            leftPadding: Kirigami.Units.largeSpacing
            rightPadding: Kirigami.Units.largeSpacing
            level: 1
            text: root.pullRequest ? root.pullRequest.title : ""
            wrapMode: Text.WordWrap
        }

        Kirigami.Separator {
            Kirigami.FormData.isSection: true
        }

        RowLayout {
            Layout.fillWidth: true
            ColumnLayout {
                Layout.fillWidth: true
                RowLayout {
                    QQC2.Label {
                        text: "Author"
                        elide: Text.ElideRight
                    }
                    QQC2.Label {
                        text: root.pullRequest ? root.pullRequest.username : ""
                        elide: Text.ElideLeft
                    }
                }
                RowLayout {
                    QQC2.Label {
                        text: "State: "
                        elide: Text.ElideRight
                    }
                    QQC2.Label {
                        text: root.pullRequest ? root.pullRequest.state : ""
                        elide: Text.ElideLeft
                    }
                }
                RowLayout {
                    QQC2.Label {
                        text: "Draft?: "
                        elide: Text.ElideRight
                    }
                    QQC2.Label {
                        text: root.pullRequest ? root.pullRequest.draft ? i18n("Yes") : i18n("No") : ""
                        elide: Text.ElideLeft
                    }
                }

                RowLayout {
                    QQC2.Label {
                        text: "Last commit: "
                        elide: Text.ElideRight
                    }
                    QQC2.Label {
                        text: root.pullRequest ? root.pullRequest.last_commit : ""
                        elide: Text.ElideLeft
                    }
                }
            }

            ColumnLayout {
                Layout.fillWidth: false
                Layout.fillHeight: true
                Repeater {
                    model: 0
                    delegate: QQC2.Label {
                        text: "#Faa"
                    }
                }
            }
        }

        Loader {
            id: labelModelLoader
            active: !!root.pullRequest
            sourceComponent: LabelModel {
                pullRequest: root.pullRequest
            }
        }

        RowLayout {
            Repeater {
                model: labelModelLoader.item
                delegate: Rectangle {
                    required property string name
                    required property string labelColor
                    required property string textColor
                    color: labelColor
                    width: thelabel.implicitWidth
                    height: thelabel.implicitHeight
                    radius: 5
                    QQC2.Label {
                        id: thelabel
                        padding: Kirigami.Units.smallSpacing
                        text: name
                        color: textColor
                    }
                }
            }
        }

        Kirigami.Separator {
            Kirigami.FormData.isSection: true
            Kirigami.FormData.label: "Description"
        }

        MarkdownLabel {
            Layout.fillWidth: true
            Layout.fillHeight: false
            leftPadding: Kirigami.Units.largeSpacing
            rightPadding: Kirigami.Units.largeSpacing
            text: root.pullRequest ?
                (root.pullRequest.body != "" ? root.pullRequest.body : "*No description provided.*") : ""
        }
    }
}