NoConfigFoundPopup.ui.qml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. onNoConfigFoundPopupClose: {
  21. popup.close()
  22. }
  23. onNoConfigFoundPopupOpen: {
  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: noConfigFoundPopupText
  34. text: qsTr("No configuration file found. Default config will be created.\nPlease specify the 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: noConfigFoundPopupCliPath
  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: noConfigFoundPopupSelectCliButton
  60. height: 50
  61. text: qsTr("Select CLI")
  62. font.pointSize: 16
  63. // @disable-check M223
  64. onClicked: {
  65. // @disable-check M222
  66. noConfigFoundPopupCliDialog.open()
  67. }
  68. }
  69. }
  70. Button {
  71. Layout.alignment: Qt.AlignCenter
  72. Layout.preferredHeight: 50
  73. Layout.preferredWidth: 200
  74. id: noConfigFoundPopupContinueButton
  75. text: qsTr("Continue")
  76. enabled: noConfigFoundPopupCliPath.text == "Select CLI Path >>>" ? false : true
  77. font.pointSize: 16
  78. // @disable-check M223
  79. onClicked: {
  80. // @disable-check M222
  81. _qmlHandler.onNoConfigFoundPopupContinueButton(
  82. noConfigFoundPopupCliPath.text)
  83. popup.close()
  84. }
  85. }
  86. }
  87. FileDialog {
  88. id: noConfigFoundPopupCliDialog
  89. nameFilters: ["CLI file (ccats-cli)", "Any file (*)"]
  90. title: "Please select the CLI File"
  91. folder: shortcuts.home
  92. // @disable-check M223
  93. onAccepted: {
  94. // @disable-check M222
  95. var path = noConfigFoundPopupCliDialog.fileUrl.toString()
  96. path = path.replace(/^(file:\/{2})/, "")
  97. noConfigFoundPopupCliPath.text = path
  98. }
  99. }
  100. }