diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-04-22 16:15:26 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-04-26 08:03:47 +0000 |
commit | c1f90aeca2a921397c36f53fd8d6a834b79e0b0d (patch) | |
tree | b32416613d15ad3cfe201e8ed4c08ce882f838c2 /src/plugins/texteditor | |
parent | b2c05547333444859941b584f3f30c9cfac6815a (diff) |
ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/codestylepool.cpp | 4 | ||||
-rw-r--r-- | src/plugins/texteditor/fontsettings.cpp | 15 | ||||
-rw-r--r-- | src/plugins/texteditor/fontsettingspage.cpp | 7 | ||||
-rw-r--r-- | src/plugins/texteditor/highlighter.cpp | 2 | ||||
-rw-r--r-- | src/plugins/texteditor/highlightersettings.cpp | 6 | ||||
-rw-r--r-- | src/plugins/texteditor/snippets/snippetscollection.cpp | 8 |
6 files changed, 18 insertions, 24 deletions
diff --git a/src/plugins/texteditor/codestylepool.cpp b/src/plugins/texteditor/codestylepool.cpp index 55377eceae..272f6772c6 100644 --- a/src/plugins/texteditor/codestylepool.cpp +++ b/src/plugins/texteditor/codestylepool.cpp @@ -94,9 +94,7 @@ QByteArray CodeStylePoolPrivate::generateUniqueId(const QByteArray &id) const static QString customCodeStylesPath() { - QString path = Core::ICore::userResourcePath(); - path.append(QLatin1String("/codestyles/")); - return path; + return Core::ICore::userResourcePath().pathAppended("codestyles").toString(); } CodeStylePool::CodeStylePool(ICodeStylePreferencesFactory *factory, QObject *parent) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index d74a13b2cc..4e61f89ebc 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -504,20 +504,19 @@ int FontSettings::defaultFontSize() */ QString FontSettings::defaultSchemeFileName(const QString &fileName) { - QString defaultScheme = Core::ICore::resourcePath(); - defaultScheme += QLatin1String("/styles/"); + Utils::FilePath defaultScheme = Core::ICore::resourcePath() / "styles"; - if (!fileName.isEmpty() && QFile::exists(defaultScheme + fileName)) { - defaultScheme += fileName; + if (!fileName.isEmpty() && (defaultScheme / fileName).exists()) { + defaultScheme = defaultScheme / fileName; } else { const QString themeScheme = Utils::creatorTheme()->defaultTextEditorColorScheme(); - if (!themeScheme.isEmpty() && QFile::exists(defaultScheme + themeScheme)) - defaultScheme += themeScheme; + if (!themeScheme.isEmpty() && (defaultScheme / themeScheme).exists()) + defaultScheme = defaultScheme / themeScheme; else - defaultScheme += QLatin1String("default.xml"); + defaultScheme = defaultScheme / "default.xml"; } - return defaultScheme; + return defaultScheme.toString(); } } // namespace TextEditor diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 42c14549c4..19759d2208 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -191,9 +191,7 @@ public: static QString customStylesPath() { - QString path = Core::ICore::userResourcePath(); - path.append(QLatin1String("/styles/")); - return path; + return Core::ICore::userResourcePath().pathAppended("styles").toString(); } static QString createColorSchemeFileName(const QString &pattern) @@ -558,8 +556,7 @@ void FontSettingsPageWidget::refreshColorSchemeList() { QList<ColorSchemeEntry> colorSchemes; - QString resourcePath = Core::ICore::resourcePath(); - QDir styleDir(resourcePath + QLatin1String("/styles")); + QDir styleDir(Core::ICore::resourcePath().pathAppended("styles").toDir()); styleDir.setNameFilters(QStringList() << QLatin1String("*.xml")); styleDir.setFilter(QDir::Files); diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp index 51e1a307f1..5e770078b2 100644 --- a/src/plugins/texteditor/highlighter.cpp +++ b/src/plugins/texteditor/highlighter.cpp @@ -59,7 +59,7 @@ KSyntaxHighlighting::Repository *highlightRepository() if (!repository) { repository = new KSyntaxHighlighting::Repository(); repository->addCustomSearchPath(TextEditorSettings::highlighterSettings().definitionFilesPath()); - QDir dir(Core::ICore::resourcePath() + QLatin1String("/generic-highlighter/syntax")); + QDir dir(Core::ICore::resourcePath().pathAppended("generic-highlighter/syntax").toDir()); if (dir.exists() && dir.cdUp()) repository->addCustomSearchPath(dir.path()); } diff --git a/src/plugins/texteditor/highlightersettings.cpp b/src/plugins/texteditor/highlightersettings.cpp index bb224f6345..9edb522a57 100644 --- a/src/plugins/texteditor/highlightersettings.cpp +++ b/src/plugins/texteditor/highlightersettings.cpp @@ -88,7 +88,7 @@ QString findFallbackDefinitionsLocation() } } - dir.setPath(Core::ICore::resourcePath() + QLatin1String("/generic-highlighter")); + dir.setPath(Core::ICore::resourcePath().pathAppended("generic-highlighter").toString()); if (dir.exists() && !dir.entryInfoList().isEmpty()) return dir.path(); @@ -165,8 +165,8 @@ void HighlighterSettings::assignDefaultIgnoredPatterns() void HighlighterSettings::assignDefaultDefinitionsPath() { - const QString &path = - Core::ICore::userResourcePath() + QLatin1String("/generic-highlighter"); + const QString path + = Core::ICore::userResourcePath().pathAppended("generic-highlighter").toString(); if (QFile::exists(path) || QDir().mkpath(path)) m_definitionFilesPath = path; } diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp index afb6c28eda..bdde6f4c2c 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.cpp +++ b/src/plugins/texteditor/snippets/snippetscollection.cpp @@ -94,11 +94,11 @@ SnippetsCollection *SnippetsCollection::instance() } // SnippetsCollection -SnippetsCollection::SnippetsCollection() : - m_userSnippetsPath(Core::ICore::userResourcePath() + QLatin1String("/snippets/")), - m_userSnippetsFile(QLatin1String("snippets.xml")) +SnippetsCollection::SnippetsCollection() + : m_userSnippetsPath(Core::ICore::userResourcePath().pathAppended("snippets/").toString()) + , m_userSnippetsFile(QLatin1String("snippets.xml")) { - QDir dir(Core::ICore::resourcePath() + QLatin1String("/snippets/")); + QDir dir = Core::ICore::resourcePath().pathAppended("snippets").toDir(); dir.setNameFilters(QStringList(QLatin1String("*.xml"))); foreach (const QFileInfo &fi, dir.entryInfoList()) m_builtInSnippetsFiles.append(fi.absoluteFilePath()); |