#ifndef SETTINGSCONFIGLOADER_P_H #define SETTINGSCONFIGLOADER_P_H #include #include #include "qtmvvmcore_global.h" #include "settingssetup.h" #include namespace QtMvvm { class Q_MVVMCORE_EXPORT SettingsConfigLoader : public QObject, public ISettingsSetupLoader, public SettingsConfigImpl { Q_OBJECT Q_INTERFACES(QtMvvm::ISettingsSetupLoader) public: Q_INVOKABLE SettingsConfigLoader(QObject *parent = nullptr); 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; SettingsElements::Setup convertSettings(const SettingsConfigType &settings) const; template SettingsElements::Category convertCategory(const CategoryType &category, const QList> &content) const; template SettingsElements::Section convertSection(const SectionType §ion, const QList> &content) const; template SettingsElements::Group convertGroup(const GroupType &group, const QList> &content) const; SettingsElements::Entry convertEntry(const EntryType &entry) const; QVariant readElement(const ElementType &element) const; QPair readProperty(const PropertyType &property) const; template TType trIf(const optional &text, const TType &defaultValue = {}) const; template TType trIf(const optional &text, bool allowTr, const TType &defaultValue = {}) const; }; class Q_MVVMCORE_EXPORT SettingsConfigException : public SettingsLoaderException { public: SettingsConfigException(SettingsConfigBase::Exception &exception); SettingsConfigException(QByteArray what); const char *what() const noexcept override; void raise() const override; QException *clone() const override; private: const QByteArray _what; }; } namespace std { uint qHash(const std::tuple &key, uint seed); } #endif // SETTINGSCONFIGLOADER_P_H