From d30f5d63fe0aac0f366e9062c2e870672705af85 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 20 Jan 2021 12:46:19 +0000 Subject: [PATCH] Launcher: Getting started tips updates --- src/GUI/GettingStartedTipsController.cxx | 20 ++++++++++++++++++ src/GUI/qml/AircraftList.qml | 9 ++++---- src/GUI/qml/Location.qml | 19 +++++++++++++++++ src/GUI/qml/Sidebar.qml | 26 +++++++++++++++++++++++- src/GUI/qml/Summary.qml | 8 ++++---- 5 files changed, 73 insertions(+), 9 deletions(-) diff --git a/src/GUI/GettingStartedTipsController.cxx b/src/GUI/GettingStartedTipsController.cxx index e133e4521..a1418b5d5 100755 --- a/src/GUI/GettingStartedTipsController.cxx +++ b/src/GUI/GettingStartedTipsController.cxx @@ -119,6 +119,9 @@ private: QTimer* _notMovingTimeout = nullptr; }; +// static used to ensure only one controller is active at a time +static QPointer static_activeController; + GettingStartedTipsController::GettingStartedTipsController(QObject *parent) : QObject(parent) { // observer for the tip item @@ -207,6 +210,10 @@ void GettingStartedTipsController::showOneShotTip(GettingStartedTip *tip) return; } + if (static_activeController != this) { + return; + } + QSettings settings; settings.beginGroup("GettingStarted-DontShow"); if (settings.value(tip->tipId()).toBool()) { @@ -229,6 +236,7 @@ void GettingStartedTipsController::tipsWereReset() bool a = shouldShowScope(); if (a != _scopeActive) { _scopeActive = a; + static_activeController = this; // we became active emit activeChanged(); currentTipUpdated(); } @@ -411,7 +419,12 @@ void GettingStartedTipsController::close() if (_oneShotTip) { disconnect(_oneShotTip, nullptr, this, nullptr); _oneShotTip = nullptr; + static_activeController.clear(); } else { + if (_scopeActive) { + static_activeController.clear(); + } + QSettings settings; settings.beginGroup("GettingStarted-DontShow"); settings.setValue(_scopeId, true); @@ -445,12 +458,19 @@ void GettingStartedTipsController::setScopeId(QString scopeId) _scopeId = scopeId; _scopeActive = shouldShowScope(); + if (_scopeActive) { + static_activeController = this; + } emit scopeIdChanged(_scopeId); emit activeChanged(); } bool GettingStartedTipsController::shouldShowScope() const { + if (static_activeController && (static_activeController != this)) { + return false; + } + if (_scopeId.isEmpty()) return true; diff --git a/src/GUI/qml/AircraftList.qml b/src/GUI/qml/AircraftList.qml index dda24ca5d..651cf6f85 100644 --- a/src/GUI/qml/AircraftList.qml +++ b/src/GUI/qml/AircraftList.qml @@ -52,10 +52,11 @@ FocusScope anchors { horizontalCenter: parent.horizontalCenter + horizontalCenterOffset: Style.margin top: parent.bottom } arrow: GettingStartedTip.TopLeft - text: qsTr("Click here to switch between grid and list mode") + text: qsTr("Toggle between grid and list view") } } @@ -81,7 +82,7 @@ FocusScope top: parent.bottom } arrow: GettingStartedTip.TopCenter - text: qsTr("Use this tab to view installed aircraft") + text: qsTr("Use this button to view installed aircraft") } } @@ -113,7 +114,7 @@ FocusScope top: parent.bottom } arrow: GettingStartedTip.TopCenter - text: qsTr("Use this tab to view available aircraft to download") + text: qsTr("View available aircraft to download") } } @@ -155,7 +156,7 @@ FocusScope top: parent.bottom } arrow: GettingStartedTip.TopRight - text: qsTr("Enter text here to search aircraft names and descriptions.") + text: qsTr("Enter text to search aircraft names and descriptions.") } } } diff --git a/src/GUI/qml/Location.qml b/src/GUI/qml/Location.qml index 439a6a094..862626c72 100644 --- a/src/GUI/qml/Location.qml +++ b/src/GUI/qml/Location.qml @@ -13,6 +13,7 @@ Item { property bool showCarriers: false readonly property var locationModel: showCarriers ? _location.carriersModel : _location.searchModel + GettingStartedScope.controller: tips.controller function backToSearch() { @@ -239,6 +240,18 @@ Item { this.icon = "qrc:///svg/icon-carrier" } } + + GettingStartedTip { + tipId: "locationCarriersList" + + anchors { + horizontalCenter: parent.horizontalCenter + horizontalCenterOffset: -Style.margin + top: parent.bottom + } + arrow: GettingStartedTip.TopRight + text: qsTr("View available aircraft carriers to start at.") + } } StyledText { @@ -307,6 +320,12 @@ Item { } } + GettingStartedTipLayer { + id: tips + anchors.fill: parent + scopeId: "location" + } + // scrollbar Loader { diff --git a/src/GUI/qml/Sidebar.qml b/src/GUI/qml/Sidebar.qml index 08aaea242..f1e7616bc 100644 --- a/src/GUI/qml/Sidebar.qml +++ b/src/GUI/qml/Sidebar.qml @@ -1,5 +1,7 @@ import QtQuick 2.4 - +import QtQml 2.4 +import FlightGear.Launcher 1.0 +import FlightGear 1.0 import "." Rectangle { @@ -23,6 +25,8 @@ Rectangle { selectedPage = index } + GettingStartedScope.controller: tips.controller + Column { id: mainColumn width: parent.width @@ -48,6 +52,20 @@ Rectangle { hoverEnabled: true onClicked: root.showMenu() } + + + GettingStartedTip { + id: menuTip + tipId: "sidebarMenuTip" + arrow: GettingStartedTip.TopLeft + + anchors { + horizontalCenter: parent.horizontalCenter + horizontalCenterOffset: Style.margin + top: parent.bottom + } + text: qsTr("Access additional options here") + } } Repeater { @@ -77,4 +95,10 @@ Rectangle { icon: _launcher.flyIconUrl onClicked: _launcher.fly(); } + + GettingStartedTipLayer { + id: tips + anchors.fill: parent + scopeId: "sidebar" + } } diff --git a/src/GUI/qml/Summary.qml b/src/GUI/qml/Summary.qml index 3a313fb88..09fbb0c43 100644 --- a/src/GUI/qml/Summary.qml +++ b/src/GUI/qml/Summary.qml @@ -180,7 +180,7 @@ Item { horizontalCenter: parent.horizontalCenter bottom: parent.top } - text: qsTr("Click here to select a recently used aircraft.") + text: qsTr("Access recently used aircraft.") } } @@ -275,7 +275,7 @@ Item { anchors { verticalCenter: parent.verticalCenter } - text: qsTr("Use this menu to choose the starting state of the aircraft") + text: qsTr("Choose the starting condition of the aircraft") } } @@ -328,7 +328,7 @@ Item { leftMargin: Style.strutSize } arrow: GettingStartedTip.TopLeft - text: qsTr("Click this description to view and change the current location.") + text: qsTr("Click to view and change the current location.") } } @@ -347,7 +347,7 @@ Item { bottom: parent.top } arrow: GettingStartedTip.BottomRight - text: qsTr("Click here to access recently used locations") + text: qsTr("Access recently used locations") } }