Some fixes for interpolation setups

* added missing signal
* refresh list on reload button press
* display pitch value
* list ctor for single object
This commit is contained in:
Klaus Basan
2020-04-15 05:30:48 +02:00
committed by Mat Sutcliffe
parent 9b031bb582
commit 148368ca0c
11 changed files with 77 additions and 55 deletions

View File

@@ -34,15 +34,15 @@ namespace BlackGui
ui->tvp_InterpolationSetup->menuAddItems(CInterpolationSetupView::MenuRemoveSelectedRows);
connect(ui->pb_RenderingSetup, &QPushButton::clicked, this, &CInterpolationSetupComponent::requestRenderingRestrictionsWidget);
connect(ui->pb_Save, &QPushButton::clicked, this, &CInterpolationSetupComponent::saveSetup);
connect(ui->pb_DeleteOrReset, &QPushButton::clicked, this, &CInterpolationSetupComponent::removeOrResetSetup);
connect(ui->pb_Reload, &QPushButton::clicked, this, &CInterpolationSetupComponent::reloadSetup);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::doubleClicked, this, &CInterpolationSetupComponent::onRowDoubleClicked);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::modelChanged, this, &CInterpolationSetupComponent::onModelChanged, Qt::QueuedConnection);
connect(ui->pb_Save, &QPushButton::clicked, this, &CInterpolationSetupComponent::saveSetup);
connect(ui->pb_DeleteOrReset, &QPushButton::clicked, this, &CInterpolationSetupComponent::removeOrResetSetup);
connect(ui->pb_Reload, &QPushButton::clicked, this, &CInterpolationSetupComponent::reloadSetup, Qt::QueuedConnection);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::doubleClicked, this, &CInterpolationSetupComponent::onRowDoubleClicked);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::modelChanged, this, &CInterpolationSetupComponent::onModelChanged, Qt::QueuedConnection);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::modelDataChanged, this, &CInterpolationSetupComponent::onModelChanged, Qt::QueuedConnection);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::objectsDeleted, this, &CInterpolationSetupComponent::onObjectsDeleted, Qt::QueuedConnection);
connect(ui->tvp_InterpolationSetup, &CInterpolationSetupView::objectsDeleted, this, &CInterpolationSetupComponent::onObjectsDeleted, Qt::QueuedConnection);
connect(ui->rb_Callsign, &QRadioButton::released, this, &CInterpolationSetupComponent::onModeChanged);
connect(ui->rb_Global, &QRadioButton::released, this, &CInterpolationSetupComponent::onModeChanged);
connect(ui->rb_Global, &QRadioButton::released, this, &CInterpolationSetupComponent::onModeChanged);
if (sGui && sGui->getIContextSimulator())
{
connect(sGui->getIContextSimulator(), &IContextSimulator::interpolationAndRenderingSetupChanged, this, &CInterpolationSetupComponent::onSetupChanged, Qt::QueuedConnection);
@@ -106,9 +106,15 @@ namespace BlackGui
// void
}
void CInterpolationSetupComponent::onReloadSetup()
{
this->reloadSetup();
this->displaySetupsPerCallsign();
}
void CInterpolationSetupComponent::reloadSetup()
{
const bool global = (this->getSetupMode() == CInterpolationSetupComponent::SetupGlobal);
const bool global = (this->getSetupMode() == CInterpolationSetupComponent::SetupGlobal);
const bool overlay = QObject::sender() == ui->pb_Reload;
if (!this->checkPrerequisites(!global, overlay)) { return; }
if (global)
@@ -268,7 +274,7 @@ namespace BlackGui
CInterpolationSetupList setups = ui->tvp_InterpolationSetup->container();
setups.removeByCallsigns(deletedSetups.getCallsigns());
const bool set = this->setSetupsToContext(setups, true);
Q_UNUSED(set);
Q_UNUSED(set)
}
}
} // ns

View File

@@ -39,7 +39,7 @@ namespace BlackGui
explicit CInterpolationSetupComponent(QWidget *parent = nullptr);
//! Destructor
virtual ~CInterpolationSetupComponent();
virtual ~CInterpolationSetupComponent() override;
//! Setup mode
Mode getSetupMode() const;
@@ -60,6 +60,9 @@ namespace BlackGui
//! View has been changed
void onModelChanged();
//! Requested reload
void onReloadSetup();
//! Reload
void reloadSetup();

View File

@@ -82,13 +82,13 @@ namespace BlackGui
CStatusMessageList CInterpolationSetupForm::validate(bool nested) const
{
Q_UNUSED(nested);
Q_UNUSED(nested)
return CStatusMessageList();
}
void CInterpolationSetupForm::onCheckboxChanged(int state)
{
Q_UNUSED(state);
Q_UNUSED(state)
emit this->valueChanged();
}
@@ -112,7 +112,7 @@ namespace BlackGui
void CInterpolationSetupForm::onInterpolatorModeChanged(bool checked)
{
Q_UNUSED(checked);
Q_UNUSED(checked)
emit this->valueChanged();
}
@@ -126,7 +126,7 @@ namespace BlackGui
{
CAngle pitch;
const QString p = ui->le_PitchOnGround->text().trimmed();
pitch.parseFromString(p, CPqString::SeparatorBestGuess);
pitch.parseFromString(p, CPqString::SeparatorBestGuess, CAngleUnit::deg());
return pitch;
}

View File

@@ -13,6 +13,7 @@
#include <QtGlobal>
using namespace BlackMisc;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Simulation;
@@ -24,13 +25,15 @@ namespace BlackGui
CListModelCallsignObjects("CInterpolationSetupListModel", parent)
{
m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", CInterpolationAndRenderingSetupPerCallsign::IndexCallsign, CCallsign::IndexCallsignString));
this->m_columns.addColumn(CColumn::standardString("interpolator", CInterpolationAndRenderingSetupPerCallsign::IndexInterpolatorModeAsString));
m_columns.addColumn(CColumn("parts", "aircraft parts", CInterpolationAndRenderingSetupPerCallsign::IndexEnabledAircraftParts, new CBoolIconFormatter("parts", "aircraft parts")));
m_columns.addColumn(CColumn("send gnd.", "send gnd.", CInterpolationAndRenderingSetupPerCallsign::IndexSendGndFlagToSimulator, new CBoolIconFormatter("send gnd.", "send gnd.")));
m_columns.addColumn(CColumn("sc.os.", "fix scenery offset", CInterpolationAndRenderingSetupPerCallsign::IndexFixSceneryOffset, new CBoolIconFormatter("sc.os.", "fix scenery offset")));
this->m_columns.addColumn(CColumn::standardString("interpolator", CInterpolationAndRenderingSetupPerCallsign::IndexInterpolatorModeAsString));
m_columns.addColumn(CColumn("parts", "aircraft parts", CInterpolationAndRenderingSetupPerCallsign::IndexEnabledAircraftParts, new CBoolIconFormatter("parts", "aircraft parts")));
m_columns.addColumn(CColumn("send gnd.", "send gnd.", CInterpolationAndRenderingSetupPerCallsign::IndexSendGndFlagToSimulator, new CBoolIconFormatter("send gnd.", "send gnd.")));
m_columns.addColumn(CColumn("sc.os.", "fix scenery offset", CInterpolationAndRenderingSetupPerCallsign::IndexFixSceneryOffset, new CBoolIconFormatter("sc.os.", "fix scenery offset")));
m_columns.addColumn(CColumn("full int.", "full interpolation", CInterpolationAndRenderingSetupPerCallsign::IndexForceFullInterpolation, new CBoolIconFormatter("full int.", "full interpolation")));
m_columns.addColumn(CColumn("sim.dbg.", "simulator debug", CInterpolationAndRenderingSetupPerCallsign::IndexSimulatorDebugMessages, new CBoolIconFormatter("sim.dbg.", "simulator debug")));
m_columns.addColumn(CColumn("log.int.", "log.interpolation", CInterpolationAndRenderingSetupPerCallsign::IndexLogInterpolation, new CBoolIconFormatter("log.int.", "log.interpolation")));
m_columns.addColumn(CColumn("sim.dbg.", "simulator debug", CInterpolationAndRenderingSetupPerCallsign::IndexSimulatorDebugMessages, new CBoolIconFormatter("sim.dbg.", "simulator debug")));
m_columns.addColumn(CColumn("log.int.", "log.interpolation", CInterpolationAndRenderingSetupPerCallsign::IndexLogInterpolation, new CBoolIconFormatter("log.int.", "log.interpolation")));
m_columns.addColumn(CColumn("gnd.pitch", "pitch on ground", CInterpolationAndRenderingSetupPerCallsign::IndexPitchOnGround, new CPhysiqalQuantiyFormatter<CAngleUnit, CAngle>(CAngleUnit::deg(), 1)));
// default sort order
this->setSortColumnByPropertyIndex(CCountry::IndexIsoCode);
m_sortOrder = Qt::AscendingOrder;

View File

@@ -31,7 +31,7 @@ namespace BlackGui
explicit CInterpolationSetupListModel(QObject *parent = nullptr);
//! Destructor
virtual ~CInterpolationSetupListModel() {}
virtual ~CInterpolationSetupListModel() override {}
};
} // ns
} // ns