forked from qt-creator/qt-creator
Core: Use FileName for file path in IDocument
Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
9c1b28fec2
commit
c6a983d271
@@ -74,7 +74,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
|
||||
widget->convertPosition(pos, &line, &column);
|
||||
|
||||
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManager::instance()->snapshot();
|
||||
CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath());
|
||||
CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath().toString());
|
||||
QTC_ASSERT(doc, return 0);
|
||||
|
||||
// fetch the expression's code
|
||||
|
@@ -56,14 +56,12 @@ bool AndroidManifestDocument::save(QString *errorString, const QString &fileName
|
||||
|
||||
QString AndroidManifestDocument::defaultPath() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.absolutePath();
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString AndroidManifestDocument::suggestedFileName() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.fileName();
|
||||
return filePath().toFileInfo().fileName();
|
||||
}
|
||||
|
||||
bool AndroidManifestDocument::isModified() const
|
||||
|
@@ -476,7 +476,7 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
void AndroidManifestEditorWidget::updateTargetComboBox()
|
||||
{
|
||||
const QString docPath(m_textEditorWidget->textDocument()->filePath());
|
||||
const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
|
||||
ProjectExplorer::Project *project = androidProject(docPath);
|
||||
QStringList items;
|
||||
if (project) {
|
||||
@@ -577,7 +577,7 @@ void AndroidManifestEditorWidget::preSave()
|
||||
syncToEditor();
|
||||
|
||||
if (m_setAppName && m_appNameInStringsXml) {
|
||||
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
|
||||
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
|
||||
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
|
||||
QFile f(fileName);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
@@ -601,7 +601,7 @@ void AndroidManifestEditorWidget::preSave()
|
||||
m_setAppName = false;
|
||||
}
|
||||
|
||||
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
|
||||
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
|
||||
if (!m_lIconPath.isEmpty()) {
|
||||
copyIcon(LowDPI, baseDir, m_lIconPath);
|
||||
m_lIconPath.clear();
|
||||
@@ -695,7 +695,7 @@ void AndroidManifestEditorWidget::updateInfoBar()
|
||||
|
||||
void AndroidManifestEditorWidget::updateSdkVersions()
|
||||
{
|
||||
const QString docPath(m_textEditorWidget->textDocument()->filePath());
|
||||
const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
|
||||
QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
|
||||
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
|
||||
m_androidMinSdkVersion->addItem(tr("API %1: %2")
|
||||
@@ -766,7 +766,7 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
|
||||
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
|
||||
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
|
||||
|
||||
QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
|
||||
QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
|
||||
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
|
||||
|
||||
QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));
|
||||
|
@@ -71,14 +71,12 @@ JavaDocument::JavaDocument()
|
||||
|
||||
QString JavaDocument::defaultPath() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.absolutePath();
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString JavaDocument::suggestedFileName() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.fileName();
|
||||
return filePath().toFileInfo().fileName();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -43,7 +43,7 @@ AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QStr
|
||||
{
|
||||
setId("Autotools.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
bool AutotoolsProjectFile::save(QString *errorString, const QString &fileName, bool autoSave)
|
||||
|
@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
|
||||
ProjectNode(projectFile->filePath()),
|
||||
ProjectNode(projectFile->filePath().toString()),
|
||||
m_project(project),
|
||||
m_projectFile(projectFile)
|
||||
{
|
||||
|
@@ -746,7 +746,7 @@ bool BazaarPlugin::submitEditorAboutToClose()
|
||||
// Whether local commit or not
|
||||
if (commitWidget->isLocalOptionEnabled())
|
||||
extraOptions += QLatin1String("--local");
|
||||
m_client->commit(m_submitRepository, files, editorDocument->filePath(), extraOptions);
|
||||
m_client->commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -233,7 +233,7 @@ void BeautifierPlugin::formatCurrentFile(const Command &command)
|
||||
watcher, &QFutureWatcher<FormatTask>::cancel);
|
||||
connect(watcher, SIGNAL(finished()), m_asyncFormatMapper, SLOT(map()));
|
||||
m_asyncFormatMapper->setMapping(watcher, watcher);
|
||||
const QString filePath = widget->textDocument()->filePath();
|
||||
const QString filePath = widget->textDocument()->filePath().toString();
|
||||
watcher->setFuture(QtConcurrent::run(&BeautifierPlugin::formatAsync, this,
|
||||
FormatTask(widget, filePath, sourceData, command)));
|
||||
}
|
||||
|
@@ -61,6 +61,7 @@
|
||||
#include <utils/reloadpromptutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Utils;
|
||||
using namespace Core;
|
||||
|
||||
namespace BinEditor {
|
||||
@@ -256,9 +257,8 @@ public:
|
||||
bool save(QString *errorString, const QString &fn, bool autoSave)
|
||||
{
|
||||
QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive
|
||||
const QString fileNameToUse
|
||||
= fn.isEmpty() ? filePath() : fn;
|
||||
if (m_widget->save(errorString, filePath(), fileNameToUse)) {
|
||||
const FileName fileNameToUse = fn.isEmpty() ? filePath() : FileName::fromString(fn);
|
||||
if (m_widget->save(errorString, filePath().toString(), fileNameToUse.toString())) {
|
||||
setFilePath(fileNameToUse);
|
||||
return true;
|
||||
} else {
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
return false;
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
file.close();
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
m_widget->setSizes(offset, file.size());
|
||||
return true;
|
||||
}
|
||||
@@ -297,10 +297,10 @@ public:
|
||||
private slots:
|
||||
void provideData(quint64 block)
|
||||
{
|
||||
const QString fn = filePath();
|
||||
const FileName fn = filePath();
|
||||
if (fn.isEmpty())
|
||||
return;
|
||||
QFile file(fn);
|
||||
QFile file(fn.toString());
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
int blockSize = m_widget->dataBlockSize();
|
||||
file.seek(block * blockSize);
|
||||
@@ -313,13 +313,13 @@ private slots:
|
||||
} else {
|
||||
QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"),
|
||||
tr("Cannot open %1: %2").arg(
|
||||
QDir::toNativeSeparators(fn), file.errorString()));
|
||||
fn.toUserOutput(), file.errorString()));
|
||||
}
|
||||
}
|
||||
|
||||
void provideNewRange(quint64 offset)
|
||||
{
|
||||
open(0, filePath(), offset);
|
||||
open(0, filePath().toString(), offset);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -332,11 +332,10 @@ public:
|
||||
: m_widget->isModified(); }
|
||||
|
||||
bool isFileReadOnly() const {
|
||||
const QString fn = filePath();
|
||||
const FileName fn = filePath();
|
||||
if (fn.isEmpty())
|
||||
return false;
|
||||
const QFileInfo fi(fn);
|
||||
return !fi.isWritable();
|
||||
return !fn.toFileInfo().isWritable();
|
||||
}
|
||||
|
||||
bool isSaveAsAllowed() const { return true; }
|
||||
@@ -350,7 +349,7 @@ public:
|
||||
emit aboutToReload();
|
||||
int cPos = m_widget->cursorPosition();
|
||||
m_widget->clear();
|
||||
const bool success = open(errorString, filePath());
|
||||
const bool success = open(errorString, filePath().toString());
|
||||
m_widget->setCursorPosition(cPos);
|
||||
emit reloadFinished(success);
|
||||
return success;
|
||||
|
@@ -437,7 +437,7 @@ void BookmarkManager::toggleBookmark(bool)
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
toggleBookmark(editor->document()->filePath(), editor->currentLine());
|
||||
toggleBookmark(editor->document()->filePath().toString(), editor->currentLine());
|
||||
}
|
||||
|
||||
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
|
||||
@@ -555,7 +555,7 @@ void BookmarkManager::documentPrevNext(bool next)
|
||||
if (editorLine <= 0)
|
||||
return;
|
||||
|
||||
QFileInfo fi(editor->document()->filePath());
|
||||
const QFileInfo fi = editor->document()->filePath().toFileInfo();
|
||||
if (!m_bookmarksMap.contains(fi.path()))
|
||||
return;
|
||||
|
||||
@@ -646,7 +646,7 @@ BookmarkManager::State BookmarkManager::state() const
|
||||
if (!editor)
|
||||
return HasBookMarks;
|
||||
|
||||
const QFileInfo fi(editor->document()->filePath());
|
||||
const QFileInfo fi = editor->document()->filePath().toFileInfo();
|
||||
|
||||
const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path());
|
||||
if (dit == m_bookmarksMap.constEnd())
|
||||
@@ -849,7 +849,7 @@ void BookmarkManager::loadBookmarks()
|
||||
|
||||
void BookmarkManager::handleBookmarkTooltipRequest(IEditor *editor, const QPoint &pos, int line)
|
||||
{
|
||||
Bookmark *mark = findBookmark(editor->document()->filePath(), line);
|
||||
Bookmark *mark = findBookmark(editor->document()->filePath().toString(), line);
|
||||
operateTooltip(editor->widget(), pos, mark);
|
||||
}
|
||||
|
||||
|
@@ -110,7 +110,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
|
||||
connect(m_toggleAction, &QAction::triggered, [this]() {
|
||||
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
|
||||
m_bookmarkManager->toggleBookmark(editor->document()->filePath(), editor->currentLine());
|
||||
m_bookmarkManager->toggleBookmark(editor->document()->filePath().toString(), editor->currentLine());
|
||||
});
|
||||
|
||||
connect(m_prevAction, &QAction::triggered, m_bookmarkManager, &BookmarkManager::prev);
|
||||
@@ -165,7 +165,7 @@ void BookmarksPlugin::editorOpened(IEditor *editor)
|
||||
connect(widget, &TextEditorWidget::markRequested, m_bookmarkManager,
|
||||
[this, editor](TextEditorWidget *, int line, TextMarkRequestKind kind) {
|
||||
if (kind == BookmarkRequest && editor->document())
|
||||
m_bookmarkManager->toggleBookmark(editor->document()->filePath(), line);
|
||||
m_bookmarkManager->toggleBookmark(editor->document()->filePath().toString(), line);
|
||||
});
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ void BookmarksPlugin::requestContextMenu(TextEditorWidget *widget,
|
||||
return;
|
||||
|
||||
m_bookmarkMarginActionLineNumber = lineNumber;
|
||||
m_bookmarkMarginActionFileName = widget->textDocument()->filePath();
|
||||
m_bookmarkMarginActionFileName = widget->textDocument()->filePath().toString();
|
||||
|
||||
menu->addAction(m_bookmarkMarginAction);
|
||||
if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
|
||||
|
@@ -94,7 +94,7 @@ namespace ClangCodeModel {
|
||||
|
||||
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document)
|
||||
: BaseEditorDocumentProcessor(document)
|
||||
, m_parser(document->filePath())
|
||||
, m_parser(document->filePath().toString())
|
||||
, m_parserRevision(0)
|
||||
, m_semanticHighlighter(document)
|
||||
, m_builtinProcessor(document, /*enableSemanticHighlighter=*/ false)
|
||||
@@ -112,7 +112,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocum
|
||||
const int lastLine = baseTextDocument()->document()->blockCount();
|
||||
|
||||
CreateMarkers *createMarkers = CreateMarkers::create(m_parser.semanticMarker(),
|
||||
baseTextDocument()->filePath(),
|
||||
baseTextDocument()->filePath().toString(),
|
||||
firstLine, lastLine);
|
||||
return createMarkers->start();
|
||||
});
|
||||
|
@@ -76,7 +76,7 @@ UnsavedFiles createUnsavedFiles(WorkingCopy workingCopy)
|
||||
|
||||
QSet< ::Utils::FileName> modifiedFiles;
|
||||
foreach (IDocument *doc, Core::DocumentManager::modifiedDocuments())
|
||||
modifiedFiles.insert(::Utils::FileName::fromString(doc->filePath()));
|
||||
modifiedFiles.insert(doc->filePath());
|
||||
|
||||
UnsavedFiles result;
|
||||
QHashIterator< ::Utils::FileName, QPair<QByteArray, unsigned> > wcIter = workingCopy.iterator();
|
||||
|
@@ -455,7 +455,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
|
||||
auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(EditorManager::currentEditor());
|
||||
if (textEditor) {
|
||||
// check if current cursor position is a known location of the symbol
|
||||
const QString fileName = textEditor->document()->filePath();
|
||||
const QString fileName = textEditor->document()->filePath().toString();
|
||||
int line;
|
||||
int column;
|
||||
textEditor->convertPosition(textEditor->position(), &line, &column);
|
||||
|
@@ -633,7 +633,7 @@ bool ClearCasePlugin::submitEditorAboutToClose()
|
||||
|
||||
// Submit editor closing. Make it write out the check in message
|
||||
// and retrieve files
|
||||
const QFileInfo editorFile(editorDocument->filePath());
|
||||
const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
|
||||
const QFileInfo changeFile(m_checkInMessageFileName);
|
||||
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
|
||||
return true; // Oops?!
|
||||
|
@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
|
||||
info.setCustomButtonInfo(tr("Build now"), [document]() {
|
||||
foreach (Project *p, SessionManager::projects()) {
|
||||
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
|
||||
if (cmakeProject->isProjectFile(document->filePath())) {
|
||||
if (cmakeProject->isProjectFile(document->filePath().toString())) {
|
||||
ProjectExplorerPlugin::buildProject(cmakeProject);
|
||||
break;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
|
||||
// TODO: Resolve variables
|
||||
|
||||
QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
|
||||
QDir dir(textDocument()->filePath().toFileInfo().absolutePath());
|
||||
QString fileName = dir.filePath(buffer);
|
||||
QFileInfo fi(fileName);
|
||||
if (fi.exists()) {
|
||||
@@ -252,14 +252,12 @@ CMakeDocument::CMakeDocument()
|
||||
|
||||
QString CMakeDocument::defaultPath() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.absolutePath();
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString CMakeDocument::suggestedFileName() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.fileName();
|
||||
return filePath().toFileInfo().fileName();
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -233,7 +233,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
|
||||
foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments())
|
||||
if (isProjectFile(document->filePath()))
|
||||
if (isProjectFile(document->filePath().toString()))
|
||||
document->infoBar()->removeInfo("CMakeEditor.RunCMake");
|
||||
|
||||
// Find cbp file
|
||||
@@ -741,7 +741,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||
{
|
||||
setId("Cmake.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
|
||||
|
@@ -162,7 +162,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(IDocument *document, QWidget *parent,
|
||||
: QDialog(parent)
|
||||
, d(new ReadOnlyFilesDialogPrivate(this, document, displaySaveAs))
|
||||
{
|
||||
d->initDialog(QStringList(document->filePath()));
|
||||
d->initDialog(QStringList(document->filePath().toString()));
|
||||
}
|
||||
|
||||
ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> &documents, QWidget *parent)
|
||||
@@ -171,7 +171,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> &documents, QW
|
||||
{
|
||||
QStringList files;
|
||||
foreach (IDocument *document, documents)
|
||||
files << document->filePath();
|
||||
files << document->filePath().toString();
|
||||
d->initDialog(files);
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
|
||||
foreach (IDocument *document, items) {
|
||||
QString visibleName;
|
||||
QString directory;
|
||||
QString fileName = document->filePath();
|
||||
QString fileName = document->filePath().toString();
|
||||
if (fileName.isEmpty()) {
|
||||
visibleName = document->suggestedFileName();
|
||||
} else {
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <coreplugin/editormanager/iexternaleditor.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
@@ -265,8 +266,8 @@ static void addFileInfo(const QString &fileName, IDocument *document, bool isLin
|
||||
(The added file names are guaranteed to be absolute and cleaned.) */
|
||||
static void addFileInfo(IDocument *document)
|
||||
{
|
||||
const QString fixedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::KeepLinks);
|
||||
const QString fixedResolvedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::ResolveLinks);
|
||||
const QString fixedName = DocumentManager::fixFileName(document->filePath().toString(), DocumentManager::KeepLinks);
|
||||
const QString fixedResolvedName = DocumentManager::fixFileName(document->filePath().toString(), DocumentManager::ResolveLinks);
|
||||
addFileInfo(fixedResolvedName, document, false);
|
||||
if (fixedName != fixedResolvedName)
|
||||
addFileInfo(fixedName, document, true);
|
||||
@@ -285,7 +286,8 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
|
||||
foreach (IDocument *document, documents) {
|
||||
if (document && !d->m_documentsWithoutWatch.contains(document)) {
|
||||
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
|
||||
connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
|
||||
connect(document, &IDocument::filePathChanged,
|
||||
m_instance, &DocumentManager::filePathChanged);
|
||||
d->m_documentsWithoutWatch.append(document);
|
||||
}
|
||||
}
|
||||
@@ -296,7 +298,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
|
||||
if (document && !d->m_documentsWithWatch.contains(document)) {
|
||||
connect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName()));
|
||||
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
|
||||
connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
|
||||
connect(document, &IDocument::filePathChanged, m_instance, &DocumentManager::filePathChanged);
|
||||
addFileInfo(document);
|
||||
}
|
||||
}
|
||||
@@ -387,20 +389,20 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
|
||||
foreach (IDocument *document, documentsToRename) {
|
||||
d->m_blockedIDocument = document;
|
||||
removeFileInfo(document);
|
||||
document->setFilePath(to);
|
||||
document->setFilePath(Utils::FileName::fromString(to));
|
||||
addFileInfo(document);
|
||||
d->m_blockedIDocument = 0;
|
||||
}
|
||||
emit m_instance->allDocumentsRenamed(from, to);
|
||||
}
|
||||
|
||||
void DocumentManager::filePathChanged(const QString &oldName, const QString &newName)
|
||||
void DocumentManager::filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName)
|
||||
{
|
||||
IDocument *doc = qobject_cast<IDocument *>(sender());
|
||||
QTC_ASSERT(doc, return);
|
||||
if (doc == d->m_blockedIDocument)
|
||||
return;
|
||||
emit m_instance->documentRenamed(doc, oldName, newName);
|
||||
emit m_instance->documentRenamed(doc, oldName.toString(), newName.toString());
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -564,7 +566,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
|
||||
|
||||
foreach (IDocument *document, documents) {
|
||||
if (document && document->isModified()) {
|
||||
QString name = document->filePath();
|
||||
QString name = document->filePath().toString();
|
||||
if (name.isEmpty())
|
||||
name = document->suggestedFileName();
|
||||
|
||||
@@ -634,7 +636,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
|
||||
bool DocumentManager::saveDocument(IDocument *document, const QString &fileName, bool *isReadOnly)
|
||||
{
|
||||
bool ret = true;
|
||||
QString effName = fileName.isEmpty() ? document->filePath() : fileName;
|
||||
QString effName = fileName.isEmpty() ? document->filePath().toString() : fileName;
|
||||
expectFileChange(effName); // This only matters to other IDocuments which refer to this file
|
||||
bool addWatcher = removeDocument(document); // So that our own IDocument gets no notification at all
|
||||
|
||||
@@ -721,7 +723,7 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
|
||||
{
|
||||
if (!document)
|
||||
return QLatin1String("");
|
||||
QString absoluteFilePath = document->filePath();
|
||||
QString absoluteFilePath = document->filePath().toString();
|
||||
const QFileInfo fi(absoluteFilePath);
|
||||
QString path;
|
||||
QString fileName;
|
||||
@@ -1063,7 +1065,7 @@ void DocumentManager::checkForReload()
|
||||
success = document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents);
|
||||
} else {
|
||||
// Ask about content change
|
||||
previousReloadAnswer = Utils::reloadPrompt(document->filePath(), document->isModified(),
|
||||
previousReloadAnswer = Utils::reloadPrompt(document->filePath().toString(), document->isModified(),
|
||||
ICore::dialogParent());
|
||||
switch (previousReloadAnswer) {
|
||||
case Utils::ReloadAll:
|
||||
@@ -1086,13 +1088,13 @@ void DocumentManager::checkForReload()
|
||||
while (unhandled) {
|
||||
if (previousDeletedAnswer != Utils::FileDeletedCloseAll) {
|
||||
previousDeletedAnswer =
|
||||
Utils::fileDeletedPrompt(document->filePath(),
|
||||
Utils::fileDeletedPrompt(document->filePath().toString(),
|
||||
trigger == IDocument::TriggerExternal,
|
||||
QApplication::activeWindow());
|
||||
}
|
||||
switch (previousDeletedAnswer) {
|
||||
case Utils::FileDeletedSave:
|
||||
documentsToSave.insert(document, document->filePath());
|
||||
documentsToSave.insert(document, document->filePath().toString());
|
||||
unhandled = false;
|
||||
break;
|
||||
case Utils::FileDeletedSaveAs:
|
||||
@@ -1115,7 +1117,7 @@ void DocumentManager::checkForReload()
|
||||
}
|
||||
if (!success) {
|
||||
if (errorString.isEmpty())
|
||||
errorStrings << tr("Cannot reload %1").arg(QDir::toNativeSeparators(document->filePath()));
|
||||
errorStrings << tr("Cannot reload %1").arg(document->filePath().toUserOutput());
|
||||
else
|
||||
errorStrings << errorString;
|
||||
}
|
||||
|
@@ -43,6 +43,8 @@ class QMainWindow;
|
||||
class QMenu;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class FileName; }
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IContext;
|
||||
@@ -160,7 +162,6 @@ protected:
|
||||
|
||||
private slots:
|
||||
void documentDestroyed(QObject *obj);
|
||||
void filePathChanged(const QString &oldName, const QString &newName);
|
||||
void checkForNewFileName();
|
||||
void checkForReload();
|
||||
void changedFile(const QString &file);
|
||||
@@ -169,6 +170,8 @@ private:
|
||||
explicit DocumentManager(QObject *parent);
|
||||
~DocumentManager();
|
||||
|
||||
void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName);
|
||||
|
||||
friend class Core::Internal::MainWindow;
|
||||
};
|
||||
|
||||
|
@@ -130,7 +130,7 @@ QAbstractItemModel *DocumentModel::model()
|
||||
|
||||
QString DocumentModel::Entry::fileName() const
|
||||
{
|
||||
return document ? document->filePath() : m_fileName;
|
||||
return document ? document->filePath().toString() : m_fileName;
|
||||
}
|
||||
|
||||
QString DocumentModel::Entry::displayName() const
|
||||
@@ -400,13 +400,10 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const
|
||||
case Qt::DecorationRole:
|
||||
{
|
||||
bool showLock = false;
|
||||
if (e->document) {
|
||||
showLock = e->document->filePath().isEmpty()
|
||||
? false
|
||||
: e->document->isFileReadOnly();
|
||||
} else {
|
||||
if (e->document)
|
||||
showLock = e->document->filePath().isEmpty() ? false : e->document->isFileReadOnly();
|
||||
else
|
||||
showLock = !QFileInfo(e->m_fileName).isWritable();
|
||||
}
|
||||
return showLock ? m_lockedIcon : QIcon();
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
|
@@ -492,7 +492,7 @@ void EditorManagerPrivate::init()
|
||||
globalMacroExpander()->registerFileVariables(kCurrentDocumentPrefix, tr("Current document"),
|
||||
[]() -> QString {
|
||||
IDocument *document = EditorManager::currentDocument();
|
||||
return document ? document->filePath() : QString();
|
||||
return document ? document->filePath().toString() : QString();
|
||||
});
|
||||
|
||||
globalMacroExpander()->registerIntVariable(kCurrentDocumentXPos,
|
||||
@@ -930,7 +930,7 @@ void EditorManagerPrivate::addEditor(IEditor *editor)
|
||||
const bool addWatcher = !isTemporary;
|
||||
DocumentManager::addDocument(editor->document(), addWatcher);
|
||||
if (!isTemporary)
|
||||
DocumentManager::addToRecentFiles(editor->document()->filePath(),
|
||||
DocumentManager::addToRecentFiles(editor->document()->filePath().toString(),
|
||||
editor->document()->id());
|
||||
}
|
||||
emit m_instance->editorOpened(editor);
|
||||
@@ -988,7 +988,7 @@ IEditor *EditorManagerPrivate::duplicateEditor(IEditor *editor)
|
||||
|
||||
IEditor *duplicate = editor->duplicate();
|
||||
duplicate->restoreState(editor->saveState());
|
||||
emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
|
||||
emit m_instance->editorCreated(duplicate, duplicate->document()->filePath().toString());
|
||||
addEditor(duplicate);
|
||||
return duplicate;
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ void EditorManagerPrivate::activateView(EditorView *view)
|
||||
void EditorManagerPrivate::restoreEditorState(IEditor *editor)
|
||||
{
|
||||
QTC_ASSERT(editor, return);
|
||||
QString fileName = editor->document()->filePath();
|
||||
QString fileName = editor->document()->filePath().toString();
|
||||
editor->restoreState(d->m_editorStates.value(fileName).toByteArray());
|
||||
}
|
||||
|
||||
@@ -1253,7 +1253,7 @@ void EditorManagerPrivate::addDocumentToRecentFiles(IDocument *document)
|
||||
DocumentModel::Entry *entry = DocumentModel::entryForDocument(document);
|
||||
if (!entry)
|
||||
return;
|
||||
DocumentManager::addToRecentFiles(document->filePath(), entry->id());
|
||||
DocumentManager::addToRecentFiles(document->filePath().toString(), entry->id());
|
||||
}
|
||||
|
||||
void EditorManagerPrivate::updateAutoSave()
|
||||
@@ -1275,9 +1275,9 @@ void EditorManagerPrivate::updateMakeWritableWarning()
|
||||
// Do this after setWriteWarning so we don't re-evaluate this part even
|
||||
// if we do not really show a warning.
|
||||
bool promptVCS = false;
|
||||
const QString directory = QFileInfo(document->filePath()).absolutePath();
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
|
||||
if (versionControl && versionControl->openSupportMode(document->filePath().toString()) != IVersionControl::NoOpen) {
|
||||
if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
|
||||
vcsOpenCurrentEditor();
|
||||
ww = false;
|
||||
@@ -1368,7 +1368,7 @@ void EditorManagerPrivate::updateWindowTitleForDocument(IDocument *document, QWi
|
||||
QString windowTitle;
|
||||
const QString dashSep = QLatin1String(" - ");
|
||||
|
||||
QString filePath = document ? QFileInfo(document->filePath()).absoluteFilePath()
|
||||
QString filePath = document ? document->filePath().toFileInfo().absoluteFilePath()
|
||||
: QString();
|
||||
|
||||
const QString windowTitleAddition = d->m_titleAdditionHandler
|
||||
@@ -1473,12 +1473,12 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
const QString directory = QFileInfo(document->filePath()).absolutePath();
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
|
||||
if (!versionControl || versionControl->openSupportMode(document->filePath().toString()) == IVersionControl::NoOpen)
|
||||
return;
|
||||
|
||||
if (!versionControl->vcsOpen(document->filePath())) {
|
||||
if (!versionControl->vcsOpen(document->filePath().toString())) {
|
||||
// TODO: wrong dialog parent
|
||||
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"),
|
||||
tr("Cannot open the file for editing with VCS."));
|
||||
@@ -1550,7 +1550,7 @@ void EditorManagerPrivate::autoSave()
|
||||
if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
|
||||
continue;
|
||||
QString errorString;
|
||||
if (!document->autoSave(&errorString, autoSaveName(document->filePath())))
|
||||
if (!document->autoSave(&errorString, autoSaveName(document->filePath().toString())))
|
||||
errors << errorString;
|
||||
}
|
||||
if (!errors.isEmpty())
|
||||
@@ -1577,7 +1577,7 @@ void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
|
||||
QTimer::singleShot(0, d, SLOT(setCurrentEditorFromContextChange()));
|
||||
} else {
|
||||
if (editor && !editor->document()->isTemporary())
|
||||
DocumentManager::setCurrentFile(editor->document()->filePath());
|
||||
DocumentManager::setCurrentFile(editor->document()->filePath().toString());
|
||||
updateActions();
|
||||
}
|
||||
}
|
||||
@@ -1653,7 +1653,7 @@ bool EditorManagerPrivate::saveDocument(IDocument *document)
|
||||
|
||||
document->checkPermissions();
|
||||
|
||||
const QString &fileName = document->filePath();
|
||||
const QString &fileName = document->filePath().toString();
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return saveDocumentAs(document);
|
||||
@@ -1689,7 +1689,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
|
||||
const QString filter = MimeDatabase::allFiltersString();
|
||||
QString selectedFilter =
|
||||
MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString();
|
||||
MimeDatabase::findByFile(document->filePath().toFileInfo()).filterString();
|
||||
if (selectedFilter.isEmpty())
|
||||
selectedFilter = MimeDatabase::findByType(document->mimeType()).filterString();
|
||||
const QString &absoluteFilePath =
|
||||
@@ -1698,7 +1698,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
if (absoluteFilePath.isEmpty())
|
||||
return false;
|
||||
|
||||
if (absoluteFilePath != document->filePath()) {
|
||||
if (absoluteFilePath != document->filePath().toString()) {
|
||||
// close existing editors for the new file name
|
||||
IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
|
||||
if (otherDocument)
|
||||
@@ -1734,7 +1734,7 @@ void EditorManagerPrivate::revertToSaved(IDocument *document)
|
||||
{
|
||||
if (!document)
|
||||
return;
|
||||
const QString fileName = document->filePath();
|
||||
const QString fileName = document->filePath().toString();
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
if (document->isModified()) {
|
||||
@@ -1824,7 +1824,7 @@ void EditorManagerPrivate::setCurrentEditorFromContextChange()
|
||||
d->m_scheduledCurrentEditor = 0;
|
||||
setCurrentEditor(newCurrent);
|
||||
if (!newCurrent->document()->isTemporary())
|
||||
DocumentManager::setCurrentFile(newCurrent->document()->filePath());
|
||||
DocumentManager::setCurrentFile(newCurrent->document()->filePath().toString());
|
||||
|
||||
}
|
||||
|
||||
@@ -2096,7 +2096,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
|
||||
&& !editor->document()->isTemporary()) {
|
||||
QByteArray state = editor->saveState();
|
||||
if (!state.isEmpty())
|
||||
d->m_editorStates.insert(editor->document()->filePath(), QVariant(state));
|
||||
d->m_editorStates.insert(editor->document()->filePath().toString(), QVariant(state));
|
||||
}
|
||||
|
||||
EditorManagerPrivate::removeEditor(editor);
|
||||
@@ -2468,7 +2468,7 @@ QByteArray EditorManager::saveState()
|
||||
IEditor *editor = DocumentModel::editorsForDocument(document).first();
|
||||
QByteArray state = editor->saveState();
|
||||
if (!state.isEmpty())
|
||||
d->m_editorStates.insert(document->filePath(), QVariant(state));
|
||||
d->m_editorStates.insert(document->filePath().toString(), QVariant(state));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -219,7 +219,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
|
||||
|
||||
EditLocation location;
|
||||
location.document = document;
|
||||
location.fileName = document->filePath();
|
||||
location.fileName = document->filePath().toString();
|
||||
location.id = document->id();
|
||||
location.state = QVariant(state);
|
||||
|
||||
@@ -440,7 +440,7 @@ void EditorView::addCurrentPositionToNavigationHistory(const QByteArray &saveSta
|
||||
|
||||
EditLocation location;
|
||||
location.document = document;
|
||||
location.fileName = document->filePath();
|
||||
location.fileName = document->filePath().toString();
|
||||
location.id = document->id();
|
||||
location.state = QVariant(state);
|
||||
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
||||
@@ -495,7 +495,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
|
||||
location = &m_navigationHistory[m_navigationHistory.size()-1];
|
||||
}
|
||||
location->document = document;
|
||||
location->fileName = document->filePath();
|
||||
location->fileName = document->filePath().toString();
|
||||
location->id = document->id();
|
||||
location->state = QVariant(editor->saveState());
|
||||
}
|
||||
@@ -810,10 +810,14 @@ QByteArray SplitterOrView::saveState() const
|
||||
stream << QByteArray("empty");
|
||||
} else if (e == EditorManager::currentEditor()) {
|
||||
stream << QByteArray("currenteditor")
|
||||
<< e->document()->filePath() << e->document()->id().toString() << e->saveState();
|
||||
<< e->document()->filePath().toString()
|
||||
<< e->document()->id().toString()
|
||||
<< e->saveState();
|
||||
} else {
|
||||
stream << QByteArray("editor")
|
||||
<< e->document()->filePath() << e->document()->id().toString() << e->saveState();
|
||||
<< e->document()->filePath().toString()
|
||||
<< e->document()->id().toString()
|
||||
<< e->saveState();
|
||||
}
|
||||
}
|
||||
return bytes;
|
||||
|
@@ -233,7 +233,7 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit
|
||||
item->setIcon(0, !hi.document->filePath().isEmpty() && hi.document->isFileReadOnly()
|
||||
? DocumentModel::lockedIcon() : m_emptyIcon);
|
||||
item->setText(0, title);
|
||||
item->setToolTip(0, hi.document->filePath());
|
||||
item->setToolTip(0, hi.document->filePath().toString());
|
||||
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.document.data()));
|
||||
item->setData(0, Qt::UserRole+1, QVariant::fromValue(view));
|
||||
item->setTextAlignment(0, Qt::AlignLeft);
|
||||
|
@@ -424,12 +424,11 @@ void EditorToolBar::updateDocumentStatus(IDocument *document)
|
||||
if (document->filePath().isEmpty())
|
||||
d->m_dragHandle->setIcon(QIcon());
|
||||
else
|
||||
d->m_dragHandle->setIcon(FileIconProvider::icon(QFileInfo(document->filePath())));
|
||||
d->m_dragHandle->setIcon(FileIconProvider::icon(document->filePath().toFileInfo()));
|
||||
|
||||
d->m_editorList->setToolTip(
|
||||
document->filePath().isEmpty()
|
||||
? document->displayName()
|
||||
: QDir::toNativeSeparators(document->filePath()));
|
||||
d->m_editorList->setToolTip(document->filePath().isEmpty()
|
||||
? document->displayName()
|
||||
: document->filePath().toUserOutput());
|
||||
}
|
||||
|
||||
bool EditorToolBar::eventFilter(QObject *obj, QEvent *event)
|
||||
|
@@ -591,7 +591,7 @@ void ExternalToolRunner::run()
|
||||
}
|
||||
if (m_tool->modifiesCurrentDocument()) {
|
||||
if (IDocument *document = EditorManager::currentDocument()) {
|
||||
m_expectedFileName = document->filePath();
|
||||
m_expectedFileName = document->filePath().toString();
|
||||
if (!DocumentManager::saveModifiedDocument(document)) {
|
||||
deleteLater();
|
||||
return;
|
||||
|
@@ -82,7 +82,7 @@ public:
|
||||
|
||||
Id id;
|
||||
QString mimeType;
|
||||
QString filePath;
|
||||
Utils::FileName filePath;
|
||||
QString displayName;
|
||||
QString autoSaveName;
|
||||
InfoBar *infoBar;
|
||||
@@ -127,7 +127,7 @@ bool IDocument::setContents(const QByteArray &contents)
|
||||
return false;
|
||||
}
|
||||
|
||||
QString IDocument::filePath() const
|
||||
Utils::FileName IDocument::filePath() const
|
||||
{
|
||||
return d->filePath;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ bool IDocument::isFileReadOnly() const
|
||||
{
|
||||
if (filePath().isEmpty())
|
||||
return false;
|
||||
return !QFileInfo(filePath()).isWritable();
|
||||
return !filePath().toFileInfo().isWritable();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -244,11 +244,11 @@ InfoBar *IDocument::infoBar()
|
||||
signals. Can be reimplemented by subclasses to do more.
|
||||
\sa filePath()
|
||||
*/
|
||||
void IDocument::setFilePath(const QString &filePath)
|
||||
void IDocument::setFilePath(const Utils::FileName &filePath)
|
||||
{
|
||||
if (d->filePath == filePath)
|
||||
return;
|
||||
QString oldName = d->filePath;
|
||||
Utils::FileName oldName = d->filePath;
|
||||
d->filePath = filePath;
|
||||
emit filePathChanged(oldName, d->filePath);
|
||||
emit changed();
|
||||
@@ -263,7 +263,7 @@ QString IDocument::displayName() const
|
||||
{
|
||||
if (!d->displayName.isEmpty())
|
||||
return d->displayName;
|
||||
return QFileInfo(d->filePath).fileName();
|
||||
return d->filePath.toFileInfo().fileName();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include "core_global.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace Core {
|
||||
@@ -88,8 +90,8 @@ public:
|
||||
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0;
|
||||
virtual bool setContents(const QByteArray &contents);
|
||||
|
||||
QString filePath() const;
|
||||
virtual void setFilePath(const QString &filePath);
|
||||
Utils::FileName filePath() const;
|
||||
virtual void setFilePath(const Utils::FileName &filePath);
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
@@ -128,7 +130,7 @@ signals:
|
||||
void aboutToReload();
|
||||
void reloadFinished(bool success);
|
||||
|
||||
void filePathChanged(const QString &oldName, const QString &newName);
|
||||
void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName);
|
||||
|
||||
private:
|
||||
Internal::IDocumentPrivate *d;
|
||||
|
@@ -69,7 +69,7 @@ void FileSystemFilter::prepareSearch(const QString &entry)
|
||||
Q_UNUSED(entry)
|
||||
IDocument *document= EditorManager::currentDocument();
|
||||
if (document && !document->filePath().isEmpty()) {
|
||||
QFileInfo info(document->filePath());
|
||||
const QFileInfo info = document->filePath().toFileInfo();
|
||||
m_currentDocumentDirectory = info.absolutePath() + QLatin1Char('/');
|
||||
} else {
|
||||
m_currentDocumentDirectory.clear();
|
||||
|
@@ -71,7 +71,7 @@ TextEditor::BaseTextEditor *currentEditor()
|
||||
QString fileInCurrentEditor()
|
||||
{
|
||||
if (TextEditor::BaseTextEditor *editor = currentEditor())
|
||||
return editor->document()->filePath();
|
||||
return editor->document()->filePath().toString();
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
TextEditor::BaseTextEditor *editor = currentEditor();
|
||||
EditorDocumentHandle *editorDocument = 0;
|
||||
if (editor) {
|
||||
const QString editorFilePath = editor->document()->filePath();
|
||||
const QString editorFilePath = editor->document()->filePath().toString();
|
||||
editorDocument = cmmi->editorDocument(editorFilePath);
|
||||
if (auto *documentProcessor = BaseEditorDocumentProcessor::get(editorFilePath)) {
|
||||
const CPlusPlus::Snapshot editorSnapshot = documentProcessor->snapshot();
|
||||
|
@@ -637,7 +637,7 @@ AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistR
|
||||
if (CppCompletionAssistProvider *cap =
|
||||
qobject_cast<CppCompletionAssistProvider *>(cppEditorDocument()->completionAssistProvider())) {
|
||||
return cap->createAssistInterface(
|
||||
textDocument()->filePath(),
|
||||
textDocument()->filePath().toString(),
|
||||
document(),
|
||||
cppEditorDocument()->isObjCEnabled(),
|
||||
position(),
|
||||
@@ -766,7 +766,7 @@ void CppEditorWidget::abortDeclDefLink()
|
||||
|
||||
void CppEditorWidget::showPreProcessorWidget()
|
||||
{
|
||||
const Utils::FileName fileName = Utils::FileName::fromString(textDocument()->filePath());
|
||||
const Utils::FileName fileName = textDocument()->filePath();
|
||||
|
||||
// Check if this editor belongs to a project
|
||||
QList<ProjectPart::Ptr> projectParts = d->m_modelManager->projectPart(fileName);
|
||||
@@ -775,7 +775,7 @@ void CppEditorWidget::showPreProcessorWidget()
|
||||
if (projectParts.isEmpty())
|
||||
projectParts << d->m_modelManager->fallbackProjectPart();
|
||||
|
||||
CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath(), projectParts);
|
||||
CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath().toString(), projectParts);
|
||||
if (preProcessorDialog.exec() == QDialog::Accepted) {
|
||||
cppEditorDocument()->setPreprocessorSettings(
|
||||
preProcessorDialog.projectPart(),
|
||||
|
@@ -68,14 +68,14 @@ class CppEditorDocumentHandle : public CppTools::EditorDocumentHandle
|
||||
public:
|
||||
CppEditorDocumentHandle(CppEditor::Internal::CppEditorDocument *cppEditorDocument)
|
||||
: m_cppEditorDocument(cppEditorDocument)
|
||||
, m_registrationFilePath(cppEditorDocument->filePath())
|
||||
, m_registrationFilePath(cppEditorDocument->filePath().toString())
|
||||
{
|
||||
mm()->registerEditorDocument(this);
|
||||
}
|
||||
|
||||
~CppEditorDocumentHandle() { mm()->unregisterEditorDocument(m_registrationFilePath); }
|
||||
|
||||
QString filePath() const { return m_cppEditorDocument->filePath(); }
|
||||
QString filePath() const { return m_cppEditorDocument->filePath().toString(); }
|
||||
QByteArray contents() const { return m_cppEditorDocument->contentsText(); }
|
||||
unsigned revision() const { return m_cppEditorDocument->contentsRevision(); }
|
||||
|
||||
@@ -105,8 +105,8 @@ CppEditorDocument::CppEditorDocument()
|
||||
|
||||
connect(this, SIGNAL(aboutToReload()), this, SLOT(onAboutToReload()));
|
||||
connect(this, SIGNAL(reloadFinished(bool)), this, SLOT(onReloadFinished()));
|
||||
connect(this, SIGNAL(filePathChanged(QString,QString)),
|
||||
this, SLOT(onFilePathChanged(QString,QString)));
|
||||
connect(this, &IDocument::filePathChanged,
|
||||
this, &CppEditorDocument::onFilePathChanged);
|
||||
|
||||
m_processorTimer.setSingleShot(true);
|
||||
m_processorTimer.setInterval(processDocumentIntervalInMs);
|
||||
@@ -196,12 +196,13 @@ void CppEditorDocument::onReloadFinished()
|
||||
m_fileIsBeingReloaded = false;
|
||||
}
|
||||
|
||||
void CppEditorDocument::onFilePathChanged(const QString &oldPath, const QString &newPath)
|
||||
void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
|
||||
const Utils::FileName &newPath)
|
||||
{
|
||||
Q_UNUSED(oldPath);
|
||||
|
||||
if (!newPath.isEmpty()) {
|
||||
setMimeType(Core::MimeDatabase::findByFile(QFileInfo(newPath)).type());
|
||||
setMimeType(Core::MimeDatabase::findByFile(newPath.toFileInfo()).type());
|
||||
|
||||
disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||
connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
|
||||
@@ -250,8 +251,8 @@ void CppEditorDocument::updatePreprocessorSettings()
|
||||
|
||||
const QString prefix = QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX);
|
||||
const QString &projectFile = ProjectExplorer::SessionManager::value(
|
||||
prefix + filePath()).toString();
|
||||
const QString directivesKey = projectFile + QLatin1Char(',') + filePath();
|
||||
prefix + filePath().toString()).toString();
|
||||
const QString directivesKey = projectFile + QLatin1Char(',') + filePath().toString();
|
||||
const QByteArray additionalDirectives = ProjectExplorer::SessionManager::value(
|
||||
directivesKey).toString().toUtf8();
|
||||
|
||||
|
@@ -84,7 +84,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void invalidateFormatterCache();
|
||||
void onFilePathChanged(const QString &oldPath, const QString &newPath);
|
||||
void onFilePathChanged(const Utils::FileName &oldPath, const Utils::FileName &newPath);
|
||||
void onMimeTypeChanged();
|
||||
|
||||
void onAboutToReload();
|
||||
|
@@ -195,7 +195,7 @@ void CppEditorOutline::updateNow()
|
||||
return;
|
||||
|
||||
const CPlusPlus::Snapshot snapshot = cmmi->snapshot();
|
||||
const QString filePath = m_editorWidget->textDocument()->filePath();
|
||||
const QString filePath = m_editorWidget->textDocument()->filePath().toString();
|
||||
CPlusPlus::Document::Ptr document = snapshot.document(filePath);
|
||||
if (!document)
|
||||
return;
|
||||
|
@@ -88,7 +88,7 @@ void CppElementEvaluator::execute()
|
||||
return;
|
||||
|
||||
const Snapshot &snapshot = m_modelManager->snapshot();
|
||||
Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath());
|
||||
Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath().toString());
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
|
@@ -550,7 +550,7 @@ TextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &curs
|
||||
}
|
||||
|
||||
// Now we prefer the doc from the snapshot with macros expanded.
|
||||
Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath());
|
||||
Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath().toString());
|
||||
if (!doc) {
|
||||
doc = documentFromSemanticInfo;
|
||||
if (!doc)
|
||||
@@ -645,7 +645,7 @@ TextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &curs
|
||||
if (Symbol *d = r.declaration()) {
|
||||
if (d->isDeclaration() || d->isFunction()) {
|
||||
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
|
||||
if (m_widget->textDocument()->filePath() == fileName) {
|
||||
if (m_widget->textDocument()->filePath().toString() == fileName) {
|
||||
if (unsigned(lineNumber) == d->line()
|
||||
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
|
||||
result = r; // take the symbol under cursor.
|
||||
|
@@ -118,12 +118,12 @@ void CppIncludeHierarchyWidget::perform()
|
||||
return;
|
||||
|
||||
m_model->clear();
|
||||
m_model->buildHierarchy(m_editor, widget->textDocument()->filePath());
|
||||
m_model->buildHierarchy(m_editor, widget->textDocument()->filePath().toString());
|
||||
if (m_model->isEmpty())
|
||||
return;
|
||||
|
||||
m_inspectedFile->setText(widget->textDocument()->displayName());
|
||||
m_inspectedFile->setLink(TextEditorWidget::Link(widget->textDocument()->filePath()));
|
||||
m_inspectedFile->setLink(TextEditorWidget::Link(widget->textDocument()->filePath().toString()));
|
||||
|
||||
//expand "Includes"
|
||||
m_treeView->expand(m_model->index(0, 0));
|
||||
|
@@ -174,7 +174,7 @@ void CppIncludeHierarchyModel::fetchMore(const QModelIndex &parent)
|
||||
return;
|
||||
|
||||
if (parentItem->needChildrenPopulate()) {
|
||||
const QString editorFilePath = m_editor->document()->filePath();
|
||||
const QString editorFilePath = m_editor->document()->filePath().toString();
|
||||
QSet<QString> cyclic;
|
||||
cyclic << editorFilePath;
|
||||
CppIncludeHierarchyItem *item = parentItem->parent();
|
||||
@@ -285,7 +285,7 @@ void CppIncludeHierarchyModel::buildHierarchyIncludes(const QString ¤tFile
|
||||
if (!m_editor)
|
||||
return;
|
||||
|
||||
const QString editorFilePath = m_editor->document()->filePath();
|
||||
const QString editorFilePath = m_editor->document()->filePath().toString();
|
||||
auto *documentProcessor = BaseEditorDocumentProcessor::get(editorFilePath);
|
||||
QTC_ASSERT(documentProcessor, return);
|
||||
const Snapshot editorDocumentSnapshot = documentProcessor->snapshot();
|
||||
|
@@ -77,7 +77,7 @@ QList<TextEditor::QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactorie
|
||||
CppQuickFixInterface::CppQuickFixInterface(CppEditorWidget *editor,
|
||||
TextEditor::AssistReason reason)
|
||||
: AssistInterface(editor->document(), editor->position(),
|
||||
editor->textDocument()->filePath(), reason)
|
||||
editor->textDocument()->filePath().toString(), reason)
|
||||
, m_editor(editor)
|
||||
, m_semanticInfo(editor->semanticInfo())
|
||||
, m_snapshot(CppTools::CppModelManager::instance()->snapshot())
|
||||
|
@@ -344,7 +344,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
||||
BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor);
|
||||
QVERIFY(currentTextEditor);
|
||||
|
||||
QCOMPARE(currentTextEditor->document()->filePath(), targetTestFile->filePath());
|
||||
QCOMPARE(currentTextEditor->document()->filePath().toString(), targetTestFile->filePath());
|
||||
int expectedLine, expectedColumn;
|
||||
currentTextEditor->convertPosition(targetTestFile->m_targetCursorPosition,
|
||||
&expectedLine, &expectedColumn);
|
||||
|
@@ -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(); }
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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());
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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());
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -492,7 +492,7 @@ bool CvsPlugin::submitEditorAboutToClose()
|
||||
|
||||
// Submit editor closing. Make it write out the commit message
|
||||
// and retrieve files
|
||||
const QFileInfo editorFile(editorDocument->filePath());
|
||||
const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
|
||||
const QFileInfo changeFile(m_commitMessageFileName);
|
||||
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
|
||||
return true; // Oops?!
|
||||
|
@@ -568,7 +568,7 @@ static bool currentTextEditorPosition(ContextData *data)
|
||||
return false;
|
||||
const TextDocument *document = textEditor->textDocument();
|
||||
QTC_ASSERT(document, return false);
|
||||
data->fileName = document->filePath();
|
||||
data->fileName = document->filePath().toString();
|
||||
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
|
||||
int lineNumber = textEditor->currentLine();
|
||||
QString line = textEditor->textDocument()->plainText()
|
||||
@@ -1722,7 +1722,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
|
||||
|
||||
BreakpointModelId id = BreakpointModelId();
|
||||
TextDocument *document = widget->textDocument();
|
||||
args.fileName = document->filePath();
|
||||
args.fileName = document->filePath().toString();
|
||||
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
|
||||
QString line = document->plainText()
|
||||
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
|
||||
@@ -1842,7 +1842,7 @@ void DebuggerPluginPrivate::toggleBreakpoint()
|
||||
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
|
||||
toggleBreakpointByAddress(address);
|
||||
} else if (lineNumber >= 0) {
|
||||
toggleBreakpointByFileAndLine(textEditor->document()->filePath(), lineNumber);
|
||||
toggleBreakpointByFileAndLine(textEditor->document()->filePath().toString(), lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1899,7 +1899,7 @@ void DebuggerPluginPrivate::requestMark(TextEditorWidget *widget, int lineNumber
|
||||
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
|
||||
toggleBreakpointByAddress(address);
|
||||
} else {
|
||||
toggleBreakpointByFileAndLine(document->filePath(), lineNumber);
|
||||
toggleBreakpointByFileAndLine(document->filePath().toString(), lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1981,7 +1981,7 @@ void DebuggerPluginPrivate::cleanupViews()
|
||||
bool keepIt = true;
|
||||
if (document->isModified())
|
||||
keepIt = true;
|
||||
else if (document->filePath().contains(_("qeventdispatcher")))
|
||||
else if (document->filePath().toString().contains(_("qeventdispatcher")))
|
||||
keepIt = false;
|
||||
else if (isMemory)
|
||||
keepIt = !closeMemory;
|
||||
|
@@ -1189,7 +1189,7 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips()
|
||||
return;
|
||||
}
|
||||
|
||||
const QString fileName = toolTipEditor->textDocument()->filePath();
|
||||
const QString fileName = toolTipEditor->textDocument()->filePath().toString();
|
||||
if (fileName.isEmpty()) {
|
||||
hideAllToolTips();
|
||||
return;
|
||||
@@ -1339,7 +1339,7 @@ static void slotTooltipOverrideRequested
|
||||
|
||||
DebuggerToolTipContext context;
|
||||
context.engineType = engine->objectName();
|
||||
context.fileName = editorWidget->textDocument()->filePath();
|
||||
context.fileName = editorWidget->textDocument()->filePath().toString();
|
||||
context.position = pos;
|
||||
editorWidget->convertPosition(pos, &context.line, &context.column);
|
||||
QString raw = cppExpressionAt(editorWidget, context.position, &context.line, &context.column,
|
||||
|
@@ -299,7 +299,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
|
||||
!= QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
|
||||
return;
|
||||
|
||||
QString filename = newEditor->document()->filePath();
|
||||
QString filename = newEditor->document()->filePath().toString();
|
||||
QmlJS::ModelManagerInterface *modelManager =
|
||||
QmlJS::ModelManagerInterface::instance();
|
||||
if (modelManager) {
|
||||
@@ -330,7 +330,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
|
||||
connect(preview, SIGNAL(reloadRequest()),
|
||||
this, SLOT(onReload()));
|
||||
|
||||
m_textPreviews.insert(newEditor->document()->filePath(), preview);
|
||||
m_textPreviews.insert(newEditor->document()->filePath().toString(), preview);
|
||||
preview->associateEditor(newEditor);
|
||||
preview->updateDebugIds();
|
||||
}
|
||||
@@ -340,7 +340,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
|
||||
void QmlInspectorAdapter::removePreviewForEditor(Core::IEditor *editor)
|
||||
{
|
||||
if (QmlLiveTextPreview *preview
|
||||
= m_textPreviews.value(editor->document()->filePath())) {
|
||||
= m_textPreviews.value(editor->document()->filePath().toString())) {
|
||||
preview->unassociateEditor(editor);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void QmlInspectorAdapter::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc
|
||||
Core::IEditor *editor = editors.takeFirst();
|
||||
createPreviewForEditor(editor);
|
||||
QmlLiveTextPreview *preview
|
||||
= m_textPreviews.value(editor->document()->filePath());
|
||||
= m_textPreviews.value(editor->document()->filePath().toString());
|
||||
foreach (Core::IEditor *editor, editors)
|
||||
preview->associateEditor(editor);
|
||||
}
|
||||
@@ -460,7 +460,7 @@ void QmlInspectorAdapter::initializePreviews()
|
||||
QList<Core::IEditor *> editors = Core::DocumentModel::editorsForDocument(document);
|
||||
createPreviewForEditor(editors.takeFirst());
|
||||
QmlLiveTextPreview *preview
|
||||
= m_textPreviews.value(document->filePath());
|
||||
= m_textPreviews.value(document->filePath().toString());
|
||||
foreach (Core::IEditor *editor, editors)
|
||||
preview->associateEditor(editor);
|
||||
}
|
||||
|
@@ -264,7 +264,7 @@ bool getUninitializedVariables(const Snapshot &snapshot,
|
||||
bool isCppEditor(TextEditorWidget *editorWidget)
|
||||
{
|
||||
const TextDocument *document = editorWidget->textDocument();
|
||||
return ProjectFile::classify(document->filePath()) != ProjectFile::Unclassified;
|
||||
return ProjectFile::classify(document->filePath().toString()) != ProjectFile::Unclassified;
|
||||
}
|
||||
|
||||
QString cppFunctionAt(const QString &fileName, int line, int column)
|
||||
@@ -305,7 +305,7 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
|
||||
}
|
||||
|
||||
if (!expr.isEmpty()) {
|
||||
QString fileName = editorWidget->textDocument()->filePath();
|
||||
QString fileName = editorWidget->textDocument()->filePath().toString();
|
||||
const Snapshot snapshot = CppModelManager::instance()->snapshot();
|
||||
if (const Document::Ptr document = snapshot.document(fileName)) {
|
||||
QString func = document->functionAt(*line, *column, scopeFromLine, scopeToLine);
|
||||
|
@@ -147,7 +147,7 @@ void FormEditorPlugin::initializeTemplates()
|
||||
static QString currentFile()
|
||||
{
|
||||
if (const IDocument *document = EditorManager::currentDocument()) {
|
||||
const QString fileName = document->filePath();
|
||||
const QString fileName = document->filePath().toString();
|
||||
if (!fileName.isEmpty() && QFileInfo(fileName).isFile())
|
||||
return fileName;
|
||||
}
|
||||
|
@@ -95,7 +95,7 @@ bool FormWindowEditor::open(QString *errorString, const QString &fileName, const
|
||||
form->setDirty(fileName != realFileName);
|
||||
|
||||
document->syncXmlFromFormWindow();
|
||||
document->setFilePath(absfileName);
|
||||
document->setFilePath(Utils::FileName::fromString(absfileName));
|
||||
document->setShouldAutoSave(false);
|
||||
document->resourceHandler()->updateResources(true);
|
||||
|
||||
|
@@ -44,6 +44,8 @@
|
||||
#include <QDebug>
|
||||
#include <QTextCodec>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
|
||||
@@ -64,13 +66,13 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
|
||||
connect(m_formWindow, SIGNAL(changed()), SLOT(updateIsModified()));
|
||||
|
||||
m_resourceHandler = new ResourceHandler(form);
|
||||
connect(this, SIGNAL(filePathChanged(QString,QString)),
|
||||
connect(this, SIGNAL(filePathChanged(Utils::FileName,Utils::FileName)),
|
||||
m_resourceHandler, SLOT(updateResources()));
|
||||
}
|
||||
|
||||
bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSave)
|
||||
{
|
||||
const QString actualName = name.isEmpty() ? filePath() : name;
|
||||
const FileName actualName = name.isEmpty() ? filePath() : FileName::fromString(name);
|
||||
|
||||
if (Designer::Constants::Internal::debug)
|
||||
qDebug() << Q_FUNC_INFO << name << "->" << actualName;
|
||||
@@ -80,11 +82,10 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
|
||||
if (actualName.isEmpty())
|
||||
return false;
|
||||
|
||||
const QFileInfo fi(actualName);
|
||||
const QString oldFormName = m_formWindow->fileName();
|
||||
if (!autoSave)
|
||||
m_formWindow->setFileName(fi.absoluteFilePath());
|
||||
const bool writeOK = writeFile(actualName, errorString);
|
||||
m_formWindow->setFileName(actualName.toString());
|
||||
const bool writeOK = writeFile(actualName.toString(), errorString);
|
||||
m_shouldAutoSave = false;
|
||||
if (autoSave)
|
||||
return writeOK;
|
||||
@@ -95,7 +96,7 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
|
||||
}
|
||||
|
||||
m_formWindow->setDirty(false);
|
||||
setFilePath(fi.absoluteFilePath());
|
||||
setFilePath(actualName);
|
||||
updateIsModified();
|
||||
|
||||
return true;
|
||||
@@ -135,9 +136,9 @@ bool FormWindowFile::setContents(const QByteArray &contents)
|
||||
return true;
|
||||
}
|
||||
|
||||
void FormWindowFile::setFilePath(const QString &newName)
|
||||
void FormWindowFile::setFilePath(const FileName &newName)
|
||||
{
|
||||
m_formWindow->setFileName(newName);
|
||||
m_formWindow->setFileName(newName.toString());
|
||||
IDocument::setFilePath(newName);
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@ bool FormWindowFile::reload(QString *errorString, ReloadFlag flag, ChangeType ty
|
||||
emit changed();
|
||||
} else {
|
||||
emit aboutToReload();
|
||||
emit reloadRequested(errorString, filePath());
|
||||
emit reloadRequested(errorString, filePath().toString());
|
||||
const bool success = errorString->isEmpty();
|
||||
emit reloadFinished(success);
|
||||
return success;
|
||||
|
@@ -77,7 +77,7 @@ signals:
|
||||
void reloadRequested(QString *errorString, const QString &);
|
||||
|
||||
public slots:
|
||||
void setFilePath(const QString &);
|
||||
void setFilePath(const Utils::FileName &);
|
||||
void setShouldAutoSave(bool sad = true) { m_shouldAutoSave = sad; }
|
||||
void updateIsModified();
|
||||
|
||||
|
@@ -178,12 +178,12 @@ public:
|
||||
integration->emitNavigateToSlot(QLatin1String("pushButton"), QLatin1String("clicked()"),
|
||||
QStringList());
|
||||
|
||||
QCOMPARE(EditorManager::currentDocument()->filePath(), cppFile);
|
||||
QCOMPARE(EditorManager::currentDocument()->filePath().toString(), cppFile);
|
||||
QVERIFY(EditorManager::currentDocument()->isModified());
|
||||
|
||||
// Wait for updated documents
|
||||
foreach (TextEditor::BaseTextEditor *editor, editors) {
|
||||
const QString filePath = editor->document()->filePath();
|
||||
const QString filePath = editor->document()->filePath().toString();
|
||||
if (auto parser = BuiltinEditorDocumentParser::get(filePath)) {
|
||||
forever {
|
||||
if (Document::Ptr document = parser->document()) {
|
||||
|
@@ -510,7 +510,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
|
||||
{
|
||||
typedef QMap<int, Document::Ptr> DocumentMap;
|
||||
|
||||
const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath();
|
||||
const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath().toString();
|
||||
#if 0
|
||||
return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage);
|
||||
#endif
|
||||
|
@@ -90,7 +90,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
|
||||
DiffEditorManager::removeDocument(this);
|
||||
const QFileInfo fi(fileName);
|
||||
setTemporary(false);
|
||||
setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
|
||||
setFilePath(Utils::FileName::fromString(fi.absoluteFilePath()));
|
||||
setDisplayName(QString());
|
||||
return true;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ bool DiffEditorDocument::reload(QString *errorString, ReloadFlag flag, ChangeTyp
|
||||
Q_UNUSED(type)
|
||||
if (flag == FlagIgnore)
|
||||
return true;
|
||||
return open(errorString, filePath());
|
||||
return open(errorString, filePath().toString());
|
||||
}
|
||||
|
||||
bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
|
||||
@@ -120,7 +120,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
|
||||
|
||||
const QFileInfo fi(fileName);
|
||||
setTemporary(false);
|
||||
setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
|
||||
setFilePath(Utils::FileName::fromString(fi.absoluteFilePath()));
|
||||
m_controller->setDiffFiles(fileDataList, fi.absolutePath());
|
||||
return true;
|
||||
}
|
||||
|
@@ -1810,7 +1810,7 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
|
||||
connect(ICore::instance(), SIGNAL(saveSettingsRequested()),
|
||||
SLOT(writeSettings()));
|
||||
|
||||
handler->setCurrentFileName(editor->document()->filePath());
|
||||
handler->setCurrentFileName(editor->document()->filePath().toString());
|
||||
handler->installEventFilter();
|
||||
|
||||
// pop up the bar
|
||||
@@ -1970,7 +1970,7 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
|
||||
// :w[rite]
|
||||
IEditor *editor = m_editorToHandler.key(handler);
|
||||
const QString fileName = handler->currentFileName();
|
||||
if (editor && editor->document()->filePath() == fileName) {
|
||||
if (editor && editor->document()->filePath().toString() == fileName) {
|
||||
// Handle that as a special case for nicer interaction with core
|
||||
DocumentManager::saveDocument(editor->document());
|
||||
// Check result by reading back.
|
||||
|
@@ -447,7 +447,7 @@ GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName,
|
||||
{
|
||||
setId("Generic.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::GENERICMIMETYPE));
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
bool GenericProjectFile::save(QString *, const QString &, bool)
|
||||
|
@@ -43,9 +43,11 @@ namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IDocument *projectFile)
|
||||
: ProjectNode(projectFile->filePath()), m_project(project), m_projectFile(projectFile)
|
||||
: ProjectNode(projectFile->filePath().toString())
|
||||
, m_project(project)
|
||||
, m_projectFile(projectFile)
|
||||
{
|
||||
setDisplayName(QFileInfo(projectFile->filePath()).completeBaseName());
|
||||
setDisplayName(projectFile->filePath().toFileInfo().completeBaseName());
|
||||
}
|
||||
|
||||
Core::IDocument *GenericProjectNode::projectFile() const
|
||||
@@ -55,7 +57,7 @@ Core::IDocument *GenericProjectNode::projectFile() const
|
||||
|
||||
QString GenericProjectNode::projectFilePath() const
|
||||
{
|
||||
return m_projectFile->filePath();
|
||||
return m_projectFile->filePath().toString();
|
||||
}
|
||||
|
||||
QHash<QString, QStringList> sortFilesIntoPaths(const QString &base, const QSet<QString> &files)
|
||||
|
@@ -698,7 +698,7 @@ static inline QString msgCannotLaunch(const QString &binary)
|
||||
static inline QString currentDocumentPath()
|
||||
{
|
||||
if (IDocument *document= EditorManager::currentDocument())
|
||||
return QFileInfo(document->filePath()).path();
|
||||
return document->filePath().toFileInfo().path();
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
@@ -1035,7 +1035,7 @@ bool GitPlugin::submitEditorAboutToClose()
|
||||
QTC_ASSERT(editorDocument, return true);
|
||||
// Submit editor closing. Make it write out the commit message
|
||||
// and retrieve files
|
||||
const QFileInfo editorFile(editorDocument->filePath());
|
||||
const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
|
||||
const QFileInfo changeFile(m_commitMessageFileName);
|
||||
// Paranoia!
|
||||
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
|
||||
|
@@ -313,7 +313,7 @@ AssistInterface *GlslEditorWidget::createAssistInterface(
|
||||
if (kind == Completion)
|
||||
return new GlslCompletionAssistInterface(document(),
|
||||
position(),
|
||||
textDocument()->filePath(),
|
||||
textDocument()->filePath().toString(),
|
||||
reason,
|
||||
textDocument()->mimeType(),
|
||||
m_glslDocument);
|
||||
|
@@ -126,7 +126,7 @@ bool ImageViewer::open(QString *errorString, const QString &fileName, const QStr
|
||||
*errorString = tr("Cannot open image file %1.").arg(QDir::toNativeSeparators(realFileName));
|
||||
return false;
|
||||
}
|
||||
d->file->setFilePath(fileName);
|
||||
d->file->setFilePath(Utils::FileName::fromString(fileName));
|
||||
d->ui_toolbar.toolButtonPlayPause->setVisible(d->imageView->isAnimated());
|
||||
setPaused(!d->imageView->isAnimated());
|
||||
// d_ptr->file->setMimeType
|
||||
|
@@ -65,7 +65,7 @@ bool ImageViewerFile::reload(QString *errorString,
|
||||
emit changed();
|
||||
return true;
|
||||
}
|
||||
return m_editor->open(errorString, filePath(), filePath());
|
||||
return m_editor->open(errorString, filePath().toString(), filePath().toString());
|
||||
}
|
||||
|
||||
bool ImageViewerFile::save(QString *errorString, const QString &fileName, bool autoSave)
|
||||
|
@@ -638,7 +638,7 @@ bool MercurialPlugin::submitEditorAboutToClose()
|
||||
QStringList extraOptions;
|
||||
if (!commitEditor->committerInfo().isEmpty())
|
||||
extraOptions << QLatin1String("-u") << commitEditor->committerInfo();
|
||||
m_client->commit(m_submitRepository, files, editorFile->filePath(),
|
||||
m_client->commit(m_submitRepository, files, editorFile->filePath().toString(),
|
||||
extraOptions);
|
||||
}
|
||||
return true;
|
||||
|
@@ -281,7 +281,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
|
||||
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0);
|
||||
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
|
||||
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
|
||||
Project *project = SessionManager::projectForFile(editor->document()->filePath());
|
||||
Project *project = SessionManager::projectForFile(editor->document()->filePath().toString());
|
||||
if (project && project->editorConfiguration() == this)
|
||||
switchSettings(widget);
|
||||
}
|
||||
|
@@ -134,7 +134,7 @@ Core::Id Project::id() const
|
||||
|
||||
Utils::FileName Project::projectFilePath() const
|
||||
{
|
||||
return Utils::FileName::fromString(document()->filePath());
|
||||
return document()->filePath();
|
||||
}
|
||||
|
||||
bool Project::hasActiveBuildSettings() const
|
||||
|
@@ -1120,11 +1120,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
|
||||
tr("Current project's main file"),
|
||||
[this]() -> QString {
|
||||
QString projectFilePath;
|
||||
Utils::FileName projectFilePath;
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
if (IDocument *doc = project->document())
|
||||
projectFilePath = doc->filePath();
|
||||
return projectFilePath;
|
||||
return projectFilePath.toString();
|
||||
});
|
||||
|
||||
expander->registerVariable(Constants::VAR_CURRENTPROJECT_BUILDPATH,
|
||||
@@ -1242,7 +1242,7 @@ void ProjectExplorerPlugin::loadAction()
|
||||
// for your special convenience, we preselect a pro file if it is
|
||||
// the current file
|
||||
if (const IDocument *document = EditorManager::currentDocument()) {
|
||||
const QString fn = document->filePath();
|
||||
const QString fn = document->filePath().toString();
|
||||
const bool isProject = dd->m_profileMimeTypes.contains(document->mimeType());
|
||||
dir = isProject ? fn : QFileInfo(fn).absolutePath();
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ void ProjectExplorerPlugin::unloadProject(Project *project)
|
||||
if (!DocumentManager::saveModifiedDocumentSilently(document))
|
||||
return;
|
||||
|
||||
dd->addToRecentProjects(document->filePath(), project->displayName());
|
||||
dd->addToRecentProjects(document->filePath().toString(), project->displayName());
|
||||
|
||||
SessionManager::removeProject(project);
|
||||
m_instance->updateActions();
|
||||
|
@@ -333,7 +333,7 @@ void ProjectTree::updateExternalFileWarning()
|
||||
}
|
||||
if (!infoBar->canInfoBeAdded(externalFileId))
|
||||
return;
|
||||
Utils::FileName fileName = Utils::FileName::fromString(document->filePath());
|
||||
const Utils::FileName fileName = document->filePath();
|
||||
const QList<Project *> projects = SessionManager::projects();
|
||||
if (projects.isEmpty())
|
||||
return;
|
||||
|
@@ -607,7 +607,7 @@ void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileN
|
||||
void SessionManager::configureEditors(Project *project)
|
||||
{
|
||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||
if (d->projectContainsFile(project, document->filePath())) {
|
||||
if (d->projectContainsFile(project, document->filePath().toString())) {
|
||||
foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) {
|
||||
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
|
||||
project->editorConfiguration()->configureEditor(textEditor);
|
||||
|
@@ -157,7 +157,7 @@ QString QbsProject::displayName() const
|
||||
IDocument *QbsProject::document() const
|
||||
{
|
||||
foreach (IDocument *doc, m_qbsDocuments) {
|
||||
if (doc->filePath() == m_fileName)
|
||||
if (doc->filePath().toString() == m_fileName)
|
||||
return doc;
|
||||
}
|
||||
QTC_ASSERT(false, return 0);
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
: m_document(0)
|
||||
{
|
||||
foreach (Core::IDocument * const doc, documents) {
|
||||
if (doc->filePath() == filePath) {
|
||||
if (doc->filePath().toString() == filePath) {
|
||||
m_document = doc;
|
||||
break;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
{
|
||||
QTC_ASSERT(m_document, return);
|
||||
Core::DocumentManager::addDocument(m_document);
|
||||
Core::DocumentManager::unexpectFileChange(m_document->filePath());
|
||||
Core::DocumentManager::unexpectFileChange(m_document->filePath().toString());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -658,7 +658,7 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
|
||||
QTC_ASSERT(!newFiles.isEmpty(), newFiles << m_fileName);
|
||||
QSet<QString> oldFiles;
|
||||
foreach (IDocument *doc, m_qbsDocuments)
|
||||
oldFiles.insert(doc->filePath());
|
||||
oldFiles.insert(doc->filePath().toString());
|
||||
|
||||
QSet<QString> filesToAdd = newFiles;
|
||||
filesToAdd.subtract(oldFiles);
|
||||
@@ -667,7 +667,7 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
|
||||
|
||||
QSet<IDocument *> currentDocuments = m_qbsDocuments;
|
||||
foreach (IDocument *doc, currentDocuments) {
|
||||
if (filesToRemove.contains(doc->filePath())) {
|
||||
if (filesToRemove.contains(doc->filePath().toString())) {
|
||||
m_qbsDocuments.remove(doc);
|
||||
delete doc;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ QbsProjectFile::QbsProjectFile(QbsProject *parent, QString fileName) : Core::IDo
|
||||
{
|
||||
setId("Qbs.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::MIME_TYPE));
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
QbsProjectFile::~QbsProjectFile()
|
||||
|
@@ -71,13 +71,13 @@ namespace Internal {
|
||||
static Node *currentEditorNode()
|
||||
{
|
||||
Core::IDocument *doc = Core::EditorManager::currentDocument();
|
||||
return doc ? SessionManager::nodeForFile(doc->filePath()) : 0;
|
||||
return doc ? SessionManager::nodeForFile(doc->filePath().toString()) : 0;
|
||||
}
|
||||
|
||||
static QbsProject *currentEditorProject()
|
||||
{
|
||||
Core::IDocument *doc = Core::EditorManager::currentDocument();
|
||||
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : 0;
|
||||
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath().toString())) : 0;
|
||||
}
|
||||
|
||||
QbsProjectManagerPlugin::QbsProjectManagerPlugin() :
|
||||
|
@@ -137,7 +137,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
|
||||
}
|
||||
}
|
||||
|
||||
QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
|
||||
QDir dir(textDocument()->filePath().toFileInfo().absolutePath());
|
||||
QString fileName = dir.filePath(buffer);
|
||||
QFileInfo fi(fileName);
|
||||
if (fi.exists()) {
|
||||
@@ -185,14 +185,12 @@ ProFileDocument::ProFileDocument()
|
||||
|
||||
QString ProFileDocument::defaultPath() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.absolutePath();
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString ProFileDocument::suggestedFileName() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.fileName();
|
||||
return filePath().toFileInfo().fileName();
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -244,7 +244,7 @@ QmakePriFile::QmakePriFile(QmakeProjectManager::QmakePriFileNode *qmakePriFile)
|
||||
{
|
||||
setId("Qmake.PriFile");
|
||||
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
|
||||
setFilePath(m_priFile->path());
|
||||
setFilePath(Utils::FileName::fromString(m_priFile->path()));
|
||||
}
|
||||
|
||||
bool QmakePriFile::save(QString *errorString, const QString &fileName, bool autoSave)
|
||||
|
@@ -283,7 +283,7 @@ QmakeProjectFile::QmakeProjectFile(const QString &filePath, QObject *parent)
|
||||
{
|
||||
setId("Qmake.ProFile");
|
||||
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
|
||||
setFilePath(filePath);
|
||||
setFilePath(Utils::FileName::fromString(filePath));
|
||||
}
|
||||
|
||||
bool QmakeProjectFile::save(QString *, const QString &, bool)
|
||||
@@ -414,7 +414,7 @@ bool QmakeProject::fromMap(const QVariantMap &map)
|
||||
|
||||
m_manager->registerProject(this);
|
||||
|
||||
m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath(), this);
|
||||
m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath().toString(), this);
|
||||
m_rootProjectNode->registerWatcher(m_nodesWatcher);
|
||||
|
||||
// We have the profile nodes now, so we know the runconfigs!
|
||||
@@ -1048,7 +1048,7 @@ void QmakeProject::destroyProFileReader(QtSupport::ProFileReader *reader)
|
||||
{
|
||||
delete reader;
|
||||
if (!--m_qmakeGlobalsRefCnt) {
|
||||
QString dir = QFileInfo(m_fileInfo->filePath()).absolutePath();
|
||||
QString dir = m_fileInfo->filePath().toFileInfo().absolutePath();
|
||||
if (!dir.endsWith(QLatin1Char('/')))
|
||||
dir += QLatin1Char('/');
|
||||
QtSupport::ProFileCacheManager::instance()->discardFiles(dir);
|
||||
|
@@ -135,7 +135,7 @@ void QmakeManager::setContextFile(ProjectExplorer::FileNode *file)
|
||||
void QmakeManager::addLibrary()
|
||||
{
|
||||
if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor()))
|
||||
addLibrary(editor->document()->filePath(), editor);
|
||||
addLibrary(editor->document()->filePath().toString(), editor);
|
||||
}
|
||||
|
||||
void QmakeManager::addLibraryContextMenu()
|
||||
@@ -231,7 +231,7 @@ void QmakeManager::buildFileContextMenu()
|
||||
void QmakeManager::buildFile()
|
||||
{
|
||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||
const QString file = currentDocument->filePath();
|
||||
const QString file = currentDocument->filePath().toString();
|
||||
FileNode *node = qobject_cast<FileNode *>(SessionManager::nodeForFile(file));
|
||||
Project *project = SessionManager::projectForFile(file);
|
||||
|
||||
|
@@ -392,7 +392,7 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
|
||||
bool enabled = false;
|
||||
|
||||
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
|
||||
QString file = currentDocument->filePath();
|
||||
QString file = currentDocument->filePath().toString();
|
||||
Node *node = SessionManager::nodeForFile(file);
|
||||
Project *project = SessionManager::projectForFile(file);
|
||||
m_buildFileAction->setParameter(QFileInfo(file).fileName());
|
||||
|
@@ -65,7 +65,7 @@ static CrumbleBarInfo createCrumbleBarInfoFromModelNode(const ModelNode &modelNo
|
||||
{
|
||||
CrumbleBarInfo crumbleBarInfo;
|
||||
crumbleBarInfo.displayName = componentIdForModelNode(modelNode);
|
||||
crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath();
|
||||
crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath().toString();
|
||||
crumbleBarInfo.modelNode = modelNode;
|
||||
|
||||
return crumbleBarInfo;
|
||||
|
@@ -194,22 +194,22 @@ QString DesignDocument::simplfiedDisplayName() const
|
||||
return list.last();
|
||||
}
|
||||
|
||||
void DesignDocument::updateFileName(const QString & /*oldFileName*/, const QString &newFileName)
|
||||
void DesignDocument::updateFileName(const Utils::FileName & /*oldFileName*/, const Utils::FileName &newFileName)
|
||||
{
|
||||
if (m_documentModel)
|
||||
m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName));
|
||||
m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName.toString()));
|
||||
|
||||
if (m_inFileComponentModel)
|
||||
m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName));
|
||||
m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName.toString()));
|
||||
|
||||
viewManager().setItemLibraryViewResourcePath(QFileInfo(newFileName).absolutePath());
|
||||
viewManager().setItemLibraryViewResourcePath(newFileName.toFileInfo().absolutePath());
|
||||
|
||||
emit displayNameChanged(displayName());
|
||||
}
|
||||
|
||||
QString DesignDocument::fileName() const
|
||||
{
|
||||
return editor()->document()->filePath();
|
||||
return editor()->document()->filePath().toString();
|
||||
}
|
||||
|
||||
ProjectExplorer::Kit *DesignDocument::currentKit() const
|
||||
@@ -243,7 +243,7 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit)
|
||||
|
||||
m_inFileComponentTextModifier.reset();
|
||||
|
||||
updateFileName(QString(), fileName());
|
||||
updateFileName(Utils::FileName(), Utils::FileName::fromString(fileName()));
|
||||
|
||||
m_documentLoaded = true;
|
||||
}
|
||||
@@ -581,9 +581,8 @@ RewriterView *DesignDocument::rewriterView() const
|
||||
void DesignDocument::setEditor(Core::IEditor *editor)
|
||||
{
|
||||
m_textEditor = editor;
|
||||
connect(editor->document(),
|
||||
SIGNAL(filePathChanged(QString,QString)),
|
||||
SLOT(updateFileName(QString,QString)));
|
||||
connect(editor->document(), &Core::IDocument::filePathChanged,
|
||||
this, &DesignDocument::updateFileName);
|
||||
|
||||
updateActiveQtVersion();
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ public slots:
|
||||
void changeToMaster();
|
||||
|
||||
private slots:
|
||||
void updateFileName(const QString &oldFileName, const QString &newFileName);
|
||||
void updateFileName(const Utils::FileName &oldFileName, const Utils::FileName &newFileName);
|
||||
|
||||
private: // functions
|
||||
void changeToInFileComponentModel(ComponentTextModifier *textModifer);
|
||||
|
@@ -509,7 +509,7 @@ void DesignModeWidget::resizeEvent(QResizeEvent *event)
|
||||
void DesignModeWidget::setupNavigatorHistory(Core::IEditor *editor)
|
||||
{
|
||||
if (!m_keepNavigatorHistory)
|
||||
addNavigatorHistoryEntry(editor->document()->filePath());
|
||||
addNavigatorHistoryEntry(editor->document()->filePath().toString());
|
||||
|
||||
const bool canGoBack = m_navigatorHistoryCounter > 0;
|
||||
const bool canGoForward = m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1);
|
||||
|
@@ -366,7 +366,7 @@ static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
|
||||
if (editor)
|
||||
if (editor && editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) {
|
||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||
QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath());
|
||||
QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath().toString());
|
||||
if (!document.isNull())
|
||||
return document->language() == QmlJS::Dialect::QmlQtQuick1
|
||||
|| document->language() == QmlJS::Dialect::QmlQtQuick2
|
||||
|
@@ -224,7 +224,7 @@ void QmlJSEditorWidget::updateCodeWarnings(QmlJS::Document::Ptr doc)
|
||||
void QmlJSEditorWidget::modificationChanged(bool changed)
|
||||
{
|
||||
if (!changed && m_modelManager)
|
||||
m_modelManager->fileChangedOnDisk(textDocument()->filePath());
|
||||
m_modelManager->fileChangedOnDisk(textDocument()->filePath().toString());
|
||||
}
|
||||
|
||||
void QmlJSEditorWidget::jumpToOutlineElement(int /*index*/)
|
||||
@@ -641,12 +641,12 @@ TextEditorWidget::Link QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
|
||||
void QmlJSEditorWidget::findUsages()
|
||||
{
|
||||
m_findReferences->findUsages(textDocument()->filePath(), textCursor().position());
|
||||
m_findReferences->findUsages(textDocument()->filePath().toString(), textCursor().position());
|
||||
}
|
||||
|
||||
void QmlJSEditorWidget::renameUsages()
|
||||
{
|
||||
m_findReferences->renameUsages(textDocument()->filePath(), textCursor().position());
|
||||
m_findReferences->renameUsages(textDocument()->filePath().toString(), textCursor().position());
|
||||
}
|
||||
|
||||
void QmlJSEditorWidget::showContextPane()
|
||||
@@ -846,7 +846,7 @@ AssistInterface *QmlJSEditorWidget::createAssistInterface(
|
||||
if (assistKind == TextEditor::Completion) {
|
||||
return new QmlJSCompletionAssistInterface(document(),
|
||||
position(),
|
||||
textDocument()->filePath(),
|
||||
textDocument()->filePath().toString(),
|
||||
reason,
|
||||
m_qmlJsEditorDocument->semanticInfo());
|
||||
} else if (assistKind == TextEditor::QuickFix) {
|
||||
|
@@ -451,7 +451,7 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
||||
m_updateOutlineModelTimer.setSingleShot(true);
|
||||
connect(&m_updateOutlineModelTimer, SIGNAL(timeout()), this, SLOT(updateOutlineModel()));
|
||||
|
||||
modelManager->updateSourceFiles(QStringList(parent->filePath()), false);
|
||||
modelManager->updateSourceFiles(QStringList(parent->filePath().toString()), false);
|
||||
}
|
||||
|
||||
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
|
||||
@@ -468,13 +468,13 @@ void QmlJSEditorDocumentPrivate::invalidateFormatterCache()
|
||||
|
||||
void QmlJSEditorDocumentPrivate::reparseDocument()
|
||||
{
|
||||
ModelManagerInterface::instance()->updateSourceFiles(QStringList() << q->filePath(),
|
||||
false);
|
||||
ModelManagerInterface::instance()->updateSourceFiles(QStringList(q->filePath().toString()),
|
||||
false);
|
||||
}
|
||||
|
||||
void QmlJSEditorDocumentPrivate::onDocumentUpdated(Document::Ptr doc)
|
||||
{
|
||||
if (q->filePath() != doc->fileName())
|
||||
if (q->filePath().toString() != doc->fileName())
|
||||
return;
|
||||
|
||||
// text document has changed, simply wait for the next onDocumentUpdated
|
||||
|
@@ -50,7 +50,7 @@ using namespace Internal;
|
||||
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
|
||||
TextEditor::AssistReason reason)
|
||||
: AssistInterface(editor->document(), editor->position(),
|
||||
editor->textDocument()->filePath(), reason)
|
||||
editor->textDocument()->filePath().toString(), reason)
|
||||
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
|
||||
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
|
||||
{}
|
||||
|
@@ -336,7 +336,7 @@ QMimeData *QmlOutlineModel::mimeData(const QModelIndexList &indexes) const
|
||||
QModelIndex index = indexes.at(i);
|
||||
|
||||
AST::SourceLocation location = sourceLocation(index);
|
||||
data->addFile(m_editorDocument->filePath(), location.startLine,
|
||||
data->addFile(m_editorDocument->filePath().toString(), location.startLine,
|
||||
location.startColumn - 1 /*editors have 0-based column*/);
|
||||
|
||||
QList<int> rowPath;
|
||||
|
@@ -251,7 +251,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
|
||||
{
|
||||
WorkingCopy workingCopy;
|
||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||
const QString key = document->filePath();
|
||||
const QString key = document->filePath().toString();
|
||||
if (TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
|
||||
// TODO the language should be a property on the document, not the editor
|
||||
if (DocumentModel::editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS))
|
||||
|
@@ -36,7 +36,7 @@
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
|
||||
QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName)
|
||||
: Core::IDocument(parent),
|
||||
m_project(parent)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
|
||||
QTC_CHECK(!fileName.isEmpty());
|
||||
setId("Qml.ProjectFile");
|
||||
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
QmlProjectFile::~QmlProjectFile()
|
||||
|
@@ -44,7 +44,7 @@ class QmlProjectFile : public Core::IDocument
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlProjectFile(QmlProject *parent, QString fileName);
|
||||
QmlProjectFile(QmlProject *parent, const QString &fileName);
|
||||
virtual ~QmlProjectFile();
|
||||
|
||||
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
|
||||
|
@@ -42,11 +42,11 @@ namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IDocument *projectFile)
|
||||
: ProjectExplorer::ProjectNode(QFileInfo(projectFile->filePath()).absoluteFilePath()),
|
||||
: ProjectExplorer::ProjectNode(projectFile->filePath().toString()),
|
||||
m_project(project),
|
||||
m_projectFile(projectFile)
|
||||
{
|
||||
setDisplayName(QFileInfo(projectFile->filePath()).completeBaseName());
|
||||
setDisplayName(projectFile->filePath().toFileInfo().completeBaseName());
|
||||
// make overlay
|
||||
const QSize desiredSize = QSize(16, 16);
|
||||
const QIcon projectBaseIcon(QLatin1String(":/qmlproject/images/qmlfolder.png"));
|
||||
@@ -63,7 +63,7 @@ Core::IDocument *QmlProjectNode::projectFile() const
|
||||
{ return m_projectFile; }
|
||||
|
||||
QString QmlProjectNode::projectFilePath() const
|
||||
{ return m_projectFile->filePath(); }
|
||||
{ return m_projectFile->filePath().toString(); }
|
||||
|
||||
void QmlProjectNode::refresh()
|
||||
{
|
||||
|
@@ -257,7 +257,7 @@ void QmlProjectRunConfiguration::changeCurrentFile(IEditor *editor)
|
||||
editor = EditorManager::currentEditor();
|
||||
|
||||
if (editor)
|
||||
m_currentFileFilename = editor->document()->filePath();
|
||||
m_currentFileFilename = editor->document()->filePath().toString();
|
||||
updateEnabled();
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ void QmlProjectRunConfiguration::updateEnabled()
|
||||
if (mainScriptSource() == FileInEditor) {
|
||||
IDocument *document = EditorManager::currentDocument();
|
||||
if (document) {
|
||||
m_currentFileFilename = document->filePath();
|
||||
m_currentFileFilename = document->filePath().toString();
|
||||
if (MimeDatabase::findByFile(mainScript()).type() == QLatin1String("application/x-qml"))
|
||||
qmlFileFound = true;
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ bool BarDescriptorDocument::open(QString *errorString, const QString &fileName)
|
||||
if (read(fileName, &contents, errorString) != Utils::TextFileFormat::ReadSuccess)
|
||||
return false;
|
||||
|
||||
setFilePath(fileName);
|
||||
setFilePath(Utils::FileName::fromString(fileName));
|
||||
|
||||
const bool result = loadContent(contents, false);
|
||||
|
||||
@@ -83,7 +83,7 @@ bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool a
|
||||
QTC_ASSERT(!autoSave, return false);
|
||||
QTC_ASSERT(fn.isEmpty(), return false);
|
||||
|
||||
const bool result = write(filePath(), xmlSource(), errorString);
|
||||
const bool result = write(filePath().toString(), xmlSource(), errorString);
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
@@ -94,14 +94,12 @@ bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool a
|
||||
|
||||
QString BarDescriptorDocument::defaultPath() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.absolutePath();
|
||||
return filePath().toFileInfo().absolutePath();
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::suggestedFileName() const
|
||||
{
|
||||
QFileInfo fi(filePath());
|
||||
return fi.fileName();
|
||||
return filePath().toFileInfo().fileName();
|
||||
}
|
||||
|
||||
bool BarDescriptorDocument::shouldAutoSave() const
|
||||
@@ -135,7 +133,7 @@ bool BarDescriptorDocument::reload(QString *errorString, Core::IDocument::Reload
|
||||
if (flag == Core::IDocument::FlagIgnore)
|
||||
return true;
|
||||
|
||||
return open(errorString, filePath());
|
||||
return open(errorString, filePath().toString());
|
||||
}
|
||||
|
||||
QString BarDescriptorDocument::xmlSource() const
|
||||
|
@@ -112,7 +112,7 @@ bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, co
|
||||
if (result) {
|
||||
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
|
||||
QTC_ASSERT(editorWidget, return false);
|
||||
editorWidget->setFilePath(fileName);
|
||||
editorWidget->setFilePath(Utils::FileName::fromString(fileName));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user