summaryrefslogtreecommitdiff
path: root/kodereviewer
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer')
-rw-r--r--kodereviewer/qml/PullRequestDescription.qml133
-rw-r--r--kodereviewer/qml/PullRequestPage.qml108
2 files changed, 136 insertions, 105 deletions
diff --git a/kodereviewer/qml/PullRequestDescription.qml b/kodereviewer/qml/PullRequestDescription.qml
new file mode 100644
index 0000000..a40ecd4
--- /dev/null
+++ b/kodereviewer/qml/PullRequestDescription.qml
@@ -0,0 +1,133 @@
+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.FormLayout {
+ id: root
+ anchors.fill: parent
+ implicitWidth: parent.width
+ property var pullRequest: undefined
+
+ 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.*") : ""
+ }
+}
diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml
index b9106c1..4747203 100644
--- a/kodereviewer/qml/PullRequestPage.qml
+++ b/kodereviewer/qml/PullRequestPage.qml
@@ -33,8 +33,6 @@ Kirigami.ScrollablePage {
ReviewDialog {
id: reviewChangesDialog
onAccepted: {
- print('Sending', root.pullRequest.number, root.pullRequest.last_commit,
- reviewBodyText, event)
root.connection.createReview(
root.pullRequest.number, root.pullRequest.last_commit,
reviewBodyText, event
@@ -71,111 +69,11 @@ Kirigami.ScrollablePage {
text: "Select a pull request"
}
- Kirigami.FormLayout {
- id: descriptionLayout
+ PullRequestDescription {
visible: !!root.pullRequest && root.currentView == "info"
- 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 {
- 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
- }
- }
-
- 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.*") : ""
- }
+ pullRequest: root.pullRequest
}
+
ColumnLayout {
visible: !!root.pullRequest && root.currentView == "comments"
Repeater {