Browse Source

remove selector from tool code

pull/2/head
Skycoder42 6 years ago
parent
commit
94c9e4ebca
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 11
      src/mvvmcore/settingsconfigloader.cpp
  2. 4
      src/mvvmcore/settingsconfigloader_p.h
  3. 20
      src/settingsconfig/settingsconfigimpl.cpp
  4. 4
      src/settingsconfig/settingsconfigimpl.h

11
src/mvvmcore/settingsconfigloader.cpp

@ -1,5 +1,6 @@
#include "settingsconfigloader_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QFileSelector>
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;

4
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<std::tuple<QString, QString, QStringList>, SettingsElements::Setup> _cache;

20
src/settingsconfig/settingsconfigimpl.cpp

@ -3,7 +3,6 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QDebug>
#include <QtCore/QFileSelector>
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<typename TGroup>
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<QFileDevice*>(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);

4
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 <typename TGroup>
void finishContents(QXmlStreamReader &reader, TGroup &group);

Loading…
Cancel
Save