ToolboxInstalledTile.qml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.1 as UM
  7. Item
  8. {
  9. height: UM.Theme.getSize("toolbox_installed_tile").height
  10. width: parent.width
  11. property bool isEnabled: true
  12. Rectangle
  13. {
  14. color: UM.Theme.getColor("lining")
  15. width: parent.width
  16. height: Math.floor(UM.Theme.getSize("default_lining").height)
  17. anchors.bottom: parent.bottom
  18. }
  19. Row
  20. {
  21. id: tileRow
  22. height: parent.height
  23. width: parent.width
  24. spacing: UM.Theme.getSize("default_margin").width
  25. topPadding: UM.Theme.getSize("default_margin").height
  26. CheckBox
  27. {
  28. id: disableButton
  29. anchors.verticalCenter: pluginInfo.verticalCenter
  30. checked: isEnabled
  31. visible: model.type == "plugin"
  32. width: visible ? UM.Theme.getSize("checkbox").width : 0
  33. enabled: !toolbox.isDownloading
  34. style: UM.Theme.styles.checkbox
  35. onClicked: toolbox.isEnabled(model.id) ? toolbox.disable(model.id) : toolbox.enable(model.id)
  36. }
  37. Column
  38. {
  39. id: pluginInfo
  40. topPadding: UM.Theme.getSize("narrow_margin").height
  41. property var color: model.type === "plugin" && !isEnabled ? UM.Theme.getColor("lining") : UM.Theme.getColor("text")
  42. width: Math.floor(tileRow.width - (authorInfo.width + pluginActions.width + 2 * tileRow.spacing + ((disableButton.visible) ? disableButton.width + tileRow.spacing : 0)))
  43. Label
  44. {
  45. text: model.name
  46. width: parent.width
  47. wrapMode: Text.WordWrap
  48. font: UM.Theme.getFont("large_bold")
  49. color: pluginInfo.color
  50. renderType: Text.NativeRendering
  51. }
  52. Label
  53. {
  54. text: model.description
  55. font: UM.Theme.getFont("default")
  56. maximumLineCount: 3
  57. elide: Text.ElideRight
  58. width: parent.width
  59. wrapMode: Text.WordWrap
  60. color: pluginInfo.color
  61. renderType: Text.NativeRendering
  62. }
  63. }
  64. Column
  65. {
  66. id: authorInfo
  67. width: Math.floor(UM.Theme.getSize("toolbox_action_button").width * 1.25)
  68. Label
  69. {
  70. text:
  71. {
  72. if (model.author_email)
  73. {
  74. return "<a href=\"mailto:" + model.author_email + "?Subject=Cura: " + model.name + "\">" + model.author_name + "</a>"
  75. }
  76. else
  77. {
  78. return model.author_name
  79. }
  80. }
  81. font: UM.Theme.getFont("medium")
  82. width: parent.width
  83. height: Math.floor(UM.Theme.getSize("toolbox_property_label").height)
  84. wrapMode: Text.WordWrap
  85. verticalAlignment: Text.AlignVCenter
  86. horizontalAlignment: Text.AlignLeft
  87. onLinkActivated: Qt.openUrlExternally("mailto:" + model.author_email + "?Subject=Cura: " + model.name + " Plugin")
  88. color: model.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("lining")
  89. linkColor: UM.Theme.getColor("text_link")
  90. renderType: Text.NativeRendering
  91. }
  92. Label
  93. {
  94. text: model.version
  95. font: UM.Theme.getFont("default")
  96. width: parent.width
  97. height: UM.Theme.getSize("toolbox_property_label").height
  98. color: UM.Theme.getColor("text")
  99. verticalAlignment: Text.AlignVCenter
  100. horizontalAlignment: Text.AlignLeft
  101. renderType: Text.NativeRendering
  102. }
  103. }
  104. ToolboxInstalledTileActions
  105. {
  106. id: pluginActions
  107. }
  108. Connections
  109. {
  110. target: toolbox
  111. onEnabledChanged: isEnabled = toolbox.isEnabled(model.id)
  112. }
  113. }
  114. }