MainView.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. Row {
  7. id: selector
  8. Text {
  9. text: "Active repository" + repoOpenDialog.fileUrl
  10. }
  11. Button {
  12. text: "Choose..."
  13. onClicked: repoOpenDialog.open()
  14. }
  15. }
  16. Column {
  17. anchors.top: selector.bottom
  18. Repeater {
  19. model: _handler.repositories
  20. Text {
  21. text: model.name
  22. }
  23. }
  24. }
  25. ListView {
  26. anchors.top: parent.top
  27. anchors.bottom: parent.bottom
  28. width: 200
  29. anchors.right: parent.right
  30. model: _handler.modelByHead("master")
  31. delegate: Rectangle {
  32. id: idRect
  33. width: parent.width
  34. height: 80
  35. color: "#cccccc"
  36. states: [
  37. State {
  38. name:"full"
  39. PropertyChanges {
  40. target: sha1Lable
  41. text: model.sha1
  42. }
  43. PropertyChanges {
  44. target: idRect
  45. color: "#dddddd"
  46. }
  47. },
  48. State {
  49. name:"short"
  50. PropertyChanges {
  51. target: sha1Lable
  52. text: model.shortSha1
  53. }
  54. PropertyChanges {
  55. target: idRect
  56. color: "#cccccc"
  57. }
  58. }]
  59. state: "short"
  60. Text {
  61. id: sha1Lable
  62. maximumLineCount: 8
  63. text: model.shortSha1
  64. }
  65. MouseArea {
  66. hoverEnabled: true
  67. anchors.fill: parent
  68. onEntered: {
  69. parent.state = "full"
  70. }
  71. onExited: {
  72. parent.state = "short"
  73. }
  74. }
  75. }
  76. }
  77. FileDialog {
  78. id: repoOpenDialog
  79. folder: "."
  80. selectFolder: true
  81. selectMultiple: false
  82. onAccepted: {
  83. _handler.open(repoOpenDialog.fileUrl)
  84. }
  85. }
  86. }