From a88655cd202dc43a64a7107f6f533bd386079386 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 21 Oct 2024 09:57:10 -0300 Subject: Add reviews view :D --- kodereviewer/qml/PullRequestPage.qml | 56 +++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) (limited to 'kodereviewer/qml/PullRequestPage.qml') diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml index cdcc1ec..5b52c3e 100644 --- a/kodereviewer/qml/PullRequestPage.qml +++ b/kodereviewer/qml/PullRequestPage.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard +import org.kde.kirigamiaddons.components as KirigamiComponents import org.deprecated.kodereviewer 1.0 @@ -20,6 +21,8 @@ Kirigami.ScrollablePage { property string currentView: "info" + title: pullRequest ? pullRequest.title : "" + actions: [ Kirigami.Action { id: reviewChangesAction @@ -65,6 +68,16 @@ Kirigami.ScrollablePage { } } + Loader { + id: reviewLoader + active: !!root.pullRequest + sourceComponent: ReviewModel { + id: reviewModel + pullRequest: root.pullRequest + onPullRequestChanged: root.connection.getPullRequestReviews(root.pullRequest.number) + } + } + Loader { id: fileModelLoader active: !!root.pullRequest @@ -94,34 +107,39 @@ Kirigami.ScrollablePage { Layout.fillHeight: true //anchors.fill: parent } - Kirigami.CardsListView { - visible: !!root.pullRequest && root.currentView == "comments" - //anchors.fill: parent + id: commentsListView Layout.fillWidth: true Layout.fillHeight: true + visible: !!root.pullRequest && root.currentView == "comments" model: commentModelLoader.item delegate: CommentDelegate {} footerPositioning: ListView.OverlayFooter } + ReviewList { + id: reviewListView + visible: !!root.pullRequest && root.currentView == "reviews" + Layout.fillWidth: true + Layout.fillHeight: true + model: reviewLoader.item + } + Editor { + id: editor visible: !!root.pullRequest && root.currentView == "files" - Layout.fillWidth: true Layout.fillHeight: true - id: editor text: "" file: "" - //fileModel: fileModelLoader.item } } Connections { target: contextDrawer function onFileSelected(filename, text) { - print("ASDF") + console.log("file changed!") editor.filename = filename + '.diff' editor.text = text } @@ -132,18 +150,36 @@ Kirigami.ScrollablePage { Kirigami.Action { icon.name: "info" text: i18n("Info") - onTriggered: root.currentView = "info" + onTriggered: { + root.currentView = "info" + //root.flickable = mainLayout + } }, Kirigami.Action { icon.name: "comment-symbolic" text: i18n("Comments") - onTriggered: root.currentView = "comments" + onTriggered: { + root.currentView = "comments" + //root.flickable = commentsListView + } }, Kirigami.Action { icon.name: "file-catalog-symbolic" text: i18n("Files") - onTriggered: root.currentView = "files" + onTriggered: { + root.currentView = "files" + //root.flickable = reviewListView + } + }, + Kirigami.Action { + icon.name: "document-preview-symbolic" + text: i18n("Reviews") + onTriggered: { + root.currentView = "reviews" + + //root.flickable = mainLayout + } } ] } -- cgit v1.2.3-70-g09d2