EditorManager: Remove QString openEditor(At) overloads

In favor of the FilePath/Link ones.

Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2021-11-01 17:02:02 +01:00
parent 4dac32d661
commit 195abefe7d
56 changed files with 149 additions and 126 deletions

View File

@@ -654,7 +654,7 @@ void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem
return; return;
} }
IEditor *editor = EditorManager::openEditor(saver.filePath().toString(), COMMIT_ID); IEditor *editor = EditorManager::openEditor(saver.filePath(), COMMIT_ID);
if (!editor) { if (!editor) {
VcsOutputWindow::appendError(tr("Unable to create an editor for the commit.")); VcsOutputWindow::appendError(tr("Unable to create an editor for the commit."));
return; return;

View File

@@ -141,8 +141,8 @@ void ClangCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection,
if (!m_currentEditor) if (!m_currentEditor)
return; return;
auto lineColumn = qvariant_cast<LineColumn>(selection.internalData); auto lineColumn = qvariant_cast<LineColumn>(selection.internalData);
Core::EditorManager::openEditorAt(m_currentPath, lineColumn.line, Core::EditorManager::openEditorAt(
lineColumn.column - 1); {FilePath::fromString(m_currentPath), lineColumn.line, lineColumn.column - 1});
} }
void ClangCurrentDocumentFilter::reset(Core::IEditor *newCurrent, const QString &path) void ClangCurrentDocumentFilter::reset(Core::IEditor *newCurrent, const QString &path)

View File

@@ -74,9 +74,9 @@ void openEditorAt(const ClangBackEnd::DiagnosticContainer &diagnostic)
{ {
const ClangBackEnd::SourceLocationContainer &location = diagnostic.location; const ClangBackEnd::SourceLocationContainer &location = diagnostic.location;
Core::EditorManager::openEditorAt(location.filePath.toString(), Core::EditorManager::openEditorAt({Utils::FilePath::fromString(location.filePath.toString()),
int(location.line), int(location.line),
int(location.column - 1)); int(location.column - 1)});
} }
void applyFixit(const ClangBackEnd::DiagnosticContainer &diagnostic) void applyFixit(const ClangBackEnd::DiagnosticContainer &diagnostic)

View File

@@ -323,7 +323,8 @@ bool OpenDocumentCommand::run()
{ {
qCDebug(debug) << "line" << context().lineNumber << "OpenDocumentCommand" << m_documentFilePath; qCDebug(debug) << "line" << context().lineNumber << "OpenDocumentCommand" << m_documentFilePath;
const bool openEditorSucceeded = Core::EditorManager::openEditor(m_documentFilePath); const bool openEditorSucceeded = Core::EditorManager::openEditor(
Utils::FilePath::fromString(m_documentFilePath));
QTC_ASSERT(openEditorSucceeded, return false); QTC_ASSERT(openEditorSucceeded, return false);
auto *processor = ClangEditorDocumentProcessor::get(m_documentFilePath); auto *processor = ClangEditorDocumentProcessor::get(m_documentFilePath);

View File

@@ -181,7 +181,8 @@ private:
OpenEditorAtCursorPosition::OpenEditorAtCursorPosition(const TestDocument &testDocument) OpenEditorAtCursorPosition::OpenEditorAtCursorPosition(const TestDocument &testDocument)
{ {
Core::IEditor *coreEditor = Core::EditorManager::openEditor(testDocument.filePath); Core::IEditor *coreEditor = Core::EditorManager::openEditor(
Utils::FilePath::fromString(testDocument.filePath));
m_editor = qobject_cast<TextEditor::BaseTextEditor *>(coreEditor); m_editor = qobject_cast<TextEditor::BaseTextEditor *>(coreEditor);
QTC_CHECK(m_editor); QTC_CHECK(m_editor);
if (m_editor) { if (m_editor) {

View File

@@ -1852,7 +1852,7 @@ void ClangdTestCompletion::getProposal(const QString &fileName,
int line, column; int line, column;
Utils::Text::convertPosition(doc->document(), pos, &line, &column); Utils::Text::convertPosition(doc->document(), pos, &line, &column);
const auto editor = qobject_cast<BaseTextEditor *>( const auto editor = qobject_cast<BaseTextEditor *>(
EditorManager::openEditorAt(doc->filePath().toString(), line, column - 1)); EditorManager::openEditorAt({doc->filePath(), line, column - 1}));
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(EditorManager::currentEditor(), editor); QCOMPARE(EditorManager::currentEditor(), editor);
QCOMPARE(editor->textDocument(), doc); QCOMPARE(editor->textDocument(), doc);

View File

@@ -123,7 +123,7 @@ bool ClangFormatPlugin::initialize(const QStringList &arguments, QString *errorS
[openClangFormatConfigAction]() { [openClangFormatConfigAction]() {
const FilePath fileName = FilePath::fromVariant(openClangFormatConfigAction->data()); const FilePath fileName = FilePath::fromVariant(openClangFormatConfigAction->data());
if (!fileName.isEmpty()) if (!fileName.isEmpty())
EditorManager::openEditor(configForFile(fileName)); EditorManager::openEditor(FilePath::fromString(configForFile(fileName)));
}); });
connect(EditorManager::instance(), connect(EditorManager::instance(),

View File

@@ -377,7 +377,7 @@ void Manager::onWidgetVisibilityIsChanged(bool visibility)
void Manager::gotoLocation(const QString &fileName, int line, int column) void Manager::gotoLocation(const QString &fileName, int line, int column)
{ {
EditorManager::openEditorAt(fileName, line, column); EditorManager::openEditorAt({FilePath::fromString(fileName), line, column});
} }
/*! /*!

View File

@@ -2689,10 +2689,11 @@ public:
ClearCasePluginPrivate::instance()->setFakeCleartool(true); ClearCasePluginPrivate::instance()->setFakeCleartool(true);
VcsManager::clearVersionControlCache(); VcsManager::clearVersionControlCache();
FileSaver srcSaver(Utils::FilePath::fromString(fileName)); const auto filePath = Utils::FilePath::fromString(fileName);
FileSaver srcSaver(filePath);
srcSaver.write(QByteArray()); srcSaver.write(QByteArray());
srcSaver.finalize(); srcSaver.finalize();
m_editor = EditorManager::openEditor(fileName); m_editor = EditorManager::openEditor(filePath);
QCoreApplication::processEvents(); // process any pending events QCoreApplication::processEvents(); // process any pending events
} }

View File

@@ -182,10 +182,10 @@ void OpenCMakeTargetLocatorFilter::accept(Core::LocatorFilterEntry selection,
const QVariantMap extraData = selection.internalData.toMap(); const QVariantMap extraData = selection.internalData.toMap();
const int line = extraData.value("line").toInt(); const int line = extraData.value("line").toInt();
const QString file = extraData.value("file").toString(); const auto file = FilePath::fromVariant(extraData.value("file"));
if (line >= 0) if (line >= 0)
Core::EditorManager::openEditorAt(file, line); Core::EditorManager::openEditorAt({file, line});
else else
Core::EditorManager::openEditor(file); Core::EditorManager::openEditor(file);
} }

View File

@@ -188,7 +188,7 @@ bool BaseFileWizardFactory::postGenerateOpenEditors(const GeneratedFiles &l, QSt
{ {
foreach (const GeneratedFile &file, l) { foreach (const GeneratedFile &file, l) {
if (file.attributes() & GeneratedFile::OpenEditorAttribute) { if (file.attributes() & GeneratedFile::OpenEditorAttribute) {
if (!EditorManager::openEditor(file.path(), file.editorId())) { if (!EditorManager::openEditor(FilePath::fromString(file.path()), file.editorId())) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("Failed to open an editor for \"%1\".").arg(QDir::toNativeSeparators(file.path())); *errorMessage = tr("Failed to open an editor for \"%1\".").arg(QDir::toNativeSeparators(file.path()));
return false; return false;

View File

@@ -3092,12 +3092,6 @@ IEditor *EditorManager::openEditor(const FilePath &filePath, Id editorId,
filePath, editorId, flags, newEditor); filePath, editorId, flags, newEditor);
} }
IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
OpenEditorFlags flags, bool *newEditor)
{
return openEditor(FilePath::fromString(fileName), editorId, flags, newEditor);
}
/*! /*!
Opens the document specified by \a filePath using the editor type \a Opens the document specified by \a filePath using the editor type \a
editorId and the specified \a flags. editorId and the specified \a flags.
@@ -3132,12 +3126,6 @@ IEditor *EditorManager::openEditorAt(const Link &link,
newEditor); newEditor);
} }
IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column,
Id editorId, OpenEditorFlags flags, bool *newEditor)
{
return openEditorAt(Link(FilePath::fromString(fileName), line, column), editorId, flags, newEditor);
}
/*! /*!
Opens the document at the position of the search result \a item using the Opens the document at the position of the search result \a item using the
editor type \a editorId and the specified \a flags. editor type \a editorId and the specified \a flags.
@@ -3157,13 +3145,13 @@ void EditorManager::openEditorAtSearchResult(const SearchResultItem &item,
bool *newEditor) bool *newEditor)
{ {
if (item.path().empty()) { if (item.path().empty()) {
openEditor(QDir::fromNativeSeparators(item.lineText()), editorId, flags, newEditor); openEditor(FilePath::fromUserInput(item.lineText()), editorId, flags, newEditor);
return; return;
} }
openEditorAt(QDir::fromNativeSeparators(item.path().first()), openEditorAt({FilePath::fromUserInput(item.path().first()),
item.mainRange().begin.line, item.mainRange().begin.line,
item.mainRange().begin.column, item.mainRange().begin.column},
editorId, editorId,
flags, flags,
newEditor); newEditor);
@@ -3603,7 +3591,7 @@ bool EditorManager::restoreState(const QByteArray &state)
continue; continue;
const FilePath rfp = autoSaveName(filePath); const FilePath rfp = autoSaveName(filePath);
if (rfp.exists() && filePath.lastModified() < rfp.lastModified()) { if (rfp.exists() && filePath.lastModified() < rfp.lastModified()) {
if (IEditor *editor = openEditor(fileName, id, DoNotMakeVisible)) if (IEditor *editor = openEditor(filePath, id, DoNotMakeVisible))
DocumentModelPrivate::setPinned(DocumentModel::entryForDocument(editor->document()), pinned); DocumentModelPrivate::setPinned(DocumentModel::entryForDocument(editor->document()), pinned);
} else { } else {
if (DocumentModel::Entry *entry = DocumentModelPrivate::addSuspendedDocument( if (DocumentModel::Entry *entry = DocumentModelPrivate::addSuspendedDocument(

View File

@@ -97,13 +97,6 @@ public:
OpenEditorFlags flags = NoFlags, OpenEditorFlags flags = NoFlags,
bool *newEditor = nullptr); bool *newEditor = nullptr);
// Kept for a while for transition.
static IEditor *openEditor(const QString &fileName, Utils::Id editorId = {},
OpenEditorFlags flags = NoFlags, bool *newEditor = nullptr); // FIXME: Remove overload
static IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
Utils::Id editorId = {}, OpenEditorFlags flags = NoFlags,
bool *newEditor = nullptr); // FIXME: Remove overload
static void openEditorAtSearchResult(const SearchResultItem &item, static void openEditorAtSearchResult(const SearchResultItem &item,
Utils::Id editorId = {}, Utils::Id editorId = {},
OpenEditorFlags flags = NoFlags, OpenEditorFlags flags = NoFlags,

View File

@@ -616,7 +616,7 @@ void FolderNavigationWidget::openItem(const QModelIndex &index)
if (m_fileSystemModel->isDir(index)) if (m_fileSystemModel->isDir(index))
return; return;
const QString path = m_fileSystemModel->filePath(index); const QString path = m_fileSystemModel->filePath(index);
Core::EditorManager::openEditor(path); Core::EditorManager::openEditor(FilePath::fromString(path));
} }
void FolderNavigationWidget::createNewFolder(const QModelIndex &parent) void FolderNavigationWidget::createNewFolder(const QModelIndex &parent)

View File

@@ -400,10 +400,10 @@ void CodePasterPluginPrivate::finishFetch(const QString &titleDescription,
MessageManager::writeDisrupting(saver.errorString()); MessageManager::writeDisrupting(saver.errorString());
return; return;
} }
const QString fileName = saver.filePath().toString(); const Utils::FilePath filePath = saver.filePath();
m_fetchedSnippets.push_back(fileName); m_fetchedSnippets.push_back(filePath.toString());
// Open editor with title. // Open editor with title.
IEditor *editor = EditorManager::openEditor(fileName); IEditor *editor = EditorManager::openEditor(filePath);
QTC_ASSERT(editor, return); QTC_ASSERT(editor, return);
editor->document()->setPreferredDisplayName(titleDescription); editor->document()->setPreferredDisplayName(titleDescription);
} }

View File

@@ -79,7 +79,7 @@ public:
QVERIFY(!fileName.isEmpty()); QVERIFY(!fileName.isEmpty());
// Open in editor // Open in editor
m_editor = EditorManager::openEditor(fileName); m_editor = EditorManager::openEditor(Utils::FilePath::fromString(fileName));
QVERIFY(m_editor); QVERIFY(m_editor);
closeEditorAtEndOfTestCase(m_editor); closeEditorAtEndOfTestCase(m_editor);
m_editorWidget = TextEditorWidget::fromEditor(m_editor); m_editorWidget = TextEditorWidget::fromEditor(m_editor);

View File

@@ -125,7 +125,8 @@ void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection,
Q_UNUSED(selectionStart) Q_UNUSED(selectionStart)
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData); IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData);
Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); Core::EditorManager::openEditorAt(
{Utils::FilePath::fromString(info->fileName()), info->line(), info->column()});
} }
void CppCurrentDocumentFilter::onDocumentUpdated(Document::Ptr doc) void CppCurrentDocumentFilter::onDocumentUpdated(Document::Ptr doc)

View File

@@ -626,8 +626,8 @@ void CppEditorPlugin::switchHeaderSource()
void CppEditorPlugin::switchHeaderSourceInNextSplit() void CppEditorPlugin::switchHeaderSourceInNextSplit()
{ {
QString otherFile = correspondingHeaderOrSource( const auto otherFile = FilePath::fromString(
EditorManager::currentDocument()->filePath().toString()); correspondingHeaderOrSource(EditorManager::currentDocument()->filePath().toString()));
if (!otherFile.isEmpty()) if (!otherFile.isEmpty())
EditorManager::openEditor(otherFile, Id(), EditorManager::OpenInOtherSplit); EditorManager::openEditor(otherFile, Id(), EditorManager::OpenInOtherSplit);
} }

View File

@@ -143,7 +143,8 @@ void CppLocatorFilter::accept(Core::LocatorFilterEntry selection,
Q_UNUSED(selectionStart) Q_UNUSED(selectionStart)
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData); IndexItem::Ptr info = qvariant_cast<IndexItem::Ptr>(selection.internalData);
Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); Core::EditorManager::openEditorAt(
{Utils::FilePath::fromString(info->fileName()), info->line(), info->column()});
} }
CppClassesFilter::CppClassesFilter(CppLocatorData *locatorData) CppClassesFilter::CppClassesFilter(CppLocatorData *locatorData)

View File

@@ -114,7 +114,7 @@ private:
QVERIFY(DocumentModel::openedDocuments().isEmpty()); QVERIFY(DocumentModel::openedDocuments().isEmpty());
QVERIFY(garbageCollectGlobalSnapshot()); QVERIFY(garbageCollectGlobalSnapshot());
m_editor = EditorManager::openEditor(m_fileName); m_editor = EditorManager::openEditor(FilePath::fromString(m_fileName));
QVERIFY(m_editor); QVERIFY(m_editor);
QVERIFY(waitForFileInGlobalSnapshot(m_fileName)); QVERIFY(waitForFileInGlobalSnapshot(m_fileName));

View File

@@ -653,7 +653,7 @@ void ModelManagerTest::testGcIfLastCppeditorClosed()
// Open a file in the editor // Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
Core::IEditor *editor = Core::EditorManager::openEditor(file); Core::IEditor *editor = Core::EditorManager::openEditor(Utils::FilePath::fromString(file));
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor)); QVERIFY(mm->isCppEditor(editor));
@@ -684,7 +684,7 @@ void ModelManagerTest::testDontGcOpenedFiles()
// Open a file in the editor // Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
Core::IEditor *editor = Core::EditorManager::openEditor(file); Core::IEditor *editor = Core::EditorManager::openEditor(Utils::FilePath::fromString(file));
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor)); QVERIFY(mm->isCppEditor(editor));
@@ -783,7 +783,8 @@ void ModelManagerTest::testDefinesPerProject()
const QString firstDeclarationName = i.firstDeclarationName; const QString firstDeclarationName = i.firstDeclarationName;
const QString fileName = i.fileName; const QString fileName = i.fileName;
Core::IEditor *editor = Core::EditorManager::openEditor(fileName); Core::IEditor *editor = Core::EditorManager::openEditor(
Utils::FilePath::fromString(fileName));
EditorCloser closer(editor); EditorCloser closer(editor);
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -847,7 +848,8 @@ void ModelManagerTest::testPrecompiledHeaders()
const QByteArray firstClassInPchFile = i.firstClassInPchFile.toUtf8(); const QByteArray firstClassInPchFile = i.firstClassInPchFile.toUtf8();
const QString fileName = i.fileName; const QString fileName = i.fileName;
Core::IEditor *editor = Core::EditorManager::openEditor(fileName); Core::IEditor *editor = Core::EditorManager::openEditor(
Utils::FilePath::fromString(fileName));
EditorCloser closer(editor); EditorCloser closer(editor);
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -921,7 +923,8 @@ void ModelManagerTest::testDefinesPerEditor()
const QString editorDefines = i.editorDefines; const QString editorDefines = i.editorDefines;
const QString firstDeclarationName = i.firstDeclarationName; const QString firstDeclarationName = i.firstDeclarationName;
Core::IEditor *editor = Core::EditorManager::openEditor(main1File); Core::IEditor *editor = Core::EditorManager::openEditor(
Utils::FilePath::fromString(main1File));
EditorCloser closer(editor); EditorCloser closer(editor);
QVERIFY(editor); QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -949,7 +952,7 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
const QString fileB = testDataDirectory.file(_("main2.cpp")); // content not relevant const QString fileB = testDataDirectory.file(_("main2.cpp")); // content not relevant
// Open file A in editor // Open file A in editor
Core::IEditor *editorA = Core::EditorManager::openEditor(fileA); Core::IEditor *editorA = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileA));
QVERIFY(editorA); QVERIFY(editorA);
EditorCloser closerA(editorA); EditorCloser closerA(editorA);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -958,7 +961,7 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
QVERIFY(!documentAProjectPart->hasProject()); QVERIFY(!documentAProjectPart->hasProject());
// Open file B in editor // Open file B in editor
Core::IEditor *editorB = Core::EditorManager::openEditor(fileB); Core::IEditor *editorB = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileB));
QVERIFY(editorB); QVERIFY(editorB);
EditorCloser closerB(editorB); EditorCloser closerB(editorB);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 2); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 2);
@@ -1087,7 +1090,7 @@ void ModelManagerTest::testRenameIncludesInEditor()
// Open a file in the editor // Open a file in the editor
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0); QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0);
Core::IEditor *editor = Core::EditorManager::openEditor(mainFile); Core::IEditor *editor = Core::EditorManager::openEditor(Utils::FilePath::fromString(mainFile));
QVERIFY(editor); QVERIFY(editor);
EditorCloser editorCloser(editor); EditorCloser editorCloser(editor);
Utils::ExecuteOnDestruction saveAllFiles([](){ Utils::ExecuteOnDestruction saveAllFiles([](){

View File

@@ -273,7 +273,8 @@ void switchHeaderSource()
{ {
const Core::IDocument *currentDocument = Core::EditorManager::currentDocument(); const Core::IDocument *currentDocument = Core::EditorManager::currentDocument();
QTC_ASSERT(currentDocument, return); QTC_ASSERT(currentDocument, return);
const QString otherFile = correspondingHeaderOrSource(currentDocument->filePath().toString()); const auto otherFile = Utils::FilePath::fromString(
correspondingHeaderOrSource(currentDocument->filePath().toString()));
if (!otherFile.isEmpty()) if (!otherFile.isEmpty())
Core::EditorManager::openEditor(otherFile); Core::EditorManager::openEditor(otherFile);
} }

View File

@@ -232,7 +232,8 @@ bool TestCase::succeededSoFar() const
bool TestCase::openCppEditor(const QString &fileName, TextEditor::BaseTextEditor **editor, bool TestCase::openCppEditor(const QString &fileName, TextEditor::BaseTextEditor **editor,
CppEditorWidget **editorWidget) CppEditorWidget **editorWidget)
{ {
if (const auto e = dynamic_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::openEditor(fileName))) { if (const auto e = dynamic_cast<TextEditor::BaseTextEditor *>(
Core::EditorManager::openEditor(FilePath::fromString(fileName)))) {
if (editor) { if (editor) {
*editor = e; *editor = e;
TextEditor::StorageSettings s = e->textDocument()->storageSettings(); TextEditor::StorageSettings s = e->textDocument()->storageSettings();

View File

@@ -179,7 +179,8 @@ void SymbolsFindFilter::openEditor(const SearchResultItem &item)
if (!item.userData().canConvert<IndexItem::Ptr>()) if (!item.userData().canConvert<IndexItem::Ptr>())
return; return;
IndexItem::Ptr info = item.userData().value<IndexItem::Ptr>(); IndexItem::Ptr info = item.userData().value<IndexItem::Ptr>();
EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); EditorManager::openEditorAt(
{FilePath::fromString(info->fileName()), info->line(), info->column()});
} }
QWidget *SymbolsFindFilter::createConfigWidget() QWidget *SymbolsFindFilter::createConfigWidget()

View File

@@ -802,7 +802,7 @@ static void setDiffBaseDirectory(IEditor *editor, const FilePath &db)
CvsSubmitEditor *CvsPluginPrivate::openCVSSubmitEditor(const QString &fileName) CvsSubmitEditor *CvsPluginPrivate::openCVSSubmitEditor(const QString &fileName)
{ {
IEditor *editor = EditorManager::openEditor(fileName, CVSCOMMITEDITOR_ID); IEditor *editor = EditorManager::openEditor(FilePath::fromString(fileName), CVSCOMMITEDITOR_ID);
auto submitEditor = qobject_cast<CvsSubmitEditor*>(editor); auto submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return nullptr); QTC_ASSERT(submitEditor, return nullptr);
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles, connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,

View File

@@ -182,11 +182,10 @@ void ConsoleView::onRowActivated(const QModelIndex &index)
if (!index.isValid()) if (!index.isValid())
return; return;
const QFileInfo fi = m_finder.findFile(model()->data(index, ConsoleItem::FileRole).toString()) const Utils::FilePath fp
.constFirst().toFileInfo(); = m_finder.findFile(model()->data(index, ConsoleItem::FileRole).toString()).constFirst();
if (fi.exists() && fi.isFile() && fi.isReadable()) { if (fp.exists() && fp.isFile() && fp.isReadableFile()) {
Core::EditorManager::openEditorAt(fi.canonicalFilePath(), Core::EditorManager::openEditorAt({fp, model()->data(index, ConsoleItem::LineRole).toInt()});
model()->data(index, ConsoleItem::LineRole).toInt());
} }
} }

View File

@@ -140,7 +140,7 @@ static void openImageViewer(const QImage &image)
fileName = temporaryFile.fileName(); fileName = temporaryFile.fileName();
temporaryFile.close(); temporaryFile.close();
} }
if (Core::IEditor *e = Core::EditorManager::openEditor(fileName)) if (Core::IEditor *e = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileName)))
e->document()->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, QVariant(true)); e->document()->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, QVariant(true));
} }

View File

@@ -756,8 +756,8 @@ void QmlInspectorAgent::onShowAppOnTopChanged(bool checked)
void QmlInspectorAgent::jumpToObjectDefinitionInEditor(const FileReference &objSource) void QmlInspectorAgent::jumpToObjectDefinitionInEditor(const FileReference &objSource)
{ {
const QString fileName = m_qmlEngine->toFileInProject(objSource.url()); const auto filePath = Utils::FilePath::fromString(m_qmlEngine->toFileInProject(objSource.url()));
Core::EditorManager::openEditorAt(fileName, objSource.lineNumber()); Core::EditorManager::openEditorAt({filePath, objSource.lineNumber()});
} }
void QmlInspectorAgent::selectObjects(const QList<int> &debugIds, void QmlInspectorAgent::selectObjects(const QList<int> &debugIds,

View File

@@ -184,7 +184,7 @@ static QString otherFile()
void FormEditorPlugin::switchSourceForm() void FormEditorPlugin::switchSourceForm()
{ {
const QString fileToOpen = otherFile(); const auto fileToOpen = Utils::FilePath::fromString(otherFile());
if (!fileToOpen.isEmpty()) if (!fileToOpen.isEmpty())
EditorManager::openEditor(fileToOpen); EditorManager::openEditor(fileToOpen);
} }

View File

@@ -154,7 +154,7 @@ public:
QList<TextEditor::BaseTextEditor *> editors; QList<TextEditor::BaseTextEditor *> editors;
for (const QString &file : files) { for (const QString &file : files) {
IEditor *editor = EditorManager::openEditor(file); IEditor *editor = EditorManager::openEditor(Utils::FilePath::fromString(file));
TextEditor::BaseTextEditor *e = qobject_cast<TextEditor::BaseTextEditor *>(editor); TextEditor::BaseTextEditor *e = qobject_cast<TextEditor::BaseTextEditor *>(editor);
QVERIFY(e); QVERIFY(e);
closeEditorAtEndOfTestCase(editor); closeEditorAtEndOfTestCase(editor);

View File

@@ -246,9 +246,10 @@ static Function *findDeclaration(const Class *cl, const QString &functionName)
static inline BaseTextEditor *editorAt(const QString &fileName, int line, int column) static inline BaseTextEditor *editorAt(const QString &fileName, int line, int column)
{ {
return qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column, return qobject_cast<BaseTextEditor *>(
Utils::Id(), Core::EditorManager::openEditorAt({FilePath::fromString(fileName), line, column},
Core::EditorManager::DoNotMakeVisible)); Utils::Id(),
Core::EditorManager::DoNotMakeVisible));
} }
static void addDeclaration(const Snapshot &snapshot, static void addDeclaration(const Snapshot &snapshot,
@@ -560,8 +561,8 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
CppEditor::CppRefactoringChanges refactoring(docTable); CppEditor::CppRefactoringChanges refactoring(docTable);
CppEditor::SymbolFinder symbolFinder; CppEditor::SymbolFinder symbolFinder;
if (const Function *funImpl = symbolFinder.findMatchingDefinition(fun, docTable, true)) { if (const Function *funImpl = symbolFinder.findMatchingDefinition(fun, docTable, true)) {
Core::EditorManager::openEditorAt(QString::fromUtf8(funImpl->fileName()), Core::EditorManager::openEditorAt(
funImpl->line() + 2); {FilePath::fromString(QString::fromUtf8(funImpl->fileName())), funImpl->line() + 2});
return true; return true;
} }
const QString implFilePath = CppEditor::correspondingHeaderOrSource(declFilePath); const QString implFilePath = CppEditor::correspondingHeaderOrSource(declFilePath);
@@ -575,9 +576,9 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
+ functionNameWithParameterNames + "\n{\n" + QString(indentation, ' ') + "\n}\n" + functionNameWithParameterNames + "\n{\n" + QString(indentation, ' ') + "\n}\n"
+ location.suffix(); + location.suffix();
editor->insert(definition); editor->insert(definition);
Core::EditorManager::openEditorAt(location.fileName(), Core::EditorManager::openEditorAt({FilePath::fromString(location.fileName()),
location.line() + location.prefix().count('\n') + 2, int(location.line() + location.prefix().count('\n') + 2),
indentation); indentation});
return true; return true;
} }

View File

@@ -217,7 +217,7 @@ void DiffEditorWidgetController::jumpToOriginalFile(const QString &fileName,
const FilePath filePath = m_document->baseDirectory().resolvePath(fileName); const FilePath filePath = m_document->baseDirectory().resolvePath(fileName);
if (filePath.exists() && !filePath.isDir()) if (filePath.exists() && !filePath.isDir())
EditorManager::openEditorAt(filePath.toString(), lineNumber, columnNumber); EditorManager::openEditorAt({filePath, lineNumber, columnNumber});
} }
void DiffEditorWidgetController::setFontSettings(const FontSettings &fontSettings) void DiffEditorWidgetController::setFontSettings(const FontSettings &fontSettings)

View File

@@ -1841,12 +1841,13 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
} }
}); });
handler->requestJumpToGlobalMark.connect([this](QChar mark, bool backTickMode, const QString &fileName) { handler->requestJumpToGlobalMark.connect(
if (IEditor *iedit = EditorManager::openEditor(fileName)) { [this](QChar mark, bool backTickMode, const QString &fileName) {
if (FakeVimHandler *handler = m_editorToHandler.value(iedit, nullptr)) if (IEditor *iedit = EditorManager::openEditor(FilePath::fromString(fileName))) {
handler->jumpToLocalMark(mark, backTickMode); if (FakeVimHandler *handler = m_editorToHandler.value(iedit, nullptr))
} handler->jumpToLocalMark(mark, backTickMode);
}); }
});
handler->handleExCommandRequested.connect([this, handler](bool *handled, const ExCommand &cmd) { handler->handleExCommandRequested.connect([this, handler](bool *handled, const ExCommand &cmd) {
handleExCommand(handler, handled, cmd); handleExCommand(handler, handled, cmd);

View File

@@ -1384,7 +1384,8 @@ void GitPluginPrivate::updateVersionWarning()
IEditor *GitPluginPrivate::openSubmitEditor(const QString &fileName, const CommitData &cd) IEditor *GitPluginPrivate::openSubmitEditor(const QString &fileName, const CommitData &cd)
{ {
IEditor *editor = EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID); IEditor *editor = EditorManager::openEditor(FilePath::fromString(fileName),
Constants::GITSUBMITEDITOR_ID);
auto submitEditor = qobject_cast<GitSubmitEditor*>(editor); auto submitEditor = qobject_cast<GitSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return nullptr); QTC_ASSERT(submitEditor, return nullptr);
setSubmitEditor(submitEditor); setSubmitEditor(submitEditor);

View File

@@ -156,8 +156,10 @@ void ElementTasks::openClassDefinition(const qmt::MElement *element)
CppEditor::IndexItem::Ptr info = qvariant_cast<CppEditor::IndexItem::Ptr>(entry.internalData); CppEditor::IndexItem::Ptr info = qvariant_cast<CppEditor::IndexItem::Ptr>(entry.internalData);
if (info->scopedSymbolName() != qualifiedClassName) if (info->scopedSymbolName() != qualifiedClassName)
continue; continue;
if (Core::EditorManager::instance()->openEditorAt(info->fileName(), info->line(), info->column())) if (Core::EditorManager::instance()->openEditorAt(
{Utils::FilePath::fromString(info->fileName()), info->line(), info->column()})) {
return; return;
}
} }
} }
} }

View File

@@ -259,7 +259,7 @@ void ModelsManager::onOpenDiagramFromProjectExplorer()
void ModelsManager::onOpenDefaultModel(const qmt::Uid &modelUid) void ModelsManager::onOpenDefaultModel(const qmt::Uid &modelUid)
{ {
QString modelFile = d->modelIndexer->findModel(modelUid); const auto modelFile = Utils::FilePath::fromString(d->modelIndexer->findModel(modelUid));
if (!modelFile.isEmpty()) if (!modelFile.isEmpty())
Core::EditorManager::openEditor(modelFile); Core::EditorManager::openEditor(modelFile);
} }

View File

@@ -802,7 +802,8 @@ void PerforcePluginPrivate::startSubmitProject()
IEditor *PerforcePluginPrivate::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames) IEditor *PerforcePluginPrivate::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames)
{ {
IEditor *editor = EditorManager::openEditor(fileName, PERFORCE_SUBMIT_EDITOR_ID); IEditor *editor = EditorManager::openEditor(FilePath::fromString(fileName),
PERFORCE_SUBMIT_EDITOR_ID);
auto submitEditor = static_cast<PerforceSubmitEditor*>(editor); auto submitEditor = static_cast<PerforceSubmitEditor*>(editor);
setSubmitEditor(submitEditor); setSubmitEditor(submitEditor);
submitEditor->restrictToProjectFiles(depotFileNames); submitEditor->restrictToProjectFiles(depotFileNames);

View File

@@ -555,10 +555,10 @@ void PerfProfilerTool::gotoSourceLocation(QString filePath, int lineNumber, int
// The text editors count columns starting with 0, but the ASTs store the // The text editors count columns starting with 0, but the ASTs store the
// location starting with 1, therefore the -1. // location starting with 1, therefore the -1.
EditorManager::openEditorAt(fi.filePath(), lineNumber, columnNumber - 1, Utils::Id(), EditorManager::openEditorAt({FilePath::fromFileInfo(fi), lineNumber, columnNumber - 1},
Utils::Id(),
EditorManager::DoNotSwitchToDesignMode EditorManager::DoNotSwitchToDesignMode
| EditorManager::DoNotSwitchToEditMode); | EditorManager::DoNotSwitchToEditMode);
} }
static Utils::FilePaths collectQtIncludePaths(const ProjectExplorer::Kit *kit) static Utils::FilePaths collectQtIncludePaths(const ProjectExplorer::Kit *kit)

View File

@@ -466,7 +466,9 @@ void JsonWizard::openFiles(const JsonWizard::GeneratorFiles &files)
openedSomething = true; openedSomething = true;
} }
if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) { if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) {
Core::IEditor *editor = Core::EditorManager::openEditor(file.path(), file.editorId()); Core::IEditor *editor = Core::EditorManager::openEditor(FilePath::fromString(
file.path()),
file.editorId());
if (!editor) { if (!editor) {
errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
"Failed to open an editor for \"%1\".") "Failed to open an editor for \"%1\".")

View File

@@ -45,9 +45,9 @@ bool ShowInEditorTaskHandler::canHandle(const Task &task) const
void ShowInEditorTaskHandler::handle(const Task &task) void ShowInEditorTaskHandler::handle(const Task &task)
{ {
QFileInfo fi(task.file.toFileInfo());
const int column = task.column ? task.column - 1 : 0; const int column = task.column ? task.column - 1 : 0;
Core::EditorManager::openEditorAt(fi.filePath(), task.movedLine, column, {}, Core::EditorManager::openEditorAt({task.file, task.movedLine, column},
{},
Core::EditorManager::SwitchSplitIfAlreadyVisible); Core::EditorManager::SwitchSplitIfAlreadyVisible);
} }

View File

@@ -123,7 +123,7 @@ private:
return false; return false;
const QString fileName = match.captured(3); const QString fileName = match.captured(3);
const int lineNumber = match.captured(4).toInt(); const int lineNumber = match.captured(4).toInt();
Core::EditorManager::openEditorAt(fileName, lineNumber); Core::EditorManager::openEditorAt({FilePath::fromString(fileName), lineNumber});
return true; return true;
} }

View File

@@ -685,7 +685,9 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
if (!usages.isEmpty() && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) { if (!usages.isEmpty() && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) {
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col); Core::EditorManager::openEditorAt({Utils::FilePath::fromString(usages.constFirst().path),
usages.constFirst().line,
usages.constFirst().col});
if (!signalNames.isEmpty()) { if (!signalNames.isEmpty()) {
auto dialog = new AddSignalHandlerDialog(Core::ICore::dialogParent()); auto dialog = new AddSignalHandlerDialog(Core::ICore::dialogParent());
@@ -707,7 +709,9 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
//Move cursor to correct curser position //Move cursor to correct curser position
const QString filePath = Core::EditorManager::currentDocument()->filePath().toString(); const QString filePath = Core::EditorManager::currentDocument()->filePath().toString();
QList<QmlJSEditor::FindReferences::Usage> usages = FindImplementation::run(filePath, typeName, itemId); QList<QmlJSEditor::FindReferences::Usage> usages = FindImplementation::run(filePath, typeName, itemId);
Core::EditorManager::openEditorAt(filePath, usages.constFirst().line, usages.constFirst().col + 1); Core::EditorManager::openEditorAt({Utils::FilePath::fromString(filePath),
usages.constFirst().line,
usages.constFirst().col + 1});
} ); } );
dialog->show(); dialog->show();
@@ -715,7 +719,9 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
return; return;
} }
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col + 1); Core::EditorManager::openEditorAt({Utils::FilePath::fromString(usages.constFirst().path),
usages.constFirst().line,
usages.constFirst().col + 1});
} }
void removeLayout(const SelectionContext &selectionContext) void removeLayout(const SelectionContext &selectionContext)

View File

@@ -388,8 +388,10 @@ void NavigatorView::changeToComponent(const QModelIndex &index)
if (index.isValid() && currentModel()->data(index, Qt::UserRole).isValid()) { if (index.isValid() && currentModel()->data(index, Qt::UserRole).isValid()) {
const ModelNode doubleClickNode = modelNodeForIndex(index); const ModelNode doubleClickNode = modelNodeForIndex(index);
if (doubleClickNode.metaInfo().isFileComponent()) if (doubleClickNode.metaInfo().isFileComponent())
Core::EditorManager::openEditor(doubleClickNode.metaInfo().componentFileName(), Core::EditorManager::openEditor(Utils::FilePath::fromString(
Utils::Id(), Core::EditorManager::DoNotMakeVisible); doubleClickNode.metaInfo().componentFileName()),
Utils::Id(),
Core::EditorManager::DoNotMakeVisible);
} }
} }

View File

@@ -527,7 +527,8 @@ void DesignModeWidget::toolBarOnGoBackClicked()
if (m_navigatorHistoryCounter > 0) { if (m_navigatorHistoryCounter > 0) {
--m_navigatorHistoryCounter; --m_navigatorHistoryCounter;
m_keepNavigatorHistory = true; m_keepNavigatorHistory = true;
Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter), Core::EditorManager::openEditor(Utils::FilePath::fromString(
m_navigatorHistory.at(m_navigatorHistoryCounter)),
Utils::Id(), Utils::Id(),
Core::EditorManager::DoNotMakeVisible); Core::EditorManager::DoNotMakeVisible);
m_keepNavigatorHistory = false; m_keepNavigatorHistory = false;
@@ -539,7 +540,8 @@ void DesignModeWidget::toolBarOnGoForwardClicked()
if (m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1)) { if (m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1)) {
++m_navigatorHistoryCounter; ++m_navigatorHistoryCounter;
m_keepNavigatorHistory = true; m_keepNavigatorHistory = true;
Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter), Core::EditorManager::openEditor(Utils::FilePath::fromString(
m_navigatorHistory.at(m_navigatorHistoryCounter)),
Utils::Id(), Utils::Id(),
Core::EditorManager::DoNotMakeVisible); Core::EditorManager::DoNotMakeVisible);
m_keepNavigatorHistory = false; m_keepNavigatorHistory = false;

View File

@@ -111,8 +111,9 @@ static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QV
static void openFileComponent(const ModelNode &modelNode) static void openFileComponent(const ModelNode &modelNode)
{ {
QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally(); QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally();
Core::EditorManager::openEditor(modelNode.metaInfo().componentFileName(), Core::EditorManager::openEditor(FilePath::fromString(modelNode.metaInfo().componentFileName()),
Utils::Id(), Core::EditorManager::DoNotMakeVisible); Utils::Id(),
Core::EditorManager::DoNotMakeVisible);
} }
static void openFileComponentForDelegate(const ModelNode &modelNode) static void openFileComponentForDelegate(const ModelNode &modelNode)
@@ -138,7 +139,10 @@ static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode)
componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().constFirst(); componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().constFirst();
} }
Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Utils::Id(), Core::EditorManager::DoNotMakeVisible); Core::EditorManager::openEditor(FilePath::fromString(
componentModelNode.metaInfo().componentFileName()),
Utils::Id(),
Core::EditorManager::DoNotMakeVisible);
} }
static void openSourcePropertyOfLoader(const ModelNode &modelNode) static void openSourcePropertyOfLoader(const ModelNode &modelNode)
@@ -148,7 +152,10 @@ static void openSourcePropertyOfLoader(const ModelNode &modelNode)
QString componentFileName = modelNode.variantProperty("source").value().toString(); QString componentFileName = modelNode.variantProperty("source").value().toString();
QFileInfo fileInfo(modelNode.model()->fileUrl().toLocalFile()); QFileInfo fileInfo(modelNode.model()->fileUrl().toLocalFile());
Core::EditorManager::openEditor(fileInfo.absolutePath() + "/" + componentFileName, Utils::Id(), Core::EditorManager::DoNotMakeVisible); Core::EditorManager::openEditor(FilePath::fromString(fileInfo.absolutePath())
/ componentFileName,
Utils::Id(),
Core::EditorManager::DoNotMakeVisible);
} }

View File

@@ -383,7 +383,8 @@ void QmlDesignerPlugin::showDesigner()
dialog.exec(); dialog.exec();
if (dialog.uiFileOpened()) { if (dialog.uiFileOpened()) {
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
Core::EditorManager::openEditorAt(dialog.uiQmlFile(), 0, 0); Core::EditorManager::openEditorAt(
{Utils::FilePath::fromString(dialog.uiQmlFile()), 0, 0});
return; return;
} }
} }

View File

@@ -102,5 +102,6 @@ void FunctionFilter::accept(Core::LocatorFilterEntry selection,
Q_UNUSED(selectionStart) Q_UNUSED(selectionStart)
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData); const LocatorData::Entry entry = qvariant_cast<LocatorData::Entry>(selection.internalData);
Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column); Core::EditorManager::openEditorAt(
{Utils::FilePath::fromString(entry.fileName), entry.line, entry.column});
} }

View File

@@ -419,17 +419,20 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber,
if (lineNumber < 0 || fileUrl.isEmpty()) if (lineNumber < 0 || fileUrl.isEmpty())
return; return;
const QString projectFileName = d->m_profilerModelManager->findLocalFile(fileUrl); const auto projectFileName = FilePath::fromString(
d->m_profilerModelManager->findLocalFile(fileUrl));
QFileInfo fileInfo(projectFileName); if (!projectFileName.exists() || !projectFileName.isReadableFile())
if (!fileInfo.exists() || !fileInfo.isReadable())
return; return;
// The text editors count columns starting with 0, but the ASTs store the // The text editors count columns starting with 0, but the ASTs store the
// location starting with 1, therefore the -1. // location starting with 1, therefore the -1.
EditorManager::openEditorAt( EditorManager::openEditorAt({projectFileName,
projectFileName, lineNumber == 0 ? 1 : lineNumber, columnNumber - 1, Id(), lineNumber == 0 ? 1 : lineNumber,
EditorManager::DoNotSwitchToDesignMode | EditorManager::DoNotSwitchToEditMode); columnNumber - 1},
Id(),
EditorManager::DoNotSwitchToDesignMode
| EditorManager::DoNotSwitchToEditMode);
} }
void QmlProfilerTool::updateTimeDisplay() void QmlProfilerTool::updateTimeDisplay()

View File

@@ -229,7 +229,7 @@ bool QtOutputLineParser::handleLink(const QString &href)
void QtOutputLineParser::openEditor(const QString &fileName, int line, int column) void QtOutputLineParser::openEditor(const QString &fileName, int line, int column)
{ {
Core::EditorManager::openEditorAt(fileName, line, column); Core::EditorManager::openEditorAt({FilePath::fromString(fileName), line, column});
} }
void QtOutputLineParser::updateProjectFileList() void QtOutputLineParser::updateProjectFileList()

View File

@@ -304,7 +304,7 @@ void ResourceEditorW::openCurrentFile()
void ResourceEditorW::openFile(const QString &fileName) void ResourceEditorW::openFile(const QString &fileName)
{ {
Core::EditorManager::openEditor(fileName); Core::EditorManager::openEditor(FilePath::fromString(fileName));
} }
void ResourceEditorW::onRefresh() void ResourceEditorW::onRefresh()

View File

@@ -212,7 +212,7 @@ public:
const QString qmlFile = QFileInfo(projectFile).dir().absolutePath() + "/" const QString qmlFile = QFileInfo(projectFile).dir().absolutePath() + "/"
+ formFile; + formFile;
Core::EditorManager::openEditor(qmlFile); Core::EditorManager::openEditor(Utils::FilePath::fromString(qmlFile));
}); });
return; return;
} }

View File

@@ -624,7 +624,8 @@ void SubversionPluginPrivate::diffCommitFiles(const QStringList &files)
SubversionSubmitEditor *SubversionPluginPrivate::openSubversionSubmitEditor(const QString &fileName) SubversionSubmitEditor *SubversionPluginPrivate::openSubversionSubmitEditor(const QString &fileName)
{ {
IEditor *editor = EditorManager::openEditor(fileName, Constants::SUBVERSION_COMMIT_EDITOR_ID); IEditor *editor = EditorManager::openEditor(FilePath::fromString(fileName),
Constants::SUBVERSION_COMMIT_EDITOR_ID);
auto submitEditor = qobject_cast<SubversionSubmitEditor*>(editor); auto submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return nullptr); QTC_ASSERT(submitEditor, return nullptr);
setSubmitEditor(submitEditor); setSubmitEditor(submitEditor);

View File

@@ -569,10 +569,11 @@ void CallgrindToolPrivate::selectFunction(const Function *func)
if (!item || item != func) if (!item || item != func)
m_stackBrowser.select(func); m_stackBrowser.select(func);
if (QFile::exists(func->file())) { const auto filePath = FilePath::fromString(func->file());
if (filePath.exists()) {
///TODO: custom position support? ///TODO: custom position support?
int line = func->lineNumber(); int line = func->lineNumber();
EditorManager::openEditorAt(func->file(), qMax(line, 0)); EditorManager::openEditorAt({filePath, qMax(line, 0)});
} }
} }

View File

@@ -265,7 +265,7 @@ void CleanDialog::slotDoubleClicked(const QModelIndex &index)
// Open file on doubleclick // Open file on doubleclick
if (const QStandardItem *item = d->m_filesModel->itemFromIndex(index)) if (const QStandardItem *item = d->m_filesModel->itemFromIndex(index))
if (!item->data(Internal::isDirectoryRole).toBool()) { if (!item->data(Internal::isDirectoryRole).toBool()) {
const QString fname = item->data(Internal::fileNameRole).toString(); const auto fname = Utils::FilePath::fromVariant(item->data(Internal::fileNameRole));
Core::EditorManager::openEditor(fname); Core::EditorManager::openEditor(fname);
} }
} }

View File

@@ -1190,7 +1190,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor)
if (!exists) if (!exists)
return; return;
Core::IEditor *ed = Core::EditorManager::openEditor(fileName); Core::IEditor *ed = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileName));
if (auto editor = qobject_cast<BaseTextEditor *>(ed)) if (auto editor = qobject_cast<BaseTextEditor *>(ed))
editor->gotoLine(chunkStart + lineCount); editor->gotoLine(chunkStart + lineCount);
} }

View File

@@ -203,7 +203,7 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
return; return;
} }
if (action == openAction) { if (action == openAction) {
const QString fileName = action->data().toString(); const auto fileName = Utils::FilePath::fromVariant(action->data());
Core::EditorManager::openEditor(fileName); Core::EditorManager::openEditor(fileName);
} }
} }