UserOperations.qml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // Copyright (c) 2022 UltiMaker
  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.5 as UM
  6. import Cura 1.1 as Cura
  7. Column
  8. {
  9. spacing: UM.Theme.getSize("default_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: accountSyncDetailsColumn.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. maskColor: UM.Theme.getColor("main_background")
  28. outlineColor: UM.Theme.getColor("main_background")
  29. }
  30. Rectangle
  31. {
  32. id: initialCircle
  33. width: avatar.width
  34. height: avatar.height
  35. radius: width
  36. anchors.verticalCenter: parent.verticalCenter
  37. color: UM.Theme.getColor("action_button_disabled")
  38. visible: !avatar.hasAvatar
  39. UM.Label
  40. {
  41. id: initialLabel
  42. anchors.centerIn: parent
  43. text: profile.username.charAt(0).toUpperCase()
  44. font: UM.Theme.getFont("large_bold")
  45. horizontalAlignment: Text.AlignHCenter
  46. }
  47. }
  48. Column
  49. {
  50. id: accountSyncDetailsColumn
  51. anchors.left: avatar.right
  52. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  53. spacing: UM.Theme.getSize("narrow_margin").height
  54. width: childrenRect.width
  55. height: childrenRect.height
  56. UM.Label
  57. {
  58. id: username
  59. text: profile.username
  60. font: UM.Theme.getFont("large_bold")
  61. }
  62. SyncState
  63. {
  64. id: syncRow
  65. }
  66. UM.Label
  67. {
  68. id: lastSyncLabel
  69. text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime)
  70. color: UM.Theme.getColor("text_medium")
  71. }
  72. }
  73. }
  74. Rectangle
  75. {
  76. width: parent.width
  77. color: UM.Theme.getColor("lining")
  78. height: UM.Theme.getSize("default_lining").height
  79. }
  80. Cura.TertiaryButton
  81. {
  82. id: cloudButton
  83. width: parent.width
  84. height: UM.Theme.getSize("account_button").height
  85. text: "Ultimaker Digital Factory"
  86. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-DF")
  87. fixedWidthMode: false
  88. }
  89. Cura.TertiaryButton
  90. {
  91. id: accountButton
  92. width: parent.width
  93. height: UM.Theme.getSize("account_button").height
  94. text: catalog.i18nc("@button", "UltiMaker Account")
  95. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "?utm_source=cura&utm_medium=software&utm_campaign=menu-visit-account")
  96. fixedWidthMode: false
  97. }
  98. Rectangle
  99. {
  100. width: parent.width
  101. color: UM.Theme.getColor("lining")
  102. height: UM.Theme.getSize("default_lining").height
  103. }
  104. Cura.TertiaryButton
  105. {
  106. id: signOutButton
  107. width: parent.width
  108. height: UM.Theme.getSize("account_button").height
  109. onClicked: Cura.API.account.logout()
  110. text: catalog.i18nc("@button", "Sign Out")
  111. fixedWidthMode: false
  112. }
  113. }