Commit e413f106 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make the resources deduplicated automatically

Just make the option always on
parent d07168fc
......@@ -251,7 +251,7 @@ void ThemeManager::populateThemeMenu()
QAction * action;
const QStringList schemeFiles = KoResourcePaths::findAllResources("data", "color-schemes/*.colors", KoResourcePaths::NoDuplicates);
const QStringList schemeFiles = KoResourcePaths::findAllResources("data", "color-schemes/*.colors");
QMap<QString, QAction*> actionMap;
for (int i = 0; i < schemeFiles.size(); ++i)
......@@ -351,7 +351,7 @@ QString ThemeManager::currentKDEdefaultTheme() const
void ThemeManager::populateThemeMap()
{
const QStringList schemeFiles = KoResourcePaths::findAllResources("data", "color-schemes/*.colors", KoResourcePaths::NoDuplicates);
const QStringList schemeFiles = KoResourcePaths::findAllResources("data", "color-schemes/*.colors");
for (int i = 0; i < schemeFiles.size(); ++i)
{
const QString filename = schemeFiles.at(i);
......
......@@ -327,7 +327,7 @@ void KisCustomImageWidget::fillPredefined()
cmbPredefined->addItem("");
QStringList definitions = KoResourcePaths::findAllResources("data", "predefined_image_sizes/*.predefinedimage", KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
QStringList definitions = KoResourcePaths::findAllResources("data", "predefined_image_sizes/*.predefinedimage", KoResourcePaths::Recursive);
definitions.sort();
if (!definitions.empty()) {
......
......@@ -82,7 +82,7 @@ public:
QStringList fileNames;
foreach (const QString &extension, extensionList) {
fileNames += KoResourcePaths::findAllResources(type().toLatin1(), extension, KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
fileNames += KoResourcePaths::findAllResources(type().toLatin1(), extension, KoResourcePaths::Recursive);
}
return fileNames;
......
......@@ -396,10 +396,9 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
debugWidgetUtils << "=====================================================";
debugWidgetUtils << type << _filter << QStandardPaths::standardLocations(d->mapTypeToQStandardPaths(type));
bool noDuplicates = options & KoResourcePaths::NoDuplicates;
bool recursive = options & KoResourcePaths::Recursive;
debugWidgetUtils << "findAllResources: type" << type << "filter" << _filter << "no dups" << noDuplicates << "recursive" << recursive;
debugWidgetUtils << "findAllResources: type" << type << "filter" << _filter << "recursive" << recursive;
QStringList aliases = d->aliases(type);
QString filter = _filter;
......@@ -416,7 +415,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
QStringList standardResources =
QStandardPaths::locateAll(d->mapTypeToQStandardPaths(type),
filter, QStandardPaths::LocateFile);
appendResources(&resources, standardResources, noDuplicates);
appendResources(&resources, standardResources, true);
}
debugWidgetUtils << "\tresources from qstandardpaths:" << resources.size();
......@@ -432,7 +431,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
Q_FOREACH (const QString &dir, dirs) {
appendResources(&resources,
filesInDir(dir, filter, recursive),
noDuplicates);
true);
}
}
......@@ -444,7 +443,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
QStringList prefixResources;
prefixResources << filesInDir(getInstallationPrefix() + "share/" + fi.path(), fi.fileName(), false);
prefixResources << filesInDir(getInstallationPrefix() + "share/krita/" + fi.path(), fi.fileName(), false);
appendResources(&resources, prefixResources, noDuplicates);
appendResources(&resources, prefixResources, true);
}
debugWidgetUtils << "\tresources from installation:" << resources.size();
......
......@@ -49,7 +49,6 @@ public:
enum SearchOption { NoSearchOptions = 0,
Recursive = 1,
NoDuplicates = 2,
IgnoreExecBit = 4
};
Q_DECLARE_FLAGS(SearchOptions, SearchOption)
......@@ -155,8 +154,7 @@ public:
* wildcard expression. E.g. <tt>"images\*.jpg"</tt>.
* Use QString() if you do not want a filter.
* @param options if the flags passed include Recursive, subdirectories
* will also be search; if NoDuplicates is passed then only entries with
* unique filenames will be returned eliminating duplicates.
* will also be search.
*
* @return List of all the files whose filename matches the
* specified filter.
......
......@@ -377,9 +377,8 @@ void KisActionRegistry::writeCustomShortcuts(KConfigBase *config) const
void KisActionRegistry::Private::loadActionFiles()
{
auto searchType = KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates;
QStringList actionDefinitions =
KoResourcePaths::findAllResources("kis_actions", "*.action", searchType);
KoResourcePaths::findAllResources("kis_actions", "*.action", KoResourcePaths::Recursive);
// Extract actions all XML .action files.
Q_FOREACH (const QString &actionDefinition, actionDefinitions) {
......
......@@ -94,10 +94,10 @@ LcmsEnginePlugin::LcmsEnginePlugin(QObject *parent, const QVariantList &)
QStringList profileFilenames;
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icm", KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICM", KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICC", KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icc", KoResourcePaths::Recursive | KoResourcePaths::NoDuplicates);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icm", KoResourcePaths::Recursive);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICM", KoResourcePaths::Recursive);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICC", KoResourcePaths::Recursive);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icc", KoResourcePaths::Recursive);
// Load the profiles
if (!profileFilenames.empty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment