ToolboxAuthorPage.qml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.5 as UM
  7. import "../components"
  8. Item
  9. {
  10. id: page
  11. property var details: base.selection || {}
  12. anchors.fill: parent
  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 && details.icon_url ? details.icon_url : "../../images/placeholder.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 && details.name ? details.name : ""
  56. font: UM.Theme.getFont("large_bold")
  57. color: UM.Theme.getColor("text_medium")
  58. wrapMode: Text.WordWrap
  59. width: parent.width
  60. height: UM.Theme.getSize("toolbox_property_label").height
  61. renderType: Text.NativeRendering
  62. }
  63. Label
  64. {
  65. id: description
  66. text: details && details.description ? details.description : ""
  67. font: UM.Theme.getFont("default")
  68. color: UM.Theme.getColor("text_medium")
  69. anchors
  70. {
  71. top: title.bottom
  72. left: title.left
  73. topMargin: UM.Theme.getSize("default_margin").height
  74. }
  75. renderType: Text.NativeRendering
  76. }
  77. Column
  78. {
  79. id: properties
  80. anchors
  81. {
  82. top: description.bottom
  83. left: description.left
  84. topMargin: UM.Theme.getSize("default_margin").height
  85. }
  86. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  87. width: childrenRect.width
  88. Label
  89. {
  90. text: catalog.i18nc("@label", "Website") + ":"
  91. font: UM.Theme.getFont("default")
  92. color: UM.Theme.getColor("text_medium")
  93. renderType: Text.NativeRendering
  94. }
  95. Label
  96. {
  97. text: catalog.i18nc("@label", "Email") + ":"
  98. font: UM.Theme.getFont("default")
  99. color: UM.Theme.getColor("text_medium")
  100. renderType: Text.NativeRendering
  101. }
  102. }
  103. Column
  104. {
  105. id: values
  106. anchors
  107. {
  108. top: description.bottom
  109. left: properties.right
  110. leftMargin: UM.Theme.getSize("default_margin").width
  111. right: parent.right
  112. rightMargin: UM.Theme.getSize("default_margin").width
  113. topMargin: UM.Theme.getSize("default_margin").height
  114. }
  115. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  116. Label
  117. {
  118. text:
  119. {
  120. if (details && details.website)
  121. {
  122. return "<a href=\"" + details.website + "\">" + details.website + "</a>"
  123. }
  124. return ""
  125. }
  126. width: parent.width
  127. elide: Text.ElideRight
  128. font: UM.Theme.getFont("default")
  129. color: UM.Theme.getColor("text")
  130. linkColor: UM.Theme.getColor("text_link")
  131. onLinkActivated: UM.UrlUtil.openUrl(link, ["https", "http"])
  132. renderType: Text.NativeRendering
  133. }
  134. Label
  135. {
  136. text:
  137. {
  138. if (details && details.email)
  139. {
  140. return "<a href=\"mailto:" + details.email + "\">" + details.email + "</a>"
  141. }
  142. return ""
  143. }
  144. font: UM.Theme.getFont("default")
  145. color: UM.Theme.getColor("text")
  146. linkColor: UM.Theme.getColor("text_link")
  147. onLinkActivated: Qt.openUrlExternally(link)
  148. renderType: Text.NativeRendering
  149. }
  150. }
  151. Rectangle
  152. {
  153. color: UM.Theme.getColor("lining")
  154. width: parent.width
  155. height: UM.Theme.getSize("default_lining").height
  156. anchors.bottom: parent.bottom
  157. }
  158. }
  159. ToolboxDetailList
  160. {
  161. anchors
  162. {
  163. top: header.bottom
  164. bottom: page.bottom
  165. left: header.left
  166. right: page.right
  167. }
  168. }
  169. }