diff options
Diffstat (limited to 'kodereviewer/qml/Main.qml')
-rw-r--r-- | kodereviewer/qml/Main.qml | 89 |
1 files changed, 84 insertions, 5 deletions
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) + } + } + ] + } } |