Core: Use FileName for file path in IDocument

Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2014-12-21 21:54:30 +02:00
committed by Orgad Shaneh
parent 9c1b28fec2
commit c6a983d271
123 changed files with 327 additions and 324 deletions

View File

@@ -87,7 +87,7 @@ protected:
CppTools::WorkingCopy workingCopy);
// Convenience
QString filePath() const { return m_baseTextDocument->filePath(); }
QString filePath() const { return m_baseTextDocument->filePath().toString(); }
unsigned revision() const { return static_cast<unsigned>(textDocument()->revision()); }
QTextDocument *textDocument() const { return m_baseTextDocument->document(); }

View File

@@ -128,7 +128,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
TextEditor::TextDocument *document,
bool enableSemanticHighlighter)
: BaseEditorDocumentProcessor(document)
, m_parser(document->filePath())
, m_parser(document->filePath().toString())
, m_codeWarningsUpdated(false)
, m_semanticHighlighter(enableSemanticHighlighter
? new CppTools::SemanticHighlighter(document)

View File

@@ -105,7 +105,7 @@ public:
{
QStringList completions;
CppCompletionAssistInterface *ai
= new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath(),
= new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath().toString(),
m_editorWidget->document(), m_position,
ExplicitlyInvoked, m_snapshot,
ProjectPart::HeaderPaths());

View File

@@ -133,7 +133,7 @@ void CppCurrentDocumentFilter::onCurrentEditorChanged(Core::IEditor *currentEdit
{
QMutexLocker locker(&m_mutex);
if (currentEditor)
m_currentFileName = currentEditor->document()->filePath();
m_currentFileName = currentEditor->document()->filePath().toString();
else
m_currentFileName.clear();
m_itemsOfCurrentDoc.clear();
@@ -145,7 +145,7 @@ void CppCurrentDocumentFilter::onEditorAboutToClose(Core::IEditor *editorAboutTo
return;
QMutexLocker locker(&m_mutex);
if (m_currentFileName == editorAboutToClose->document()->filePath()) {
if (m_currentFileName == editorAboutToClose->document()->filePath().toString()) {
m_currentFileName.clear();
m_itemsOfCurrentDoc.clear();
}

View File

@@ -699,7 +699,7 @@ void CppModelManager::updateCppEditorDocuments() const
QSet<Core::IDocument *> visibleCppEditorDocuments;
foreach (Core::IEditor *editor, Core::EditorManager::visibleEditors()) {
if (Core::IDocument *document = editor->document()) {
if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath())) {
if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath().toString())) {
visibleCppEditorDocuments.insert(document);
cppEditorDocument->processor()->run();
}
@@ -711,7 +711,7 @@ void CppModelManager::updateCppEditorDocuments() const
= Core::DocumentModel::openedDocuments().toSet();
invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments);
foreach (Core::IDocument *document, invisibleCppEditorDocuments) {
if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath()))
if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath().toString()))
cppEditorDocument->setNeedsRefresh(true);
}
}
@@ -887,7 +887,8 @@ void CppModelManager::onCurrentEditorChanged(Core::IEditor *editor)
if (!editor || !editor->document())
return;
if (EditorDocumentHandle *cppEditorDocument = editorDocument(editor->document()->filePath())) {
if (EditorDocumentHandle *cppEditorDocument =
editorDocument(editor->document()->filePath().toString())) {
if (cppEditorDocument->needsRefresh()) {
cppEditorDocument->setNeedsRefresh(false);
cppEditorDocument->processor()->run();

View File

@@ -989,7 +989,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
const QString filePath = editor->document()->filePath();
const QString filePath = editor->document()->filePath().toString();
BaseEditorDocumentParser *parser = BaseEditorDocumentParser::get(filePath);
parser->setEditorDefines(editorDefines.toUtf8());
parser->update(mm->workingCopy());

View File

@@ -134,7 +134,7 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
testCase.closeEditorAtEndOfTestCase(editor);
// Check editor snapshot
const QString filePath = editor->document()->filePath();
const QString filePath = editor->document()->filePath().toString();
auto *processor = BaseEditorDocumentProcessor::get(filePath);
QVERIFY(processor);
Snapshot snapshot = processor->snapshot();

View File

@@ -236,7 +236,7 @@ void CppToolsPlugin::switchHeaderSource()
void CppToolsPlugin::switchHeaderSourceInNextSplit()
{
QString otherFile = correspondingHeaderOrSource(
EditorManager::currentDocument()->filePath());
EditorManager::currentDocument()->filePath().toString());
if (!otherFile.isEmpty())
EditorManager::openEditor(otherFile, Id(), EditorManager::OpenInOtherSplit);
}

View File

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