refs #799, changed components to use settings

* removed update timer
* Removed getter/setters for update times
* used UI component for settings in main settings component
This commit is contained in:
Klaus Basan
2016-11-11 20:41:50 +01:00
parent 5bde36479d
commit df64f31dbf
19 changed files with 141 additions and 383 deletions

View File

@@ -11,7 +11,6 @@
#include "blackcore/context/contextsimulator.h"
#include "blackcore/network.h"
#include "blackgui/components/mappingcomponent.h"
#include "blackgui/components/updatetimer.h"
#include "blackgui/guiapplication.h"
#include "blackgui/guiutility.h"
#include "blackgui/models/aircraftmodellistmodel.h"
@@ -51,6 +50,7 @@ using namespace BlackGui;
using namespace BlackGui::Views;
using namespace BlackGui::Models;
using namespace BlackGui::Filters;
using namespace BlackGui::Settings;
namespace BlackGui
{
@@ -59,8 +59,7 @@ namespace BlackGui
CMappingComponent::CMappingComponent(QWidget *parent) :
QFrame(parent),
CIdentifiable(this),
ui(new Ui::CMappingComponent),
m_updateTimer(new CUpdateTimer("CMappingComponent", &CMappingComponent::ps_backgroundUpdate, this))
ui(new Ui::CMappingComponent)
{
ui->setupUi(this);
ui->tvp_AircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnSimulatorModel);
@@ -100,7 +99,8 @@ namespace BlackGui
// Updates
ui->tvp_AircraftModels->setDisplayAutomatically(false);
this->m_updateTimer->setUpdateInterval(10 * 1000);
this->ps_settingsChanged();
connect(&m_updateTimer, &QTimer::timeout, this, &CMappingComponent::ps_backgroundUpdate);
connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CMappingComponent::ps_onModelSetChanged);
connect(sGui->getIContextSimulator(), &IContextSimulator::modelMatchingCompleted, this, &CMappingComponent::ps_markRenderedAircraftForUpdate);
@@ -441,5 +441,11 @@ namespace BlackGui
this->updateRenderedAircraftView(true);
}
}
void CMappingComponent::ps_settingsChanged()
{
const CViewUpdateSettings settings = this->m_settings.get();
this->m_updateTimer.setInterval(settings.getAircraftUpdateTime().toMs());
}
} // namespace
} // namespace