From e9c7736ff83b9003eba960edebd2653bd5a4021f Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Fri, 4 Oct 2024 18:30:17 -0300 Subject: Fix a lot of warnings and add file view --- kodereviewer/qml/PullRequestPage.qml | 52 +++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 10 deletions(-) (limited to 'kodereviewer/qml/PullRequestPage.qml') diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml index e99d81b..219762a 100644 --- a/kodereviewer/qml/PullRequestPage.qml +++ b/kodereviewer/qml/PullRequestPage.qml @@ -56,11 +56,26 @@ Kirigami.ScrollablePage { } } - CommentModel { - id: commentModel - pullRequest: root.pullRequest + Loader { + id: commentModelLoader + active: !!root.pullRequest + sourceComponent: CommentModel { + id: commentModel + pullRequest: root.pullRequest + + onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number) + } + } - onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number) + Loader { + id: fileModelLoader + active: !!root.pullRequest + sourceComponent: FileModel { + id: fileModel + pullRequest: root.pullRequest + + onPullRequestChanged: root.connection.getFiles(root.pullRequest.number) + } } Kirigami.PlaceholderMessage { @@ -89,13 +104,23 @@ Kirigami.ScrollablePage { 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.state + text: root.pullRequest ? root.pullRequest.state : "" elide: Text.ElideLeft } } @@ -105,16 +130,22 @@ Kirigami.ScrollablePage { elide: Text.ElideRight } QQC2.Label { - text: root.pullRequest.draft ? i18n("Yes") : i18n("No") + text: root.pullRequest ? root.pullRequest.draft ? i18n("Yes") : i18n("No") : "" elide: Text.ElideLeft } } + Loader { + id: labelModelLoader + active: !!root.pullRequest + sourceComponent: LabelModel { + pullRequest: root.pullRequest + } + } + RowLayout { Repeater { - model: LabelModel { - pullRequest: root.pullRequest - } + model: labelModelLoader.item delegate: Rectangle { required property string name required property string labelColor @@ -150,13 +181,14 @@ Kirigami.ScrollablePage { ColumnLayout { visible: !!root.pullRequest && root.currentView == "comments" Repeater { - model: commentModel + model: commentModelLoader.item delegate: CommentDelegate {} } } FilesView { visible: !!root.pullRequest && root.currentView == "files" + fileModel: fileModelLoader.item } footer: Kirigami.NavigationTabBar { -- cgit v1.2.3-70-g09d2