diff --git a/app/images/NoWorkspace.svg b/app/images/NoWorkspace.svg new file mode 100644 index 000000000..665104d2a --- /dev/null +++ b/app/images/NoWorkspace.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/app/images/images.qrc b/app/images/images.qrc index 8d6e33a8d..390209962 100644 --- a/app/images/images.qrc +++ b/app/images/images.qrc @@ -37,5 +37,6 @@ SyncFailed.svg NoPermissions.svg SignIn.svg + NoWorkspace.svg diff --git a/app/mmstyle.h b/app/mmstyle.h index 182a758e1..a31696ae4 100644 --- a/app/mmstyle.h +++ b/app/mmstyle.h @@ -216,6 +216,8 @@ class MMStyle: public QObject Q_PROPERTY( QUrl crosshairCircleImage READ crosshairCircleImage CONSTANT ) Q_PROPERTY( QUrl crosshairForegroundImage READ crosshairForegroundImage CONSTANT ) Q_PROPERTY( QUrl crosshairPlusImage READ crosshairPlusImage CONSTANT ) + Q_PROPERTY( QUrl noWorkspaceImage READ noWorkspaceImage CONSTANT ) + /* * Pixel sizes used across the app @@ -448,6 +450,7 @@ class MMStyle: public QObject QUrl crosshairCircleImage() {return QUrl( "qrc:/images/CrosshairCircle.svg" );} QUrl crosshairForegroundImage() {return QUrl( "qrc:/images/CrosshairForeground.svg" );} QUrl crosshairPlusImage() {return QUrl( "qrc:/images/CrosshairPlus.svg" );} + QUrl noWorkspaceImage() {return QUrl( "qrc:/images/NoWorkspace.svg" );} static QUrl lineLayerImage() {return QUrl( "qrc:/images/mIconLineLayer.svg" );} static QUrl pointLayerImage() {return QUrl( "qrc:/images/mIconPointLayer.svg" );} diff --git a/app/qml/CMakeLists.txt b/app/qml/CMakeLists.txt index 0fdfab574..3fe9465ac 100644 --- a/app/qml/CMakeLists.txt +++ b/app/qml/CMakeLists.txt @@ -5,7 +5,6 @@ set(MM_QML InputStyle.qml Notification.qml NotificationBanner.qml - misc/NoWorkspaceBanner.qml account/MMAcountPage.qml account/MMAcountPageItem.qml account/MMSwitchWorkspacePage.qml diff --git a/app/qml/components/MMWarningBubble.qml b/app/qml/components/MMWarningBubble.qml index b4cda7e4e..7726e2f9a 100644 --- a/app/qml/components/MMWarningBubble.qml +++ b/app/qml/components/MMWarningBubble.qml @@ -18,6 +18,7 @@ Item { required property string title property string description + property alias imageSource: icon.source signal clicked diff --git a/app/qml/gps/MMBluetoothConnectionDrawer.qml b/app/qml/gps/MMBluetoothConnectionDrawer.qml index 7dbdb92f7..956b9f6fa 100644 --- a/app/qml/gps/MMBluetoothConnectionDrawer.qml +++ b/app/qml/gps/MMBluetoothConnectionDrawer.qml @@ -250,7 +250,6 @@ Drawer { MMBusyIndicator { id: loadingSpinner - size: parent.height / 2 anchors.centerIn: parent running: rootstate.state === "working" } diff --git a/app/qml/layers/MMFeaturesListPage.qml b/app/qml/layers/MMFeaturesListPage.qml index 1d9fa67ba..74c5f3c14 100644 --- a/app/qml/layers/MMFeaturesListPage.qml +++ b/app/qml/layers/MMFeaturesListPage.qml @@ -133,7 +133,6 @@ Page { MMBusyIndicator { id: busyIndicator - size: parent.width/8 running: featuresModel.fetchingResults anchors.centerIn: parent } diff --git a/app/qml/main.qml b/app/qml/main.qml index 18b342d37..7feadd133 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -22,7 +22,6 @@ import "./map" import "./dialogs" import "./layers" import "./components" -import "./misc" import "./project" import "./settings" import "./gps" diff --git a/app/qml/misc/NoWorkspaceBanner.qml b/app/qml/misc/NoWorkspaceBanner.qml deleted file mode 100644 index 185c60970..000000000 --- a/app/qml/misc/NoWorkspaceBanner.qml +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -import QtQuick -import ".." -import "../components" - -Rectangle { - id: root - - signal createWorkspaceRequested - - color: '#ff4f4f' - height: InputStyle.rowHeight - - TextWithIcon { - width: parent.width - height: InputStyle.rowHeight - fontColor: 'white' - bgColor: '#ff4f4f' - iconColor: 'white' - linkColor: 'white' - source: InputStyle.exclamationTriangleIcon - text: qsTr("%1Workspace is required to use Mergin Maps. Click here to create one%2.") - .arg("") - .arg("") - } - - MouseArea { - anchors.fill: parent - onClicked: root.createWorkspaceRequested() - } -} diff --git a/app/qml/project/MMProjectHomePage.qml b/app/qml/project/MMProjectHomePage.qml index 7b280723e..ace7b2466 100644 --- a/app/qml/project/MMProjectHomePage.qml +++ b/app/qml/project/MMProjectHomePage.qml @@ -12,7 +12,6 @@ import QtQuick import mm 1.0 as MM import "../components" -import "../misc" import "../inputs" Item { @@ -20,9 +19,11 @@ Item { property string activeProjectId: "" property alias list: projectlist + property alias noWorkspaceBannerVisible: noWorkspaceBanner.visible signal openProjectRequested( string projectFilePath ) signal showLocalChangesRequested( string projectId ) + signal createWorkspaceRequested() function refreshProjectsList() { searchBar.deactivate() @@ -50,8 +51,9 @@ Item { } MMWarningBubble { - id: warningBubble - visible: __merginApi.subscriptionInfo ? __merginApi.subscriptionInfo.actionRequired : false + id: attentionRequiredBanner + + visible: !noWorkspaceBanner.visible && (__merginApi.subscriptionInfo ? __merginApi.subscriptionInfo.actionRequired : false) width: root.width - 2 * root.hPadding anchors { top: searchBar.bottom @@ -59,11 +61,28 @@ Item { right: parent.right topMargin: root.spacing } - title: qsTr("Your attention is required.") + title: qsTr("Your attention is required") description: qsTr("Click here to visit Mergin Maps dashboard") onClicked: Qt.openUrlExternally( __inputHelp.merginDashboardLink ) } + MMWarningBubble { + id: noWorkspaceBanner + + visible: false // Set from parent + width: root.width - 2 * root.hPadding + anchors { + top: searchBar.bottom + left: parent.left + right: parent.right + topMargin: root.spacing + } + title: qsTr("No workspace detected") + description: qsTr("Create your workspace by clicking here") + imageSource: __style.noWorkspaceImage + onClicked: root.createWorkspaceRequested() + } + Component { id: activeProjectComponent @@ -161,8 +180,10 @@ Item { left: parent.left right: parent.right top: { - if( warningBubble.visible ) - return warningBubble.bottom + if( attentionRequiredBanner.visible ) + return attentionRequiredBanner.bottom + if( noWorkspaceBanner.visible ) + return noWorkspaceBanner.bottom return searchBar.bottom } bottom: parent.bottom diff --git a/app/qml/project/MMProjectList.qml b/app/qml/project/MMProjectList.qml index 3f6ab594b..fff5bc9e2 100644 --- a/app/qml/project/MMProjectList.qml +++ b/app/qml/project/MMProjectList.qml @@ -132,7 +132,6 @@ Item { MMBusyIndicator { x: parent.width / 2 - width / 2 running: controllerModel.isLoading - size: __style.row63 } } diff --git a/app/qml/project/MMProjectListPage.qml b/app/qml/project/MMProjectListPage.qml index 496da1482..2fe847ea2 100644 --- a/app/qml/project/MMProjectListPage.qml +++ b/app/qml/project/MMProjectListPage.qml @@ -12,7 +12,6 @@ import QtQuick import mm 1.0 as MM import "../components" -import "../misc" import "../inputs" Item { diff --git a/app/qml/project/MMProjectPanel.qml b/app/qml/project/MMProjectPanel.qml index d7d1c1d35..9da2ccbca 100644 --- a/app/qml/project/MMProjectPanel.qml +++ b/app/qml/project/MMProjectPanel.qml @@ -15,7 +15,6 @@ import QtQuick.Dialogs import mm 1.0 as MM -import "../misc" import "../components" import "../onboarding" import "../inputs" @@ -88,40 +87,13 @@ Item { stackView.focus = true } - NoWorkspaceBanner { - id: noWorkspaceBanner - visible: { - if ( !__merginApi.apiSupportsWorkspaces ) { - return false; - } - if ( !__merginApi.userAuth.hasAuthData() ) { - return false; - } - // do not show the banner in case of accepting invitation or creating a workspace - if (onboardingController.inProgress) { - return false; - } - return !__merginApi.userInfo.hasWorkspaces - } - z: parent.z + 1 - anchors { - top: parent.top - left: parent.left - right: parent.right - } - - onCreateWorkspaceRequested: { - createWorkspaceController.createNewWorkspace() - } - } - StackView { id: stackView initialItem: workspaceProjectsPanelComp anchors { - top: noWorkspaceBanner.visible ? noWorkspaceBanner.bottom : parent.top + top: parent.top left: parent.left right: parent.right bottom: parent.bottom @@ -189,7 +161,6 @@ Item { MMBusyIndicator { id: busyIndicator - size: parent.width/8 running: stackView.pending anchors.centerIn: parent z: parent.z + 1 @@ -377,6 +348,24 @@ Item { showChanges( projectId ) } list.onActiveProjectDeleted: setupProjectOpen( "" ) + + noWorkspaceBannerVisible: { + if ( !__merginApi.apiSupportsWorkspaces ) { + return false; + } + if ( !__merginApi.userAuth.hasAuthData() ) { + return false; + } + // do not show the banner in case of accepting invitation or creating a workspace + if (onboardingController.inProgress) { + return false; + } + return !__merginApi.userInfo.hasWorkspaces + } + + onCreateWorkspaceRequested: { + createWorkspaceController.createNewWorkspace() + } } MMProjectListPage { diff --git a/app/qml/settings/MMSettingsController.qml b/app/qml/settings/MMSettingsController.qml index 326a467f4..40ff51fdb 100644 --- a/app/qml/settings/MMSettingsController.qml +++ b/app/qml/settings/MMSettingsController.qml @@ -14,7 +14,6 @@ import QtQuick.Layouts import mm 1.0 as MM import "../components" -import "../misc" import "../gps" Item { diff --git a/app/qml/settings/MMSettingsPanel.qml b/app/qml/settings/MMSettingsPanel.qml index 5f7153243..1fa50caea 100644 --- a/app/qml/settings/MMSettingsPanel.qml +++ b/app/qml/settings/MMSettingsPanel.qml @@ -15,7 +15,6 @@ import mm 1.0 as MM import "." import "../components" -import "../misc" Page { id: root diff --git a/gallery/qml/pages/ImagesPage.qml b/gallery/qml/pages/ImagesPage.qml index afea60bf6..404638ea9 100644 --- a/gallery/qml/pages/ImagesPage.qml +++ b/gallery/qml/pages/ImagesPage.qml @@ -71,6 +71,7 @@ ScrollView { Column { Image { source: __style.warnLogoImage } Text { text: "warnLogoImage" } } Column { Image { source: __style.attentionImage } Text { text: "attentionImage" } } Column { Image { source: __style.bubbleImage } Text { text: "bubbleImage" } } + Column { Image { source: __style.noWorkspaceImage } Text { text: "noWorkspaceImage" } } } } diff --git a/gallery/qml/pages/MiscPage.qml b/gallery/qml/pages/MiscPage.qml index a66bdc710..1388dcb5d 100644 --- a/gallery/qml/pages/MiscPage.qml +++ b/gallery/qml/pages/MiscPage.qml @@ -191,7 +191,6 @@ ScrollView { anchors.fill: parent MMBusyIndicator { running: true - size: 55 } } }