AccountDetails.qml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.1
  5. import UM 1.4 as UM
  6. import Cura 1.1 as Cura
  7. Column
  8. {
  9. property var profile: null
  10. property var loggedIn: false
  11. padding: 2 * UM.Theme.getSize("default_margin").height
  12. spacing: 2 * UM.Theme.getSize("default_margin").height
  13. AvatarImage
  14. {
  15. id: avatar
  16. width: UM.Theme.getSize("avatar_image").width
  17. height: UM.Theme.getSize("avatar_image").height
  18. anchors.horizontalCenter: parent.horizontalCenter
  19. source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user")
  20. outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
  21. }
  22. Label
  23. {
  24. id: information
  25. anchors.horizontalCenter: parent.horizontalCenter
  26. horizontalAlignment: Text.AlignHCenter
  27. renderType: Text.NativeRendering
  28. text: loggedIn ? profile["username"] : catalog.i18nc("@label", "Please log in or create an account to\nenjoy all features of Ultimaker Cura.")
  29. font: loggedIn ? UM.Theme.getFont("large") : UM.Theme.getFont("default")
  30. color: UM.Theme.getColor("text")
  31. }
  32. Loader
  33. {
  34. id: accountOperations
  35. anchors.horizontalCenter: parent.horizontalCenter
  36. sourceComponent: loggedIn ? userOperations : generalOperations
  37. }
  38. Component
  39. {
  40. id: userOperations
  41. UserOperations { }
  42. }
  43. Component
  44. {
  45. id: generalOperations
  46. GeneralOperations { }
  47. }
  48. }