12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import QtQuick 2.0
- import QtQuick.Controls 1.4
- import org.semlanik.nicegit 1.0
- Item {
- id: root
- property var commitsForDiff: null
- property bool controlActive: false
- TopBar {
- id: topBar
- onCloseClicked: {
- commitPlane.diff = null
- commitPlane.commit = null
- commitList.state = "full"
- }
- closeVisible: commitPlane.diff != null
- }
- Rectangle {
- id: bg
- color: "#eeeeee"
- anchors.fill: commitList
- }
- CommitList {
- id: commitList
- anchors.top: topBar.bottom
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- commitsModel: _handler.commits
- graphModel: _handler.graph
- onCommitClicked: {
- if(commit.diff == null) {
- commitPlane.commit = null
- commitPlane.diff = null
- commitList.state = "full"
- return
- }
- commitList.state = "commitsOnly"
- if(!root.controlActive) {
- commitPlane.commit = commit
- root.commitsForDiff=[]
- } else {
- console.log("root.controlActive: " + root.controlActive)
- if(root.commitsForDiff === null) {
- root.commitsForDiff = new Array(0);
- }
- console.log("Length" + root.commitsForDiff.length)
- root.commitsForDiff.push(commit)
- if(root.commitsForDiff.length === 2) {
- commitPlane.commit = root.commitsForDiff[1]
- commitPlane.diff = _handler.diff(root.commitsForDiff[0], root.commitsForDiff[1])
- root.commitsForDiff=[]
- }
- }
- }
- }
- CommitPlane {
- id: commitPlane
- anchors.left: commitList.right
- anchors.right: parent.right
- anchors.top: topBar.bottom
- anchors.bottom: parent.bottom
- // visible: diff != null
- // opacity: diff != null ? 1.0 : 0.0
- }
- Keys.onPressed: {
- if(event.key === Qt.Key_Control) {
- root.controlActive = true
- console.log("control pressed");
- }
- }
- Keys.onReleased: {
- if(event.key === Qt.Key_Control) {
- root.controlActive = false
- console.log("control released");
- }
- }
- Tooltip {
- }
- }
|