ToolboxDetailsTile.qml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // PluginBrowser is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Dialogs 1.1
  5. import QtQuick.Controls 1.4
  6. import QtQuick.Controls.Styles 1.4
  7. import UM 1.1 as UM
  8. Rectangle
  9. {
  10. width: parent.width
  11. height: childrenRect.height
  12. color: "transparent"
  13. Column
  14. {
  15. anchors
  16. {
  17. left: parent.left
  18. right: controls.left
  19. rightMargin: UM.Theme.getSize("default_margin").width
  20. top: parent.top
  21. leftMargin: UM.Theme.getSize("default_margin").width
  22. topMargin: UM.Theme.getSize("default_margin").height
  23. }
  24. Label
  25. {
  26. width: parent.width
  27. height: UM.Theme.getSize("base_unit").height * 2
  28. text: "DSM Abrasive"
  29. wrapMode: Text.WordWrap
  30. color: UM.Theme.getColor("text")
  31. font: UM.Theme.getFont("default_bold")
  32. }
  33. Label
  34. {
  35. width: parent.width
  36. text: "DSM abrasive material provides extra stiffness. It’s suitable for printing \"Functional prototypes\" and \"End parts\"."
  37. wrapMode: Text.WordWrap
  38. color: UM.Theme.getColor("text")
  39. font: UM.Theme.getFont("normal")
  40. }
  41. }
  42. Rectangle
  43. {
  44. id: controls
  45. anchors.right: parent.right
  46. anchors.top: parent.top
  47. anchors.topMargin: UM.Theme.getSize("default_margin").height
  48. width: childrenRect.width
  49. Button {
  50. id: installButton
  51. text: catalog.i18nc("@action:button", "Install")
  52. enabled:
  53. {
  54. if ( manager.isDownloading )
  55. {
  56. return pluginList.activePlugin == model ? true : false
  57. }
  58. else
  59. {
  60. return true
  61. }
  62. }
  63. opacity: enabled ? 1.0 : 0.5
  64. style: ButtonStyle {
  65. background: Rectangle
  66. {
  67. implicitWidth: 96
  68. implicitHeight: 30
  69. color: UM.Theme.getColor("primary")
  70. }
  71. label: Label
  72. {
  73. text: control.text
  74. color: "white"
  75. verticalAlignment: Text.AlignVCenter
  76. horizontalAlignment: Text.AlignHCenter
  77. }
  78. }
  79. onClicked:
  80. {
  81. if ( manager.isDownloading && pluginList.activePlugin == model )
  82. {
  83. manager.cancelDownload();
  84. }
  85. else
  86. {
  87. pluginList.activePlugin = model;
  88. if ( model.can_upgrade )
  89. {
  90. manager.downloadAndInstallPlugin( model.update_url );
  91. }
  92. else {
  93. manager.downloadAndInstallPlugin( model.file_location );
  94. }
  95. }
  96. }
  97. }
  98. }
  99. Rectangle
  100. {
  101. color: UM.Theme.getColor("text_medium")
  102. width: parent.width
  103. height: UM.Theme.getSize("default_lining").height
  104. anchors.top: parent.top
  105. }
  106. }