diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 75b1d67697..3af6ebeaf8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -261,6 +261,10 @@ class CuraApplication(QtApplication): def ultimakerCloudAccountRootUrl(self) -> str: return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot + @pyqtProperty(str, constant=True) + def ultimakerDigitalFactoryUrl(self) -> str: + return UltimakerCloudAuthentication.CuraDigitalFactoryURL + def addCommandLineOptions(self): """Adds command line options to the command line parser. diff --git a/cura/UltimakerCloud/UltimakerCloudAuthentication.py b/cura/UltimakerCloud/UltimakerCloudAuthentication.py index c8346e5c4e..707b814d34 100644 --- a/cura/UltimakerCloud/UltimakerCloudAuthentication.py +++ b/cura/UltimakerCloud/UltimakerCloudAuthentication.py @@ -7,6 +7,7 @@ DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" # type: str DEFAULT_CLOUD_API_VERSION = "1" # type: str DEFAULT_CLOUD_ACCOUNT_API_ROOT = "https://account.ultimaker.com" # type: str +DEFAULT_DIGITAL_FACTORY_URL = "https://digitalfactory.ultimaker.com" # type: str try: from cura.CuraVersion import CuraCloudAPIRoot # type: ignore @@ -28,3 +29,10 @@ try: CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT except ImportError: CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT + +try: + from cura.CuraVersion import CuraDigitalFactoryURL + if CuraDigitalFactoryURL == "": + CuraDigitalFactoryURL = DEFAULT_DIGITAL_FACTORY_URL +except ImportError: + CuraDigitalFactoryURL = DEFAULT_DIGITAL_FACTORY_URL \ No newline at end of file diff --git a/resources/qml/Account/SyncState.qml b/resources/qml/Account/SyncState.qml index 729a38c3c5..a362c93e21 100644 --- a/resources/qml/Account/SyncState.qml +++ b/resources/qml/Account/SyncState.qml @@ -91,6 +91,8 @@ Row // Sync state icon + message color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + height: contentHeight + verticalAlignment: Text.AlignVCenter visible: !Cura.API.account.manualSyncEnabled } @@ -101,6 +103,8 @@ Row // Sync state icon + message color: UM.Theme.getColor("secondary_button_text") font: UM.Theme.getFont("medium") renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + height: contentHeight visible: Cura.API.account.manualSyncEnabled MouseArea diff --git a/resources/qml/Account/UserOperations.qml b/resources/qml/Account/UserOperations.qml index 63215a0540..e660286257 100644 --- a/resources/qml/Account/UserOperations.qml +++ b/resources/qml/Account/UserOperations.qml @@ -9,62 +9,88 @@ import Cura 1.1 as Cura Column { - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("narrow_margin").height - Label + Item { - id: title - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - renderType: Text.NativeRendering - text: catalog.i18nc("@label The argument is a username.", "Hi %1").arg(profile.username) - font: UM.Theme.getFont("large_bold") - color: UM.Theme.getColor("text") + width: childrenRect.width + height: childrenRect.height + AvatarImage + { + id: avatar + + width: UM.Theme.getSize("main_window_header").height + height: UM.Theme.getSize("main_window_header").height + + source: profile["profile_image_url"] ? profile["profile_image_url"] : "" + outlineColor: "transparent" + } + Column + { + anchors.left: avatar.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + spacing: UM.Theme.getSize("narrow_margin").height + Label + { + id: username + renderType: Text.NativeRendering + text: profile.username + font: UM.Theme.getFont("large_bold") + color: UM.Theme.getColor("text") + } + + SyncState + { + id: syncRow + } + Label + { + id: lastSyncLabel + renderType: Text.NativeRendering + text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime) + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_medium") + } + } } - SyncState + Rectangle { - id: syncRow + width: parent.width + color: UM.Theme.getColor("lining") + height: UM.Theme.getSize("default_lining").height } - - Label + Cura.TertiaryButton { - id: lastSyncLabel - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - renderType: Text.NativeRendering - text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime) - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text_medium") - } - - Cura.SecondaryButton - { - id: accountButton - anchors.horizontalCenter: parent.horizontalCenter + id: cloudButton width: UM.Theme.getSize("account_button").width height: UM.Theme.getSize("account_button").height - text: catalog.i18nc("@button", "Ultimaker account") + text: catalog.i18nc("@button", "Ultimaker Digital Factory") + onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl) + fixedWidthMode: false + } + + Cura.TertiaryButton + { + id: accountButton + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + text: catalog.i18nc("@button", "Ultimaker Account") onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl) fixedWidthMode: false } - Label + Rectangle + { + width: parent.width + color: UM.Theme.getColor("lining") + height: UM.Theme.getSize("default_lining").height + } + + Cura.TertiaryButton { id: signOutButton - anchors.horizontalCenter: parent.horizontalCenter - text: catalog.i18nc("@button", "Sign out") - color: UM.Theme.getColor("secondary_button_text") - font: UM.Theme.getFont("medium") - renderType: Text.NativeRendering - - MouseArea - { - anchors.fill: parent - onClicked: Cura.API.account.logout() - hoverEnabled: true - onEntered: signOutButton.font.underline = true - onExited: signOutButton.font.underline = false - } + onClicked: Cura.API.account.logout() + text: catalog.i18nc("@button", "Sign Out") } }