ToolboxDetailPage.qml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.3
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.1 as UM
  7. Item
  8. {
  9. id: page
  10. property var details: base.selection
  11. anchors.fill: parent
  12. width: parent.width
  13. ToolboxBackColumn
  14. {
  15. id: sidebar
  16. }
  17. Item
  18. {
  19. id: header
  20. anchors
  21. {
  22. left: sidebar.right
  23. right: parent.right
  24. rightMargin: UM.Theme.getSize("wide_margin").width
  25. }
  26. height: UM.Theme.getSize("toolbox_detail_header").height
  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. mipmap: true
  35. anchors
  36. {
  37. top: parent.top
  38. left: parent.left
  39. leftMargin: UM.Theme.getSize("wide_margin").width
  40. topMargin: UM.Theme.getSize("wide_margin").height
  41. }
  42. }
  43. Label
  44. {
  45. id: title
  46. anchors
  47. {
  48. top: thumbnail.top
  49. left: thumbnail.right
  50. leftMargin: UM.Theme.getSize("default_margin").width
  51. right: parent.right
  52. rightMargin: UM.Theme.getSize("wide_margin").width
  53. bottomMargin: UM.Theme.getSize("default_margin").height
  54. }
  55. text: details.name || ""
  56. font: UM.Theme.getFont("large")
  57. color: UM.Theme.getColor("text")
  58. wrapMode: Text.WordWrap
  59. width: parent.width
  60. height: UM.Theme.getSize("toolbox_property_label").height
  61. }
  62. Column
  63. {
  64. id: properties
  65. anchors
  66. {
  67. top: title.bottom
  68. left: title.left
  69. topMargin: UM.Theme.getSize("default_margin").height
  70. }
  71. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  72. width: childrenRect.width
  73. Label
  74. {
  75. text: catalog.i18nc("@label", "Version") + ":"
  76. font: UM.Theme.getFont("very_small")
  77. color: UM.Theme.getColor("text_medium")
  78. }
  79. Label
  80. {
  81. text: catalog.i18nc("@label", "Last updated") + ":"
  82. font: UM.Theme.getFont("very_small")
  83. color: UM.Theme.getColor("text_medium")
  84. }
  85. Label
  86. {
  87. text: catalog.i18nc("@label", "Author") + ":"
  88. font: UM.Theme.getFont("very_small")
  89. color: UM.Theme.getColor("text_medium")
  90. }
  91. }
  92. Column
  93. {
  94. id: values
  95. anchors
  96. {
  97. top: title.bottom
  98. left: properties.right
  99. leftMargin: UM.Theme.getSize("default_margin").width
  100. topMargin: UM.Theme.getSize("default_margin").height
  101. }
  102. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  103. Label
  104. {
  105. text: details.version || catalog.i18nc("@label", "Unknown")
  106. font: UM.Theme.getFont("very_small")
  107. color: UM.Theme.getColor("text")
  108. }
  109. Label
  110. {
  111. text:
  112. {
  113. var date = new Date(details.last_updated)
  114. return date.toLocaleString(UM.Preferences.getValue("general/language"))
  115. }
  116. font: UM.Theme.getFont("very_small")
  117. color: UM.Theme.getColor("text")
  118. }
  119. Label
  120. {
  121. text:
  122. {
  123. if (details.author_email)
  124. {
  125. return "<a href=\"mailto:" + details.author_email+"?Subject=Cura: " + details.name + "\">" + details.author_name + "</a>"
  126. }
  127. else
  128. {
  129. return "<a href=\"" + details.website + "\">" + details.author_name + "</a>"
  130. }
  131. }
  132. font: UM.Theme.getFont("very_small")
  133. color: UM.Theme.getColor("text")
  134. linkColor: UM.Theme.getColor("text_link")
  135. onLinkActivated: Qt.openUrlExternally(link)
  136. }
  137. }
  138. Rectangle
  139. {
  140. color: UM.Theme.getColor("lining")
  141. width: parent.width
  142. height: UM.Theme.getSize("default_lining").height
  143. anchors.bottom: parent.bottom
  144. }
  145. }
  146. ToolboxDetailList
  147. {
  148. anchors
  149. {
  150. top: header.bottom
  151. bottom: page.bottom
  152. left: header.left
  153. right: page.right
  154. }
  155. }
  156. }