blob: e99d81b9089fc821e4015c24e6d5d722cf258dc2 (
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
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
Kirigami.ScrollablePage {
id: root
property var pullRequest
property NetworkManager connection
Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false
property string currentView: "info"
actions: [
Kirigami.Action {
id: reviewChangesAction
text: "Review changes"
icon.name: "preview-symbolic"
enabled: !!root.pullRequest
onTriggered: reviewChangesDialog.open()
}
]
Kirigami.Dialog {
id: reviewChangesDialog
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
title: i18nc("@title:window", "Review changes")
padding: Kirigami.Units.largeSpacing
preferredWidth: Kirigami.Units.gridUnit * 20
ColumnLayout {
MarkdownTextArea {
Layout.fillWidth: true
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Layout.fillWidth: true
}
QQC2.RadioButton {
text: "Approve"
}
QQC2.RadioButton {
text: "Comment"
}
QQC2.RadioButton {
text: "Request changes"
}
}
}
CommentModel {
id: commentModel
pullRequest: root.pullRequest
onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number)
}
Kirigami.PlaceholderMessage {
visible: !root.pullRequest
anchors.centerIn: parent
icon.name: "org.deprecated.kodereviewer"
text: "Select a pull request"
}
Kirigami.FormLayout {
id: descriptionLayout
visible: !!root.pullRequest && root.currentView == "info"
anchors.fill: parent
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 {
QQC2.Label {
text: "State: "
elide: Text.ElideRight
}
QQC2.Label {
text: root.pullRequest.state
elide: Text.ElideLeft
}
}
RowLayout {
QQC2.Label {
text: "Draft?: "
elide: Text.ElideRight
}
QQC2.Label {
text: root.pullRequest.draft ? i18n("Yes") : i18n("No")
elide: Text.ElideLeft
}
}
RowLayout {
Repeater {
model: LabelModel {
pullRequest: root.pullRequest
}
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.*") : ""
}
}
ColumnLayout {
visible: !!root.pullRequest && root.currentView == "comments"
Repeater {
model: commentModel
delegate: CommentDelegate {}
}
}
FilesView {
visible: !!root.pullRequest && root.currentView == "files"
}
footer: Kirigami.NavigationTabBar {
actions: [
Kirigami.Action {
icon.name: "info"
text: i18n("Info")
onTriggered: root.currentView = "info"
},
Kirigami.Action {
icon.name: "comment-symbolic"
text: i18n("Comments")
onTriggered: root.currentView = "comments"
},
Kirigami.Action {
icon.name: "file-catalog-symbolic"
text: i18n("Files")
onTriggered: root.currentView = "files"
}
]
}
}
|