InvalidCliPathPopup.ui.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. Connections {
  16. target: _qmlHandler
  17. onInvalidCliPathPopupClose: {
  18. popup.close()
  19. }
  20. onInvalidCliPathPopupOpen: {
  21. popup.open()
  22. }
  23. }
  24. ColumnLayout {
  25. anchors.fill: parent
  26. Text {
  27. Layout.alignment: Qt.AlignCenter
  28. Layout.preferredWidth: parent.width
  29. Layout.preferredHeight: 50
  30. id: invalidCliPathPopupText
  31. color: "#ffffff"
  32. 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:")
  33. wrapMode: Text.WordWrap
  34. horizontalAlignment: Text.AlignHCenter
  35. verticalAlignment: Text.AlignVCenter
  36. font.pixelSize: 20
  37. }
  38. RowLayout {
  39. Layout.alignment: Qt.AlignCenter
  40. Layout.preferredWidth: parent.width
  41. Layout.preferredHeight: 50
  42. Text {
  43. Layout.alignment: Qt.AlignCenter
  44. Layout.preferredHeight: parent.height
  45. Layout.preferredWidth: 600
  46. id: invalidCliPathPopupCliPath
  47. color: "#ffffff"
  48. text: qsTr("Select CLI Path >>>")
  49. horizontalAlignment: Text.AlignLeft
  50. font.italic: true
  51. verticalAlignment: Text.AlignVCenter
  52. font.pixelSize: 20
  53. }
  54. Button {
  55. Layout.alignment: Qt.AlignLeft
  56. Layout.preferredHeight: parent.height
  57. Layout.preferredWidth: 150
  58. id: invalicCliPathPopupSelectCliButton
  59. height: 50
  60. text: qsTr("Select CLI")
  61. font.pointSize: 16
  62. // @disable-check M223
  63. onClicked: {
  64. // @disable-check M222
  65. invalidCliPathPopupDialog.open()
  66. }
  67. }
  68. }
  69. RowLayout {
  70. Layout.alignment: Qt.AlignCenter
  71. Layout.preferredWidth: parent.width
  72. Layout.preferredHeight: 50
  73. Button {
  74. Layout.alignment: Qt.AlignCenter
  75. Layout.preferredHeight: parent.height
  76. Layout.preferredWidth: 200
  77. id: invalidCliPathPopupQuitButton
  78. text: qsTr("Quit")
  79. font.pointSize: 16
  80. // @disable-check M223
  81. onClicked: {
  82. // @disable-check M222
  83. _qmlHandler.onInvalidCliPathPopupQuitButton()
  84. }
  85. }
  86. Button {
  87. Layout.alignment: Qt.AlignCenter
  88. Layout.preferredHeight: parent.height
  89. Layout.preferredWidth: 200
  90. id: invalidCliPathPopupContinueButton
  91. text: qsTr("Continue")
  92. enabled: invalidCliPathPopupText.text == "Select CLI Path >>>" ? false : true
  93. font.pointSize: 16
  94. // @disable-check M223
  95. onClicked: {
  96. // @disable-check M222
  97. _qmlHandler.onInvalidCliPathPopupContinueButton(
  98. invalidCliPathPopupCliPath.text)
  99. popup.close()
  100. }
  101. }
  102. }
  103. }
  104. FileDialog {
  105. id: invalidCliPathPopupDialog
  106. nameFilters: ["CLI file (ccats-cli)", "Any file (*)"]
  107. title: "Please select the CLI File"
  108. folder: shortcuts.home
  109. // @disable-check M223
  110. onAccepted: {
  111. // @disable-check M222
  112. var path = invalidCliPathPopupDialog.fileUrl.toString()
  113. path = path.replace(/^(file:\/{2})/, "")
  114. invalidCliPathPopupCliPath.text = path
  115. }
  116. }
  117. }