Check for minimum mapping version

* check functions in gui application/application
* check for instance mapping wizard
* check on mapping tool's stashing component
This commit is contained in:
Klaus Basan
2018-12-05 03:37:36 +01:00
parent 774458afc9
commit 42af510342
7 changed files with 41 additions and 9 deletions

View File

@@ -457,6 +457,11 @@ namespace BlackCore
return m_setupReader->asyncLoad();
}
bool CApplication::hasMinimumMappingVersion() const
{
return (this->getGlobalSetup().isSwiftVersionMinimumMappingVersion());
}
bool CApplication::hasWebDataServices() const
{
if (this->isShuttingDown()) { return false; } // service will not survive for long

View File

@@ -382,6 +382,9 @@ namespace BlackCore
//! Reload setup and version
BlackMisc::CStatusMessageList requestReloadOfSetupAndVersion();
//! Minimum mapping version check
virtual bool hasMinimumMappingVersion() const;
//! Read and wait for setup
//! \sa waitForSetup
BlackMisc::CStatusMessageList synchronizeSetup(int timeoutMs = BlackMisc::Network::CNetworkUtils::getLongTimeoutMs());

View File

@@ -269,6 +269,7 @@ namespace BlackGui
{
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
if (ui->tvp_StashAircraftModels->isEmpty()) { return; }
if (!sGui->hasMinimumMappingVersion()) { return; }
// get models right here, because later steps might affect selection
const CAircraftModelList models(getSelectedOrAllModels());

View File

@@ -38,6 +38,7 @@
#include "blackconfig/buildconfig.h"
#include <QDialogButtonBox>
#include <QMessageBox>
#include <QGroupBox>
#include <QIntValidator>
#include <QLineEdit>
@@ -693,6 +694,8 @@ namespace BlackGui
void CLoginComponent::mappingWizard()
{
if (!sGui || !sGui->getIContextOwnAircraft() || sGui->isShuttingDown()) { return; }
if (!sGui->hasMinimumMappingVersion()) { return; }
if (!m_mappingWizard)
{
m_mappingWizard.reset(new CDbQuickMappingWizard(this));

View File

@@ -378,6 +378,9 @@
<height>50</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
</layout>
@@ -845,6 +848,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::CTickLabel</class>
<extends>QLabel</extends>
<header>blackgui/ticklabel.h</header>
</customwidget>
<customwidget>
<class>BlackGui::Editors::CServerForm</class>
<extends>QFrame</extends>
@@ -869,11 +877,6 @@
<header>blackgui/components/modelmatcherlogenable.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::CTickLabel</class>
<extends>QLabel</extends>
<header>blackgui/ticklabel.h</header>
</customwidget>
<customwidget>
<class>BlackGui::Components::CDbAircraftIcaoSelectorComponent</class>
<extends>QFrame</extends>
@@ -908,10 +911,8 @@
<tabstop>tw_Network</tabstop>
<tabstop>comp_VatsimServers</tabstop>
<tabstop>pb_OverrideCredentialsVatsim</tabstop>
<tabstop>comp_OtherServers</tabstop>
<tabstop>pb_OtherServersGotoSettings</tabstop>
<tabstop>pb_OverrideCredentialsOtherServers</tabstop>
<tabstop>sa_FsdDetails</tabstop>
<tabstop>tw_Details</tabstop>
<tabstop>form_Pilot</tabstop>
<tabstop>le_SimulatorModel</tabstop>
<tabstop>tb_SimulatorIcaoReverseLookup</tabstop>
<tabstop>tb_MappingWizard</tabstop>
@@ -920,11 +921,17 @@
<tabstop>le_AircraftCombinedType</tabstop>
<tabstop>selector_AirlineIcao</tabstop>
<tabstop>le_LoginCallsign</tabstop>
<tabstop>le_LoginHomeBase</tabstop>
<tabstop>le_LoginAsAircaft</tabstop>
<tabstop>le_LoginSince</tabstop>
<tabstop>tb_Timeout</tabstop>
<tabstop>cb_AutoLogoff</tabstop>
<tabstop>pb_Ok</tabstop>
<tabstop>pb_Cancel</tabstop>
<tabstop>comp_OtherServers</tabstop>
<tabstop>pb_OtherServersGotoSettings</tabstop>
<tabstop>pb_OverrideCredentialsOtherServers</tabstop>
<tabstop>sa_FsdDetails</tabstop>
</tabstops>
<resources>
<include location="../../blackmisc/blackmisc.qrc"/>

View File

@@ -49,6 +49,7 @@
#include <QRegularExpression>
#include <QSettings>
#include <QSplashScreen>
#include <QMessageBox>
#include <QStyleFactory>
#include <QStringList>
#include <QStyle>
@@ -205,6 +206,15 @@ namespace BlackGui
CGuiUtility::registerMainApplicationWidget(mainWidget);
}
bool CGuiApplication::hasMinimumMappingVersion() const
{
if (this->getGlobalSetup().isSwiftVersionMinimumMappingVersion()) { return true; }
const QString msg = QStringLiteral("Your are using swift version: '%1'.\nCreating mappings requires at least '%2'.").arg(CBuildConfig::getVersionString(), this->getGlobalSetup().getMappingMinimumVersionString());
QMessageBox::warning(this->mainApplicationWindow(), "Version check", msg, QMessageBox::Close);
return false;
}
QMainWindow *CGuiApplication::mainApplicationWindow()
{
return qobject_cast<QMainWindow *>(CGuiApplication::mainApplicationWidget());

View File

@@ -229,6 +229,9 @@ namespace BlackGui
//! \copydoc BlackGui::CGuiUtility::registerMainApplicationWidget
void registerMainApplicationWidget(QWidget *mainWidget);
//! \copydoc BlackCore::CApplication::hasMinimumMappingVersion
virtual bool hasMinimumMappingVersion() const override;
//! Main application window
static QMainWindow *mainApplicationWindow();