CompatibilityDialog.qml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Copyright (c) 2020 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Window 2.2
  5. import QtQuick.Controls 2.3
  6. import UM 1.1 as UM
  7. import Cura 1.6 as Cura
  8. UM.Dialog{
  9. visible: true
  10. title: catalog.i18nc("@title", "Changes from your account")
  11. width: UM.Theme.getSize("popup_dialog").width
  12. height: UM.Theme.getSize("popup_dialog").height
  13. minimumWidth: width
  14. maximumWidth: minimumWidth
  15. minimumHeight: height
  16. maximumHeight: minimumHeight
  17. margin: 0
  18. Rectangle
  19. {
  20. id: root
  21. anchors.fill: parent
  22. color: UM.Theme.getColor("main_background")
  23. UM.I18nCatalog
  24. {
  25. id: catalog
  26. name: "cura"
  27. }
  28. ScrollView
  29. {
  30. width: parent.width
  31. height: parent.height - nextButton.height - nextButton.anchors.margins * 2 // We want some leftover space for the button at the bottom
  32. clip: true
  33. Column
  34. {
  35. anchors.fill: parent
  36. anchors.margins: UM.Theme.getSize("default_margin").width
  37. // Compatible packages
  38. Label
  39. {
  40. font: UM.Theme.getFont("default")
  41. text: catalog.i18nc("@label", "The following packages will be added:")
  42. color: UM.Theme.getColor("text")
  43. height: contentHeight + UM.Theme.getSize("default_margin").height
  44. }
  45. Repeater
  46. {
  47. model: toolbox.subscribedPackagesModel
  48. Component
  49. {
  50. Item
  51. {
  52. width: parent.width
  53. property var lineHeight: 60
  54. visible: model.is_compatible == "True" ? true : false
  55. height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the compatible packages here
  56. Image
  57. {
  58. id: packageIcon
  59. source: model.icon_url || "../../images/logobot.svg"
  60. height: lineHeight
  61. width: height
  62. mipmap: true
  63. fillMode: Image.PreserveAspectFit
  64. }
  65. Label
  66. {
  67. text: model.name
  68. font: UM.Theme.getFont("medium_bold")
  69. anchors.left: packageIcon.right
  70. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  71. anchors.verticalCenter: packageIcon.verticalCenter
  72. color: UM.Theme.getColor("text")
  73. elide: Text.ElideRight
  74. }
  75. }
  76. }
  77. }
  78. // Incompatible packages
  79. Label
  80. {
  81. font: UM.Theme.getFont("default")
  82. text: catalog.i18nc("@label", "The following packages can not be installed because of incompatible Cura version:")
  83. color: UM.Theme.getColor("text")
  84. height: contentHeight + UM.Theme.getSize("default_margin").height
  85. }
  86. Repeater
  87. {
  88. model: toolbox.subscribedPackagesModel
  89. Component
  90. {
  91. Item
  92. {
  93. width: parent.width
  94. property var lineHeight: 60
  95. visible: model.is_compatible == "True" ? false : true
  96. height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
  97. Image
  98. {
  99. id: packageIcon
  100. source: model.icon_url || "../../images/logobot.svg"
  101. height: lineHeight
  102. width: height
  103. mipmap: true
  104. fillMode: Image.PreserveAspectFit
  105. }
  106. Label
  107. {
  108. text: model.name
  109. font: UM.Theme.getFont("medium_bold")
  110. anchors.left: packageIcon.right
  111. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  112. anchors.verticalCenter: packageIcon.verticalCenter
  113. color: UM.Theme.getColor("text")
  114. elide: Text.ElideRight
  115. }
  116. }
  117. }
  118. }
  119. }
  120. } // End of ScrollView
  121. Cura.ActionButton
  122. {
  123. id: nextButton
  124. anchors.bottom: parent.bottom
  125. anchors.right: parent.right
  126. anchors.margins: UM.Theme.getSize("default_margin").height
  127. text: catalog.i18nc("@button", "Next")
  128. }
  129. }
  130. }