forked from qt-creator/qt-creator
ProjectExplorer: Replace a non-FilePath based mimetype use
Change-Id: Icac2f3b2b79f725151a6947a0a6f544f51b31fd7 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -86,7 +86,7 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi
|
||||
if (file->isBinary() || file->contents().isEmpty())
|
||||
return true; // nothing to do
|
||||
|
||||
Id languageId = TextEditorSettings::languageId(Utils::mimeTypeForFile(file->path()).name());
|
||||
Id languageId = TextEditorSettings::languageId(Utils::mimeTypeForFile(file->filePath()).name());
|
||||
|
||||
if (!languageId.isValid())
|
||||
return true; // don't modify files like *.ui, *.pro
|
||||
@@ -99,7 +99,7 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi
|
||||
Indenter *indenter = nullptr;
|
||||
if (factory) {
|
||||
indenter = factory->createIndenter(&doc);
|
||||
indenter->setFileName(Utils::FilePath::fromString(file->path()));
|
||||
indenter->setFileName(file->filePath());
|
||||
}
|
||||
if (!indenter)
|
||||
indenter = new TextIndenter(&doc);
|
||||
|
@@ -25,15 +25,12 @@
|
||||
|
||||
#include "jsonwizardscannergenerator.h"
|
||||
|
||||
#include "../projectexplorer.h"
|
||||
#include "../projectmanager.h"
|
||||
#include "jsonwizard.h"
|
||||
#include "jsonwizardfactory.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -104,7 +101,8 @@ Core::GeneratedFiles JsonWizardScannerGenerator::fileList(Utils::MacroExpander *
|
||||
for (auto it = result.begin(); it != result.end(); ++it) {
|
||||
const QString relPath = project.relativeFilePath(it->path());
|
||||
it->setBinary(binaryPattern.match(relPath).hasMatch());
|
||||
bool found = ProjectManager::canOpenProjectForMimeType(Utils::mimeTypeForFile(relPath));
|
||||
bool found = ProjectManager::canOpenProjectForMimeType(Utils::mimeTypeForFile(
|
||||
Utils::FilePath::fromString(relPath)));
|
||||
if (found) {
|
||||
it->setAttributes(it->attributes() | Core::GeneratedFile::OpenProjectAttribute);
|
||||
minDepth = std::min(minDepth, getDepth(it->path()));
|
||||
|
@@ -244,7 +244,7 @@ void ProjectFileWizardExtension::applyCodeStyle(GeneratedFile *file) const
|
||||
if (file->isBinary() || file->contents().isEmpty())
|
||||
return; // nothing to do
|
||||
|
||||
Id languageId = TextEditorSettings::languageId(Utils::mimeTypeForFile(file->path()).name());
|
||||
Id languageId = TextEditorSettings::languageId(Utils::mimeTypeForFile(file->filePath()).name());
|
||||
|
||||
if (!languageId.isValid())
|
||||
return; // don't modify files like *.ui *.pro
|
||||
|
Reference in New Issue
Block a user