diff --git a/src/blackcore/context_simulator.h b/src/blackcore/context_simulator.h index efbe98043..a7fad6ea1 100644 --- a/src/blackcore/context_simulator.h +++ b/src/blackcore/context_simulator.h @@ -123,6 +123,9 @@ namespace BlackCore //! Installed models in simulator eco system virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0; + //! Number of installed models in simulator eco system + virtual int getInstalledModelsCount() const = 0; + //! Model for model string virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const = 0; diff --git a/src/blackcore/context_simulator_impl.cpp b/src/blackcore/context_simulator_impl.cpp index c8d494778..a6faa8077 100644 --- a/src/blackcore/context_simulator_impl.cpp +++ b/src/blackcore/context_simulator_impl.cpp @@ -116,6 +116,14 @@ namespace BlackCore return this->m_simulator->getInstalledModels(); } + int CContextSimulator::getInstalledModelsCount() const + { + if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } + if (!m_simulator) { return 0; } + + return this->m_simulator->getInstalledModels().size(); + } + CAircraftModelList CContextSimulator::getInstalledModelsStartingWith(const QString modelString) const { if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; } diff --git a/src/blackcore/context_simulator_impl.h b/src/blackcore/context_simulator_impl.h index 53f90c96d..fec3b1ef4 100644 --- a/src/blackcore/context_simulator_impl.h +++ b/src/blackcore/context_simulator_impl.h @@ -74,6 +74,9 @@ namespace BlackCore //! \copydoc IContextSimulator::getInstalledModels virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override; + //! \copydoc IContextSimulator::getInstalledModelsCount + virtual int getInstalledModelsCount() const override; + //! \copydoc IContextSimulator::getInstalledModelsStartingWith virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override; diff --git a/src/blackcore/context_simulator_proxy.cpp b/src/blackcore/context_simulator_proxy.cpp index 477f74a23..0b8dc7e0c 100644 --- a/src/blackcore/context_simulator_proxy.cpp +++ b/src/blackcore/context_simulator_proxy.cpp @@ -99,6 +99,11 @@ namespace BlackCore return m_dBusInterface->callDBusRet(QLatin1Literal("getInstalledModelsStartingWith"), modelString); } + int CContextSimulatorProxy::getInstalledModelsCount() const + { + return m_dBusInterface->callDBusRet(QLatin1Literal("getInstalledModelsCount")); + } + void CContextSimulatorProxy::reloadInstalledModels() { m_dBusInterface->callDBus(QLatin1Literal("reloadInstalledModels")); diff --git a/src/blackcore/context_simulator_proxy.h b/src/blackcore/context_simulator_proxy.h index db7ebb542..0c8613f81 100644 --- a/src/blackcore/context_simulator_proxy.h +++ b/src/blackcore/context_simulator_proxy.h @@ -77,6 +77,9 @@ namespace BlackCore //! \copydoc IContextSimulator::getInstalledModelsStartingWith virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override; + //! \copydoc IContextSimulator::getInstalledModelsCount + virtual int getInstalledModelsCount() const override; + //! \copydoc IContextSimulator::reloadInstalledModels virtual void reloadInstalledModels() override; diff --git a/src/blackcore/simulator.cpp b/src/blackcore/simulator.cpp index ddc31b278..ceeb25d26 100644 --- a/src/blackcore/simulator.cpp +++ b/src/blackcore/simulator.cpp @@ -45,4 +45,9 @@ namespace BlackCore Q_UNUSED(interpolator); } + int CSimulatorCommon::getInstalledModelsCount() const + { + return getInstalledModels().size(); + } + } // namespace diff --git a/src/blackcore/simulator.h b/src/blackcore/simulator.h index 2e5261552..8a0f8b685 100644 --- a/src/blackcore/simulator.h +++ b/src/blackcore/simulator.h @@ -109,6 +109,9 @@ namespace BlackCore //! Aircraft models for available remote aircrafts virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0; + //! Count of aircraft models for available remote aircrafts + virtual int getInstalledModelsCount() const = 0; + //! Reload the installed models virtual void reloadInstalledModels() = 0; @@ -213,6 +216,9 @@ namespace BlackCore //! \copydoc ISimulator::enableDebuggingMessages virtual void enableDebugMessages(bool driver, bool interpolator) override; + //! \copydoc ISimulator::getInstalledModelsCount + virtual int getInstalledModelsCount() const override; + protected: //! Constructor CSimulatorCommon( diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index f28043a0a..905962c56 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -47,6 +47,7 @@ namespace BlackGui this->ui->led_DBus->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "DBus connected", "DBus disconnected", 14); this->ui->led_Network->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Network connected", "Network disconnected", 14); this->ui->led_Simulator->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Blue, shape, "Simulator running", "Simulator disconnected", "Simulator connected", 14); + this->ui->led_MapperReady->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Blue, shape, "Mapper ready", "Mappings loading", "Mappings loading", 14); shape = CLedWidget::Rounded; this->ui->led_Ptt->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Ptt", "Silence", 18); @@ -75,6 +76,7 @@ namespace BlackGui if (this->getIContextSimulator()) { connect(this->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::ps_onSimulatorStatusChanged); + connect(this->getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CInfoBarStatusComponent::ps_onMapperReady); } if (this->getIContextNetwork()) @@ -92,7 +94,6 @@ namespace BlackGui { this->ui->led_Audio->setOn(!this->getIContextAudio()->isMuted()); connect(getIContextAudio(), &IContextAudio::changedMute, this, &CInfoBarStatusComponent::ps_onMuteChanged); -// connect(getIContextAudio(), &IContextAudio::changedAudioVolumes, this, &CInfoBarStatusComponent::ps_onVolumesChanged); } } @@ -169,15 +170,21 @@ namespace BlackGui } } - void CInfoBarStatusComponent::ps_onVolumesChanged(qint32 com1Volume, qint32 com2Volume) - { - bool pseudoMute = (com1Volume < 1 && com2Volume < 1); - this->ps_onMuteChanged(pseudoMute); - } - void CInfoBarStatusComponent::ps_onMuteChanged(bool muted) { this->ui->led_Audio->setOn(!muted); } + + void CInfoBarStatusComponent::ps_onMapperReady() + { + if (!getIContextSimulator()) + { + this->ui->led_MapperReady->setOn(false); + return; + } + + bool on = this->getIContextSimulator()->getInstalledModelsCount() > 0; + this->ui->led_MapperReady->setOn(on); + } } // namespace } // namespace diff --git a/src/blackgui/components/infobarstatuscomponent.h b/src/blackgui/components/infobarstatuscomponent.h index b36aeb787..2030e4412 100644 --- a/src/blackgui/components/infobarstatuscomponent.h +++ b/src/blackgui/components/infobarstatuscomponent.h @@ -62,11 +62,11 @@ namespace BlackGui //! Context menu requested void ps_customAudioContextMenuRequested(const QPoint &position); - //! Volumes changed 0..100 - void ps_onVolumesChanged(qint32 com1Volume, qint32 com2Volume); - //! Mute changed void ps_onMuteChanged(bool muted); + + //! Mapper is ready + void ps_onMapperReady(); }; } } diff --git a/src/blackgui/components/infobarstatuscomponent.ui b/src/blackgui/components/infobarstatuscomponent.ui index 020ce3594..f7b96adee 100644 --- a/src/blackgui/components/infobarstatuscomponent.ui +++ b/src/blackgui/components/infobarstatuscomponent.ui @@ -25,7 +25,7 @@ - 3 + 2 0 @@ -51,7 +51,7 @@ Network - Net + nt. @@ -70,7 +70,7 @@ Simulator - Sim + sm. @@ -84,6 +84,19 @@ + + + + Mappings ready + + + mp. + + + + + + @@ -93,7 +106,7 @@ - DBus + DB @@ -119,7 +132,7 @@ Push to talk - Ptt + ptt @@ -135,7 +148,7 @@ 0 - Audio + au. 0 diff --git a/src/swiftgui_standard/swiftguistd.ui b/src/swiftgui_standard/swiftguistd.ui index 9f6b51cd8..0646836d7 100644 --- a/src/swiftgui_standard/swiftguistd.ui +++ b/src/swiftgui_standard/swiftguistd.ui @@ -304,6 +304,7 @@ + @@ -419,6 +420,14 @@ Ctrl+W, Ctrl+M + + + Toggle stay on top + + + Ctrl+W, Ctrl+T + + diff --git a/src/swiftgui_standard/swiftguistd_init.cpp b/src/swiftgui_standard/swiftguistd_init.cpp index 3a9ef8860..fe529995c 100644 --- a/src/swiftgui_standard/swiftguistd_init.cpp +++ b/src/swiftgui_standard/swiftguistd_init.cpp @@ -158,6 +158,7 @@ void SwiftGuiStd::initGuiSignals() connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_WindowFont, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_WindowMinimize, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); + connect(this->ui->menu_WindowToggleOnTop, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked); // command line / text messages diff --git a/src/swiftgui_standard/swiftguistd_menus.cpp b/src/swiftgui_standard/swiftguistd_menus.cpp index acd66f973..725698d36 100644 --- a/src/swiftgui_standard/swiftguistd_menus.cpp +++ b/src/swiftgui_standard/swiftguistd_menus.cpp @@ -72,6 +72,10 @@ void SwiftGuiStd::ps_onMenuClicked() { this->showMinimized(); } + else if (sender == this->ui->menu_WindowToggleOnTop) + { + this->ps_toogleWindowStayOnTop(); + } else if (sender == this->ui->menu_FileClose) { CLogMessage(this).info("Closing");