summaryrefslogtreecommitdiff
path: root/kodereviewer/qml/FilesView.qml
blob: 299c353d4660c5d76b7393acc2cd3c2d23401d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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.delegates as Delegates

import org.deprecated.kodereviewer 1.0

QQC2.SplitView {
    id: root
    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"
        }
    }


    QQC2.ScrollView {
        SplitView.preferredWidth: 200
        implicitWidth: 200
        SplitView.maximumWidth: 400
        ListView {
            model: fileModel
            delegate: Delegates.RoundedItemDelegate {
                required property string filename
                required property string patch
                highlighted: ListView.isCurrentItem
                text: filename

                onClicked: {
                    textArea.text = patch
                    textArea.file = filename
                }
            }
        }
    }

    Editor {
        id: textArea
        text: ""
        file: ""
    }
}