Ref T312, UI simulator settings to check listeners manually per push button

This commit is contained in:
Klaus Basan
2018-08-27 18:50:04 +02:00
parent 2c1055cc2e
commit be816f076d
3 changed files with 255 additions and 269 deletions

View File

@@ -61,7 +61,7 @@ namespace BlackGui
m_plugins->collectPlugins(); m_plugins->collectPlugins();
ui->setupUi(this); ui->setupUi(this);
CLedWidget::LedShape shape = CLedWidget::Circle; const CLedWidget::LedShape shape = CLedWidget::Circle;
ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14); ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14);
ui->led_RenderingEnabled->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Rendering enabled", "No aircraft will be rendered", 14); ui->led_RenderingEnabled->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Rendering enabled", "No aircraft will be rendered", 14);
@@ -78,6 +78,7 @@ namespace BlackGui
connect(ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance); connect(ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance);
connect(ui->pb_ClearRestrictedRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::clearRestricedRendering); connect(ui->pb_ClearRestrictedRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::clearRestricedRendering);
connect(ui->pb_DisableRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyDisableRendering); connect(ui->pb_DisableRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onApplyDisableRendering);
connect(ui->pb_Check, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::checkSimulatorPlugins);
connect(ui->le_MaxAircraft, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft); connect(ui->le_MaxAircraft, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft);
connect(ui->le_MaxDistance, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance); connect(ui->le_MaxDistance, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::onApplyMaxRenderedDistance);
connect(ui->le_MaxAircraft, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft); connect(ui->le_MaxAircraft, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::onApplyMaxRenderedAircraft);
@@ -119,6 +120,7 @@ namespace BlackGui
ui->pb_ApplyMaxDistance->setEnabled(m_pluginLoaded); ui->pb_ApplyMaxDistance->setEnabled(m_pluginLoaded);
ui->pb_ClearRestrictedRendering->setEnabled((m_pluginLoaded)); ui->pb_ClearRestrictedRendering->setEnabled((m_pluginLoaded));
ui->pb_DisableRendering->setEnabled(m_pluginLoaded); ui->pb_DisableRendering->setEnabled(m_pluginLoaded);
ui->pb_Check->setEnabled(!m_pluginLoaded);
if (m_pluginLoaded) if (m_pluginLoaded)
{ {
@@ -285,7 +287,7 @@ namespace BlackGui
void CSettingsSimulatorComponent::showPluginDetails(const QString &identifier) void CSettingsSimulatorComponent::showPluginDetails(const QString &identifier)
{ {
const CSimulatorPluginInfoList simDrivers(getAvailablePlugins()); const CSimulatorPluginInfoList simDrivers(this->getAvailablePlugins());
const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier); const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier);
QWidget *aw = qApp->activeWindow(); QWidget *aw = qApp->activeWindow();
@@ -325,11 +327,17 @@ namespace BlackGui
{ {
// list all available simulators // list all available simulators
const auto enabledSimulators = m_enabledSimulators.getThreadLocal(); const auto enabledSimulators = m_enabledSimulators.getThreadLocal();
for (const auto &p : getAvailablePlugins()) for (const auto &p : this->getAvailablePlugins())
{ {
ui->pluginSelector_EnabledSimulators->setEnabled(p.getIdentifier(), enabledSimulators.contains(p.getIdentifier())); ui->pluginSelector_EnabledSimulators->setEnabled(p.getIdentifier(), enabledSimulators.contains(p.getIdentifier()));
} }
} }
}
void CSettingsSimulatorComponent::checkSimulatorPlugins()
{
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
if (sGui->getIContextSimulator()->isSimulatorAvailable()) { return; } // already available
sGui->getIContextSimulator()->checkListeners();
}
}
} // namespace } // namespace

View File

@@ -22,8 +22,6 @@
#include <QScopedPointer> #include <QScopedPointer>
#include <QString> #include <QString>
class QWidget;
namespace BlackCore { class CPluginManagerSimulator; } namespace BlackCore { class CPluginManagerSimulator; }
namespace BlackMisc { namespace Simulation { class CSimulatorPluginInfo; } } namespace BlackMisc { namespace Simulation { class CSimulatorPluginInfo; } }
namespace Ui { class CSettingsSimulatorComponent; } namespace Ui { class CSettingsSimulatorComponent; }
@@ -56,7 +54,7 @@ namespace BlackGui
//! Apply disable rendering //! Apply disable rendering
void onApplyDisableRendering(); void onApplyDisableRendering();
//! Apply time sync //! Apply time synchronization
void onApplyTimeSync(); void onApplyTimeSync();
//! Clear restricted rendering //! Clear restricted rendering
@@ -74,6 +72,9 @@ namespace BlackGui
//! Select/deselect enabled/disabled plugins //! Select/deselect enabled/disabled plugins
void reloadPluginConfig(); void reloadPluginConfig();
//! Check plugins again
void checkSimulatorPlugins();
//! Set the GUI values //! Set the GUI values
void setGuiValues(); void setGuiValues();

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>220</width> <width>220</width>
<height>255</height> <height>260</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -35,243 +35,32 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item row="3" column="1"> <item row="5" column="2">
<widget class="QLabel" name="lbl_PluginInfo"> <widget class="QPushButton" name="pb_ApplyTimeSync">
<property name="text"> <property name="sizePolicy">
<string>Simulator info will go here</string> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lbl_RestrictedRendering">
<property name="toolTip">
<string>Current rendering restrictions (if any)</string>
</property>
<property name="text">
<string>Restrictions</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="hl_RestrictedRendering">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="BlackGui::CLedWidget" name="led_RestrictedRendering" native="true"/>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="lbl_RestrictionText">
<property name="text">
<string>restriction info</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>clear</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbl_LoadedPlugin">
<property name="text">
<string>Loaded</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="BlackGui::CPluginSelector" name="pluginSelector_EnabledSimulators" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>60</width>
<height>50</height> <height>0</height>
</size> </size>
</property> </property>
</widget> <property name="maximumSize">
</item> <size>
<item row="4" column="0"> <width>60</width>
<widget class="QLabel" name="lbl_TimeSync"> <height>16777215</height>
<property name="toolTip"> </size>
<string>Time synchronization</string>
</property> </property>
<property name="text"> <property name="text">
<string>Time synch.</string> <string>apply</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lbl_RenderingEnabled">
<property name="toolTip">
<string>Rendering enabled</string>
</property>
<property name="text">
<string>Rendering en.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<layout class="QHBoxLayout" name="hl_RenderingEnabled">
<item>
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true"/>
</item>
<item>
<spacer name="hs_RenderingEnabled">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_DisableRendering">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>disable</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="hl_MaxAircraft">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLineEdit" name="le_MaxAircraft">
<property name="placeholderText">
<string>no restrictions</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>apply</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_Check">
<property name="text">
<string>Check</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbl_MaxDistance">
<property name="text">
<string>Max.dist.(NM)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="hl_MaxDistance">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLineEdit" name="le_MaxDistance">
<property name="placeholderText">
<string>no restrictions</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_ApplyMaxDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>apply</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QWidget" name="wi_TimeSync" native="true"> <widget class="QWidget" name="wi_TimeSync" native="true">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin"> <property name="leftMargin">
@@ -324,49 +113,226 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="pb_ApplyTimeSync">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>apply</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="1">
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true">
<property name="minimumSize">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>apply</string>
</property>
</widget>
</item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QLabel" name="lbl_RestrictedRendering">
<property name="toolTip">
<string>Current rendering restrictions (if any)</string>
</property>
<property name="text">
<string>Restrictions</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lbl_TimeSync">
<property name="toolTip">
<string>Time synchronization</string>
</property>
<property name="text">
<string>Time synch.</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="hl_RestrictedRendering">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="BlackGui::CLedWidget" name="led_RestrictedRendering" native="true"/>
</item>
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="lbl_RestrictionText">
<property name="text">
<string>restriction info</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbl_LoadedPlugin">
<property name="text">
<string>Loaded</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lbl_RenderingEnabled">
<property name="toolTip">
<string>Rendering enabled</string>
</property>
<property name="text">
<string>Rendering en.</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lbl_MaxDistance">
<property name="text">
<string>Max.dist.(NM)</string>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="hl_MaxAircraft">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLineEdit" name="le_MaxAircraft">
<property name="placeholderText">
<string>no restrictions</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="hl_MaxDistance">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QLineEdit" name="le_MaxDistance">
<property name="placeholderText">
<string>no restrictions</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0">
<widget class="QLabel" name="lbl_MaxAircraft"> <widget class="QLabel" name="lbl_MaxAircraft">
<property name="text"> <property name="text">
<string>Max.aircraft</string> <string>Max.aircraft</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" alignment="Qt::AlignRight"> <item row="9" column="2">
<widget class="QPushButton" name="pb_Check"> <widget class="QPushButton" name="pb_ApplyMaxDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>check</string> <string>apply</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="7" column="2">
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>clear</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="BlackGui::CPluginSelector" name="pluginSelector_EnabledSimulators" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="pb_DisableRendering">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>disable</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="vs_Top"> <spacer name="vs_Top">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -382,6 +348,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="1" colspan="2" alignment="Qt::AlignRight">
<widget class="QPushButton" name="pb_Check">
<property name="text">
<string>check again </string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="lbl_PluginInfo">
<property name="text">
<string>Simulator info will go here</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
@@ -399,16 +382,10 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>pb_Check</tabstop>
<tabstop>cb_TimeSync</tabstop> <tabstop>cb_TimeSync</tabstop>
<tabstop>le_TimeSyncOffset</tabstop> <tabstop>le_TimeSyncOffset</tabstop>
<tabstop>pb_ApplyTimeSync</tabstop>
<tabstop>pb_DisableRendering</tabstop>
<tabstop>pb_ClearRestrictedRendering</tabstop>
<tabstop>le_MaxAircraft</tabstop> <tabstop>le_MaxAircraft</tabstop>
<tabstop>pb_ApplyMaxAircraft</tabstop>
<tabstop>le_MaxDistance</tabstop> <tabstop>le_MaxDistance</tabstop>
<tabstop>pb_ApplyMaxDistance</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>