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();
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();
}

View file

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

View file

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

View file

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

View file

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