1
0
Fork 0

Launcher: Getting started tips updates

This commit is contained in:
James Turner 2021-01-20 12:46:19 +00:00
parent 190aad784b
commit d30f5d63fe
5 changed files with 73 additions and 9 deletions

View file

@ -119,6 +119,9 @@ private:
QTimer* _notMovingTimeout = nullptr;
};
// static used to ensure only one controller is active at a time
static QPointer<GettingStartedTipsController> 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;

View file

@ -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.")
}
}
}

View file

@ -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 {

View file

@ -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"
}
}

View file

@ -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")
}
}