diff options
Diffstat (limited to 'kodereviewer/qml/PullRequestPage.qml')
-rw-r--r-- | kodereviewer/qml/PullRequestPage.qml | 106 |
1 files changed, 59 insertions, 47 deletions
diff --git a/kodereviewer/qml/PullRequestPage.qml b/kodereviewer/qml/PullRequestPage.qml index 19defdc..5a687e9 100644 --- a/kodereviewer/qml/PullRequestPage.qml +++ b/kodereviewer/qml/PullRequestPage.qml @@ -18,67 +18,79 @@ Kirigami.ScrollablePage { Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false + property string currentView: "info" + CommentModel { id: commentModel pullRequest: root.pullRequest - onPullRequestChanged: root.connection.getPullRequestComments(pullRequest.number) + onPullRequestChanged: root.connection.getPullRequestComments(root.pullRequest.number) } - ListView { - id: listView - model: commentModel - spacing: Kirigami.Units.largeSpacing * 2 - topMargin: Kirigami.Units.largeSpacing * 2 - rightMargin: Kirigami.Units.largeSpacing * 2 - leftMargin: Kirigami.Units.largeSpacing * 2 - bottomMargin: Kirigami.Units.largeSpacing * 2 // + commentToolbar.heigh - - header: ColumnLayout { - id: headerLayout - visible: !!root.pullRequest - width: ListView.view ? ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin : 0 - - Kirigami.Heading { - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - leftPadding: Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing - level: 1 - text: root.pullRequest ? root.pullRequest.title : "" - wrapMode: Text.WordWrap - } + Kirigami.PlaceholderMessage { + visible: !root.pullRequest + anchors.centerIn: parent + icon.name: "org.deprecated.kodereviewer" + text: "Select a pull request" + } - Kirigami.ListSectionHeader { - Layout.fillWidth: true - text: "description" - } + ColumnLayout { + id: mainLayout + visible: !!root.pullRequest && root.currentView == "info" - QQC2.Label { - Layout.fillWidth: true - Layout.fillHeight: false - leftPadding: Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing - text: root.pullRequest ? root.pullRequest.body : "" - textFormat: Text.MarkdownText - wrapMode: Text.WordWrap - } + spacing: Kirigami.Units.largeSpacing * 2 - Kirigami.ListSectionHeader { - Layout.fillWidth: true - text: "Comments" - } + Kirigami.Heading { + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + leftPadding: Kirigami.Units.largeSpacing + rightPadding: Kirigami.Units.largeSpacing + level: 1 + text: root.pullRequest ? root.pullRequest.title : "" + wrapMode: Text.WordWrap } - delegate: CommentDelegate {} + Kirigami.ListSectionHeader { + Layout.fillWidth: true + text: "description" + } - Kirigami.PlaceholderMessage { - visible: !root.pullRequest - anchors.centerIn: parent - icon.name: "org.deprecated.kodereviewer" - text: "Select a pull request" + MarkdownLabel { + Layout.fillWidth: true + Layout.fillHeight: false + leftPadding: Kirigami.Units.largeSpacing + rightPadding: Kirigami.Units.largeSpacing + text: root.pullRequest ? root.pullRequest.body : "" + } + } + ColumnLayout { + visible: !!root.pullRequest && root.currentView == "comments" + Repeater { + model: commentModel + delegate: CommentDelegate {} } } + + footer: Kirigami.NavigationTabBar { + actions: [ + Kirigami.Action { + icon.name: "info" + text: i18n("Info") + onTriggered: root.currentView = "info" + }, + Kirigami.Action { + icon.name: "comment-symbolic" + text: i18n("Comments") + onTriggered: root.currentView = "comments" + + }, + Kirigami.Action { + icon.name: "file-catalog-symbolic" + text: i18n("Files") + onTriggered: root.currentView = "files" + } + ] + } } |