mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +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)
|
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 dbFsFamilyModels(sApp->getWebDataServices()->getModels().getAllFsFamilyModels());
|
||||||
CAircraftModelList stashModels;
|
CAircraftModelList stashModels;
|
||||||
if (dbFsFamilyModels.isEmpty() || ownModels.isEmpty()) { return stashModels; }
|
if (dbFsFamilyModels.isEmpty() || ownModels.isEmpty()) { return stashModels; }
|
||||||
|
|||||||
@@ -41,18 +41,18 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDbAutoSimulatorStashingComponent::accept()
|
void CDbAutoSimulatorStashingComponent::accept()
|
||||||
{
|
{
|
||||||
switch (this->m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
case Running: return;
|
case Running: return;
|
||||||
case Completed:
|
case Completed:
|
||||||
{
|
{
|
||||||
if (!this->m_modelsToStash.isEmpty())
|
if (!m_modelsToStash.isEmpty())
|
||||||
{
|
{
|
||||||
// this removes previously stashed models
|
// this removes previously stashed models
|
||||||
this->getMappingComponent()->replaceStashedModelsUnvalidated(this->m_modelsToStash);
|
this->getMappingComponent()->replaceStashedModelsUnvalidated(m_modelsToStash);
|
||||||
const CStatusMessage stashedMsg(this, CStatusMessage::SeverityInfo, QString("Stashed %1 models").arg(this->m_modelsToStash.size()));
|
const CStatusMessage stashedMsg(this, CStatusMessage::SeverityInfo, QString("Stashed %1 models").arg(m_modelsToStash.size()));
|
||||||
this->addStatusMessage(stashedMsg);
|
this->addStatusMessage(stashedMsg);
|
||||||
this->m_modelsToStash.clear();
|
m_modelsToStash.clear();
|
||||||
}
|
}
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
break;
|
break;
|
||||||
@@ -84,7 +84,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
ui->bb_OkCancel->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
ui->bb_OkCancel->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
ui->tvp_StatusMessages->clear();
|
ui->tvp_StatusMessages->clear();
|
||||||
this->m_state = Idle;
|
m_state = Idle;
|
||||||
this->updateProgressIndicator(0);
|
this->updateProgressIndicator(0);
|
||||||
|
|
||||||
const QString infoAll = this->getMappingComponent()->getOwnModelsInfoStringFsFamily();
|
const QString infoAll = this->getMappingComponent()->getOwnModelsInfoStringFsFamily();
|
||||||
@@ -128,7 +128,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "Missing mapping component");
|
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "Missing mapping component");
|
||||||
|
|
||||||
if (!this->currentModelView()) { return; }
|
if (!this->currentModelView()) { return; }
|
||||||
this->m_state = Running;
|
m_state = Running;
|
||||||
int maxObjectsStashed = -1;
|
int maxObjectsStashed = -1;
|
||||||
if (!ui->le_MaxModelsStashed->text().isEmpty())
|
if (!ui->le_MaxModelsStashed->text().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -141,29 +141,31 @@ namespace BlackGui
|
|||||||
int ownModelsCount = 0;
|
int ownModelsCount = 0;
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
const QString intro("Checking %1 selected models");
|
static const QString intro("Checking %1 selected models");
|
||||||
const CAircraftModelList selectedModels(this->currentModelView()->selectedObjects());
|
const CAircraftModelList selectedModels(this->currentModelView()->selectedObjects());
|
||||||
ownModelsCount = selectedModels.size();
|
ownModelsCount = selectedModels.size();
|
||||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, intro.arg(ownModelsCount)));
|
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
|
else
|
||||||
{
|
{
|
||||||
const CDbMappingComponent *mappincComponent = this->getMappingComponent();
|
const CDbMappingComponent *mappincComponent = this->getMappingComponent();
|
||||||
const QSet<CSimulatorInfo> fsFamilySims(CSimulatorInfo::allFsFamilySimulators().asSingleSimulatorSet());
|
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)
|
for (const CSimulatorInfo &simulator : fsFamilySims)
|
||||||
{
|
{
|
||||||
const CAircraftModelList ownModels = mappincComponent->getOwnCachedModels(simulator);
|
const CAircraftModelList ownModels = mappincComponent->getOwnCachedModels(simulator);
|
||||||
const QString sim = simulator.toQString();
|
const QString sim = simulator.toQString();
|
||||||
ownModelsCount += ownModels.size();
|
ownModelsCount += ownModels.size();
|
||||||
this->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, intro.arg(ownModels.size()).arg(sim)));
|
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");
|
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->addStatusMessage(CStatusMessage(this, CStatusMessage::SeverityInfo, result.arg(ownModelsCount).arg(m_modelsToStash.size())));
|
||||||
this->m_state = Completed;
|
m_state = Completed;
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ namespace BlackGui
|
|||||||
namespace Components
|
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)
|
* for a sibling simulator (ie. FSX/P3D/FS9)
|
||||||
*/
|
*/
|
||||||
class BLACKGUI_EXPORT CDbAutoSimulatorStashingComponent :
|
class BLACKGUI_EXPORT CDbAutoSimulatorStashingComponent :
|
||||||
public QDialog,
|
public QDialog,
|
||||||
public BlackGui::Components::CDbMappingComponentAware,
|
public Components::CDbMappingComponentAware,
|
||||||
public BlackCore::IProgressIndicator
|
public BlackCore::IProgressIndicator
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>400</height>
|
<height>402</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -19,52 +19,40 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Cross simulator updating (FSX-P3D-FS9)</string>
|
<string>Cross simulator updating (FSX-P3D-FS9)</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="vl_AutoSimulator">
|
||||||
<item row="4" column="0" colspan="4">
|
<item>
|
||||||
<widget class="QProgressBar" name="pb_StashingProgress">
|
<widget class="QGroupBox" name="gb_Info">
|
||||||
<property name="value">
|
<property name="title">
|
||||||
<number>24</number>
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="4">
|
</layout>
|
||||||
<widget class="BlackGui::Views::CStatusMessageView" name="tvp_StatusMessages">
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<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">
|
<widget class="QLineEdit" name="le_AllSets">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="2">
|
||||||
<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">
|
|
||||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QRadioButton" name="rb_ScanAllModels">
|
<widget class="QRadioButton" name="rb_ScanAllModels">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>scan all models</string>
|
<string>scan all models</string>
|
||||||
@@ -77,27 +65,67 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="le_Selected">
|
<widget class="QLineEdit" name="le_Selected">
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_MaxModelsStashed">
|
<widget class="QLabel" name="lbl_MaxModelsStashed">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Max.stashed:</string>
|
<string>Max.stashed:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<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">
|
<widget class="QLineEdit" name="le_MaxModelsStashed">
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>max.models to be stashed</string>
|
<string>max.models to be stashed</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
||||||
|
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@@ -107,6 +135,14 @@
|
|||||||
<header>blackgui/views/statusmessageview.h</header>
|
<header>blackgui/views/statusmessageview.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</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/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace BlackGui
|
|||||||
*/
|
*/
|
||||||
class BLACKGUI_EXPORT CDbDistributorSelectorComponent :
|
class BLACKGUI_EXPORT CDbDistributorSelectorComponent :
|
||||||
public QFrame,
|
public QFrame,
|
||||||
public BlackGui::CDropBase
|
public CDropBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user