UserOperations.qml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // Copyright (c) 2020 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import UM 1.4 as UM
  6. import Cura 1.1 as Cura
  7. Column
  8. {
  9. spacing: UM.Theme.getSize("narrow_margin").height
  10. topPadding: UM.Theme.getSize("default_margin").height
  11. bottomPadding: UM.Theme.getSize("default_margin").height
  12. width: childrenRect.width
  13. Item
  14. {
  15. id: accountInfo
  16. width: childrenRect.width
  17. height: childrenRect.height
  18. anchors.left: parent.left
  19. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  20. AvatarImage
  21. {
  22. id: avatar
  23. anchors.verticalCenter: parent.verticalCenter
  24. width: UM.Theme.getSize("main_window_header").height
  25. height: UM.Theme.getSize("main_window_header").height
  26. source: profile["profile_image_url"] ? profile["profile_image_url"] : ""
  27. outlineColor: UM.Theme.getColor("main_background")
  28. }
  29. Rectangle
  30. {
  31. id: initialCircle
  32. width: avatar.width
  33. height: avatar.height
  34. radius: width
  35. anchors.verticalCenter: parent.verticalCenter
  36. color: UM.Theme.getColor("action_button_disabled")
  37. visible: !avatar.hasAvatar
  38. Label
  39. {
  40. id: initialLabel
  41. anchors.centerIn: parent
  42. text: profile["username"].charAt(0).toUpperCase()
  43. font: UM.Theme.getFont("large_bold")
  44. color: UM.Theme.getColor("text")
  45. verticalAlignment: Text.AlignVCenter
  46. horizontalAlignment: Text.AlignHCenter
  47. renderType: Text.NativeRendering
  48. }
  49. }
  50. Column
  51. {
  52. anchors.left: avatar.right
  53. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  54. spacing: UM.Theme.getSize("narrow_margin").height
  55. width: childrenRect.width
  56. height: childrenRect.height
  57. Label
  58. {
  59. id: username
  60. renderType: Text.NativeRendering
  61. text: profile.username
  62. font: UM.Theme.getFont("large_bold")
  63. color: UM.Theme.getColor("text")
  64. }
  65. SyncState
  66. {
  67. id: syncRow
  68. }
  69. Label
  70. {
  71. id: lastSyncLabel
  72. renderType: Text.NativeRendering
  73. text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime)
  74. font: UM.Theme.getFont("default")
  75. color: UM.Theme.getColor("text_medium")
  76. }
  77. }
  78. }
  79. Rectangle
  80. {
  81. width: parent.width
  82. color: UM.Theme.getColor("lining")
  83. height: UM.Theme.getSize("default_lining").height
  84. }
  85. Cura.TertiaryButton
  86. {
  87. id: cloudButton
  88. width: UM.Theme.getSize("account_button").width
  89. height: UM.Theme.getSize("account_button").height
  90. text: "Ultimaker Digital Factory"
  91. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl)
  92. fixedWidthMode: false
  93. }
  94. Cura.TertiaryButton
  95. {
  96. id: accountButton
  97. width: UM.Theme.getSize("account_button").width
  98. height: UM.Theme.getSize("account_button").height
  99. text: catalog.i18nc("@button", "Ultimaker Account")
  100. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
  101. fixedWidthMode: false
  102. }
  103. Rectangle
  104. {
  105. width: parent.width
  106. color: UM.Theme.getColor("lining")
  107. height: UM.Theme.getSize("default_lining").height
  108. }
  109. Cura.TertiaryButton
  110. {
  111. id: signOutButton
  112. onClicked: Cura.API.account.logout()
  113. text: catalog.i18nc("@button", "Sign Out")
  114. }
  115. }