From 26dcc547e6a18f016db393032f30aef8dfc37f38 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 23 May 2018 23:13:39 +0200 Subject: [PATCH] Misc. smaller fixes * copy configuration dialog handles case if there is no other swift version * QPointer "guard" for lambda * first model set UI --- .../components/copyconfigurationcomponent.cpp | 9 ++++++++- .../components/copyconfigurationcomponent.h | 1 + .../components/firstmodelsetcomponent.ui | 10 +++++----- src/blackgui/overlaymessages.cpp | 18 ++++++++++++++---- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/blackgui/components/copyconfigurationcomponent.cpp b/src/blackgui/components/copyconfigurationcomponent.cpp index 6074db2de..174304871 100644 --- a/src/blackgui/components/copyconfigurationcomponent.cpp +++ b/src/blackgui/components/copyconfigurationcomponent.cpp @@ -51,6 +51,7 @@ namespace BlackGui ui->setupUi(this); this->initOtherSwiftVersions(); this->setWidths(); + m_hasOtherSwiftVersions = CDirectoryUtils::hasOtherSwiftDataDirectories(); ui->cb_ShowAll->setChecked(m_nameFilterDisables); connect(ui->rb_Cache, &QRadioButton::toggled, [ = ](bool) { this->initCurrentDirectories(true); }); @@ -249,7 +250,12 @@ namespace BlackGui // source const QString sourceDir = this->getOtherVersionsSelectedDirectory(); - if (!sourceModel || m_initializedSourceDir != sourceDir) + if (!m_hasOtherSwiftVersions) + { + // no ther versions + return; + } + else if (!sourceModel || m_initializedSourceDir != sourceDir) { m_initializedSourceDir = sourceDir; if (!sourceModel) @@ -353,6 +359,7 @@ namespace BlackGui QStringList CCopyConfigurationComponent::getSelectedFiles() const { + if (!m_hasOtherSwiftVersions) { return QStringList(); } const QModelIndexList indexes = ui->tv_Source->selectionModel()->selectedIndexes(); if (indexes.isEmpty()) { return QStringList(); } const QFileSystemModel *sourceModel = qobject_cast(ui->tv_Source->model()); diff --git a/src/blackgui/components/copyconfigurationcomponent.h b/src/blackgui/components/copyconfigurationcomponent.h index fe1e9c02d..df6a1f57e 100644 --- a/src/blackgui/components/copyconfigurationcomponent.h +++ b/src/blackgui/components/copyconfigurationcomponent.h @@ -126,6 +126,7 @@ namespace BlackGui bool m_logCopiedFiles = true; bool m_nameFilterDisables = false; //!< name filter disables or hides bool m_withBootstrapFile = false; + bool m_hasOtherSwiftVersions = false; // caches will be explicitly initialized in initCaches BlackMisc::Simulation::Data::CModelCaches m_modelCaches { false, this }; diff --git a/src/blackgui/components/firstmodelsetcomponent.ui b/src/blackgui/components/firstmodelsetcomponent.ui index 1fc23887e..39595c054 100644 --- a/src/blackgui/components/firstmodelsetcomponent.ui +++ b/src/blackgui/components/firstmodelsetcomponent.ui @@ -20,7 +20,7 @@ - <html><head/><body><p><span style=" font-size:9pt; font-weight:600; color:#ff0000;">WORK IN PROGRESS, not finished </span><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html> + <html><head/><body><p><span style=" font-size:9pt; font-weight:600; color:#ff0000;">WORK IN PROGRESS (experimental) </span><span style=" font-size:9pt;">The model set defines which aircraft you will use in the simulator. From all models you have installed on your disk you can select a subset actually being used.</span></p></body></html> Qt::RichText @@ -56,7 +56,7 @@ - Model directories: + Model dir.: @@ -79,21 +79,21 @@ - show set + set - show models + models - trigger reload + reload diff --git a/src/blackgui/overlaymessages.cpp b/src/blackgui/overlaymessages.cpp index 1f9e45ba8..9c1e9f39c 100644 --- a/src/blackgui/overlaymessages.cpp +++ b/src/blackgui/overlaymessages.cpp @@ -152,9 +152,11 @@ namespace BlackGui if (this->hasPendingConfirmation()) { // defer message + QPointer myself(this); m_pendingMessageCalls.push_back([ = ]() { - this->showOverlayMessages(messages, timeOutMs); + if (!myself) { return; } + myself->showOverlayMessages(messages, timeOutMs); }); return; } @@ -185,9 +187,11 @@ namespace BlackGui if (this->hasPendingConfirmation()) { // defer message + QPointer myself(this); m_pendingMessageCalls.push_back([ = ]() { - this->showOverlayMessage(message, timeOutMs); + if (!myself) { return; } + myself->showOverlayMessage(message, timeOutMs); }); return; } @@ -214,9 +218,11 @@ namespace BlackGui if (this->hasPendingConfirmation()) { // defer message + QPointer myself(this); m_pendingMessageCalls.push_back([ = ]() { - this->showOverlayTextMessage(textMessage, timeOutMs); + if (!myself) { return; } + myself->showOverlayTextMessage(textMessage, timeOutMs); }); return; } @@ -242,9 +248,11 @@ namespace BlackGui if (this->hasPendingConfirmation()) { // defer message + QPointer myself(this); m_pendingMessageCalls.push_back([ = ]() { - this->showOverlayImage(image, timeOutMs); + if (!myself) { return; } + myself->showOverlayImage(image, timeOutMs); }); return; } @@ -358,8 +366,10 @@ namespace BlackGui if (this->hasPendingConfirmation()) { // defer message + QPointer myself(this); m_pendingMessageCalls.push_back([ = ]() { + if (!myself) { return; } this->showOverlayMessagesWithConfirmation(messages, appendOldMessages, confirmationMessage, okLambda, defaultButton, timeOutMs); }); return;