From 1b1c4e588c34e0f43245932e1b49740744c7f8b0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 13 Jan 2018 04:57:42 +0100 Subject: [PATCH] Ref T199, do not use hardcoded names of file names --- .../components/copyconfigurationcomponent.cpp | 19 ++++++++++++++----- .../components/copyconfigurationcomponent.h | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/blackgui/components/copyconfigurationcomponent.cpp b/src/blackgui/components/copyconfigurationcomponent.cpp index 47eeec9aa..fa59e0970 100644 --- a/src/blackgui/components/copyconfigurationcomponent.cpp +++ b/src/blackgui/components/copyconfigurationcomponent.cpp @@ -165,12 +165,21 @@ namespace BlackGui if (ui->rb_Cache->isChecked()) { // only copy setup and model caches - static const QStringList cacheFilter( + static const QStringList cacheFilter = [ = ] { - "modelset*.json", - "modelcache*.json", - "*setup.json" - }); + QStringList cf({ + m_modelSetCurrentSimulator.getFilename(), + m_modelsCurrentSimulator.getFilename(), + m_launcherSetup.getFilename(), + m_vatsimSetup.getFilename(), + m_lastVatsimServer.getFilename(), + m_lastServer.getFilename(), + m_lastAircraftModel.getFilename() + }); + cf.append(m_modelSetCaches.getAllFilenames()); + cf.append(m_modelCaches.getAllFilenames()); + return CFileUtils::getFileNamesOnly(cf); + }(); if (!m_withBootstrapFile) { return cacheFilter; } static const QStringList cacheFilterBs = [ = ] diff --git a/src/blackgui/components/copyconfigurationcomponent.h b/src/blackgui/components/copyconfigurationcomponent.h index f8910c4d0..c95334df4 100644 --- a/src/blackgui/components/copyconfigurationcomponent.h +++ b/src/blackgui/components/copyconfigurationcomponent.h @@ -16,6 +16,8 @@ #include "blackcore/data/launchersetup.h" #include "blackcore/data/vatsimsetup.h" #include "blackmisc/simulation/data/modelcaches.h" +#include "blackmisc/simulation/data/lastmodel.h" +#include "blackmisc/network/data/lastserver.h" #include #include #include @@ -126,10 +128,13 @@ namespace BlackGui // caches will be initialized so they can be overriden // those caches do not harm if they exists default initialized //! \fixme this is a workaround, as it creates files on disk even if those are not copied. It was much nicer if the cache would init themself if the file appears + BlackMisc::CData m_lastServer { this }; //!< recently used server (VATSIM, other) BlackMisc::CData m_modelSetCurrentSimulator { this }; BlackMisc::CData m_modelsCurrentSimulator { this }; + BlackMisc::CData m_lastAircraftModel { this }; //!< recently used aircraft model BlackMisc::CData m_launcherSetup { this }; BlackMisc::CData m_vatsimSetup { this }; + BlackMisc::CData m_lastVatsimServer { this }; //!< recently used VATSIM server }; /**