UserOperations.qml 3.7 KB

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