AccountDetails.qml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: 75 * screenScaleFactor
  17. height: 75 * screenScaleFactor
  18. anchors.horizontalCenter: parent.horizontalCenter
  19. source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_default")
  20. outlineColor: loggedIn ? UM.Theme.getColor("account_widget_ouline_active") : UM.Theme.getColor("account_widget_ouline_inactive")
  21. }
  22. Label
  23. {
  24. id: message
  25. anchors.horizontalCenter: parent.horizontalCenter
  26. visible: !loggedIn
  27. text: catalog.i18nc("@label", "Please login or create an account to 
enjoy all features of Ultimaker Cura")
  28. }
  29. Column
  30. {
  31. id: userInformation
  32. anchors.horizontalCenter: parent.horizontalCenter
  33. visible: loggedIn
  34. Label
  35. {
  36. anchors.horizontalCenter: parent.horizontalCenter
  37. text: loggedIn ? profile["username"] : ""
  38. font: UM.Theme.getFont("large")
  39. }
  40. Label
  41. {
  42. anchors.horizontalCenter: parent.horizontalCenter
  43. text: "email.address@hardcoded.is"
  44. font: UM.Theme.getFont("default")
  45. }
  46. }
  47. Loader
  48. {
  49. id: accountEntryPoints
  50. anchors.horizontalCenter: parent.horizontalCenter
  51. sourceComponent: loggedIn ? userOperations : generalOperations
  52. }
  53. Component
  54. {
  55. id: userOperations
  56. UserOperations { }
  57. }
  58. Component
  59. {
  60. id: generalOperations
  61. GeneralOperations { }
  62. }
  63. }