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