summaryrefslogtreecommitdiff
path: root/kodereviewer/qml
diff options
context:
space:
mode:
authorMatias Linares <matias.linares@comprandoengrupo.net>2024-10-04 18:30:17 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2024-10-04 18:30:17 -0300
commite9c7736ff83b9003eba960edebd2653bd5a4021f (patch)
tree81c2da8c4d1c79f465e6eb1e35f22ec597acd2ef /kodereviewer/qml
parent332828d03ae455c9a3ada0f57a08bf0942082824 (diff)
downloadkodereviewer-e9c7736ff83b9003eba960edebd2653bd5a4021f.tar.gz
Fix a lot of warnings and add file view
Diffstat (limited to 'kodereviewer/qml')
-rw-r--r--kodereviewer/qml/Editor.qml3
-rw-r--r--kodereviewer/qml/FilesView.qml29
-rw-r--r--kodereviewer/qml/Main.qml2
-rw-r--r--kodereviewer/qml/ProjectListPage.qml57
-rw-r--r--kodereviewer/qml/PullRequestPage.qml52
5 files changed, 75 insertions, 68 deletions
diff --git a/kodereviewer/qml/Editor.qml b/kodereviewer/qml/Editor.qml
index 9cc6cbf..052933d 100644
--- a/kodereviewer/qml/Editor.qml
+++ b/kodereviewer/qml/Editor.qml
@@ -35,6 +35,7 @@ TextEdit {
LineModel {
id: lineModel
document: root.textDocument
+ onDocumentChanged: print('Document changed!')
}
onWidthChanged: lineModel.resetModel()
@@ -82,7 +83,7 @@ TextEdit {
}
}
- onTextChanged: print(root.textDocument)
+ // onTextChanged: lineModel.document = root.textDocument
onFileChanged: {
repeater.model.resetModel()
diff --git a/kodereviewer/qml/FilesView.qml b/kodereviewer/qml/FilesView.qml
index 299c353..1442860 100644
--- a/kodereviewer/qml/FilesView.qml
+++ b/kodereviewer/qml/FilesView.qml
@@ -14,23 +14,7 @@ QQC2.SplitView {
anchors.fill: parent
padding: 0
spacing: 0
- ListModel {
- id: fileModel
- ListElement {
- filename: "file1"
- status: "added"
- additions: 100
- deletions: 40
- patch: "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
- }
- ListElement {
- filename: "file2"
- status: "added"
- additions: 100
- deletions: 40
- patch: "@@ -1,9 +1,9 @@ def something @@ -1000,7 +1000,7 @@ module Test"
- }
- }
+ required property FileModel fileModel
QQC2.ScrollView {
@@ -52,10 +36,11 @@ QQC2.SplitView {
}
}
}
-
- Editor {
- id: textArea
- text: ""
- file: ""
+ QQC2.ScrollView {
+ Editor {
+ id: textArea
+ text: ""
+ file: ""
+ }
}
}
diff --git a/kodereviewer/qml/Main.qml b/kodereviewer/qml/Main.qml
index 827cf59..56248d7 100644
--- a/kodereviewer/qml/Main.qml
+++ b/kodereviewer/qml/Main.qml
@@ -15,7 +15,7 @@ Kirigami.ApplicationWindow {
title: qsTr("Kode Reviewer")
minimumWidth: Kirigami.Units.gridUnit * 20
- minimumHeight: Kirigami.Units.gridUnit * 20
+ //minimumHeight: Kirigami.Units.gridUnit * 20
width: minimumWidth
height: minimumHeight
diff --git a/kodereviewer/qml/ProjectListPage.qml b/kodereviewer/qml/ProjectListPage.qml
index 2846db1..f156dc1 100644
--- a/kodereviewer/qml/ProjectListPage.qml
+++ b/kodereviewer/qml/ProjectListPage.qml
@@ -9,7 +9,7 @@ import org.kde.kirigami as Kirigami
import org.deprecated.kodereviewer
-Kirigami.Page {
+Kirigami.ScrollablePage {
id: root
required property NetworkManager connection
@@ -56,43 +56,32 @@ Kirigami.Page {
}
]
- contentItem: QQC2.StackView {
- id: stackView
- anchors.fill: parent
-
- initialItem: pullRequestListView
-
- Component {
- id: pullRequestListView
- QQC2.ScrollView {
- ListView {
- id: view
- model: pullRequestModel
- clip: true
- delegate: Delegates.RoundedItemDelegate {
- required property int number
- required property string title
- required property bool draft
- required property int index
-
- highlighted: ListView.isCurrentItem
-
- text: `${number} - ${title}`
- icon {
- name: "vcs-merge-request"
- color: draft ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.positiveTextColor
- }
-
- onClicked: {
- view.currentIndex = index
- root.pullRequestSelected(number)
- }
- }
- }
+ ListView {
+ id: view
+ model: pullRequestModel
+ clip: true
+ delegate: Delegates.RoundedItemDelegate {
+ required property int number
+ required property string title
+ required property bool draft
+ required property int index
+
+ highlighted: ListView.isCurrentItem
+
+ text: `${number} - ${title}`
+ icon {
+ name: "vcs-merge-request"
+ color: draft ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.positiveTextColor
+ }
+
+ onClicked: {
+ view.currentIndex = index
+ root.pullRequestSelected(number)
}
}
}
+
MouseArea {
anchors.top: parent.top
anchors.bottom: parent.bottom
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 {
@@ -91,11 +106,21 @@ Kirigami.ScrollablePage {
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 {