CompatibilityDialog.qml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. visible: toolbox.has_compatible_packages
  43. color: UM.Theme.getColor("text")
  44. height: contentHeight + UM.Theme.getSize("default_margin").height
  45. }
  46. Repeater
  47. {
  48. model: toolbox.subscribedPackagesModel
  49. Component
  50. {
  51. Item
  52. {
  53. width: parent.width
  54. property int lineHeight: 60
  55. visible: model.is_compatible === "True" ? true : false
  56. height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the compatible packages here
  57. Image
  58. {
  59. id: packageIcon
  60. source: model.icon_url || "../../images/logobot.svg"
  61. height: lineHeight
  62. width: height
  63. mipmap: true
  64. fillMode: Image.PreserveAspectFit
  65. }
  66. Label
  67. {
  68. text: model.name
  69. font: UM.Theme.getFont("medium_bold")
  70. anchors.left: packageIcon.right
  71. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  72. anchors.verticalCenter: packageIcon.verticalCenter
  73. color: UM.Theme.getColor("text")
  74. elide: Text.ElideRight
  75. }
  76. }
  77. }
  78. }
  79. // Incompatible packages
  80. Label
  81. {
  82. font: UM.Theme.getFont("default")
  83. text: catalog.i18nc("@label", "The following packages can not be installed because of incompatible Cura version:")
  84. visible: toolbox.has_incompatible_packages
  85. color: UM.Theme.getColor("text")
  86. height: contentHeight + UM.Theme.getSize("default_margin").height
  87. }
  88. Repeater
  89. {
  90. model: toolbox.subscribedPackagesModel
  91. Component
  92. {
  93. Item
  94. {
  95. width: parent.width
  96. property int lineHeight: 60
  97. visible: model.is_compatible === "True" ? false : true
  98. height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
  99. Image
  100. {
  101. id: packageIcon
  102. source: model.icon_url || "../../images/logobot.svg"
  103. height: lineHeight
  104. width: height
  105. mipmap: true
  106. fillMode: Image.PreserveAspectFit
  107. }
  108. Label
  109. {
  110. text: model.name
  111. font: UM.Theme.getFont("medium_bold")
  112. anchors.left: packageIcon.right
  113. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  114. anchors.verticalCenter: packageIcon.verticalCenter
  115. color: UM.Theme.getColor("text")
  116. elide: Text.ElideRight
  117. }
  118. }
  119. }
  120. }
  121. }
  122. } // End of ScrollView
  123. Cura.ActionButton
  124. {
  125. id: nextButton
  126. anchors.bottom: parent.bottom
  127. anchors.right: parent.right
  128. anchors.margins: UM.Theme.getSize("default_margin").height
  129. text: catalog.i18nc("@button", "Next")
  130. }
  131. }
  132. }