mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 07:05:38 +08:00
refs #394, LED to display when mapper is ready
* function in context for models count * adjusted status bar component * in same step: menu to toggle "window on top"
This commit is contained in:
@@ -123,6 +123,9 @@ namespace BlackCore
|
|||||||
//! Installed models in simulator eco system
|
//! Installed models in simulator eco system
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||||
|
|
||||||
|
//! Number of installed models in simulator eco system
|
||||||
|
virtual int getInstalledModelsCount() const = 0;
|
||||||
|
|
||||||
//! Model for model string
|
//! Model for model string
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const = 0;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,14 @@ namespace BlackCore
|
|||||||
return this->m_simulator->getInstalledModels();
|
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
|
CAircraftModelList CContextSimulator::getInstalledModelsStartingWith(const QString modelString) const
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::getInstalledModels
|
//! \copydoc IContextSimulator::getInstalledModels
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::getInstalledModelsCount
|
||||||
|
virtual int getInstalledModelsCount() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<BlackMisc::Simulation::CAircraftModelList>(QLatin1Literal("getInstalledModelsStartingWith"), modelString);
|
return m_dBusInterface->callDBusRet<BlackMisc::Simulation::CAircraftModelList>(QLatin1Literal("getInstalledModelsStartingWith"), modelString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CContextSimulatorProxy::getInstalledModelsCount() const
|
||||||
|
{
|
||||||
|
return m_dBusInterface->callDBusRet<int>(QLatin1Literal("getInstalledModelsCount"));
|
||||||
|
}
|
||||||
|
|
||||||
void CContextSimulatorProxy::reloadInstalledModels()
|
void CContextSimulatorProxy::reloadInstalledModels()
|
||||||
{
|
{
|
||||||
m_dBusInterface->callDBus(QLatin1Literal("reloadInstalledModels"));
|
m_dBusInterface->callDBus(QLatin1Literal("reloadInstalledModels"));
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ namespace BlackCore
|
|||||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||||
|
|
||||||
|
//! \copydoc IContextSimulator::getInstalledModelsCount
|
||||||
|
virtual int getInstalledModelsCount() const override;
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::reloadInstalledModels
|
//! \copydoc IContextSimulator::reloadInstalledModels
|
||||||
virtual void reloadInstalledModels() override;
|
virtual void reloadInstalledModels() override;
|
||||||
|
|
||||||
|
|||||||
@@ -45,4 +45,9 @@ namespace BlackCore
|
|||||||
Q_UNUSED(interpolator);
|
Q_UNUSED(interpolator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSimulatorCommon::getInstalledModelsCount() const
|
||||||
|
{
|
||||||
|
return getInstalledModels().size();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ namespace BlackCore
|
|||||||
//! Aircraft models for available remote aircrafts
|
//! Aircraft models for available remote aircrafts
|
||||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||||
|
|
||||||
|
//! Count of aircraft models for available remote aircrafts
|
||||||
|
virtual int getInstalledModelsCount() const = 0;
|
||||||
|
|
||||||
//! Reload the installed models
|
//! Reload the installed models
|
||||||
virtual void reloadInstalledModels() = 0;
|
virtual void reloadInstalledModels() = 0;
|
||||||
|
|
||||||
@@ -213,6 +216,9 @@ namespace BlackCore
|
|||||||
//! \copydoc ISimulator::enableDebuggingMessages
|
//! \copydoc ISimulator::enableDebuggingMessages
|
||||||
virtual void enableDebugMessages(bool driver, bool interpolator) override;
|
virtual void enableDebugMessages(bool driver, bool interpolator) override;
|
||||||
|
|
||||||
|
//! \copydoc ISimulator::getInstalledModelsCount
|
||||||
|
virtual int getInstalledModelsCount() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CSimulatorCommon(
|
CSimulatorCommon(
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ namespace BlackGui
|
|||||||
this->ui->led_DBus->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "DBus connected", "DBus disconnected", 14);
|
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_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_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;
|
shape = CLedWidget::Rounded;
|
||||||
this->ui->led_Ptt->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Ptt", "Silence", 18);
|
this->ui->led_Ptt->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Ptt", "Silence", 18);
|
||||||
@@ -75,6 +76,7 @@ namespace BlackGui
|
|||||||
if (this->getIContextSimulator())
|
if (this->getIContextSimulator())
|
||||||
{
|
{
|
||||||
connect(this->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::ps_onSimulatorStatusChanged);
|
connect(this->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::ps_onSimulatorStatusChanged);
|
||||||
|
connect(this->getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CInfoBarStatusComponent::ps_onMapperReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->getIContextNetwork())
|
if (this->getIContextNetwork())
|
||||||
@@ -92,7 +94,6 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
this->ui->led_Audio->setOn(!this->getIContextAudio()->isMuted());
|
this->ui->led_Audio->setOn(!this->getIContextAudio()->isMuted());
|
||||||
connect(getIContextAudio(), &IContextAudio::changedMute, this, &CInfoBarStatusComponent::ps_onMuteChanged);
|
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)
|
void CInfoBarStatusComponent::ps_onMuteChanged(bool muted)
|
||||||
{
|
{
|
||||||
this->ui->led_Audio->setOn(!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
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ namespace BlackGui
|
|||||||
//! Context menu requested
|
//! Context menu requested
|
||||||
void ps_customAudioContextMenuRequested(const QPoint &position);
|
void ps_customAudioContextMenuRequested(const QPoint &position);
|
||||||
|
|
||||||
//! Volumes changed 0..100
|
|
||||||
void ps_onVolumesChanged(qint32 com1Volume, qint32 com2Volume);
|
|
||||||
|
|
||||||
//! Mute changed
|
//! Mute changed
|
||||||
void ps_onMuteChanged(bool muted);
|
void ps_onMuteChanged(bool muted);
|
||||||
|
|
||||||
|
//! Mapper is ready
|
||||||
|
void ps_onMapperReady();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hl_InfoBarStatus">
|
<layout class="QHBoxLayout" name="hl_InfoBarStatus">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<string>Network</string>
|
<string>Network</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Net</string>
|
<string>nt.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<string>Simulator</string>
|
<string>Simulator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sim</string>
|
<string>sm.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -84,6 +84,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lb_MapperReady">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Mappings ready</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>mp.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::CLedWidget" name="led_MapperReady" native="true"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lbl_DBus">
|
<widget class="QLabel" name="lbl_DBus">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -93,7 +106,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>DBus</string>
|
<string>DB</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -119,7 +132,7 @@
|
|||||||
<string>Push to talk</string>
|
<string>Push to talk</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ptt</string>
|
<string>ptt</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -135,7 +148,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Audio</string>
|
<string>au.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|||||||
@@ -304,6 +304,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="menu_WindowFont"/>
|
<addaction name="menu_WindowFont"/>
|
||||||
<addaction name="menu_WindowMinimize"/>
|
<addaction name="menu_WindowMinimize"/>
|
||||||
|
<addaction name="menu_WindowToggleOnTop"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu_File"/>
|
<addaction name="menu_File"/>
|
||||||
<addaction name="menuWindow"/>
|
<addaction name="menuWindow"/>
|
||||||
@@ -419,6 +420,14 @@
|
|||||||
<string>Ctrl+W, Ctrl+M</string>
|
<string>Ctrl+W, Ctrl+M</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="menu_WindowToggleOnTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Toggle stay on top</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+W, Ctrl+T</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ void SwiftGuiStd::initGuiSignals()
|
|||||||
connect(this->ui->menu_FileReloadStyleSheets, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
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_WindowFont, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
||||||
connect(this->ui->menu_WindowMinimize, &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);
|
connect(this->ui->menu_DebugMetaTypes, &QAction::triggered, this, &SwiftGuiStd::ps_onMenuClicked);
|
||||||
|
|
||||||
// command line / text messages
|
// command line / text messages
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ void SwiftGuiStd::ps_onMenuClicked()
|
|||||||
{
|
{
|
||||||
this->showMinimized();
|
this->showMinimized();
|
||||||
}
|
}
|
||||||
|
else if (sender == this->ui->menu_WindowToggleOnTop)
|
||||||
|
{
|
||||||
|
this->ps_toogleWindowStayOnTop();
|
||||||
|
}
|
||||||
else if (sender == this->ui->menu_FileClose)
|
else if (sender == this->ui->menu_FileClose)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Closing");
|
CLogMessage(this).info("Closing");
|
||||||
|
|||||||
Reference in New Issue
Block a user