ToolboxAuthorPage.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 || dummy_details
  11. anchors.fill: parent
  12. property var dummy_details: new Object({
  13. name: "",
  14. description: "",
  15. email: "",
  16. website: "",
  17. icon_url: ""
  18. })
  19. ToolboxBackColumn
  20. {
  21. id: sidebar
  22. }
  23. Rectangle
  24. {
  25. id: header
  26. anchors
  27. {
  28. left: sidebar.right
  29. right: parent.right
  30. rightMargin: UM.Theme.getSize("wide_margin").width
  31. }
  32. height: UM.Theme.getSize("toolbox_detail_header").height
  33. Image
  34. {
  35. id: thumbnail
  36. width: UM.Theme.getSize("toolbox_thumbnail_medium").width
  37. height: UM.Theme.getSize("toolbox_thumbnail_medium").height
  38. fillMode: Image.PreserveAspectFit
  39. source: details.icon_url || "../images/logobot.svg"
  40. mipmap: true
  41. anchors
  42. {
  43. top: parent.top
  44. left: parent.left
  45. leftMargin: UM.Theme.getSize("wide_margin").width
  46. topMargin: UM.Theme.getSize("wide_margin").height
  47. }
  48. }
  49. Label
  50. {
  51. id: title
  52. anchors
  53. {
  54. top: thumbnail.top
  55. left: thumbnail.right
  56. leftMargin: UM.Theme.getSize("default_margin").width
  57. right: parent.right
  58. rightMargin: UM.Theme.getSize("wide_margin").width
  59. bottomMargin: UM.Theme.getSize("default_margin").height
  60. }
  61. text: details.name || ""
  62. font: UM.Theme.getFont("large")
  63. wrapMode: Text.WordWrap
  64. width: parent.width
  65. height: UM.Theme.getSize("toolbox_property_label").height
  66. }
  67. Label
  68. {
  69. id: description
  70. text: details.description || ""
  71. anchors
  72. {
  73. top: title.bottom
  74. left: title.left
  75. topMargin: UM.Theme.getSize("default_margin").height
  76. }
  77. }
  78. Column
  79. {
  80. id: properties
  81. anchors
  82. {
  83. top: description.bottom
  84. left: description.left
  85. topMargin: UM.Theme.getSize("default_margin").height
  86. }
  87. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  88. width: childrenRect.width
  89. Label
  90. {
  91. text: catalog.i18nc("@label", "Contact") + ":"
  92. font: UM.Theme.getFont("very_small")
  93. color: UM.Theme.getColor("text_medium")
  94. }
  95. }
  96. Column
  97. {
  98. id: values
  99. anchors
  100. {
  101. top: description.bottom
  102. left: properties.right
  103. leftMargin: UM.Theme.getSize("default_margin").width
  104. topMargin: UM.Theme.getSize("default_margin").height
  105. }
  106. spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
  107. Label
  108. {
  109. text:
  110. {
  111. if (details.email)
  112. {
  113. return "<a href=\"mailto:"+details.email+"\">"+details.name+"</a>"
  114. }
  115. else
  116. {
  117. return "<a href=\""+details.website+"\">"+details.name+"</a>"
  118. }
  119. }
  120. font: UM.Theme.getFont("very_small")
  121. color: UM.Theme.getColor("text")
  122. linkColor: UM.Theme.getColor("text_link")
  123. onLinkActivated: Qt.openUrlExternally(link)
  124. }
  125. }
  126. Rectangle
  127. {
  128. color: UM.Theme.getColor("lining")
  129. width: parent.width
  130. height: UM.Theme.getSize("default_lining").height
  131. anchors.bottom: parent.bottom
  132. }
  133. }
  134. ToolboxDetailList
  135. {
  136. anchors
  137. {
  138. top: header.bottom
  139. bottom: page.bottom
  140. left: header.left
  141. right: page.right
  142. }
  143. }
  144. }