UserOperations.qml 4.0 KB

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