diff options
author | hjk <hjk@qt.io> | 2022-06-14 15:48:57 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-06-14 14:26:10 +0000 |
commit | 79e467a8b87c24a242e7cc96a20315af4fdd0eaa (patch) | |
tree | 61558b87cc7f1f1411853ad58c1d0a933a2cba8d /src/plugins/cppeditor/cppeditordocument.cpp | |
parent | bf8bf1adc0784f8deb43c7299458b45c27d6082c (diff) |
CppEditor: Remove one use of mimetype via QFileInfo
Plus some cosmetical changes I could not resist.
Change-Id: Id2634d3876437a5dfe7ddb4aaa53db396f37e02a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppeditordocument.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppeditordocument.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp index e203bd3cdb..e7621e823e 100644 --- a/src/plugins/cppeditor/cppeditordocument.cpp +++ b/src/plugins/cppeditor/cppeditordocument.cpp @@ -26,16 +26,13 @@ #include "cppeditordocument.h" #include "baseeditordocumentparser.h" -#include "builtineditordocumentprocessor.h" #include "cppcodeformatter.h" -#include "cppcodemodelsettings.h" #include "cppeditorconstants.h" #include "cppeditorplugin.h" #include "cppmodelmanager.h" #include "cppeditorconstants.h" #include "cppeditorplugin.h" #include "cpphighlighter.h" -#include "cppqtstyleindenter.h" #include "cppquickfixassistant.h" #include <coreplugin/editormanager/editormanager.h> @@ -58,20 +55,17 @@ const char NO_PROJECT_CONFIGURATION[] = "NoProject"; -namespace { - -CppEditor::CppModelManager *mm() -{ - return CppEditor::CppModelManager::instance(); -} - -} // anonymous namespace - using namespace TextEditor; +using namespace Utils; namespace CppEditor { namespace Internal { +static CppEditor::CppModelManager *mm() +{ + return CppEditor::CppModelManager::instance(); +} + enum { processDocumentIntervalInMs = 150 }; class CppEditorDocumentHandleImpl : public CppEditorDocumentHandle @@ -245,14 +239,13 @@ void CppEditorDocument::reparseWithPreferredParseContext(const QString &parseCon scheduleProcessDocument(); } -void CppEditorDocument::onFilePathChanged(const Utils::FilePath &oldPath, - const Utils::FilePath &newPath) +void CppEditorDocument::onFilePathChanged(const FilePath &oldPath, const FilePath &newPath) { Q_UNUSED(oldPath) if (!newPath.isEmpty()) { indenter()->setFileName(newPath); - setMimeType(Utils::mimeTypeForFile(newPath.toFileInfo()).name()); + setMimeType(mimeTypeForFile(newPath).name()); connect(this, &Core::IDocument::contentsChanged, this, &CppEditorDocument::scheduleProcessDocument, @@ -363,13 +356,13 @@ void CppEditorDocument::releaseResources() void CppEditorDocument::showHideInfoBarAboutMultipleParseContexts(bool show) { - const Utils::Id id = Constants::MULTIPLE_PARSE_CONTEXTS_AVAILABLE; + const Id id = Constants::MULTIPLE_PARSE_CONTEXTS_AVAILABLE; if (show) { - Utils::InfoBarEntry info(id, - tr("Note: Multiple parse contexts are available for this file. " - "Choose the preferred one from the editor toolbar."), - Utils::InfoBarEntry::GlobalSuppression::Enabled); + InfoBarEntry info(id, + tr("Note: Multiple parse contexts are available for this file. " + "Choose the preferred one from the editor toolbar."), + InfoBarEntry::GlobalSuppression::Enabled); info.removeCancelButton(); if (infoBar()->canInfoBeAdded(id)) infoBar()->addInfo(info); @@ -444,9 +437,9 @@ TextEditor::TabSettings CppEditorDocument::tabSettings() const return indenter()->tabSettings().value_or(TextEditor::TextDocument::tabSettings()); } -bool CppEditorDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave) +bool CppEditorDocument::save(QString *errorString, const FilePath &filePath, bool autoSave) { - Utils::ExecuteOnDestruction resetSettingsOnScopeExit; + ExecuteOnDestruction resetSettingsOnScopeExit; if (indenter()->formatOnSave() && !autoSave) { auto *layout = qobject_cast<TextEditor::TextDocumentLayout *>(document()->documentLayout()); |