1
0
Fork 0

Tweaks to launcher diagrams, to debug parking clicks

Adding some info/qInfo log output, to try and diagnose missed clicks
reported by some users.
This commit is contained in:
James Turner 2019-03-23 14:46:03 +00:00
parent 8db784bf17
commit 6860627dea
5 changed files with 21 additions and 9 deletions

View file

@ -165,7 +165,6 @@ void AirportDiagram::setAirport(FGAirportRef apt)
clearIgnoredNavaids(); clearIgnoredNavaids();
addIgnoredNavaid(apt); addIgnoredNavaid(apt);
recomputeBounds(true); recomputeBounds(true);
update(); update();
} }
@ -182,7 +181,7 @@ void AirportDiagram::setSelection(QmlPositioned* pos)
m_selection = pos->inner(); m_selection = pos->inner();
} }
emit selectionChanged(); emit selectionChanged();
recomputeBounds(true); recomputeBounds(false);
update(); update();
} }
@ -193,7 +192,7 @@ void AirportDiagram::setApproachExtension(QuantityValue distance)
} }
m_approachDistance = distance; m_approachDistance = distance;
recomputeBounds(true); recomputeBounds(false);
update(); update();
emit approachExtensionChanged(); emit approachExtensionChanged();
} }

View file

@ -642,20 +642,26 @@ void BaseDiagram::paintContents(QPainter* painter)
Q_UNUSED(painter); Q_UNUSED(painter);
} }
void BaseDiagram::recomputeBounds(bool resetZoom) void BaseDiagram::recomputeBounds(bool doResetZoom)
{ {
m_bounds = QRectF(); m_bounds = QRectF();
doComputeBounds(); doComputeBounds();
if (resetZoom) { if (doResetZoom) {
m_autoScalePan = true; resetZoom();
m_scale = 1.0;
m_panOffset = QPointF();
} }
update(); update();
} }
void BaseDiagram::resetZoom()
{
m_autoScalePan = true;
m_scale = 1.0;
m_panOffset = QPointF();
update();
}
void BaseDiagram::doComputeBounds() void BaseDiagram::doComputeBounds()
{ {
// no-op in the base class // no-op in the base class

View file

@ -57,6 +57,8 @@ public:
void setAircraftType(LauncherController::AircraftType type); void setAircraftType(LauncherController::AircraftType type);
QRect rect() const; QRect rect() const;
Q_INVOKABLE void resetZoom();
protected: protected:
void paint(QPainter* p) override; void paint(QPainter* p) override;

View file

@ -249,6 +249,7 @@ void LocationController::setDetailLocation(QmlPositioned* pos)
m_detailLocation.clear(); m_detailLocation.clear();
m_detailQml->setInner({}); m_detailQml->setInner({});
} else { } else {
qInfo() << Q_FUNC_INFO << "pos:" << pos->ident();
m_detailLocation = pos->inner(); m_detailLocation = pos->inner();
m_useActiveRunway = false; m_useActiveRunway = false;
m_useAvailableParking = false; m_useAvailableParking = false;

View file

@ -24,6 +24,7 @@ Item {
if (pos === null) if (pos === null)
return; return;
console.info("Saw airport click on:" + pos.ident)
_location.setDetailLocation(pos) _location.setDetailLocation(pos)
diagram.selection = pos diagram.selection = pos
syncUIFromController(); syncUIFromController();
@ -36,7 +37,7 @@ Item {
// not very declarative, try to remove this over time // not very declarative, try to remove this over time
function syncUIFromController() function syncUIFromController()
{ {
if (_location.useAvailableParking || (_location.detail.type == Positioned.Parking)) { if (_location.useAvailableParking || (_location.detail.type === Positioned.Parking)) {
parkingRadio.select() parkingRadio.select()
parkingChoice.syncCurrentIndex(); parkingChoice.syncCurrentIndex();
} else { } else {
@ -292,18 +293,21 @@ Item {
function syncCurrentIndex() function syncCurrentIndex()
{ {
if (_location.useAvailableParking) { if (_location.useAvailableParking) {
console.info("Parking: controller says use available")
currentIndex = -1; currentIndex = -1;
return; return;
} }
for (var i=0; i < _location.airportParkings.length; ++i) { for (var i=0; i < _location.airportParkings.length; ++i) {
if (_location.airportParkings[i].equals(_location.detail)) { if (_location.airportParkings[i].equals(_location.detail)) {
console.info("Found explicit parking " + _location.detail.ident + " at index " + i);
currentIndex = i; currentIndex = i;
return; return;
} }
} }
// not found, default to available // not found, default to available
console.info("Couldn't find parking at airport:" + _location.detail.ident)
currentIndex = -1; currentIndex = -1;
} }