MainView.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. import QtQuick 2.0
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Dialogs 1.2
  4. import org.semlanik.nicegit 1.0
  5. Item {
  6. id: root
  7. Row {
  8. id: selector
  9. Text {
  10. text: "Active repository" + repoOpenDialog.fileUrl
  11. }
  12. Button {
  13. text: "Choose..."
  14. onClicked: repoOpenDialog.open()
  15. }
  16. }
  17. Column {
  18. anchors.top: selector.bottom
  19. Repeater {
  20. model: _handler.repositories
  21. Text {
  22. text: model.name
  23. }
  24. }
  25. }
  26. Item {
  27. width: childrenRect.width
  28. height: childrenRect.height
  29. anchors.right: parent.right
  30. Repeater {
  31. model: _handler.modelByHead("main")
  32. Rectangle {
  33. radius: 10
  34. x: model.x*(width+20)
  35. y: model.y*(height+10)
  36. width: 100
  37. height: 30
  38. color: "#"+model.color;
  39. Text {
  40. id: sha1Lable
  41. maximumLineCount: 8
  42. text: model.shortSha1
  43. }
  44. MouseArea {
  45. hoverEnabled: true
  46. anchors.fill: parent
  47. onEntered: {
  48. parent.state = "full"
  49. }
  50. onExited: {
  51. parent.state = "short"
  52. }
  53. }
  54. }
  55. }
  56. }
  57. // Row {
  58. // anchors.right: parent.right
  59. // anchors.top: parent.top
  60. // anchors.bottom: parent.bottom
  61. // Repeater {
  62. // model: ListModel {
  63. // ListElement {
  64. // branch: "b3"
  65. // }
  66. // ListElement {
  67. // branch: "master"
  68. // }
  69. // ListElement {
  70. // branch: "b1"
  71. // }
  72. // ListElement {
  73. // branch: "b2"
  74. // }
  75. // ListElement {
  76. // branch: "b4"
  77. // }
  78. // }
  79. // Column {
  80. // width: 200
  81. // Text {
  82. // id: branchName
  83. // text: "Branch:" + branch
  84. // }
  85. // ListView {
  86. // id: branchList
  87. // height: root.height
  88. // width: 200
  89. // model: _handler.modelByHead(branch)
  90. // delegate: Rectangle {
  91. // id: idRect
  92. // width: parent.width
  93. // height: 80
  94. // color: "#cccccc"
  95. // states: [
  96. // State {
  97. // name:"full"
  98. // PropertyChanges {
  99. // target: sha1Lable
  100. // text: model.sha1
  101. // }
  102. // PropertyChanges {
  103. // target: idRect
  104. // color: !model.isMerge ? "#dddddd" : "#aa6666"
  105. // }
  106. // },
  107. // State {
  108. // name:"short"
  109. // PropertyChanges {
  110. // target: sha1Lable
  111. // text: model.shortSha1
  112. // }
  113. // PropertyChanges {
  114. // target: idRect
  115. // color: "#cccccc"
  116. // }
  117. // }]
  118. // state: "short"
  119. // Column {
  120. // width: branchList.width
  121. // Text {
  122. // id: sha1Lable
  123. // width: branchList.width
  124. // maximumLineCount: 8
  125. // text: model.shortSha1
  126. // }
  127. // Text {
  128. // text: model.message
  129. // }
  130. // }
  131. // MouseArea {
  132. // hoverEnabled: true
  133. // anchors.fill: parent
  134. // onEntered: {
  135. // parent.state = "full"
  136. // }
  137. // onExited: {
  138. // parent.state = "short"
  139. // }
  140. // }
  141. // }
  142. // }
  143. // }
  144. // }
  145. // }
  146. FileDialog {
  147. id: repoOpenDialog
  148. folder: "."
  149. selectFolder: true
  150. selectMultiple: false
  151. onAccepted: {
  152. _handler.open(repoOpenDialog.fileUrl)
  153. }
  154. }
  155. }