Ref T259, Ref T243 use new context functions for global setup in settings component

This commit is contained in:
Klaus Basan
2018-03-19 21:06:04 +01:00
parent 127b20b6ad
commit 101e5bb6c3
2 changed files with 140 additions and 86 deletions

View File

@@ -10,12 +10,6 @@
<height>337</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
@@ -36,76 +30,6 @@
<property name="verticalSpacing">
<number>20</number>
</property>
<item row="2" column="0">
<widget class="QPushButton" name="pb_Network">
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_Audio">
<property name="text">
<string>Audio</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_Servers">
<property name="text">
<string>Servers</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_Advanced">
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_Gui">
<property name="text">
<string>GUI</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="pb_SimulatorBasics">
<property name="text">
<string>Simulator (basics)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pb_Hotkeys">
<property name="text">
<string>Hotkeys</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pb_Simulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_DataLoadAndCaches">
<property name="text">
<string>Data load and caches</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pb_SimulatorMessages">
<property name="text">
<string>Simulator (messages)</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<spacer name="vs_OverviewBottom">
<property name="orientation">
@@ -119,6 +43,136 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pb_Network">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_Servers">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Servers</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_Advanced">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_Audio">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Audio</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_Gui">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>GUI</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="pb_SimulatorBasics">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator (basics)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pb_Simulator">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_DataLoadAndCaches">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data load and caches</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pb_Hotkeys">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hotkeys</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pb_SimulatorMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator (messages)</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<spacer name="vs_OverviewTop">
<property name="orientation">

View File

@@ -102,7 +102,7 @@ namespace BlackGui
void CSettingsSimulatorComponent::setGuiValues()
{
const CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
const CInterpolationAndRenderingSetupGlobal setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
// time sync
ui->cb_TimeSync->setEnabled(m_pluginLoaded);
@@ -181,17 +181,17 @@ namespace BlackGui
void CSettingsSimulatorComponent::onApplyMaxRenderedAircraft()
{
// get initial aircraft to render
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
CInterpolationAndRenderingSetupGlobal setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
const int noRequested = ui->le_MaxAircraft->text().isEmpty() ? setup.InfiniteAircraft() : ui->le_MaxAircraft->text().toInt();
const int oldValue = setup.getMaxRenderedAircraft();
if (oldValue == noRequested) { return; }
// set value
setup.setMaxRenderedAircraft(noRequested);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetupGlobal(setup);
// re-read real value
setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
const int noRendered = setup.getMaxRenderedAircraft();
if (noRequested == noRendered)
{
@@ -208,7 +208,7 @@ namespace BlackGui
void CSettingsSimulatorComponent::onApplyMaxRenderedDistance()
{
// get initial aircraft to render
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
CInterpolationAndRenderingSetupGlobal setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
CLength newDistance(0, nullptr);
if (!ui->le_MaxDistance->text().isEmpty())
{
@@ -224,16 +224,16 @@ namespace BlackGui
{
CLogMessage(this).info("Max.distance requested: %1") << newDistance.valueRoundedWithUnit(2, true);
setup.setMaxRenderedDistance(newDistance);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetupGlobal(setup);
this->setGuiValues();
}
}
void CSettingsSimulatorComponent::onApplyDisableRendering()
{
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
CInterpolationAndRenderingSetupGlobal setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
setup.disableRendering();
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetupGlobal(setup);
this->setGuiValues();
}
@@ -258,9 +258,9 @@ namespace BlackGui
void CSettingsSimulatorComponent::clearRestricedRendering()
{
CInterpolationAndRenderingSetup setup;
CInterpolationAndRenderingSetupGlobal setup;
setup.clearAllRenderingRestrictions();
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
sGui->getIContextSimulator()->setInterpolationAndRenderingSetupGlobal(setup);
this->setGuiValues();
}