refs #735, remove invalid objects from stash

* button "remove invalid objects"
* tab order fixed
This commit is contained in:
Klaus Basan
2016-08-16 23:48:08 +02:00
committed by Mathew Sutcliffe
parent 9c2a2de4c5
commit 61ac328d10
4 changed files with 35 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ namespace BlackGui
connect(this->ui->pb_Publish, &QPushButton::pressed, this, &CDbStashComponent::ps_onPublishPressed);
connect(this->ui->tvp_StashAircraftModels, &CAircraftModelView::modelChanged, this, &CDbStashComponent::stashedModelsChanged);
connect(this->ui->tvp_StashAircraftModels, &CAircraftModelView::modelDataChanged, this, &CDbStashComponent::ps_onRowCountChanged);
connect(ui->pb_RemoveInvald, &QPushButton::pressed, this, &CDbStashComponent::ps_onRemoveInvalidPressed);
// copy over buttons
connect(this->ui->pb_AircraftIcao, &QPushButton::pressed, this, &CDbStashComponent::ps_copyOverPartsToSelected);
@@ -236,6 +237,15 @@ namespace BlackGui
this->validateAndDisplay(validModels, invalidModels, true);
}
void CDbStashComponent::ps_onRemoveInvalidPressed()
{
if (ui->tvp_StashAircraftModels->isEmpty()) {return; }
CAircraftModelList validModels;
CAircraftModelList invalidModels;
this->validate(validModels, invalidModels);
this->unstashModels(invalidModels);
}
void CDbStashComponent::ps_onPublishPressed()
{
if (this->ui->tvp_StashAircraftModels->isEmpty()) {return; }

View File

@@ -77,6 +77,9 @@ namespace BlackGui
//! Unstash given models by model string
int unstashModels(QStringList modelStrings);
//! Unstash given models
int unstashModels(const BlackMisc::Simulation::CAircraftModelList &models);
//! The embedded view
BlackGui::Views::CAircraftModelView *view() const;
@@ -140,6 +143,9 @@ namespace BlackGui
//! Validate pressed
void ps_onValidatePressed();
//! Remove invalid (validates and removes invalid models)
void ps_onRemoveInvalidPressed();
//! Publish pressed
void ps_onPublishPressed();

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>616</width>
<width>773</width>
<height>221</height>
</rect>
</property>
@@ -90,6 +90,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_RemoveInvald">
<property name="toolTip">
<string>Remove invalid models</string>
</property>
<property name="text">
<string>Rem. invalid</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_Publish">
<property name="text">
@@ -155,10 +165,16 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tvp_StashAircraftModels</tabstop>
<tabstop>pb_Unstash</tabstop>
<tabstop>pb_Validate</tabstop>
<tabstop>pb_RemoveInvald</tabstop>
<tabstop>pb_Publish</tabstop>
<tabstop>tvp_StashAircraftModels</tabstop>
<tabstop>cb_SelectedOnly</tabstop>
<tabstop>pb_Distributor</tabstop>
<tabstop>pb_AircraftIcao</tabstop>
<tabstop>pb_Livery</tabstop>
<tabstop>pb_AirlineIcao</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -145,7 +145,7 @@ namespace BlackGui
{
if (modelStrings.isEmpty()) { return 0; }
CAircraftModelList copy(this->container());
int delta = copy.removeModelsWithString(modelStrings, sensitivity);
const int delta = copy.removeModelsWithString(modelStrings, sensitivity);
if (delta > 0)
{
this->updateContainerMaybeAsync(copy);