From 94c9e4ebcace109b788ffd6e34716f406a8d081f Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Sat, 28 Jul 2018 18:07:03 +0200 Subject: [PATCH] remove selector from tool code --- src/mvvmcore/settingsconfigloader.cpp | 11 +++++++++++ src/mvvmcore/settingsconfigloader_p.h | 4 ++++ src/settingsconfig/settingsconfigimpl.cpp | 20 +++++++++++++++++--- src/settingsconfig/settingsconfigimpl.h | 4 ++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/mvvmcore/settingsconfigloader.cpp b/src/mvvmcore/settingsconfigloader.cpp index 2e1490e..e02311b 100644 --- a/src/mvvmcore/settingsconfigloader.cpp +++ b/src/mvvmcore/settingsconfigloader.cpp @@ -1,5 +1,6 @@ #include "settingsconfigloader_p.h" #include +#include using namespace QtMvvm; using namespace QtMvvm::SettingsElements; @@ -37,6 +38,16 @@ Setup SettingsConfigLoader::loadSetup(const QString &filePath, const QString &fr return setup; } +QStringList QtMvvm::SettingsConfigLoader::allSelectors() const +{ + return selector()->allSelectors(); +} + +QString QtMvvm::SettingsConfigLoader::select(const QString &path) const +{ + return selector()->select(path); +} + Setup SettingsConfigLoader::convertSettings(const SettingsConfigType &settings) const { Setup setup; diff --git a/src/mvvmcore/settingsconfigloader_p.h b/src/mvvmcore/settingsconfigloader_p.h index 7eaa040..3ba8248 100644 --- a/src/mvvmcore/settingsconfigloader_p.h +++ b/src/mvvmcore/settingsconfigloader_p.h @@ -21,6 +21,10 @@ public: void changeDefaultIcon(const QUrl &defaultIcon) override; SettingsElements::Setup loadSetup(const QString &filePath, const QString &frontend, const QFileSelector *selector) const override; +protected: + QStringList allSelectors() const override; + QString select(const QString &path) const override; + private: QUrl _defaultIcon; mutable QCache, SettingsElements::Setup> _cache; diff --git a/src/settingsconfig/settingsconfigimpl.cpp b/src/settingsconfig/settingsconfigimpl.cpp index 241eb23..8bfa6ff 100644 --- a/src/settingsconfig/settingsconfigimpl.cpp +++ b/src/settingsconfig/settingsconfigimpl.cpp @@ -3,7 +3,6 @@ #include #include #include -#include namespace { @@ -123,6 +122,21 @@ bool SettingsConfigImpl::finish_settings_config_content(QXmlStreamReader &reader return hasNext; } +QStringList SettingsConfigImpl::allSelectors() const +{ + return {}; +} + +QString SettingsConfigImpl::select(const QString &path) const +{ + return path; +} + +const QFileSelector *SettingsConfigImpl::selector() const +{ + return _selector; +} + template void SettingsConfigImpl::finishContents(QXmlStreamReader &reader, TGroup &group) { @@ -155,7 +169,7 @@ bool SettingsConfigImpl::readGeneralInclude(QXmlStreamReader &reader, IncludeTyp { try { if(_selector) - include.includePath = _selector->select(include.includePath); + include.includePath = select(include.includePath); //make the path relative if possbile if(dynamic_cast(reader.device())) { @@ -184,7 +198,7 @@ bool SettingsConfigImpl::isUsable(const SelectableContrainerInfo &element) const } if(_selector && element.selectors) { - auto selectors = _selector->allSelectors(); + auto selectors = allSelectors(); auto selects = element.selectors.value().split(QLatin1Char('|'), QString::SkipEmptyParts); for(const auto &select : selects) { auto sels = select.split(QLatin1Char('&'), QString::SkipEmptyParts); diff --git a/src/settingsconfig/settingsconfigimpl.h b/src/settingsconfig/settingsconfigimpl.h index 211a5da..b73cf99 100644 --- a/src/settingsconfig/settingsconfigimpl.h +++ b/src/settingsconfig/settingsconfigimpl.h @@ -20,6 +20,10 @@ protected: bool finish_category_content(QXmlStreamReader &reader, CategoryContentGroup &data, bool hasNext) override; bool finish_settings_config_content(QXmlStreamReader &reader, SettingsConfigContentGroup &data, bool hasNext) override; + virtual QStringList allSelectors() const; + virtual QString select(const QString &path) const; + const QFileSelector *selector() const; + private: template void finishContents(QXmlStreamReader &reader, TGroup &group);