UserOperations.qml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright (c) 2018 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. width: Math.max(
  10. Math.max(title.width, accountButton.width) + 2 * UM.Theme.getSize("default_margin").width,
  11. syncRow.width
  12. )
  13. spacing: UM.Theme.getSize("default_margin").height
  14. SystemPalette
  15. {
  16. id: palette
  17. }
  18. Label
  19. {
  20. id: title
  21. anchors.horizontalCenter: parent.horizontalCenter
  22. horizontalAlignment: Text.AlignHCenter
  23. renderType: Text.NativeRendering
  24. text: catalog.i18nc("@label The argument is a username.", "Hi %1").arg(profile.username)
  25. font: UM.Theme.getFont("large_bold")
  26. color: UM.Theme.getColor("text")
  27. }
  28. SyncState {
  29. id: syncRow
  30. }
  31. Label
  32. {
  33. id: lastSyncLabel
  34. anchors.horizontalCenter: parent.horizontalCenter
  35. horizontalAlignment: Text.AlignHCenter
  36. renderType: Text.NativeRendering
  37. text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime)
  38. font: UM.Theme.getFont("default")
  39. color: UM.Theme.getColor("text_medium")
  40. }
  41. Cura.SecondaryButton
  42. {
  43. id: accountButton
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. width: UM.Theme.getSize("account_button").width
  46. height: UM.Theme.getSize("account_button").height
  47. text: catalog.i18nc("@button", "Ultimaker account")
  48. onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
  49. fixedWidthMode: false
  50. }
  51. Label
  52. {
  53. id: signOutButton
  54. anchors.horizontalCenter: parent.horizontalCenter
  55. text: catalog.i18nc("@button", "Sign out")
  56. color: UM.Theme.getColor("secondary_button_text")
  57. font: UM.Theme.getFont("medium")
  58. renderType: Text.NativeRendering
  59. MouseArea
  60. {
  61. anchors.fill: parent
  62. onClicked: Cura.API.account.logout()
  63. hoverEnabled: true
  64. onEntered: signOutButton.font.underline = true
  65. onExited: signOutButton.font.underline = false
  66. }
  67. }
  68. }