From d46b4e7470e3115df34fc96ba2f8e59974f713be Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Tue, 29 Oct 2024 18:12:20 -0300 Subject: Split PullRequestPage into different ScrollablePages --- kodereviewer/qml/Main.qml | 89 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 5 deletions(-) (limited to 'kodereviewer/qml/Main.qml') diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml index c1be6b9..dc807fe 100644 --- a/kodereviewer/qml/Main.qml +++ b/kodereviewer/qml/Main.qml @@ -22,6 +22,7 @@ Kirigami.ApplicationWindow { signal projectSelected() property Project project + property bool isProjectSelected: false property NetworkManager connection: NetworkManager { project: root.project @@ -54,6 +55,11 @@ Kirigami.ApplicationWindow { sourceComponent: TreeFileModel { pullRequest: treeFileModelLoader.pullRequest } + + onPullRequestChanged: { + if (pullRequest) + root.connection.getFiles(pullRequest.number) + } } contextDrawer: FilesDrawer { @@ -69,7 +75,7 @@ Kirigami.ApplicationWindow { Loader { id: projectListPageLoader - active: false + active: root.isProjectSelected sourceComponent: Component { ProjectListPage { connection: root.connection @@ -78,24 +84,97 @@ Kirigami.ApplicationWindow { onPullRequestSelected: number => { const pullRequest = project.pullRequest(number) pullRequestPageLoader.item.pullRequest = pullRequest + commentsPageLoader.item.pullRequest = pullRequest + reviewListPageLoader.item.pullRequest = pullRequest + filesChangedPageLoader.item.pullRequest = pullRequest treeFileModelLoader.pullRequest = pullRequest } } } } + Kirigami.PagePool { + id: pagePool + } + + Loader { + id: commentsPageLoader + active: root.isProjectSelected + sourceComponent: CommentPage { + connection: root.connection + } + } + Loader { id: pullRequestPageLoader - active: false - sourceComponent: PullRequestPage { + active: root.isProjectSelected + sourceComponent: PullRequestDescriptionPage { + connection: root.connection + } + } + + Loader { + id: reviewListPageLoader + active: root.isProjectSelected + sourceComponent: ReviewListPage { + connection: root.connection + } + } + + Loader { + id: filesChangedPageLoader + active: root.isProjectSelected + sourceComponent: FilesChangedPage { connection: root.connection } } onProjectSelected: { - projectListPageLoader.active = true - pullRequestPageLoader.active = true + navigationFooter.visible = true + + root.isProjectSelected = true + pageStack.replace(projectListPageLoader.item) pageStack.push(pullRequestPageLoader.item) } + + footer: Kirigami.NavigationTabBar { + id: navigationFooter + visible: false + actions: [ + Kirigami.Action { + icon.name: "info" + text: i18n("Info") + onTriggered: { + root.pageStack.pop() + root.pageStack.push(pullRequestPageLoader.item) + } + }, + Kirigami.Action { + icon.name: "comment-symbolic" + text: i18n("Comments") + onTriggered: { + root.pageStack.pop() + root.pageStack.push(commentsPageLoader.item) + } + + }, + Kirigami.Action { + icon.name: "file-catalog-symbolic" + text: i18n("Files") + onTriggered: { + root.pageStack.pop() + root.pageStack.push(filesChangedPageLoader.item) + } + }, + Kirigami.Action { + icon.name: "document-preview-symbolic" + text: i18n("Reviews") + onTriggered: { + root.pageStack.pop() + root.pageStack.push(reviewListPageLoader.item) + } + } + ] + } } -- cgit v1.2.3-70-g09d2