From 64d153b10b97dd2dd1413beeb2461103fe3bf48f Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 13 Jul 2018 01:48:55 +0200 Subject: [PATCH] Ref T286, fixes for copy component * copy servers * clear status * refresh UI in "silent mode" --- .../copymodelsfromotherswiftversionscomponent.cpp | 8 +++++++- .../copymodelsfromotherswiftversionscomponent.ui | 4 ++-- .../components/copysettingsandcachescomponent.cpp | 15 ++++++++++++++- .../components/copysettingsandcachescomponent.h | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/blackgui/components/copymodelsfromotherswiftversionscomponent.cpp b/src/blackgui/components/copymodelsfromotherswiftversionscomponent.cpp index cce01f225..361dbb4bd 100644 --- a/src/blackgui/components/copymodelsfromotherswiftversionscomponent.cpp +++ b/src/blackgui/components/copymodelsfromotherswiftversionscomponent.cpp @@ -156,7 +156,13 @@ namespace BlackGui bool CCopyModelsFromOtherSwiftVersionsComponent::confirmOverride(const QString &msg) { - if (ui->cb_Silent->isChecked()) { return true; } + if (!sApp || sApp->isShuttingDown()) { return false; } + if (ui->cb_Silent->isChecked()) + { + // allow UI updates + sApp->processEventsFor(50); + return true; + } const QMessageBox::StandardButton reply = QMessageBox::question(this, QStringLiteral("Confirm override"), withQUestionMark(msg), QMessageBox::Yes | QMessageBox::No); return reply == QMessageBox::Yes; } diff --git a/src/blackgui/components/copymodelsfromotherswiftversionscomponent.ui b/src/blackgui/components/copymodelsfromotherswiftversionscomponent.ui index 8dcfde641..c46efc26a 100644 --- a/src/blackgui/components/copymodelsfromotherswiftversionscomponent.ui +++ b/src/blackgui/components/copymodelsfromotherswiftversionscomponent.ui @@ -6,7 +6,7 @@ 0 0 - 508 + 533 495 @@ -89,7 +89,7 @@ - silent + silent mode diff --git a/src/blackgui/components/copysettingsandcachescomponent.cpp b/src/blackgui/components/copysettingsandcachescomponent.cpp index 7145b7fc1..583831f4f 100644 --- a/src/blackgui/components/copysettingsandcachescomponent.cpp +++ b/src/blackgui/components/copysettingsandcachescomponent.cpp @@ -58,7 +58,7 @@ namespace BlackGui readOnlyCheckbox(ui->cb_SettingsAudioInputDevice, !CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsAudio.getFilename())); readOnlyCheckbox(ui->cb_SettingsAudioOutputDevice, !CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsAudioOutputDevice.getFilename())); - readOnlyCheckbox(ui->cb_SettingsNetworkTrafficServers, !CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsTrafficNetworkServers.getFilename())); + readOnlyCheckbox(ui->cb_SettingsNetworkTrafficServers, !CCacheSettingsUtils::hasOtherVersionSettingsFile(info, m_settingsNetworkServers.getFilename())); readOnlyCheckbox(ui->cb_CacheLastNetworkServer, !CCacheSettingsUtils::hasOtherVersionCacheFile(info, m_cacheLastNetworkServer.getFilename())); readOnlyCheckbox(ui->cb_CacheLastVatsimServer, !CCacheSettingsUtils::hasOtherVersionCacheFile(info, m_cacheLastVatsimServer.getFilename())); @@ -133,8 +133,11 @@ namespace BlackGui void CCopySettingsAndCachesComponent::copy() { + ui->le_Status->clear(); + const CApplicationInfo otherVersionInfo = ui->comp_OtherSwiftVersions->selectedOtherVersion(); if (otherVersionInfo.isNull()) { return; } + ui->le_Status->setText("Starting to copy from '" + otherVersionInfo.toQString(true) + "'"); // ------- audio ------- if (ui->cb_SettingsAudio->isChecked()) @@ -168,6 +171,16 @@ namespace BlackGui } // ------- network ------- + if (ui->cb_SettingsNetworkTrafficServers->isChecked()) + { + const QString joStr = CCacheSettingsUtils::otherVersionSettingsFileContent(otherVersionInfo, m_settingsNetworkServers.getFilename()); + if (!joStr.isEmpty()) + { + const CServerList networkServers = CServerList::fromJson(joStr, true); + this->displayStatusMessage(m_settingsNetworkServers.setAndSave(networkServers), networkServers.toQString(true)); + } + } + if (ui->cb_CacheLastNetworkServer->isChecked()) { const QString joStr = CCacheSettingsUtils::otherVersionCacheFileContent(otherVersionInfo, m_cacheLastNetworkServer.getFilename()); diff --git a/src/blackgui/components/copysettingsandcachescomponent.h b/src/blackgui/components/copysettingsandcachescomponent.h index 9a39f69a0..dc6c35fb3 100644 --- a/src/blackgui/components/copysettingsandcachescomponent.h +++ b/src/blackgui/components/copysettingsandcachescomponent.h @@ -110,7 +110,7 @@ namespace BlackGui BlackMisc::CSetting m_settingsAudio { this }; BlackMisc::CSetting m_settingsAudioInputDevice { this }; BlackMisc::CSetting m_settingsAudioOutputDevice { this }; - BlackMisc::CSetting m_settingsTrafficNetworkServers { this }; + BlackMisc::CSetting m_settingsNetworkServers { this }; BlackMisc::CSetting m_settingsGuiGeneral { this }; BlackMisc::CSetting m_settingsDockWidget { this }; BlackMisc::CSetting m_settingsViewUpdate { this };