summaryrefslogtreecommitdiff
path: root/kodereviewer/qml
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer/qml')
-rw-r--r--kodereviewer/qml/Main.qml6
-rw-r--r--kodereviewer/qml/ProjectListPage.qml21
-rw-r--r--kodereviewer/qml/PullRequestPage.qml104
3 files changed, 112 insertions, 19 deletions
diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml
index e7496a6..827cf59 100644
--- a/kodereviewer/qml/Main.qml
+++ b/kodereviewer/qml/Main.qml
@@ -54,10 +54,8 @@ Kirigami.ApplicationWindow {
connection: root.connection
project: root.project
- onPullRequestSelected: pr => {
- print(pr)
- pullRequestPageLoader.item.pullRequest = pr
-
+ onPullRequestSelected: number => {
+ pullRequestPageLoader.item.pullRequest = project.pullRequest(number)
}
}
}
diff --git a/kodereviewer/qml/ProjectListPage.qml b/kodereviewer/qml/ProjectListPage.qml
index 7ffa8b9..2846db1 100644
--- a/kodereviewer/qml/ProjectListPage.qml
+++ b/kodereviewer/qml/ProjectListPage.qml
@@ -14,7 +14,7 @@ Kirigami.Page {
required property NetworkManager connection
required property Project project
- signal pullRequestSelected(var pullRequest)
+ signal pullRequestSelected(int pullRequest)
readonly property int currentWidth: _private.currentWidth + 1
@@ -67,18 +67,26 @@ Kirigami.Page {
QQC2.ScrollView {
ListView {
id: view
- model: pullRequestFilterModel
+ model: pullRequestModel
clip: true
delegate: Delegates.RoundedItemDelegate {
required property int number
required property string title
+ required property bool draft
required property int index
+
highlighted: ListView.isCurrentItem
text: `${number} - ${title}`
- icon.name: "vcs-merge-request"
-
- onClicked: root.pullRequestSelected(pullRequestModel.get(index))
+ icon {
+ name: "vcs-merge-request"
+ color: draft ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.positiveTextColor
+ }
+
+ onClicked: {
+ view.currentIndex = index
+ root.pullRequestSelected(number)
+ }
}
}
}
@@ -108,7 +116,7 @@ Kirigami.Page {
}
if (mouse.x > _lastX) {
// _private.currentWidth = _private.currentWidth + (_lastX + mouse.x);
- _private.currentWidth = Math.min(_private.defaultWidth, _private.currentWidth + (mouse.x - _lastX))
+ _private.currentWidth = Math.min(_private.maxWidth, _private.currentWidth + (mouse.x - _lastX))
} else if (mouse.x < _lastX) {
const tmpWidth = _private.currentWidth - (_lastX - mouse.x);
if (tmpWidth > _private.minWidth)
@@ -127,6 +135,7 @@ Kirigami.Page {
property int currentWidth: defaultWidth
readonly property int defaultWidth: Kirigami.Units.gridUnit * 17
readonly property int minWidth: Kirigami.Units.gridUnit * 2
+ readonly property int maxWidth: Kirigami.Units.gridUnit * 25
}
}
diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml
index 5a687e9..e99d81b 100644
--- a/kodereviewer/qml/PullRequestPage.qml
+++ b/kodereviewer/qml/PullRequestPage.qml
@@ -20,6 +20,41 @@ Kirigami.ScrollablePage {
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
@@ -28,7 +63,6 @@ Kirigami.ScrollablePage {
onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number)
}
-
Kirigami.PlaceholderMessage {
visible: !root.pullRequest
anchors.centerIn: parent
@@ -36,11 +70,10 @@ Kirigami.ScrollablePage {
text: "Select a pull request"
}
- ColumnLayout {
- id: mainLayout
+ Kirigami.FormLayout {
+ id: descriptionLayout
visible: !!root.pullRequest && root.currentView == "info"
-
- spacing: Kirigami.Units.largeSpacing * 2
+ anchors.fill: parent
Kirigami.Heading {
Layout.fillWidth: true
@@ -52,9 +85,57 @@ Kirigami.ScrollablePage {
wrapMode: Text.WordWrap
}
- Kirigami.ListSectionHeader {
- Layout.fillWidth: true
- text: "description"
+ 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 {
@@ -62,7 +143,8 @@ Kirigami.ScrollablePage {
Layout.fillHeight: false
leftPadding: Kirigami.Units.largeSpacing
rightPadding: Kirigami.Units.largeSpacing
- text: root.pullRequest ? root.pullRequest.body : ""
+ text: root.pullRequest ?
+ (root.pullRequest.body != "" ? root.pullRequest.body : "*No description provided.*") : ""
}
}
ColumnLayout {
@@ -73,6 +155,10 @@ Kirigami.ScrollablePage {
}
}
+ FilesView {
+ visible: !!root.pullRequest && root.currentView == "files"
+ }
+
footer: Kirigami.NavigationTabBar {
actions: [
Kirigami.Action {