InvalidCliPathPopup.ui.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import QtQuick 2.4
  2. import QtQuick.Controls 2.3
  3. import QtQuick.Layouts 1.3
  4. import QtQuick.Dialogs 1.0
  5. Popup {
  6. id: popup
  7. height: 200
  8. dim: true
  9. clip: false
  10. width: 800
  11. modal: true
  12. focus: true
  13. closePolicy: Popup.NoAutoClose
  14. anchors.centerIn: Overlay.overlay
  15. Overlay.modal: Rectangle {
  16. color: "#b5c5c5c5"
  17. }
  18. Connections {
  19. target: _qmlHandler
  20. onInvalidCliPathPopupClose: {
  21. popup.close()
  22. }
  23. onInvalidCliPathPopupOpen: {
  24. popup.open()
  25. }
  26. }
  27. ColumnLayout {
  28. anchors.fill: parent
  29. Text {
  30. Layout.alignment: Qt.AlignCenter
  31. Layout.preferredWidth: parent.width
  32. Layout.preferredHeight: 50
  33. id: invalidCliPathPopupText
  34. text: qsTr("Invalid CLI-Path: CLI could not be found on the location specified in the config file.\nPlease specify the new location of the CLI:")
  35. wrapMode: Text.WordWrap
  36. horizontalAlignment: Text.AlignHCenter
  37. verticalAlignment: Text.AlignVCenter
  38. font.pixelSize: 20
  39. }
  40. RowLayout {
  41. Layout.alignment: Qt.AlignCenter
  42. Layout.preferredWidth: parent.width
  43. Layout.preferredHeight: 50
  44. Text {
  45. Layout.alignment: Qt.AlignCenter
  46. Layout.preferredHeight: parent.height
  47. Layout.preferredWidth: 600
  48. id: invalidCliPathPopupCliPath
  49. text: qsTr("Select CLI Path >>>")
  50. horizontalAlignment: Text.AlignLeft
  51. font.italic: true
  52. verticalAlignment: Text.AlignVCenter
  53. font.pixelSize: 20
  54. }
  55. Button {
  56. Layout.alignment: Qt.AlignLeft
  57. Layout.preferredHeight: parent.height
  58. Layout.preferredWidth: 150
  59. id: invalicCliPathPopupSelectCliButton
  60. height: 50
  61. text: qsTr("Select CLI")
  62. font.pointSize: 16
  63. // @disable-check M223
  64. onClicked: {
  65. // @disable-check M222
  66. invalidCliPathPopupDialog.open()
  67. }
  68. }
  69. }
  70. RowLayout {
  71. Layout.alignment: Qt.AlignCenter
  72. Layout.preferredWidth: parent.width
  73. Layout.preferredHeight: 50
  74. Button {
  75. Layout.alignment: Qt.AlignCenter
  76. Layout.preferredHeight: parent.height
  77. Layout.preferredWidth: 200
  78. id: invalidCliPathPopupQuitButton
  79. text: qsTr("Quit")
  80. font.pointSize: 16
  81. // @disable-check M223
  82. onClicked: {
  83. // @disable-check M222
  84. _qmlHandler.onInvalidCliPathPopupQuitButton()
  85. }
  86. }
  87. Button {
  88. Layout.alignment: Qt.AlignCenter
  89. Layout.preferredHeight: parent.height
  90. Layout.preferredWidth: 200
  91. id: invalidCliPathPopupContinueButton
  92. text: qsTr("Continue")
  93. enabled: invalidCliPathPopupText.text == "Select CLI Path >>>" ? false : true
  94. font.pointSize: 16
  95. // @disable-check M223
  96. onClicked: {
  97. // @disable-check M222
  98. _qmlHandler.onInvalidCliPathPopupContinueButton(
  99. invalidCliPathPopupCliPath.text)
  100. popup.close()
  101. }
  102. }
  103. }
  104. }
  105. FileDialog {
  106. id: invalidCliPathPopupDialog
  107. nameFilters: ["CLI file (ccats-cli)", "Any file (*)"]
  108. title: "Please select the CLI File"
  109. folder: shortcuts.home
  110. // @disable-check M223
  111. onAccepted: {
  112. // @disable-check M222
  113. var path = invalidCliPathPopupDialog.fileUrl.toString()
  114. path = path.replace(/^(file:\/{2})/, "")
  115. invalidCliPathPopupCliPath.text = path
  116. }
  117. }
  118. }