refs #829, use settings for own model set

(ignore excluded models)
This commit is contained in:
Klaus Basan
2016-12-10 01:30:57 +01:00
parent fcb8df92b1
commit e55867c297
2 changed files with 15 additions and 3 deletions

View File

@@ -168,10 +168,13 @@ namespace BlackGui
return CStatusMessage(this, CStatusMessage::SeverityError,
"Cannot add data for " + simulator.toQString(true) + " to " + this->getModelSetSimulator().toQString(true), true);
}
const bool allowExcludedModels = this->m_modelSettings.get().getAllowExcludedModels();
CAircraftModelList updateModels(this->getModelSet());
const int d = updateModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
int d = updateModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
if (d > 0)
{
if (!allowExcludedModels) { updateModels.removeIfExcluded(); }
updateModels.resetOrder();
ui->tvp_OwnModelSet->updateContainerMaybeAsync(updateModels);
return CStatusMessage(this, CStatusMessage::SeverityInfo, "Modified " + QString::number(d) + " entries in model set " + this->getModelSetSimulator().toQString(true), true);
@@ -274,6 +277,11 @@ namespace BlackGui
}
}
void CDbOwnModelSetComponent::ps_modelSettingsChanged()
{
// void
}
void CDbOwnModelSetComponent::ps_viewModelChanged()
{
ui->pb_SaveAsSetForSimulator->setEnabled(true);

View File

@@ -29,8 +29,8 @@
class QAction;
class QWidget;
namespace BlackMisc { namespace Simulation { class CAircraftModel; } }
namespace Ui { class CDbOwnModelSetComponent; }
namespace BlackMisc { namespace Simulation { class CAircraftModel; } }
namespace BlackGui
{
namespace Menus { class CMenuActions; }
@@ -122,6 +122,9 @@ namespace BlackGui
//! Preferences changed
void ps_distributorPreferencesChanged();
//! Model settings changed
void ps_modelSettingsChanged();
//! Model (of view) has been changed
void ps_viewModelChanged();
@@ -144,7 +147,8 @@ namespace BlackGui
QScopedPointer<Ui::CDbOwnModelSetComponent> ui;
QScopedPointer<CDbOwnModelSetDialog> m_modelSetDialog;
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this };
BlackMisc::CSetting<BlackMisc::Simulation::TDistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::ps_distributorPreferencesChanged };
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::TDistributorListPreferences> m_distributorPreferences { this, &CDbOwnModelSetComponent::ps_distributorPreferencesChanged }; //!< distributor preferences
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::TModel> m_modelSettings { this, &CDbOwnModelSetComponent::ps_modelSettingsChanged }; //!< settings for models
// -------------------------- custom menus -----------------------------------