TopBar.qml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import QtQuick 2.0
  2. import QtQuick.Dialogs 1.2
  3. import QtQuick.Controls 1.4
  4. import QtQuick.Controls.Styles 1.4
  5. import "popups"
  6. Item {
  7. id: root
  8. anchors.right: parent.right
  9. anchors.left: parent.left
  10. height: childrenRect.height
  11. signal closeClicked()
  12. property alias closeVisible: closeControl.visible
  13. Row {
  14. anchors.left: parent.left
  15. anchors.leftMargin: 10
  16. spacing: 10
  17. height: 40
  18. Text {
  19. font.weight: Font.Bold
  20. anchors.verticalCenter: parent.verticalCenter
  21. text: qsTr("Active projects") + ":"
  22. }
  23. ComboBox {
  24. id: repositories
  25. anchors.verticalCenter: parent.verticalCenter
  26. width: 400
  27. model: _handler.repositories
  28. textRole: "name"
  29. onActivated: {
  30. _handler.activateRepository(index)
  31. }
  32. currentIndex: _handler.repositories.activeRepositoryIndex
  33. style: ComboBoxStyle {
  34. font.weight:Font.Bold
  35. }
  36. }
  37. Separator {
  38. anchors.verticalCenter: parent.verticalCenter
  39. }
  40. Button {
  41. anchors.verticalCenter: parent.verticalCenter
  42. text: qsTr("Add...")
  43. onClicked: {
  44. console.log("repoOpenDialog.folder: " + repoOpenDialog.folder)
  45. repoOpenDialog.open()
  46. }
  47. }
  48. Button {
  49. anchors.verticalCenter: parent.verticalCenter
  50. text: qsTr("Pull")
  51. onClicked: {
  52. pullDialog.open()
  53. }
  54. }
  55. }
  56. Row {
  57. anchors.right: parent.right
  58. anchors.top: parent.top
  59. anchors.topMargin: 10
  60. anchors.rightMargin: 10
  61. spacing: 10
  62. Button {
  63. id: closeControl
  64. style: ButtonStyle {
  65. background: Image {
  66. source: control.pressed ? "qrc:///images/x-mark-3-24_active.png" : "qrc:///images/x-mark-3-24.png"
  67. }
  68. }
  69. onClicked: {
  70. root.closeClicked()
  71. }
  72. }
  73. Button {
  74. id: help
  75. style: ButtonStyle {
  76. background: Image {
  77. source: control.pressed ? "qrc:///images/question-mark-4-24_active.png" : "qrc:///images/question-mark-4-24.png"
  78. }
  79. }
  80. onClicked: {
  81. helpDialog.open()
  82. }
  83. }
  84. }
  85. FileDialog {
  86. id: repoOpenDialog
  87. folder: _handler.homePath
  88. selectFolder: true
  89. selectMultiple: false
  90. onAccepted: {
  91. _handler.open(repoOpenDialog.fileUrl, true)
  92. }
  93. }
  94. Dialog {
  95. id: helpDialog
  96. title: qsTr("About")
  97. modality: Qt.NonModal
  98. contentItem: Item {
  99. implicitWidth: 400
  100. implicitHeight: 200
  101. Text {
  102. anchors.left: parent.left
  103. anchors.leftMargin: 8
  104. anchors.right: parent.right
  105. anchors.rightMargin: 8
  106. anchors.horizontalCenter: parent
  107. wrapMode: Text.WordWrap
  108. font.pointSize: 12
  109. textFormat: Text.RichText
  110. text:"<p><b>CuteGit</b> is free opensource software. You're free to use and modify it in terms of GPLv3 license.<br/>" +
  111. "You can support project by contributing your ideas and code to CuteGit repository.</p>" +
  112. "<p><b>Author:</b> Alexey Edelev aka semlanik</p>"
  113. }
  114. }
  115. }
  116. PullStrategy {
  117. id: pullDialog
  118. onAccepted: {
  119. _handler.pull(pullDialog.strategy)
  120. }
  121. }
  122. }