From 6860627deaef917f38e1502663bb80fc9bbe7954 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 23 Mar 2019 14:46:03 +0000 Subject: [PATCH] Tweaks to launcher diagrams, to debug parking clicks Adding some info/qInfo log output, to try and diagnose missed clicks reported by some users. --- src/GUI/AirportDiagram.cxx | 5 ++--- src/GUI/BaseDiagram.cxx | 16 +++++++++++----- src/GUI/BaseDiagram.hxx | 2 ++ src/GUI/LocationController.cxx | 1 + src/GUI/qml/LocationAirportView.qml | 6 +++++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/GUI/AirportDiagram.cxx b/src/GUI/AirportDiagram.cxx index 3d7b9ef12..b2250150b 100644 --- a/src/GUI/AirportDiagram.cxx +++ b/src/GUI/AirportDiagram.cxx @@ -165,7 +165,6 @@ void AirportDiagram::setAirport(FGAirportRef apt) clearIgnoredNavaids(); addIgnoredNavaid(apt); - recomputeBounds(true); update(); } @@ -182,7 +181,7 @@ void AirportDiagram::setSelection(QmlPositioned* pos) m_selection = pos->inner(); } emit selectionChanged(); - recomputeBounds(true); + recomputeBounds(false); update(); } @@ -193,7 +192,7 @@ void AirportDiagram::setApproachExtension(QuantityValue distance) } m_approachDistance = distance; - recomputeBounds(true); + recomputeBounds(false); update(); emit approachExtensionChanged(); } diff --git a/src/GUI/BaseDiagram.cxx b/src/GUI/BaseDiagram.cxx index c227c14e1..1d6cce7f8 100644 --- a/src/GUI/BaseDiagram.cxx +++ b/src/GUI/BaseDiagram.cxx @@ -642,20 +642,26 @@ void BaseDiagram::paintContents(QPainter* painter) Q_UNUSED(painter); } -void BaseDiagram::recomputeBounds(bool resetZoom) +void BaseDiagram::recomputeBounds(bool doResetZoom) { m_bounds = QRectF(); doComputeBounds(); - if (resetZoom) { - m_autoScalePan = true; - m_scale = 1.0; - m_panOffset = QPointF(); + if (doResetZoom) { + resetZoom(); } update(); } +void BaseDiagram::resetZoom() +{ + m_autoScalePan = true; + m_scale = 1.0; + m_panOffset = QPointF(); + update(); +} + void BaseDiagram::doComputeBounds() { // no-op in the base class diff --git a/src/GUI/BaseDiagram.hxx b/src/GUI/BaseDiagram.hxx index 4217b7e6c..c28ef36f1 100644 --- a/src/GUI/BaseDiagram.hxx +++ b/src/GUI/BaseDiagram.hxx @@ -57,6 +57,8 @@ public: void setAircraftType(LauncherController::AircraftType type); QRect rect() const; + + Q_INVOKABLE void resetZoom(); protected: void paint(QPainter* p) override; diff --git a/src/GUI/LocationController.cxx b/src/GUI/LocationController.cxx index 56f36e860..a11c0e11a 100644 --- a/src/GUI/LocationController.cxx +++ b/src/GUI/LocationController.cxx @@ -249,6 +249,7 @@ void LocationController::setDetailLocation(QmlPositioned* pos) m_detailLocation.clear(); m_detailQml->setInner({}); } else { + qInfo() << Q_FUNC_INFO << "pos:" << pos->ident(); m_detailLocation = pos->inner(); m_useActiveRunway = false; m_useAvailableParking = false; diff --git a/src/GUI/qml/LocationAirportView.qml b/src/GUI/qml/LocationAirportView.qml index f11f4d7c8..0fb5b80f3 100644 --- a/src/GUI/qml/LocationAirportView.qml +++ b/src/GUI/qml/LocationAirportView.qml @@ -24,6 +24,7 @@ Item { if (pos === null) return; + console.info("Saw airport click on:" + pos.ident) _location.setDetailLocation(pos) diagram.selection = pos syncUIFromController(); @@ -36,7 +37,7 @@ Item { // not very declarative, try to remove this over time function syncUIFromController() { - if (_location.useAvailableParking || (_location.detail.type == Positioned.Parking)) { + if (_location.useAvailableParking || (_location.detail.type === Positioned.Parking)) { parkingRadio.select() parkingChoice.syncCurrentIndex(); } else { @@ -292,18 +293,21 @@ Item { function syncCurrentIndex() { if (_location.useAvailableParking) { + console.info("Parking: controller says use available") currentIndex = -1; return; } for (var i=0; i < _location.airportParkings.length; ++i) { if (_location.airportParkings[i].equals(_location.detail)) { + console.info("Found explicit parking " + _location.detail.ident + " at index " + i); currentIndex = i; return; } } // not found, default to available + console.info("Couldn't find parking at airport:" + _location.detail.ident) currentIndex = -1; }