summaryrefslogtreecommitdiff
path: root/kodereviewer/qml
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer/qml')
-rw-r--r--kodereviewer/qml/Editor.qml2
-rw-r--r--kodereviewer/qml/Main.qml2
-rw-r--r--kodereviewer/qml/MarkdownTextArea.qml3
-rw-r--r--kodereviewer/qml/PullRequestPage.qml56
-rw-r--r--kodereviewer/qml/ReviewList.qml84
5 files changed, 133 insertions, 14 deletions
diff --git a/kodereviewer/qml/Editor.qml b/kodereviewer/qml/Editor.qml
index 052933d..fdd1cbd 100644
--- a/kodereviewer/qml/Editor.qml
+++ b/kodereviewer/qml/Editor.qml
@@ -32,10 +32,10 @@ TextEdit {
font.family: "monospace"
Kirigami.SpellCheck.enabled: false
+
LineModel {
id: lineModel
document: root.textDocument
- onDocumentChanged: print('Document changed!')
}
onWidthChanged: lineModel.resetModel()
diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml
index 1c5e951..c1be6b9 100644
--- a/kodereviewer/qml/Main.qml
+++ b/kodereviewer/qml/Main.qml
@@ -46,8 +46,6 @@ Kirigami.ApplicationWindow {
}
}
-
-
Loader {
id: treeFileModelLoader
active: !!pullRequest
diff --git a/kodereviewer/qml/MarkdownTextArea.qml b/kodereviewer/qml/MarkdownTextArea.qml
index 966b209..9debc1a 100644
--- a/kodereviewer/qml/MarkdownTextArea.qml
+++ b/kodereviewer/qml/MarkdownTextArea.qml
@@ -10,7 +10,8 @@ QQC2.TextArea {
placeholderText: "Leave a comment"
wrapMode: TextEdit.Wrap
- Kirigami.SpellCheck.enabled: true
+ Kirigami.SpellCheck.enabled: false
+
SyntaxHighlighter {
id: hightlighter
textEdit: root
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
@@ -66,6 +69,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
sourceComponent: FileModel {
@@ -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
+ }
}
]
}
diff --git a/kodereviewer/qml/ReviewList.qml b/kodereviewer/qml/ReviewList.qml
new file mode 100644
index 0000000..e8821af
--- /dev/null
+++ b/kodereviewer/qml/ReviewList.qml
@@ -0,0 +1,84 @@
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtCore
+import QtQuick.Controls as QQC2
+import QtQuick.Layouts
+
+import org.kde.kirigami as Kirigami
+import org.kde.kirigamiaddons.formcard as FormCard
+import org.kde.kirigamiaddons.components as KirigamiComponents
+
+
+Kirigami.CardsListView {
+ id: root
+
+ Kirigami.PlaceholderMessage {
+ visible: root.count == 0
+ anchors.centerIn: parent
+ text: "No reviews!"
+ }
+
+ delegate: Kirigami.AbstractCard {
+ id: delegate
+
+ required property int id
+ required property string diff
+ required property var reviews
+
+ clip: true
+
+ header: Editor {
+ text: delegate.diff
+ file: "bla.txt"
+ }
+
+ contentItem: Item {
+ implicitHeight: commentsLayout.implicitHeight
+ implicitWidth: commentsLayout.implicitWidth
+ ColumnLayout {
+ id: commentsLayout
+ anchors.fill: parent
+
+ Repeater {
+ model: delegate.reviews
+ ColumnLayout {
+ required property var modelData
+
+ Kirigami.Separator {
+ Layout.fillWidth: true
+ }
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ KirigamiComponents.Avatar {
+ name: modelData.user.username
+ source: modelData.user.avatarUrl
+ Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
+ Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
+ Layout.fillWidth: false
+ Layout.alignment: Qt.AlignTop
+ }
+ QQC2.Label {
+ text: `@${modelData.user.username}`
+ Layout.fillWidth: false
+ Layout.alignment: Qt.AlignTop
+ }
+ }
+ MarkdownLabel {
+ Layout.fillWidth: true
+ text: modelData.body
+ }
+
+ }
+ }
+
+ MarkdownTextArea {
+ id: addComment
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+}
+