ToolboxDetailPage.qml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox 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. Item
  9. {
  10. id: base
  11. property var details: toolbox.packagesModel.items[0]
  12. anchors.fill: parent
  13. ToolboxBackColumn
  14. {
  15. id: sidebar
  16. }
  17. Rectangle
  18. {
  19. id: header
  20. anchors
  21. {
  22. left: sidebar.right
  23. right: parent.right
  24. rightMargin: UM.Theme.getSize("double_margin").width
  25. }
  26. height: UM.Theme.getSize("base_unit").height * 12
  27. Image
  28. {
  29. id: thumbnail
  30. width: UM.Theme.getSize("toolbox_thumbnail_medium").width
  31. height: UM.Theme.getSize("toolbox_thumbnail_medium").height
  32. fillMode: Image.PreserveAspectFit
  33. source: details.icon_url || "../images/logobot.svg"
  34. anchors
  35. {
  36. top: parent.top
  37. left: parent.left
  38. leftMargin: UM.Theme.getSize("double_margin").width
  39. topMargin: UM.Theme.getSize("double_margin").height
  40. }
  41. }
  42. Label
  43. {
  44. id: title
  45. anchors
  46. {
  47. top: thumbnail.top
  48. left: thumbnail.right
  49. leftMargin: UM.Theme.getSize("default_margin").width
  50. right: parent.right
  51. rightMargin: UM.Theme.getSize("double_margin").width
  52. bottomMargin: UM.Theme.getSize("default_margin").height
  53. }
  54. text: details.name
  55. font: UM.Theme.getFont("large")
  56. wrapMode: Text.WordWrap
  57. width: parent.width
  58. height: UM.Theme.getSize("base_unit") * 2
  59. }
  60. Column
  61. {
  62. id: properties
  63. anchors
  64. {
  65. top: title.bottom
  66. left: title.left
  67. topMargin: UM.Theme.getSize("default_margin").height
  68. }
  69. spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2)
  70. width: childrenRect.width
  71. Label
  72. {
  73. text: catalog.i18nc("@label", "Version") + ":"
  74. font: UM.Theme.getFont("very_small")
  75. color: UM.Theme.getColor("text_medium")
  76. }
  77. Label
  78. {
  79. text: catalog.i18nc("@label", "Last updated") + ":"
  80. font: UM.Theme.getFont("very_small")
  81. color: UM.Theme.getColor("text_medium")
  82. }
  83. Label
  84. {
  85. text: catalog.i18nc("@label", "Author") + ":"
  86. font: UM.Theme.getFont("very_small")
  87. color: UM.Theme.getColor("text_medium")
  88. }
  89. }
  90. Column
  91. {
  92. id: values
  93. anchors
  94. {
  95. top: title.bottom
  96. left: properties.right
  97. leftMargin: UM.Theme.getSize("default_margin").width
  98. topMargin: UM.Theme.getSize("default_margin").height
  99. }
  100. spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
  101. width: UM.Theme.getSize("base_unit").width * 12
  102. Label
  103. {
  104. text: details.version
  105. font: UM.Theme.getFont("very_small")
  106. color: UM.Theme.getColor("text")
  107. }
  108. Label
  109. {
  110. text: Qt.formatDateTime(details.last_updated, "dd MMM yyyy")
  111. font: UM.Theme.getFont("very_small")
  112. color: UM.Theme.getColor("text")
  113. }
  114. Label
  115. {
  116. text:
  117. {
  118. if (details.author_email)
  119. {
  120. return "<a href=\"mailto:"+details.author_email+"?Subject=Cura: "+details.name+"\">"+details.author_name+"</a>"
  121. }
  122. else
  123. {
  124. return "<a href=\""+details.website+"\">"+details.author_name+"</a>"
  125. }
  126. }
  127. font: UM.Theme.getFont("very_small")
  128. color: UM.Theme.getColor("text")
  129. onLinkActivated: Qt.openUrlExternally(link)
  130. }
  131. }
  132. Rectangle
  133. {
  134. color: UM.Theme.getColor("lining")
  135. width: parent.width
  136. height: UM.Theme.getSize("default_lining").height
  137. anchors.bottom: parent.bottom
  138. }
  139. }
  140. ToolboxDetailList
  141. {
  142. anchors
  143. {
  144. top: header.bottom
  145. bottom: base.bottom
  146. left: header.left
  147. right: base.right
  148. }
  149. }
  150. }