diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ebfdb60d7..5a755072f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -11,7 +11,7 @@ This text is partially Markdown, hence sometimes strange formatting. **This is a stable release of *Little Navmap* which fixes several bugs and adds improvements as well as new features.** -**Notable changes: Windows Installation program, Prepar3D v6 support, +**Notable changes: Windows Installation program, Prepar3D v6 support, fix for MSFS waypoint moved to North issue, Little Navconnect tray icon and more.** **Also update *Little Navconnect* and *Little Xpconnect* if you're using one of them to @@ -93,7 +93,7 @@ A big thank you to all who reported bugs and issues! ### Flight Plan and Export -* Corrected wrong error message for procedures having a MAP lower than airport elevation. +* Corrected wrong error message for procedures having a MAP lower than airport elevation. Example: FAUP RNAV UP1F1 (R35) * Fix in flight plan export for MSFS where several waypoints are moved to North. Thanks to Github user [eaides](https://github.com/eaides) for the hint. #1038 @@ -113,6 +113,7 @@ A big thank you to all who reported bugs and issues! This resulted in a random crash to desktop while loading the scenery library. * Fixed crash when loading Active Sky files if Active Sky file path was set manually and removed later on. +* Corrected menu items and toolbar buttons which remained disabled after connecting to simulator. ## Little Navconnect Version 2.8.7 diff --git a/src/common/htmlinfobuilder.cpp b/src/common/htmlinfobuilder.cpp index 18b8ca131..2856bfab9 100644 --- a/src/common/htmlinfobuilder.cpp +++ b/src/common/htmlinfobuilder.cpp @@ -279,8 +279,7 @@ void HtmlInfoBuilder::airportText(const MapAirport& airport, const map::WeatherC arg(Unit::altFeet(transitionLevel)).arg(transitionLevel / 100.f, 3, 'f', 0, QChar('0'))); // Sunrise and sunset =========================== - QDateTime datetime = - NavApp::isConnectedAndAircraft() ? NavApp::getUserAircraft().getZuluTime() : QDateTime::currentDateTimeUtc(); + QDateTime datetime = NavApp::isConnectedAndAircraft() ? NavApp::getUserAircraft().getZuluTime() : QDateTime::currentDateTimeUtc(); if(datetime.isValid()) { diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 32bfa52ac..e09b86e9c 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1590,6 +1590,8 @@ void MainWindow::connectAllSlots() // Messages about database query result status - use queued to avoid blocking paint connect(mapWidget, &MapPaintWidget::resultTruncated, this, &MainWindow::resultTruncated, Qt::QueuedConnection); + connect(mapWidget, &MapWidget::userAircraftValidChanged, this, &MainWindow::updateActionStates); + connect(databaseManager, &DatabaseManager::preDatabaseLoad, this, &MainWindow::preDatabaseLoad); connect(databaseManager, &DatabaseManager::postDatabaseLoad, this, &MainWindow::postDatabaseLoad); diff --git a/src/mapgui/mapwidget.cpp b/src/mapgui/mapwidget.cpp index 1a3d9024a..3b322f79a 100644 --- a/src/mapgui/mapwidget.cpp +++ b/src/mapgui/mapwidget.cpp @@ -2362,11 +2362,19 @@ void MapWidget::simDataChanged(const atools::fs::sc::SimConnectData& simulatorDa using atools::geo::angleAbsDiff; const atools::fs::sc::SimConnectUserAircraft& aircraft = simulatorData.getUserAircraftConst(); + + // Emit signal later once all values are updated - check for aircraft state changes + bool userAircraftValidToggled = getScreenIndexConst()->getUserAircraft().isFullyValid() != aircraft.isFullyValid(); + getScreenIndex()->updateSimData(simulatorData); if(databaseLoadStatus || !aircraft.isValid()) { getScreenIndex()->updateLastSimData(atools::fs::sc::SimConnectData()); + + // Update action states if needed + if(userAircraftValidToggled) + emit userAircraftValidChanged(); return; } @@ -2384,8 +2392,8 @@ void MapWidget::simDataChanged(const atools::fs::sc::SimConnectData& simulatorDa QPoint aircraftPoint = conv.wToS(aircraft.getPosition(), CoordinateConverter::DEFAULT_WTOS_SIZE, &visible); // Difference from last movement on map - const atools::fs::sc::SimConnectUserAircraft& last = getScreenIndexConst()->getLastUserAircraft(); - QPoint aircraftPointDiff = aircraftPoint - conv.wToS(last.getPosition()); + const atools::fs::sc::SimConnectUserAircraft& lastAircraft = getScreenIndexConst()->getLastUserAircraft(); + QPoint aircraftPointDiff = aircraftPoint - conv.wToS(lastAircraft.getPosition()); const OptionData& od = OptionData::instance(); // Zoom to aircraft and next waypoint - depends on various criteria @@ -2488,18 +2496,18 @@ void MapWidget::simDataChanged(const atools::fs::sc::SimConnectData& simulatorDa } // Check if position has changed significantly - bool posHasChanged = !last.isValid() || // No previous position + bool posHasChanged = !lastAircraft.isValid() || // No previous position aircraftPointDiff.manhattanLength() >= deltas.manhattanLengthDelta; // Screen position has changed // Check if any data like heading has changed which requires a redraw bool dataHasChanged = posHasChanged || - last.isFlying() != aircraft.isFlying() || - last.isOnGround() != aircraft.isOnGround() || - angleAbsDiff(last.getHeadingDegMag(), + lastAircraft.isFlying() != aircraft.isFlying() || + lastAircraft.isOnGround() != aircraft.isOnGround() || + angleAbsDiff(lastAircraft.getHeadingDegMag(), aircraft.getHeadingDegMag()) > deltas.headingDelta || // Heading has changed - almostNotEqual(last.getIndicatedSpeedKts(), + almostNotEqual(lastAircraft.getIndicatedSpeedKts(), aircraft.getIndicatedSpeedKts(), deltas.speedDelta) || // Speed has changed - almostNotEqual(last.getPosition().getAltitude(), + almostNotEqual(lastAircraft.getPosition().getAltitude(), aircraft.getActualAltitudeFt(), deltas.altitudeDelta); // Altitude has changed // Force an update every five seconds to avoid hanging map view if aircraft does not move on map @@ -2510,8 +2518,8 @@ void MapWidget::simDataChanged(const atools::fs::sc::SimConnectData& simulatorDa lastSimUpdateMs = now; // Check for takeoff, landing and fuel consumption changes =========== - simDataCalcTakeoffLanding(aircraft, last); - simDataCalcFuelOnOff(aircraft, last); + simDataCalcTakeoffLanding(aircraft, lastAircraft); + simDataCalcFuelOnOff(aircraft, lastAircraft); if(dataHasChanged) // Also changes local "last" @@ -2756,6 +2764,10 @@ void MapWidget::simDataChanged(const atools::fs::sc::SimConnectData& simulatorDa if(!updatesEnabled()) setUpdatesEnabled(true); } // if(now - lastSimUpdateMs > deltas.timeDeltaMs) + + // Update action states if needed + if(userAircraftValidToggled) + emit userAircraftValidChanged(); } void MapWidget::mainWindowShown() diff --git a/src/mapgui/mapwidget.h b/src/mapgui/mapwidget.h index 1f525608d..bb56ddfb4 100644 --- a/src/mapgui/mapwidget.h +++ b/src/mapgui/mapwidget.h @@ -244,6 +244,9 @@ class MapWidget : void showGridConfiguration(); signals: + /* Emitted when connection is established and user aircraft turned from invalid to valid */ + void userAircraftValidChanged(); + /* Fuel flow started or stopped */ void aircraftEngineStarted(const atools::fs::sc::SimConnectUserAircraft& aircraft); void aircraftEngineStopped(const atools::fs::sc::SimConnectUserAircraft& aircraft);