mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Style, minor fixes
This commit is contained in:
@@ -294,6 +294,7 @@ namespace BlackCore
|
||||
|
||||
CAircraftModelList CDatabaseUtils::updateSimulatorForFsFamily(const CAircraftModelList &ownModels, int maxToStash, IProgressIndicator *progressIndicator, bool processEvents)
|
||||
{
|
||||
if (!sApp || !sApp->getWebDataServices()) { return CAircraftModelList(); }
|
||||
CAircraftModelList dbFsFamilyModels(sApp->getWebDataServices()->getModels().getAllFsFamilyModels());
|
||||
CAircraftModelList stashModels;
|
||||
if (dbFsFamilyModels.isEmpty() || ownModels.isEmpty()) { return stashModels; }
|
||||
@@ -328,7 +329,7 @@ namespace BlackCore
|
||||
// in DB
|
||||
CAircraftModel dbModel = dbFsFamilyModels.findFirstByModelStringOrDefault(ownModel.getModelString());
|
||||
if (!dbModel.isLoadedFromDb()) {continue; }
|
||||
if (dbModel.getSimulator() == ownModel.getSimulator()) {continue; }
|
||||
if (dbModel.getSimulator() == ownModel.getSimulator()) { continue; }
|
||||
|
||||
// update simulator and add
|
||||
CSimulatorInfo simulator(dbModel.getSimulator());
|
||||
|
||||
@@ -41,18 +41,18 @@ namespace BlackGui
|
||||
|
||||
void CDbAutoSimulatorStashingComponent::accept()
|
||||
{
|
||||
switch (this->m_state)
|
||||
switch (m_state)
|
||||
{
|
||||
case Running: return;
|
||||
case Completed:
|
||||
{
|
||||
if (!this->m_modelsToStash.isEmpty())
|
||||
if (!m_modelsToStash.isEmpty())
|
||||
{
|
||||
// this removes previously stashed models
|
||||
this->getMappingComponent()->replaceStashedModelsUnvalidated(this->m_modelsToStash);
|
||||
const CStatusMessage stashedMsg(this, CStatusMessage::SeverityInfo, QString("Stashed %1 models").arg(this->m_modelsToStash.size()));
|
||||
this->getMappingComponent()->replaceStashedModelsUnvalidated(m_modelsToStash);
|
||||
const CStatusMessage stashedMsg(this, CStatusMessage::SeverityInfo, QString("Stashed %1 models").arg(m_modelsToStash.size()));
|
||||
this->addStatusMessage(stashedMsg);
|
||||
this->m_modelsToStash.clear();
|
||||
m_modelsToStash.clear();
|
||||
}
|
||||
QDialog::accept();
|
||||
break;
|
||||
@@ -84,7 +84,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->bb_OkCancel->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui->tvp_StatusMessages->clear();
|
||||
this->m_state = Idle;
|
||||
m_state = Idle;
|
||||
this->updateProgressIndicator(0);
|
||||
|
||||
const QString infoAll = this->getMappingComponent()->getOwnModelsInfoStringFsFamily();
|
||||
@@ -128,7 +128,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "Missing mapping component");
|
||||
|
||||
if (!this->currentModelView()) { return; }
|
||||
this->m_state = Running;
|
||||
m_state = Running;
|
||||
int maxObjectsStashed = -1;
|
||||
if (!ui->le_MaxModelsStashed->text().isEmpty())
|
||||
{
|
||||
@@ -141,29 +141,31 @@ namespace BlackGui
|
||||
int ownModelsCount = 0;
|
||||
if (selected)
|
||||
{
|
||||
const QString intro("Checking %1 selected models");
|
||||
static const QString intro("Checking %1 selected models");
|
||||
const CAircraftModelList selectedModels(this->currentModelView()->selectedObjects());
|
||||
ownModelsCount = selectedModels.size();
|
||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, intro.arg(ownModelsCount)));
|
||||
this->m_modelsToStash = CDatabaseUtils::updateSimulatorForFsFamily(selectedModels, maxObjectsStashed, this, true);
|
||||
m_modelsToStash = CDatabaseUtils::updateSimulatorForFsFamily(selectedModels, maxObjectsStashed, this, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
const CDbMappingComponent *mappincComponent = this->getMappingComponent();
|
||||
const QSet<CSimulatorInfo> fsFamilySims(CSimulatorInfo::allFsFamilySimulators().asSingleSimulatorSet());
|
||||
const QString intro("Checking %1 models for %2");
|
||||
static const QString intro("Checking %1 models for %2");
|
||||
|
||||
// check all own models
|
||||
for (const CSimulatorInfo &simulator : fsFamilySims)
|
||||
{
|
||||
const CAircraftModelList ownModels = mappincComponent->getOwnCachedModels(simulator);
|
||||
const QString sim = simulator.toQString();
|
||||
ownModelsCount += ownModels.size();
|
||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, intro.arg(ownModels.size()).arg(sim)));
|
||||
this->m_modelsToStash.push_back(CDatabaseUtils::updateSimulatorForFsFamily(ownModels, maxObjectsStashed, this, true));
|
||||
m_modelsToStash.push_back(CDatabaseUtils::updateSimulatorForFsFamily(ownModels, maxObjectsStashed, this, true));
|
||||
}
|
||||
}
|
||||
const QString result("Tested %1 own models, %2 models should be updated in DB");
|
||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, result.arg(ownModelsCount).arg(this->m_modelsToStash.size())));
|
||||
this->m_state = Completed;
|
||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, result.arg(ownModelsCount).arg(m_modelsToStash.size())));
|
||||
m_state = Completed;
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -27,12 +27,12 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
/**
|
||||
* Allows to automatically updated models if found in own model set, but already existing
|
||||
* Allows to automatically update models if found in own model set, but already existing
|
||||
* for a sibling simulator (ie. FSX/P3D/FS9)
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbAutoSimulatorStashingComponent :
|
||||
public QDialog,
|
||||
public BlackGui::Components::CDbMappingComponentAware,
|
||||
public Components::CDbMappingComponentAware,
|
||||
public BlackCore::IProgressIndicator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<height>402</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -19,42 +19,104 @@
|
||||
<property name="windowTitle">
|
||||
<string>Cross simulator updating (FSX-P3D-FS9)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0" colspan="4">
|
||||
<layout class="QVBoxLayout" name="vl_AutoSimulator">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_Info">
|
||||
<property name="title">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_Info">
|
||||
<property name="text">
|
||||
<string>This tool checks the DB models simulator info against your local simulator info. For instance, if a model is locally found in P3D, the DB should also reflect that fact.You can easily update the sibling simulators by running the tool here. It will automatically stash the changes for you.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_UpdateModels">
|
||||
<property name="title">
|
||||
<string>Update models</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="le_AllSets">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_ScanAllModels">
|
||||
<property name="text">
|
||||
<string>scan all models</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ScanAllOrSelected</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_Selected">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxModelsStashed">
|
||||
<property name="text">
|
||||
<string>Max.stashed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="rb_SelectedOnly">
|
||||
<property name="text">
|
||||
<string>selected</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ScanAllOrSelected</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_MaxModelsStashed">
|
||||
<property name="placeholderText">
|
||||
<string>max.models to be stashed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="BlackGui::Views::CStatusMessageView" name="tvp_StatusMessages">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="pb_StashingProgress">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="BlackGui::Views::CStatusMessageView" name="tvp_StatusMessages">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_AllSets">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rb_SelectedOnly">
|
||||
<property name="text">
|
||||
<string>selected</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ScanAllOrSelected</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="4">
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -64,40 +126,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rb_ScanAllModels">
|
||||
<property name="text">
|
||||
<string>scan all models</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">bg_ScanAllOrSelected</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_Selected">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxModelsStashed">
|
||||
<property name="text">
|
||||
<string>Max.stashed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="le_MaxModelsStashed">
|
||||
<property name="placeholderText">
|
||||
<string>max.models to be stashed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -107,6 +135,14 @@
|
||||
<header>blackgui/views/statusmessageview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>rb_SelectedOnly</tabstop>
|
||||
<tabstop>le_Selected</tabstop>
|
||||
<tabstop>rb_ScanAllModels</tabstop>
|
||||
<tabstop>le_AllSets</tabstop>
|
||||
<tabstop>tvp_StatusMessages</tabstop>
|
||||
<tabstop>le_MaxModelsStashed</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackGui
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbDistributorSelectorComponent :
|
||||
public QFrame,
|
||||
public BlackGui::CDropBase
|
||||
public CDropBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user