summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp7
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsproject.cpp19
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp2
-rw-r--r--src/plugins/classview/classviewparser.cpp14
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp42
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.h14
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp7
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectnodes.h2
-rw-r--r--src/plugins/designer/codemodelhelpers.cpp4
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp9
-rw-r--r--src/plugins/designer/resourcehandler.cpp7
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp6
-rw-r--r--src/plugins/genericprojectmanager/genericprojectnodes.cpp23
-rw-r--r--src/plugins/ios/iosrunconfiguration.cpp7
-rw-r--r--src/plugins/ios/iosrunconfiguration.h6
-rw-r--r--src/plugins/ios/iosrunfactories.cpp18
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.cpp4
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp4
-rw-r--r--src/plugins/projectexplorer/nodesvisitor.cpp8
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp25
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.cpp4
-rw-r--r--src/plugins/projectexplorer/projectmodels.cpp29
-rw-r--r--src/plugins/projectexplorer/projectmodels.h4
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp31
-rw-r--r--src/plugins/projectexplorer/projectnodes.h20
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp2
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.cpp16
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.h8
-rw-r--r--src/plugins/projectexplorer/session.cpp27
-rw-r--r--src/plugins/projectexplorer/session.h6
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.cpp46
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.h6
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp10
-rw-r--r--src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp9
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp4
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h2
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp10
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h9
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp6
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp3
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp16
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h5
-rw-r--r--src/plugins/qmakeprojectmanager/externaleditors.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp22
-rw-r--r--src/plugins/qmakeprojectmanager/makestep.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp183
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.h15
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp52
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.h16
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.h2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakestep.cpp4
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp5
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h4
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.cpp15
-rw-r--r--src/plugins/qmlprojectmanager/qmlproject.h6
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectfile.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectfile.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectmanager.cpp5
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectnodes.cpp12
-rw-r--r--src/plugins/qnx/bardescriptorfilenode.cpp2
-rw-r--r--src/plugins/qnx/bardescriptorfilenode.h2
-rw-r--r--src/plugins/qnx/bardescriptorfilenodemanager.cpp22
-rw-r--r--src/plugins/qnx/bardescriptorfilenodemanager.h10
-rw-r--r--src/plugins/qnx/blackberryapplicationrunner.cpp10
-rw-r--r--src/plugins/qnx/blackberryapplicationrunner.h3
-rw-r--r--src/plugins/qnx/blackberrycreatepackagestep.cpp18
-rw-r--r--src/plugins/qnx/blackberrycreatepackagestep.h2
-rw-r--r--src/plugins/qnx/blackberrydeployinformation.cpp40
-rw-r--r--src/plugins/qnx/blackberrydeployinformation.h23
-rw-r--r--src/plugins/qnx/blackberrydeploystep.cpp7
-rw-r--r--src/plugins/qnx/blackberryrunconfiguration.cpp25
-rw-r--r--src/plugins/qnx/blackberryrunconfiguration.h11
-rw-r--r--src/plugins/qnx/blackberryrunconfigurationfactory.cpp11
-rw-r--r--src/plugins/qnx/blackberryrunconfigurationwidget.cpp2
-rw-r--r--src/plugins/qnx/qnxrunconfigurationfactory.cpp10
-rw-r--r--src/plugins/resourceeditor/resourceeditorplugin.cpp6
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp80
-rw-r--r--src/plugins/resourceeditor/resourcenode.h4
-rw-r--r--src/plugins/valgrind/suppressiondialog.cpp2
-rw-r--r--tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp3
86 files changed, 616 insertions, 551 deletions
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 8f27df9573..c74513919d 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -87,9 +87,8 @@ bool checkPackageName(const QString &packageName)
return QRegExp(packageNameRegExp).exactMatch(packageName);
}
-Project *androidProject(const QString &file)
+Project *androidProject(const Utils::FileName &fileName)
{
- Utils::FileName fileName = Utils::FileName::fromString(file);
foreach (Project *project, SessionManager::projects()) {
if (!project->activeTarget())
continue;
@@ -476,8 +475,7 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox()
{
- const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
- Project *project = androidProject(docPath);
+ Project *project = androidProject(m_textEditorWidget->textDocument()->filePath());
QStringList items;
if (project) {
Kit *kit = project->activeTarget()->kit();
@@ -696,7 +694,6 @@ void AndroidManifestEditorWidget::updateInfoBar()
void AndroidManifestEditorWidget::updateSdkVersions()
{
- const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
m_androidMinSdkVersion->addItem(tr("API %1: %2")
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
index 8e5b5f9dd4..428727f8ea 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
@@ -272,7 +272,7 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
// nodes later.
QHash<QString, Node *> nodeHash;
foreach (Node * node, nodes(m_rootNode))
- nodeHash.insert(node->path(), node);
+ nodeHash.insert(node->path().toString(), node);
// Add the sources to the filenode project tree. Sources
// inside the same directory are grouped into a folder-node.
@@ -317,11 +317,12 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
const QString filePath = directory.absoluteFilePath(file);
if (nodeHash.contains(filePath)) {
nodeHash.remove(filePath);
+ } else if (file == QLatin1String("Makefile.am") || file == QLatin1String("configure.ac")) {
+ fileNodes.append(new FileNode(Utils::FileName::fromString(filePath),
+ ProjectFileType, false));
} else {
- if (file == QLatin1String("Makefile.am") || file == QLatin1String("configure.ac"))
- fileNodes.append(new FileNode(filePath, ProjectFileType, false));
- else
- fileNodes.append(new FileNode(filePath, ResourceType, false));
+ fileNodes.append(new FileNode(Utils::FileName::fromString(filePath),
+ ResourceType, false));
}
}
@@ -351,9 +352,9 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
FolderNode *AutotoolsProject::insertFolderNode(const QDir &nodeDir, QHash<QString, Node *> &nodes)
{
- const QString nodePath = nodeDir.absolutePath();
- QFileInfo rootInfo(m_rootNode->path());
- const QString rootPath = rootInfo.absolutePath();
+ const Utils::FileName nodePath = Utils::FileName::fromString(nodeDir.absolutePath());
+ QFileInfo rootInfo = m_rootNode->path().toFileInfo();
+ const Utils::FileName rootPath = Utils::FileName::fromString(rootInfo.absolutePath());
// Do not create a folder for the root node
if (rootPath == nodePath)
@@ -379,7 +380,7 @@ FolderNode *AutotoolsProject::insertFolderNode(const QDir &nodeDir, QHash<QStrin
}
parentFolder->addFolderNodes(QList<FolderNode *>() << folder);
- nodes.insert(nodePath, folder);
+ nodes.insert(nodePath.toString(), folder);
return folder;
}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
index 7f961ea293..9e2232e2cd 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
- ProjectNode(projectFile->filePath().toString()),
+ ProjectNode(projectFile->filePath()),
m_project(project),
m_projectFile(projectFile)
{
diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp
index 8e99eb14f3..71d958a172 100644
--- a/src/plugins/classview/classviewparser.cpp
+++ b/src/plugins/classview/classviewparser.cpp
@@ -731,7 +731,7 @@ QStringList Parser::projectNodeFileList(const FolderNode *node) const
if (file->isGenerated())
continue;
- list << file->path();
+ list << file->path().toString();
}
foreach (const FolderNode *folder, subFolderNodes) {
@@ -756,7 +756,7 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
if (!node)
return projectList;
- const QString &nodePath = node->path();
+ const QString nodePath = node->path().toString();
// our own files
QStringList fileList;
@@ -770,8 +770,8 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
d->cachedPrjFileLists[nodePath] = fileList;
}
if (fileList.count() > 0) {
- addProject(item, fileList, node->path());
- projectList << node->path();
+ addProject(item, fileList, node->path().toString());
+ projectList << node->path().toString();
}
// subnodes
@@ -779,7 +779,7 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
foreach (const ProjectNode *project, projectNodes) {
ParserTreeItem::Ptr itemPrj(new ParserTreeItem());
- SymbolInformation information(project->displayName(), project->path());
+ SymbolInformation information(project->displayName(), project->path().toString());
projectList += addProjectNode(itemPrj, project);
@@ -800,7 +800,7 @@ QStringList Parser::getAllFiles(const ProjectNode *node)
if (!node)
return fileList;
- const QString &nodePath = node->path();
+ const QString nodePath = node->path().toString();
CitCachedPrjFileLists cit = d->cachedPrjFileLists.find(nodePath);
// try to improve parsing speed by internal cache
@@ -827,7 +827,7 @@ void Parser::addFlatTree(const ParserTreeItem::Ptr &item, const ProjectNode *nod
fileList.removeDuplicates();
if (fileList.count() > 0) {
- addProject(item, fileList, node->path());
+ addProject(item, fileList, node->path().toString());
}
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index a1195b0e26..d28797c306 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
info.setCustomButtonInfo(tr("Build now"), [document]() {
foreach (Project *p, SessionManager::projects()) {
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
- if (cmakeProject->isProjectFile(document->filePath().toString())) {
+ if (cmakeProject->isProjectFile(document->filePath())) {
ProjectExplorerPlugin::buildProject(cmakeProject);
break;
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index fac84253e1..76c48f918d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -85,7 +85,7 @@ using namespace Utils;
/*!
\class CMakeProject
*/
-CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
+CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
: m_manager(manager),
m_activeTarget(0),
m_fileName(fileName),
@@ -96,7 +96,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
- m_projectName = QFileInfo(fileName).absoluteDir().dirName();
+ m_projectName = fileName.parentDir().fileName();
m_file = new CMakeFile(this, fileName);
@@ -133,8 +133,8 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
if (!cbpFileFi.exists()) {
mode = CMakeOpenProjectWizard::NeedToCreate;
} else {
- foreach (const QString &file, m_watchedFiles) {
- if (QFileInfo(file).lastModified() > cbpFileFi.lastModified()) {
+ foreach (const FileName &file, m_watchedFiles) {
+ if (file.toFileInfo().lastModified() > cbpFileFi.lastModified()) {
mode = CMakeOpenProjectWizard::NeedToUpdate;
break;
}
@@ -234,7 +234,7 @@ bool CMakeProject::parseCMakeLists()
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments())
- if (isProjectFile(document->filePath().toString()))
+ if (isProjectFile(document->filePath()))
document->infoBar()->removeInfo("CMakeEditor.RunCMake");
// Find cbp file
@@ -268,14 +268,14 @@ bool CMakeProject::parseCMakeLists()
//qDebug()<<"Building Tree";
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
- QSet<QString> projectFiles;
+ QSet<FileName> projectFiles;
if (cbpparser.hasCMakeFiles()) {
fileList.append(cbpparser.cmakeFileList());
foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList())
projectFiles.insert(node->path());
} else {
// Manually add the CMakeLists.txt file
- QString cmakeListTxt = projectDirectory().toString() + QLatin1String("/CMakeLists.txt");
+ FileName cmakeListTxt = projectDirectory().appendPath(QLatin1String("CMakeLists.txt"));
bool generated = false;
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
projectFiles.insert(cmakeListTxt);
@@ -285,7 +285,7 @@ bool CMakeProject::parseCMakeLists()
m_files.clear();
foreach (ProjectExplorer::FileNode *fn, fileList)
- m_files.append(fn->path());
+ m_files.append(fn->path().toString());
m_files.sort();
buildTree(m_rootNode, fileList);
@@ -347,7 +347,7 @@ bool CMakeProject::parseCMakeLists()
return true;
}
-bool CMakeProject::isProjectFile(const QString &fileName)
+bool CMakeProject::isProjectFile(const FileName &fileName)
{
return m_watchedFiles.contains(fileName);
}
@@ -409,7 +409,7 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
foreach (ProjectExplorer::FileNode *fn, added) {
// qDebug()<<"added"<<fn->path();
// Get relative path to rootNode
- QString parentDir = QFileInfo(fn->path()).absolutePath();
+ QString parentDir = fn->path().toFileInfo().absolutePath();
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
folder->addFileNodes(QList<ProjectExplorer::FileNode *>()<< fn);
}
@@ -432,13 +432,13 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *rootNode, QString directory)
{
- QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
+ FileName path = rootNode->path().parentDir();
+ QDir rootParentDir(path.toString());
+ QString relativePath = rootParentDir.relativeFilePath(directory);
QStringList parts = relativePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
ProjectExplorer::FolderNode *parent = rootNode;
- QString path = QFileInfo(rootNode->path()).path();
foreach (const QString &part, parts) {
- path += QLatin1Char('/');
- path += part;
+ path.appendPath(part);
// Find folder in subFolders
bool found = false;
foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
@@ -522,7 +522,6 @@ bool CMakeProject::fromMap(const QVariantMap &map)
} else {
// We have a user file, but we could still be missing the cbp file
// or simply run createXml with the saved settings
- QFileInfo sourceFileInfo(m_fileName);
CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
if (!activeBC)
return false;
@@ -532,7 +531,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
if (!cbpFileFi.exists())
mode = CMakeOpenProjectWizard::NeedToCreate;
- else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
+ else if (cbpFileFi.lastModified() < m_fileName.toFileInfo().lastModified())
mode = CMakeOpenProjectWizard::NeedToUpdate;
if (mode != CMakeOpenProjectWizard::Nothing) {
@@ -737,12 +736,12 @@ void CMakeProject::createUiCodeModelSupport()
// CMakeFile
-CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
+CMakeFile::CMakeFile(CMakeProject *parent, const FileName &fileName)
: Core::IDocument(parent), m_project(parent)
{
setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
- setFilePath(FileName::fromString(fileName));
+ setFilePath(fileName);
}
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -873,7 +872,7 @@ void CMakeCbpParser::sortFiles()
{
QLoggingCategory log("qtc.cmakeprojectmanager.filetargetmapping");
QList<FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) {
- return FileName::fromString(node->path());
+ return node->path();
});
Utils::sort(fileNames);
@@ -1203,7 +1202,8 @@ void CMakeCbpParser::parseAdd()
void CMakeCbpParser::parseUnit()
{
//qDebug()<<stream.attributes().value("filename");
- QString fileName = attributes().value(QLatin1String("filename")).toString();
+ FileName fileName =
+ FileName::fromUserInput(attributes().value(QLatin1String("filename")).toString());
m_parsingCmakeUnit = false;
while (!atEnd()) {
readNext();
@@ -1214,7 +1214,7 @@ void CMakeCbpParser::parseUnit()
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else {
bool generated = false;
- QString onlyFileName = FileName::fromString(fileName).fileName();
+ QString onlyFileName = fileName.fileName();
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h
index 4c725daced..f6e000fac9 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.h
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.h
@@ -44,6 +44,8 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
+#include <utils/fileutils.h>
+
#include <QFuture>
#include <QXmlStreamReader>
#include <QPushButton>
@@ -92,7 +94,7 @@ class CMakeProject : public ProjectExplorer::Project
// for changeBuildDirectory
friend class CMakeBuildSettingsWidget;
public:
- CMakeProject(CMakeManager *manager, const QString &filename);
+ CMakeProject(CMakeManager *manager, const Utils::FileName &filename);
~CMakeProject();
QString displayName() const;
@@ -108,7 +110,7 @@ public:
CMakeBuildTarget buildTargetForTitle(const QString &title);
- bool isProjectFile(const QString &fileName);
+ bool isProjectFile(const Utils::FileName &fileName);
bool parseCMakeLists();
@@ -142,7 +144,7 @@ private:
CMakeManager *m_manager;
ProjectExplorer::Target *m_activeTarget;
- QString m_fileName;
+ Utils::FileName m_fileName;
CMakeFile *m_file;
QString m_projectName;
@@ -151,7 +153,7 @@ private:
QStringList m_files;
QList<CMakeBuildTarget> m_buildTargets;
QFileSystemWatcher *m_watcher;
- QSet<QString> m_watchedFiles;
+ QSet<Utils::FileName> m_watchedFiles;
QFuture<void> m_codeModelFuture;
};
@@ -185,7 +187,7 @@ private:
QList<ProjectExplorer::FileNode *> m_fileList;
QList<ProjectExplorer::FileNode *> m_cmakeFileList;
- QSet<QString> m_processedUnits;
+ QSet<Utils::FileName> m_processedUnits;
bool m_parsingCmakeUnit;
CMakeBuildTarget m_buildTarget;
@@ -200,7 +202,7 @@ class CMakeFile : public Core::IDocument
{
Q_OBJECT
public:
- CMakeFile(CMakeProject *parent, QString fileName);
+ CMakeFile(CMakeProject *parent, const Utils::FileName &fileName);
bool save(QString *errorString, const QString &fileName, bool autoSave);
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
index 20051b8fc1..2f5c271499 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
@@ -112,14 +112,15 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString)
{
- if (!QFileInfo(fileName).isFile()) {
+ Utils::FileName file = Utils::FileName::fromString(fileName);
+ if (!file.toFileInfo().isFile()) {
if (errorString)
*errorString = tr("Failed opening project \"%1\": Project is not a file")
- .arg(fileName);
+ .arg(file.toUserOutput());
return 0;
}
- return new CMakeProject(this, fileName);
+ return new CMakeProject(this, file);
}
QString CMakeManager::mimeType() const
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp
index 7f898030db..f1093f0e3b 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp
@@ -33,7 +33,7 @@
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
-CMakeProjectNode::CMakeProjectNode(const QString &fileName)
+CMakeProjectNode::CMakeProjectNode(const Utils::FileName &fileName)
: ProjectExplorer::ProjectNode(fileName)
{
}
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h
index c564ae4198..1a9ff6a638 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.h
@@ -40,7 +40,7 @@ class CMakeProjectNode : public ProjectExplorer::ProjectNode
{
friend class CMakeProject;
public:
- CMakeProjectNode(const QString &fileName);
+ CMakeProjectNode(const Utils::FileName &fileName);
virtual bool showInSimpleTree() const;
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp
index cd628e0a67..b1aced1fbb 100644
--- a/src/plugins/designer/codemodelhelpers.cpp
+++ b/src/plugins/designer/codemodelhelpers.cpp
@@ -51,8 +51,10 @@ static const char setupUiC[] = "setupUi";
// Find the generated "ui_form.h" header of the form via project.
static QString generatedHeaderOf(const QString &uiFileName)
{
- if (const ProjectExplorer::Project *uiProject = ProjectExplorer::SessionManager::projectForFile(uiFileName))
+ if (const ProjectExplorer::Project *uiProject =
+ ProjectExplorer::SessionManager::projectForFile(Utils::FileName::fromString(uiFileName))) {
return uiProject->generatedUiHeader(uiFileName);
+ }
return QString();
}
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 11bef27858..1ed02b4ffa 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -513,16 +513,17 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
{
typedef QMap<int, Document::Ptr> DocumentMap;
- const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath().toString();
+ const Utils::FileName currentUiFile = FormEditorW::activeEditor()->document()->filePath();
#if 0
- return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage);
+ return Designer::Internal::navigateToSlot(currentUiFile.toString(), objectName,
+ signalSignature, parameterNames, errorMessage);
#endif
// TODO: we should pass to findDocumentsIncluding an absolute path to generated .h file from ui.
// Currently we are guessing the name of ui_<>.h file and pass the file name only to the findDocumentsIncluding().
// The idea is that the .pro file knows if the .ui files is inside, and the .pro file knows it will
// be generating the ui_<>.h file for it, and the .pro file knows what the generated file's name and its absolute path will be.
// So we should somehow get that info from project manager (?)
- const QFileInfo fi(currentUiFile);
+ const QFileInfo fi = currentUiFile.toFileInfo();
const QString uiFolder = fi.absolutePath();
const QString uicedName = QLatin1String("ui_") + fi.completeBaseName() + QLatin1String(".h");
@@ -532,7 +533,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
const Project *uiProject = SessionManager::projectForFile(currentUiFile);
if (uiProject) {
for (Snapshot::const_iterator i = docTable.begin(), ei = docTable.end(); i != ei; ++i) {
- const Project *project = SessionManager::projectForFile(i.key().toString());
+ const Project *project = SessionManager::projectForFile(i.key());
if (project == uiProject)
newDocTable.insert(i.value());
}
diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp
index 7d0814f611..de0e4c8b48 100644
--- a/src/plugins/designer/resourcehandler.cpp
+++ b/src/plugins/designer/resourcehandler.cpp
@@ -74,10 +74,10 @@ void QrcFilesVisitor::visitFolderNode(FolderNode *folderNode)
{
foreach (const FileNode *fileNode, folderNode->fileNodes()) {
if (fileNode->fileType() == ResourceType)
- m_qrcFiles.append(fileNode->path());
+ m_qrcFiles.append(fileNode->path().toString());
}
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode))
- m_qrcFiles.append(folderNode->path());
+ m_qrcFiles.append(folderNode->path().toString());
}
// ------------ ResourceHandler
@@ -125,7 +125,8 @@ void ResourceHandler::updateResources(bool updateProjectResources)
qDebug() << "ResourceHandler::updateResources()" << fileName;
// Filename could change in the meantime.
- Project *project = SessionManager::projectForFile(fileName);
+ Project *project = SessionManager::projectForFile(
+ Utils::FileName::fromUserInput(QDir::fromNativeSeparators(fileName)));
const bool dirty = m_form->property("_q_resourcepathchanged").toBool();
if (dirty)
m_form->setDirty(true);
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index 9265fc4e54..0ea417ef10 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -94,15 +94,15 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
m_rootNode = new GenericProjectNode(this, m_creatorIDocument);
- FileNode *projectFilesNode = new FileNode(m_filesFileName,
+ FileNode *projectFilesNode = new FileNode(Utils::FileName::fromString(m_filesFileName),
ProjectFileType,
/* generated = */ false);
- FileNode *projectIncludesNode = new FileNode(m_includesFileName,
+ FileNode *projectIncludesNode = new FileNode(Utils::FileName::fromString(m_includesFileName),
ProjectFileType,
/* generated = */ false);
- FileNode *projectConfigNode = new FileNode(m_configFileName,
+ FileNode *projectConfigNode = new FileNode(Utils::FileName::fromString(m_configFileName),
ProjectFileType,
/* generated = */ false);
diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
index 75bbb4d6bc..cb0f5b4623 100644
--- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
@@ -43,7 +43,7 @@ namespace GenericProjectManager {
namespace Internal {
GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IDocument *projectFile)
- : ProjectNode(projectFile->filePath().toString())
+ : ProjectNode(projectFile->filePath())
, m_project(project)
, m_projectFile(projectFile)
{
@@ -104,7 +104,7 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QSet<QString> added = newFileList;
added.subtract(oldFileList);
- QString baseDir = QFileInfo(path()).absolutePath();
+ QString baseDir = path().toFileInfo().absolutePath();
FilesInPathHash filesInPaths = sortFilesIntoPaths(baseDir, added);
FilesInPathHashConstIt cend = filesInPaths.constEnd();
@@ -120,7 +120,8 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) {
FileType fileType = SourceType; // ### FIXME
- FileNode *fileNode = new FileNode(file, fileType, /*generated = */ false);
+ FileNode *fileNode = new FileNode(Utils::FileName::fromString(file),
+ fileType, /*generated = */ false);
fileNodes.append(fileNode);
}
@@ -138,9 +139,10 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) {
- foreach (FileNode *fn, folder->fileNodes())
- if (fn->path() == file)
+ foreach (FileNode *fn, folder->fileNodes()) {
+ if (fn->path().toString() == file)
fileNodes.append(fn);
+ }
}
folder->removeFileNodes(fileNodes);
@@ -173,8 +175,8 @@ FolderNode *GenericProjectNode::createFolderByName(const QStringList &components
const QString component = components.at(end - 1);
- const QString baseDir = QFileInfo(path()).path();
- FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
+ const Utils::FileName folderPath = path().parentDir().appendPath(folderName);
+ FolderNode *folder = new FolderNode(folderPath);
folder->setDisplayName(component);
FolderNode *parent = findFolderByName(components, end - 1);
@@ -201,10 +203,11 @@ FolderNode *GenericProjectNode::findFolderByName(const QStringList &components,
if (!parent)
return 0;
- const QString baseDir = QFileInfo(path()).path();
- foreach (FolderNode *fn, parent->subFolderNodes())
- if (fn->path() == baseDir + QLatin1Char('/') + folderName)
+ const QString baseDir = path().toFileInfo().path();
+ foreach (FolderNode *fn, parent->subFolderNodes()) {
+ if (fn->path().toString() == baseDir + QLatin1Char('/') + folderName)
return fn;
+ }
return 0;
}
diff --git a/src/plugins/ios/iosrunconfiguration.cpp b/src/plugins/ios/iosrunconfiguration.cpp
index 05f30251fc..0a455e51bd 100644
--- a/src/plugins/ios/iosrunconfiguration.cpp
+++ b/src/plugins/ios/iosrunconfiguration.cpp
@@ -85,7 +85,7 @@ private:
QStandardItemModel m_deviceTypeModel;
};
-IosRunConfiguration::IosRunConfiguration(Target *parent, Core::Id id, const QString &path)
+IosRunConfiguration::IosRunConfiguration(Target *parent, Core::Id id, const FileName &path)
: RunConfiguration(parent, id)
, m_profilePath(path)
{
@@ -190,7 +190,7 @@ IosDeployStep *IosRunConfiguration::deployStep() const
return step;
}
-QString IosRunConfiguration::profilePath() const
+FileName IosRunConfiguration::profilePath() const
{
return m_profilePath;
}
@@ -302,8 +302,7 @@ bool IosRunConfiguration::isEnabled() const
QString IosRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
- return tr("The .pro file \"%1\" is currently being parsed.")
- .arg(FileName::fromString(m_profilePath).fileName());
+ return tr("The .pro file \"%1\" is currently being parsed.").arg(m_profilePath.fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath);
diff --git a/src/plugins/ios/iosrunconfiguration.h b/src/plugins/ios/iosrunconfiguration.h
index 3422a336c3..a5b24f387d 100644
--- a/src/plugins/ios/iosrunconfiguration.h
+++ b/src/plugins/ios/iosrunconfiguration.h
@@ -54,14 +54,14 @@ class IosRunConfiguration : public ProjectExplorer::RunConfiguration
friend class IosRunConfigurationFactory;
public:
- IosRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
+ IosRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const Utils::FileName &path);
QWidget *createConfigurationWidget() Q_DECL_OVERRIDE;
Utils::OutputFormatter *createOutputFormatter() const Q_DECL_OVERRIDE;
IosDeployStep *deployStep() const;
QStringList commandLineArguments();
- QString profilePath() const;
+ Utils::FileName profilePath() const;
QString applicationName() const;
Utils::FileName bundleDirectory() const;
Utils::FileName localExecutable() const;
@@ -87,7 +87,7 @@ private:
friend class IosRunConfigurationWidget;
void updateDisplayNames();
- QString m_profilePath;
+ Utils::FileName m_profilePath;
QStringList m_arguments;
QString m_lastDisabledReason;
bool m_lastIsEnabled;
diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp
index 20ecea6f7a..f351fd56aa 100644
--- a/src/plugins/ios/iosrunfactories.cpp
+++ b/src/plugins/ios/iosrunfactories.cpp
@@ -58,13 +58,13 @@ namespace Internal {
#define IOS_PREFIX "Qt4ProjectManager.IosRunConfiguration"
#define IOS_RC_ID_PREFIX IOS_PREFIX ":"
-static QString pathFromId(Core::Id id)
+static Utils::FileName pathFromId(Core::Id id)
{
QString pathStr = id.toString();
const QString prefix = QLatin1String(IOS_RC_ID_PREFIX);
if (!pathStr.startsWith(prefix))
- return QString();
- return pathStr.mid(prefix.size());
+ return Utils::FileName();
+ return Utils::FileName::fromString(pathStr.mid(prefix.size()));
}
IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
@@ -111,7 +111,7 @@ QList<Core::Id> IosRunConfigurationFactory::availableCreationIds(Target *parent,
QString IosRunConfigurationFactory::displayNameForId(Core::Id id) const
{
- return QFileInfo(pathFromId(id)).completeBaseName();
+ return pathFromId(id).toFileInfo().completeBaseName();
}
RunConfiguration *IosRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
@@ -133,10 +133,12 @@ bool IosRunConfigurationFactory::canHandle(Target *t) const
QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{
QList<RunConfiguration *> result;
- foreach (RunConfiguration *rc, t->runConfigurations())
- if (IosRunConfiguration *qt4c = qobject_cast<IosRunConfiguration *>(rc))
- if (qt4c->profilePath() == n->path())
- result << rc;
+ foreach (RunConfiguration *rc, t->runConfigurations()) {
+ if (IosRunConfiguration *qt4c = qobject_cast<IosRunConfiguration *>(rc)) {
+ if (qt4c->profilePath() == n->path())
+ result << rc;
+ }
+ }
return result;
}
diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp
index dded5d867a..82d8ab93e6 100644
--- a/src/plugins/projectexplorer/editorconfiguration.cpp
+++ b/src/plugins/projectexplorer/editorconfiguration.cpp
@@ -281,7 +281,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0);
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
- Project *project = SessionManager::projectForFile(editor->document()->filePath().toString());
+ Project *project = SessionManager::projectForFile(editor->document()->filePath());
if (project && project->editorConfiguration() == this)
switchSettings(widget);
}
@@ -407,7 +407,7 @@ TabSettings actualTabSettings(const QString &fileName,
{
if (baseTextdocument)
return baseTextdocument->tabSettings();
- if (Project *project = SessionManager::projectForFile(fileName))
+ if (Project *project = SessionManager::projectForFile(Utils::FileName::fromString(fileName)))
return project->editorConfiguration()->codeStyle()->tabSettings();
return TextEditorSettings::codeStyle()->tabSettings();
}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
index cd2c4b77a0..b186169d1e 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp
@@ -169,7 +169,7 @@ void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
QMessageBox::critical(m_wizard, tr("Failed to Add to Project"),
tr("Failed to add subproject \"%1\"\nto project \"%2\".")
.arg(QDir::toNativeSeparators(generatedProject))
- .arg(QDir::toNativeSeparators(folder->path())));
+ .arg(folder->path().toUserOutput()));
return;
}
m_wizard->removeAttributeFromAllFiles(GeneratedFile::OpenProjectAttribute);
@@ -181,7 +181,7 @@ void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
QStringList nativeFilePaths = Utils::transform(filePaths, &QDir::toNativeSeparators);
QMessageBox::critical(wizard(), tr("Failed to Add to Project"),
tr("Failed to add one or more files to project\n\"%1\" (%2).")
- .arg(QDir::toNativeSeparators(folder->path()),
+ .arg(folder->path().toUserOutput(),
nativeFilePaths.join(QLatin1String(", "))));
return;
}
diff --git a/src/plugins/projectexplorer/nodesvisitor.cpp b/src/plugins/projectexplorer/nodesvisitor.cpp
index 2ea12fc87c..72855b8ecf 100644
--- a/src/plugins/projectexplorer/nodesvisitor.cpp
+++ b/src/plugins/projectexplorer/nodesvisitor.cpp
@@ -93,10 +93,10 @@ void FindNodesForFileVisitor::visitProjectNode(ProjectNode *node)
void FindNodesForFileVisitor::visitFolderNode(FolderNode *node)
{
- if (node->path() == m_path)
+ if (node->path().toString() == m_path)
m_nodes << node;
foreach (FileNode *fileNode, node->fileNodes()) {
- if (fileNode->path() == m_path)
+ if (fileNode->path().toString() == m_path)
m_nodes << fileNode;
}
}
@@ -124,7 +124,7 @@ void FindAllFilesVisitor::visitProjectNode(ProjectNode *projectNode)
void FindAllFilesVisitor::visitFolderNode(FolderNode *folderNode)
{
- m_filePaths.append(folderNode->path());
+ m_filePaths.append(folderNode->path().toString());
foreach (const FileNode *fileNode, folderNode->fileNodes())
- m_filePaths.append(fileNode->path());
+ m_filePaths.append(fileNode->path().toString());
}
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 89dcd44dd3..c842c49f7e 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1902,29 +1902,28 @@ void ProjectExplorerPlugin::runConfigurationConfigurationFinished()
static QString pathOrDirectoryFor(Node *node, bool dir)
{
- QString path = node->path();
+ Utils::FileName path = node->path();
QString location;
FolderNode *folder = dynamic_cast<FolderNode *>(node);
if (node->nodeType() == VirtualFolderNodeType && folder) {
// Virtual Folder case
// If there are files directly below or no subfolders, take the folder path
if (!folder->fileNodes().isEmpty() || folder->subFolderNodes().isEmpty()) {
- location = path;
+ location = path.toString();
} else {
// Otherwise we figure out a commonPath from the subfolders
QStringList list;
foreach (FolderNode *f, folder->subFolderNodes())
- list << f->path() + QLatin1Char('/');
+ list << f->path().toString() + QLatin1Char('/');
location = Utils::commonPath(list);
}
QFileInfo fi(location);
- while ((!fi.exists() || !fi.isDir())
- && !fi.isRoot())
+ while ((!fi.exists() || !fi.isDir()) && !fi.isRoot())
fi.setFile(fi.absolutePath());
location = fi.absoluteFilePath();
} else {
- QFileInfo fi(path);
+ QFileInfo fi = path.toFileInfo();
// remove any /suffixes, which e.g. ResourceNode uses
// Note this should be removed again by making node->path() a true path again
// That requires changes in both the VirtualFolderNode and ResourceNode
@@ -2827,7 +2826,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_removeFileAction->setVisible(!enableDelete || enableRemove);
m_renameFileAction->setEnabled(actions.contains(Rename));
- DocumentManager::populateOpenWithMenu(m_openWithMenu, ProjectTree::currentNode()->path());
+ DocumentManager::populateOpenWithMenu(m_openWithMenu, ProjectTree::currentNode()->path().toString());
}
if (actions.contains(HidePathActions)) {
@@ -2945,17 +2944,17 @@ void ProjectExplorerPlugin::removeProject()
ProjectNode *subProjectNode = dynamic_cast<ProjectNode*>(ProjectTree::currentNode()->projectNode());
ProjectNode *projectNode = dynamic_cast<ProjectNode *>(subProjectNode->parentFolderNode());
if (projectNode) {
- RemoveFileDialog removeFileDialog(subProjectNode->path(), ICore::mainWindow());
+ RemoveFileDialog removeFileDialog(subProjectNode->path().toString(), ICore::mainWindow());
removeFileDialog.setDeleteFileVisible(false);
if (removeFileDialog.exec() == QDialog::Accepted)
- projectNode->removeSubProjects(QStringList() << subProjectNode->path());
+ projectNode->removeSubProjects(QStringList() << subProjectNode->path().toString());
}
}
void ProjectExplorerPlugin::openFile()
{
QTC_ASSERT(ProjectTree::currentNode(), return);
- EditorManager::openEditor(ProjectTree::currentNode()->path());
+ EditorManager::openEditor(ProjectTree::currentNode()->path().toString());
}
void ProjectExplorerPlugin::searchOnFileSystem()
@@ -2983,7 +2982,7 @@ void ProjectExplorerPlugin::removeFile()
FileNode *fileNode = dynamic_cast<FileNode*>(currentNode);
- QString filePath = currentNode->path();
+ QString filePath = currentNode->path().toString();
RemoveFileDialog removeFileDialog(filePath, ICore::mainWindow());
if (removeFileDialog.exec() == QDialog::Accepted) {
@@ -3012,7 +3011,7 @@ void ProjectExplorerPlugin::deleteFile()
FileNode *fileNode = dynamic_cast<FileNode*>(currentNode);
- QString filePath = currentNode->path();
+ QString filePath = currentNode->path().toString();
QMessageBox::StandardButton button =
QMessageBox::question(ICore::mainWindow(),
tr("Delete File"),
@@ -3055,7 +3054,7 @@ void ProjectExplorerPlugin::renameFile()
void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath)
{
- QString orgFilePath = QFileInfo(node->path()).absoluteFilePath();
+ QString orgFilePath = node->path().toFileInfo().absoluteFilePath();
if (FileUtils::renameFile(orgFilePath, newFilePath)) {
// Tell the project plugin about rename
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp
index ce71c81974..dd8ec516ce 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.cpp
+++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp
@@ -199,7 +199,7 @@ bool ProjectFileWizardExtension::processProject(
if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) {
if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) {
*errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".")
- .arg(generatedProject).arg(folder->path());
+ .arg(generatedProject).arg(folder->path().toUserOutput());
return false;
}
*removeOpenProjectAttribute = true;
@@ -207,7 +207,7 @@ bool ProjectFileWizardExtension::processProject(
QStringList filePaths = Utils::transform(files, &GeneratedFile::path);
if (!folder->addFiles(filePaths)) {
*errorMessage = tr("Failed to add one or more files to project\n\"%1\" (%2).").
- arg(folder->path(), filePaths.join(QLatin1Char(',')));
+ arg(folder->path().toUserOutput(), filePaths.join(QLatin1Char(',')));
return false;
}
}
diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp
index e1654f897c..30210bd155 100644
--- a/src/plugins/projectexplorer/projectmodels.cpp
+++ b/src/plugins/projectexplorer/projectmodels.cpp
@@ -63,8 +63,8 @@ bool sortNodes(Node *n1, Node *n2)
FileNode *file2 = dynamic_cast<FileNode*>(n2);
if (file1 && file1->fileType() == ProjectFileType) {
if (file2 && file2->fileType() == ProjectFileType) {
- const QString fileName1 = Utils::FileName::fromString(file1->path()).fileName();
- const QString fileName2 = Utils::FileName::fromString(file2->path()).fileName();
+ const QString fileName1 = file1->path().fileName();
+ const QString fileName2 = file2->path().fileName();
int result = caseFriendlyCompare(fileName1, fileName2);
if (result != 0)
@@ -89,7 +89,7 @@ bool sortNodes(Node *n1, Node *n2)
if (result != 0)
return result < 0;
- result = caseFriendlyCompare(project1->path(), project2->path());
+ result = caseFriendlyCompare(project1->path().toString(), project2->path().toString());
if (result != 0)
return result < 0;
return project1 < project2; // sort by pointer value
@@ -109,7 +109,7 @@ bool sortNodes(Node *n1, Node *n2)
return true;
if (folder1->priority() < folder2->priority())
return false;
- int result = caseFriendlyCompare(folder1->path(), folder2->path());
+ int result = caseFriendlyCompare(folder1->path().toString(), folder2->path().toString());
if (result != 0)
return result < 0;
else
@@ -128,7 +128,7 @@ bool sortNodes(Node *n1, Node *n2)
FolderNode *folder1 = static_cast<FolderNode*>(n1);
FolderNode *folder2 = static_cast<FolderNode*>(n2);
- int result = caseFriendlyCompare(folder1->path(), folder2->path());
+ int result = caseFriendlyCompare(folder1->path().toString(), folder2->path().toString());
if (result != 0)
return result < 0;
else
@@ -146,8 +146,8 @@ bool sortNodes(Node *n1, Node *n2)
if (result != 0)
return result < 0;
- const QString filePath1 = n1->path();
- const QString filePath2 = n2->path();
+ const QString filePath1 = n1->path().toString();
+ const QString filePath2 = n2->path().toString();
const QString fileName1 = Utils::FileName::fromString(filePath1).fileName();
const QString fileName2 = Utils::FileName::fromString(filePath2).fileName();
@@ -288,7 +288,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break;
}
case Qt::EditRole: {
- result = Utils::FileName::fromString(node->path()).fileName();
+ result = node->path().fileName();
break;
}
case Qt::ToolTipRole: {
@@ -299,7 +299,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
if (folderNode)
result = folderNode->icon();
else
- result = Core::FileIconProvider::icon(node->path());
+ result = Core::FileIconProvider::icon(node->path().toString());
break;
}
case Qt::FontRole: {
@@ -310,7 +310,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break;
}
case Project::FilePathRole: {
- result = node->path();
+ result = node->path().toString();
break;
}
case Project::EnabledRole: {
@@ -354,11 +354,10 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol
Node *node = nodeForIndex(index);
- QString orgFilePath = QFileInfo(node->path()).absoluteFilePath();
- QString dir = QFileInfo(orgFilePath).absolutePath();
- QString newFilePath = dir + QLatin1Char('/') + value.toString();
+ Utils::FileName orgFilePath = node->path();
+ Utils::FileName newFilePath = orgFilePath.parentDir().appendPath(value.toString());
- ProjectExplorerPlugin::renameFile(node, newFilePath);
+ ProjectExplorerPlugin::renameFile(node, newFilePath.toString());
emit renamed(orgFilePath, newFilePath);
return true;
}
@@ -515,7 +514,7 @@ QMimeData *FlatModel::mimeData(const QModelIndexList &indexes) const
foreach (const QModelIndex &index, indexes) {
Node *node = nodeForIndex(index);
if (dynamic_cast<FileNode *>(node))
- data->addFile(node->path());
+ data->addFile(node->path().toString());
}
return data;
}
diff --git a/src/plugins/projectexplorer/projectmodels.h b/src/plugins/projectexplorer/projectmodels.h
index b72ac015fa..baa146ae23 100644
--- a/src/plugins/projectexplorer/projectmodels.h
+++ b/src/plugins/projectexplorer/projectmodels.h
@@ -31,6 +31,8 @@
#ifndef PROJECTMODELS_H
#define PROJECTMODELS_H
+#include <utils/fileutils.h>
+
#include <QAbstractItemModel>
#include <QSet>
@@ -79,7 +81,7 @@ public:
bool generatedFilesFilterEnabled();
signals:
- void renamed(const QString &oldName, const QString &newName);
+ void renamed(const Utils::FileName &oldName, const Utils::FileName &newName);
public slots:
void setProjectFilterEnabled(bool filter);
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index 9255261f87..51591dd8bd 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -65,8 +65,7 @@ using namespace ProjectExplorer;
\sa ProjectExplorer::NodesWatcher, ProjectExplorer::NodesVisitor
*/
-Node::Node(NodeType nodeType,
- const QString &filePath, int line)
+Node::Node(NodeType nodeType, const Utils::FileName &filePath, int line)
: m_nodeType(nodeType),
m_line(line),
m_projectNode(0),
@@ -99,7 +98,7 @@ void Node::emitNodeSortKeyChanged()
* This function does not emit any signals. That has to be done by the calling
* class.
*/
-void Node::setPath(const QString &path)
+void Node::setPath(const Utils::FileName &path)
{
if (m_path == path)
return;
@@ -120,7 +119,7 @@ void Node::setLine(int line)
emitNodeUpdated();
}
-void Node::setPathAndLine(const QString &path, int line)
+void Node::setPathAndLine(const Utils::FileName &path, int line)
{
if (m_path == path
&& m_line == line)
@@ -157,7 +156,7 @@ FolderNode *Node::parentFolderNode() const
/*!
The path of the file or folder in the filesystem the node represents.
*/
-QString Node::path() const
+Utils::FileName Node::path() const
{
return m_path;
}
@@ -169,12 +168,12 @@ int Node::line() const
QString Node::displayName() const
{
- return Utils::FileName::fromString(path()).fileName();
+ return path().fileName();
}
QString Node::tooltip() const
{
- return QDir::toNativeSeparators(path());
+ return path().toUserOutput();
}
bool Node::isEnabled() const
@@ -220,7 +219,7 @@ void Node::setParentFolderNode(FolderNode *parentFolder)
\sa ProjectExplorer::FolderNode, ProjectExplorer::ProjectNode
*/
-FileNode::FileNode(const QString &filePath,
+FileNode::FileNode(const Utils::FileName &filePath,
const FileType fileType,
bool generated, int line)
: Node(FileNodeType, filePath, line),
@@ -249,12 +248,12 @@ bool FileNode::isGenerated() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
-FolderNode::FolderNode(const QString &folderPath, NodeType nodeType, const QString &displayName) :
+FolderNode::FolderNode(const Utils::FileName &folderPath, NodeType nodeType, const QString &displayName) :
Node(nodeType, folderPath),
m_displayName(displayName)
{
if (m_displayName.isEmpty())
- m_displayName = QDir::toNativeSeparators(folderPath);
+ m_displayName = folderPath.toUserOutput();
}
FolderNode::~FolderNode()
@@ -349,7 +348,7 @@ bool FolderNode::renameFile(const QString &filePath, const QString &newFilePath)
FolderNode::AddNewInformation FolderNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files);
- return AddNewInformation(Utils::FileName::fromString(path()).fileName(), context == this ? 120 : 100);
+ return AddNewInformation(path().fileName(), context == this ? 120 : 100);
}
/*!
@@ -517,7 +516,7 @@ bool FolderNode::showInSimpleTree() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode
*/
-VirtualFolderNode::VirtualFolderNode(const QString &folderPath, int priority)
+VirtualFolderNode::VirtualFolderNode(const Utils::FileName &folderPath, int priority)
: FolderNode(folderPath, VirtualFolderNodeType), m_priority(priority)
{
}
@@ -544,18 +543,18 @@ int VirtualFolderNode::priority() const
/*!
Creates an uninitialized project node object.
*/
-ProjectNode::ProjectNode(const QString &projectFilePath)
+ProjectNode::ProjectNode(const Utils::FileName &projectFilePath)
: FolderNode(projectFilePath)
{
setNodeType(ProjectNodeType);
// project node "manages" itself
setProjectNode(this);
- setDisplayName(Utils::FileName::fromString(projectFilePath).fileName());
+ setDisplayName(projectFilePath.fileName());
}
QString ProjectNode::vcsTopic() const
{
- const QString dir = QFileInfo(path()).absolutePath();
+ const QString dir = path().toFileInfo().absolutePath();
if (Core::IVersionControl *const vc =
Core::VcsManager::findVersionControlForDirectory(dir))
@@ -686,7 +685,7 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
*/
SessionNode::SessionNode()
- : FolderNode(QLatin1String("session"))
+ : FolderNode(Utils::FileName::fromString(QLatin1String("session")))
{
setNodeType(SessionNodeType);
}
diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h
index 0cb6b3e6a0..47082ca92f 100644
--- a/src/plugins/projectexplorer/projectnodes.h
+++ b/src/plugins/projectexplorer/projectnodes.h
@@ -33,6 +33,8 @@
#include "projectexplorer_export.h"
+#include <utils/fileutils.h>
+
#include <QIcon>
#include <QObject>
@@ -111,7 +113,7 @@ public:
NodeType nodeType() const;
ProjectNode *projectNode() const; // managing project
FolderNode *parentFolderNode() const; // parent folder or project
- QString path() const; // file system path
+ Utils::FileName path() const; // file system path
int line() const;
virtual QString displayName() const;
virtual QString tooltip() const;
@@ -119,13 +121,13 @@ public:
virtual QList<ProjectAction> supportedActions(Node *node) const;
- void setPath(const QString &path);
+ void setPath(const Utils::FileName &path);
void setLine(int line);
- void setPathAndLine(const QString &path, int line);
+ void setPathAndLine(const Utils::FileName &path, int line);
void emitNodeUpdated();
protected:
- Node(NodeType nodeType, const QString &path, int line = -1);
+ Node(NodeType nodeType, const Utils::FileName &path, int line = -1);
void setNodeType(NodeType type);
void setProjectNode(ProjectNode *project);
@@ -139,13 +141,13 @@ private:
int m_line;
ProjectNode *m_projectNode;
FolderNode *m_folderNode;
- QString m_path;
+ Utils::FileName m_path;
};
class PROJECTEXPLORER_EXPORT FileNode : public Node
{
public:
- FileNode(const QString &filePath, const FileType fileType, bool generated, int line = -1);
+ FileNode(const Utils::FileName &filePath, const FileType fileType, bool generated, int line = -1);
FileType fileType() const;
bool isGenerated() const;
@@ -163,7 +165,7 @@ private:
class PROJECTEXPLORER_EXPORT FolderNode : public Node
{
public:
- explicit FolderNode(const QString &folderPath, NodeType nodeType = FolderNodeType,
+ explicit FolderNode(const Utils::FileName &folderPath, NodeType nodeType = FolderNodeType,
const QString &displayName = QString());
virtual ~FolderNode();
@@ -220,7 +222,7 @@ private:
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
{
public:
- explicit VirtualFolderNode(const QString &folderPath, int priority);
+ explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority);
virtual ~VirtualFolderNode();
int priority() const;
@@ -260,7 +262,7 @@ public:
protected:
// this is just the in-memory representation, a subclass
// will add the persistent stuff
- explicit ProjectNode(const QString &projectFilePath);
+ explicit ProjectNode(const Utils::FileName &projectFilePath);
private:
QList<ProjectNode*> m_subProjectNodes;
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index 1fc8c525ba..52d40cb1c5 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -177,7 +177,7 @@ Project *ProjectTree::projectForNode(Node *node)
void ProjectTree::updateFromDocumentManager(bool invalidCurrentNode)
{
Core::IDocument *document = Core::EditorManager::currentDocument();
- const QString &fileName = document ? document->filePath().toString() : QString();
+ const FileName fileName = document ? document->filePath() : FileName();
Node *currentNode = 0;
if (!invalidCurrentNode && m_currentNode && m_currentNode->path() == fileName)
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index badb3b5165..29113512ce 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -217,7 +217,7 @@ int ProjectTreeWidget::expandedCount(Node *node)
void ProjectTreeWidget::rowsInserted(const QModelIndex &parent, int start, int end)
{
- const QString &path = m_model->nodeForIndex(parent)->path();
+ const QString path = m_model->nodeForIndex(parent)->path().toString();
if (m_toExpand.contains(path)) {
m_view->expand(parent);
m_toExpand.remove(path);
@@ -235,7 +235,7 @@ void ProjectTreeWidget::rowsInserted(const QModelIndex &parent, int start, int e
}
}
-Node *ProjectTreeWidget::nodeForFile(const QString &fileName)
+Node *ProjectTreeWidget::nodeForFile(const Utils::FileName &fileName)
{
Node *bestNode = 0;
int bestNodeExpandCount = INT_MAX;
@@ -276,7 +276,7 @@ void ProjectTreeWidget::loadExpandData()
void ProjectTreeWidget::recursiveLoadExpandData(const QModelIndex &index, QSet<QString> &data)
{
- const QString &path = m_model->nodeForIndex(index)->path();
+ const QString path = m_model->nodeForIndex(index)->path().toString();
if (data.contains(path)) {
m_view->expand(index);
data.remove(path);
@@ -300,7 +300,7 @@ void ProjectTreeWidget::recursiveSaveExpandData(const QModelIndex &index, QStrin
if (m_view->isExpanded(index) || index == m_view->rootIndex()) {
// Note: We store the path of the node, which isn't unique for e.g. .pri files
// but works for most nodes
- data->append(m_model->nodeForIndex(index)->path());
+ data->append(m_model->nodeForIndex(index)->path().toString());
int count = m_model->rowCount(index);
for (int i = 0; i < count; ++i)
recursiveSaveExpandData(index.child(i, 0), data);
@@ -335,9 +335,9 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync)
if (m_autoSync) {
// sync from document manager
- QString fileName;
+ Utils::FileName fileName;
if (IDocument *doc = EditorManager::currentDocument())
- fileName = doc->filePath().toString();
+ fileName = doc->filePath();
if (!currentNode() || currentNode()->path() != fileName)
setCurrentItem(ProjectTreeWidget::nodeForFile(fileName));
}
@@ -356,7 +356,7 @@ void ProjectTreeWidget::editCurrentItem()
}
-void ProjectTreeWidget::renamed(const QString &oldPath, const QString &newPath)
+void ProjectTreeWidget::renamed(const Utils::FileName &oldPath, const Utils::FileName &newPath)
{
Q_UNUSED(oldPath);
if (!currentNode() || currentNode()->path() != newPath) {
@@ -452,7 +452,7 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex)
Node *node = m_model->nodeForIndex(mainIndex);
if (node->nodeType() != FileNodeType)
return;
- IEditor *editor = EditorManager::openEditor(node->path());
+ IEditor *editor = EditorManager::openEditor(node->path().toString());
if (editor && node->line() >= 0)
editor->gotoLine(node->line());
}
diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h
index 753aca3117..4f1a385259 100644
--- a/src/plugins/projectexplorer/projecttreewidget.h
+++ b/src/plugins/projectexplorer/projecttreewidget.h
@@ -33,6 +33,8 @@
#include <coreplugin/inavigationwidgetfactory.h>
+#include <utils/fileutils.h>
+
#include <QWidget>
#include <QModelIndex>
#include <QSet>
@@ -65,7 +67,7 @@ public:
Node *currentNode();
void sync(ProjectExplorer::Node *node);
- static Node *nodeForFile(const QString &fileName);
+ static Node *nodeForFile(const Utils::FileName &fileName);
public slots:
void toggleAutoSynchronization();
@@ -93,7 +95,7 @@ private:
void recursiveSaveExpandData(const QModelIndex &index, QStringList *data);
static int expandedCount(Node *node);
void rowsInserted(const QModelIndex &parent, int start, int end);
- void renamed(const QString &oldPath, const QString &newPath);
+ void renamed(const Utils::FileName &oldPath, const Utils::FileName &newPath);
QSet<QString> m_toExpand;
QTreeView *m_view;
@@ -106,7 +108,7 @@ private:
QString m_modelId;
bool m_autoSync;
bool m_autoExpand;
- QString m_delayedRename;
+ Utils::FileName m_delayedRename;
static QList<ProjectTreeWidget *> m_projectTreeWidgets;
friend class ProjectTreeWidgetFactory;
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 5c364ab36e..656d20baad 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -86,7 +86,7 @@ public:
m_writer(0)
{}
- bool projectContainsFile(Project *p, const QString &fileName) const;
+ bool projectContainsFile(Project *p, const FileName &fileName) const;
void restoreValues(const PersistentSettingsReader &reader);
void restoreDependencies(const PersistentSettingsReader &reader);
void restoreStartupProject(const PersistentSettingsReader &reader);
@@ -135,8 +135,8 @@ SessionManager::SessionManager(QObject *parent)
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(saveActiveMode(Core::IMode*)));
- connect(EditorManager::instance(), SIGNAL(editorCreated(Core::IEditor*,QString)),
- this, SLOT(configureEditor(Core::IEditor*,QString)));
+ connect(EditorManager::instance(), &EditorManager::editorCreated,
+ this, &SessionManager::configureEditor);
connect(this, SIGNAL(projectAdded(ProjectExplorer::Project*)),
EditorManager::instance(), SLOT(updateWindowTitles()));
connect(this, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
@@ -217,7 +217,7 @@ QList<Project *> SessionManager::dependencies(const Project *project)
QList<Project *> projects;
foreach (const QString &dep, proDeps) {
- if (Project *pro = projectForFile(dep))
+ if (Project *pro = projectForFile(Utils::FileName::fromString(dep)))
projects += pro;
}
@@ -469,7 +469,8 @@ QString SessionManagerPrivate::windowTitleAddition(const QString &filePath)
if (projects.size() == 1)
return projects.first()->displayName();
return QString();
- } else if (Project *project = SessionManager::projectForFile(filePath)) {
+ } else if (Project *project = SessionManager::projectForFile(
+ Utils::FileName::fromString(filePath))) {
return project->displayName();
} else {
return QString();
@@ -537,16 +538,16 @@ QList<Project *> SessionManager::projectOrder(Project *project)
return result;
}
-QList<Node *> SessionManager::nodesForFile(const QString &fileName)
+QList<Node *> SessionManager::nodesForFile(const Utils::FileName &fileName)
{
- FindNodesForFileVisitor findNodes(fileName);
+ FindNodesForFileVisitor findNodes(fileName.toString());
sessionNode()->accept(&findNodes);
return findNodes.nodes();
}
// node for file returns a randomly selected node if there are multiple
// prefer to use nodesForFile and figure out which node you want
-Node *SessionManager::nodeForFile(const QString &fileName)
+Node *SessionManager::nodeForFile(const Utils::FileName &fileName)
{
Node *node = 0;
foreach (Node *n, nodesForFile(fileName)) {
@@ -574,7 +575,7 @@ Project *SessionManager::projectForNode(Node *node)
return Utils::findOrDefault(d->m_projects, Utils::equal(&Project::rootProjectNode, rootProjectNode));
}
-Project *SessionManager::projectForFile(const QString &fileName)
+Project *SessionManager::projectForFile(const Utils::FileName &fileName)
{
if (debug)
qDebug() << "SessionManager::projectForFile(" << fileName << ")";
@@ -587,18 +588,18 @@ Project *SessionManager::projectForFile(const QString &fileName)
return 0;
}
-bool SessionManagerPrivate::projectContainsFile(Project *p, const QString &fileName) const
+bool SessionManagerPrivate::projectContainsFile(Project *p, const Utils::FileName &fileName) const
{
if (!m_projectFileCache.contains(p))
m_projectFileCache.insert(p, p->files(Project::AllFiles));
- return m_projectFileCache.value(p).contains(fileName);
+ return m_projectFileCache.value(p).contains(fileName.toString());
}
void SessionManager::configureEditor(IEditor *editor, const QString &fileName)
{
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
- Project *project = projectForFile(fileName);
+ Project *project = projectForFile(Utils::FileName::fromString(fileName));
// Global settings are the default.
if (project)
project->editorConfiguration()->configureEditor(textEditor);
@@ -608,7 +609,7 @@ void SessionManager::configureEditor(IEditor *editor, const QString &fileName)
void SessionManager::configureEditors(Project *project)
{
foreach (IDocument *document, DocumentModel::openedDocuments()) {
- if (d->projectContainsFile(project, document->filePath().toString())) {
+ if (d->projectContainsFile(project, document->filePath())) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) {
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
project->editorConfiguration()->configureEditor(textEditor);
diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h
index 535bee5aca..3d6293489e 100644
--- a/src/plugins/projectexplorer/session.h
+++ b/src/plugins/projectexplorer/session.h
@@ -117,9 +117,9 @@ public:
static SessionNode *sessionNode();
static Project *projectForNode(Node *node);
- static QList<Node *> nodesForFile(const QString &fileName);
- static Node *nodeForFile(const QString &fileName);
- static Project *projectForFile(const QString &fileName);
+ static QList<Node *> nodesForFile(const Utils::FileName &fileName);
+ static Node *nodeForFile(const Utils::FileName &fileName);
+ static Project *projectForFile(const Utils::FileName &fileName);
static QStringList projectsForSessionName(const QString &session);
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp
index 6732b72548..3d4c3ccd87 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.cpp
+++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp
@@ -248,8 +248,10 @@ public:
// QbsFileNode:
// ----------------------------------------------------------------------
-QbsFileNode::QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType,
- bool generated, int line) :
+QbsFileNode::QbsFileNode(const Utils::FileName &filePath,
+ const ProjectExplorer::FileType fileType,
+ bool generated,
+ int line) :
ProjectExplorer::FileNode(filePath, fileType, generated, line)
{ }
@@ -265,7 +267,7 @@ QString QbsFileNode::displayName() const
// QbsBaseProjectNode:
// ---------------------------------------------------------------------------
-QbsBaseProjectNode::QbsBaseProjectNode(const QString &path) :
+QbsBaseProjectNode::QbsBaseProjectNode(const Utils::FileName &path) :
ProjectExplorer::ProjectNode(path)
{ }
@@ -334,7 +336,7 @@ static QList<ProjectExplorer::ProjectAction> supportedNodeActions(ProjectExplore
return actions;
actions << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile;
if (node->nodeType() == ProjectExplorer::FileNodeType
- && !project->qbsProject().buildSystemFiles().contains(node->path())) {
+ && !project->qbsProject().buildSystemFiles().contains(node->path().toString())) {
actions << ProjectExplorer::RemoveFile;
actions << ProjectExplorer::Rename;
}
@@ -346,14 +348,14 @@ static QList<ProjectExplorer::ProjectAction> supportedNodeActions(ProjectExplore
// --------------------------------------------------------------------
QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath) :
- QbsBaseProjectNode(QString())
+ QbsBaseProjectNode(Utils::FileName())
{
if (m_groupIcon.isNull())
m_groupIcon = QIcon(QString::fromLatin1(Constants::QBS_GROUP_ICON));
setIcon(m_groupIcon);
- QbsFileNode *idx = new QbsFileNode(grp.location().filePath(),
+ QbsFileNode *idx = new QbsFileNode(Utils::FileName::fromString(grp.location().filePath()),
ProjectExplorer::ProjectFileType, false,
grp.location().line());
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx);
@@ -447,7 +449,7 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData &grp, const QString &
m_productPath = productPath;
m_qbsGroupData = grp;
- setPath(grp.location().filePath());
+ setPath(Utils::FileName::fromString(grp.location().filePath()));
setDisplayName(grp.name());
QbsFileNode *idx = 0;
@@ -457,7 +459,8 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData &grp, const QString &
break;
}
QTC_ASSERT(idx, return);
- idx->setPathAndLine(grp.location().filePath(), grp.location().line());
+ idx->setPathAndLine(Utils::FileName::fromString(grp.location().filePath()),
+ grp.location().line());
setupFiles(this, grp.allFilePaths(), productPath, updateExisting);
@@ -511,7 +514,7 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
}
foreach (FileTreeNode *c, fileTree->children) {
- QString path = c->path();
+ Utils::FileName path = Utils::FileName::fromString(c->path());
// Handle files:
if (c->isFile()) {
@@ -542,7 +545,8 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
break;
}
if (!fn) {
- fn = new FolderNode(c->path(), ProjectExplorer::FolderNodeType,
+ fn = new FolderNode(Utils::FileName::fromString(c->path()),
+ ProjectExplorer::FolderNodeType,
displayNameFromPath(c->path(), baseDir));
root->addFolderNodes(QList<FolderNode *>() << fn);
} else {
@@ -565,16 +569,16 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
// --------------------------------------------------------------------
QbsProductNode::QbsProductNode(const qbs::Project &project, const qbs::ProductData &prd) :
- QbsBaseProjectNode(prd.location().filePath())
+ QbsBaseProjectNode(Utils::FileName::fromString(prd.location().filePath()))
{
if (m_productIcon.isNull())
m_productIcon = generateIcon(QString::fromLatin1(Constants::QBS_PRODUCT_OVERLAY_ICON));
setIcon(m_productIcon);
- ProjectExplorer::FileNode *idx = new QbsFileNode(prd.location().filePath(),
- ProjectExplorer::ProjectFileType, false,
- prd.location().line());
+ auto idx = new QbsFileNode(Utils::FileName::fromString(prd.location().filePath()),
+ ProjectExplorer::ProjectFileType, false,
+ prd.location().line());
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx);
setQbsProductData(project, prd);
@@ -658,7 +662,7 @@ void QbsProductNode::setQbsProductData(const qbs::Project &project, const qbs::P
bool updateExisting = productWasEnabled != productIsEnabled;
setDisplayName(QbsProject::productDisplayName(project, prd));
- setPath(prd.location().filePath());
+ setPath(Utils::FileName::fromString(prd.location().filePath()));
const QString &productPath = QFileInfo(prd.location().filePath()).absolutePath();
// Find the QbsFileNode we added earlier:
@@ -669,7 +673,8 @@ void QbsProductNode::setQbsProductData(const qbs::Project &project, const qbs::P
break;
}
QTC_ASSERT(idx, return);
- idx->setPathAndLine(prd.location().filePath(), prd.location().line());
+ idx->setPathAndLine(Utils::FileName::fromString(prd.location().filePath()),
+ prd.location().line());
QList<ProjectExplorer::ProjectNode *> toAdd;
QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes();
@@ -732,7 +737,7 @@ QbsGroupNode *QbsProductNode::findGroupNode(const QString &name)
// QbsProjectNode:
// --------------------------------------------------------------------
-QbsProjectNode::QbsProjectNode(const QString &path) :
+QbsProjectNode::QbsProjectNode(const Utils::FileName &path) :
QbsBaseProjectNode(path)
{
ctor();
@@ -751,7 +756,8 @@ void QbsProjectNode::update(const qbs::Project &qbsProject, const qbs::ProjectDa
foreach (const qbs::ProjectData &subData, prjData.subProjects()) {
QbsProjectNode *qn = findProjectNode(subData.name());
if (!qn) {
- QbsProjectNode *subProject = new QbsProjectNode(subData.location().filePath());
+ auto subProject =
+ new QbsProjectNode(Utils::FileName::fromString(subData.location().filePath()));
subProject->update(qbsProject, subData);
toAdd << subProject;
} else {
@@ -830,9 +836,9 @@ QbsProjectNode *QbsProjectNode::findProjectNode(const QString &name)
// --------------------------------------------------------------------
QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
- QbsProjectNode(project->projectFilePath().toString()),
+ QbsProjectNode(project->projectFilePath()),
m_project(project),
- m_buildSystemFiles(new ProjectExplorer::FolderNode(project->projectDirectory().toString(),
+ m_buildSystemFiles(new ProjectExplorer::FolderNode(project->projectDirectory(),
ProjectExplorer::FolderNodeType,
QCoreApplication::translate("QbsRootProjectNode", "Qbs files")))
{
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.h b/src/plugins/qbsprojectmanager/qbsnodes.h
index 7903bb2f7f..f705495cce 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.h
+++ b/src/plugins/qbsprojectmanager/qbsnodes.h
@@ -51,7 +51,7 @@ class QbsProjectFile;
class QbsFileNode : public ProjectExplorer::FileNode
{
public:
- QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType, bool generated,
+ QbsFileNode(const Utils::FileName &filePath, const ProjectExplorer::FileType fileType, bool generated,
int line);
QString displayName() const;
@@ -66,7 +66,7 @@ class QbsGroupNode;
class QbsBaseProjectNode : public ProjectExplorer::ProjectNode
{
public:
- explicit QbsBaseProjectNode(const QString &path);
+ explicit QbsBaseProjectNode(const Utils::FileName &path);
bool showInSimpleTree() const;
@@ -155,7 +155,7 @@ private:
class QbsProjectNode : public QbsBaseProjectNode
{
public:
- explicit QbsProjectNode(const QString &path);
+ explicit QbsProjectNode(const Utils::FileName &path);
~QbsProjectNode();
virtual QbsProject *project() const;
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index b27f9dc2cc..8f7d32684c 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -73,13 +73,13 @@ namespace Internal {
static Node *currentEditorNode()
{
Core::IDocument *doc = Core::EditorManager::currentDocument();
- return doc ? SessionManager::nodeForFile(doc->filePath().toString()) : 0;
+ return doc ? SessionManager::nodeForFile(doc->filePath()) : 0;
}
static QbsProject *currentEditorProject()
{
Core::IDocument *doc = Core::EditorManager::currentDocument();
- return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath().toString())) : 0;
+ return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : 0;
}
QbsProjectManagerPlugin::QbsProjectManagerPlugin() :
@@ -288,7 +288,7 @@ void QbsProjectManagerPlugin::updateBuildActions()
&& !BuildManager::isBuilding(m_editorProject)
&& !m_editorProject->isParsing();
- fileName = Utils::FileName::fromString(m_editorNode->path()).fileName();
+ fileName = m_editorNode->path().fileName();
fileVisible = m_editorProject && m_editorNode && dynamic_cast<QbsBaseProjectNode *>(m_editorNode->projectNode());
QbsProductNode *productNode
@@ -361,7 +361,7 @@ void QbsProjectManagerPlugin::buildFileContextMenu()
QTC_ASSERT(m_selectedNode, return);
QTC_ASSERT(m_selectedProject, return);
- buildSingleFile(m_selectedProject, m_selectedNode->path());
+ buildSingleFile(m_selectedProject, m_selectedNode->path().toString());
}
void QbsProjectManagerPlugin::buildFile()
@@ -369,7 +369,7 @@ void QbsProjectManagerPlugin::buildFile()
if (!m_editorProject || !m_editorNode)
return;
- buildSingleFile(m_editorProject, m_editorNode->path());
+ buildSingleFile(m_editorProject, m_editorNode->path().toString());
}
void QbsProjectManagerPlugin::buildProductContextMenu()
diff --git a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
index b7e39bae84..03eece8a00 100644
--- a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
+++ b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp
@@ -156,7 +156,7 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
void ChooseDirectoryPage::checkPackageSourceDir()
{
- QString projectDir = QFileInfo(m_wizard->node()->path()).absolutePath();
+ QString projectDir = m_wizard->node()->path().toFileInfo().absolutePath();
QString newDir = m_androidPackageSourceDir->path();
bool isComplete = QFileInfo(projectDir) != QFileInfo(newDir);
@@ -182,7 +182,7 @@ void ChooseDirectoryPage::initializePage()
"The files in the Android package source directory are copied to the build directory's "
"Android directory and the default files are overwritten."));
- m_androidPackageSourceDir->setPath(QFileInfo(m_wizard->node()->path()).absolutePath().append(QLatin1String("/android")));
+ m_androidPackageSourceDir->setPath(m_wizard->node()->path().toFileInfo().absolutePath().append(QLatin1String("/android")));
connect(m_androidPackageSourceDir, SIGNAL(changed(QString)),
this, SLOT(checkPackageSourceDir()));
} else {
@@ -343,13 +343,14 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (m_node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir).isEmpty()) {
// and now time for some magic
QString value = QLatin1String("$$PWD/")
- + QDir(QFileInfo(m_node->path()).absolutePath()).relativeFilePath(m_directory);
+ + m_node->path().toFileInfo().absoluteDir().relativeFilePath(m_directory);
bool result =
m_node->setProVariable(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR"), QStringList(value));
if (!result) {
QMessageBox::warning(this, tr("Project File not Updated"),
- tr("Could not update the .pro file %1.").arg(m_node->path()));
+ tr("Could not update the .pro file %1.")
+ .arg(m_node->path().toUserOutput()));
}
}
Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp
index dedef67ed4..8ab8089981 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp
@@ -142,12 +142,12 @@ QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepLis
ctor();
}
-QString QmakeAndroidBuildApkStep::proFilePathForInputFile() const
+Utils::FileName QmakeAndroidBuildApkStep::proFilePathForInputFile() const
{
ProjectExplorer::RunConfiguration *rc = target()->activeRunConfiguration();
if (auto *arc = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
return arc->proFilePath();
- return QString();
+ return Utils::FileName();
}
QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep *other)
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h
index a188b7c214..fc4d7ac263 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.h
@@ -66,7 +66,7 @@ class QmakeAndroidBuildApkStep : public Android::AndroidBuildApkStep
Q_OBJECT
public:
QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc);
- QString proFilePathForInputFile() const;
+ Utils::FileName proFilePathForInputFile() const;
void setProFilePathForInputFile(const QString &path);
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp
index 7a391b269e..dfbb6af5e7 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.cpp
@@ -59,7 +59,7 @@ static QString pathFromId(const Core::Id id)
return id.suffixAfter(ANDROID_RC_ID_PREFIX);
}
-QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, Core::Id id, const Utils::FileName &path)
: AndroidRunConfiguration(parent, id)
, m_proFilePath(path)
{
@@ -88,7 +88,7 @@ void QmakeAndroidRunConfiguration::init()
bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
{
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
- m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(PRO_FILE_KEY).toString()));
+ m_proFilePath = Utils::FileName::fromUserInput(projectDir.filePath(map.value(PRO_FILE_KEY).toString()));
m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
@@ -105,7 +105,7 @@ QVariantMap QmakeAndroidRunConfiguration::toMap() const
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
QVariantMap map(RunConfiguration::toMap());
- map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(m_proFilePath));
+ map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(m_proFilePath.toString()));
return map;
}
@@ -123,7 +123,7 @@ QString QmakeAndroidRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
- .arg(Utils::FileName::fromString(m_proFilePath).fileName());
+ .arg(m_proFilePath.fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
@@ -147,7 +147,7 @@ void QmakeAndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProF
emit enabledChanged();
}
-QString QmakeAndroidRunConfiguration::proFilePath() const
+Utils::FileName QmakeAndroidRunConfiguration::proFilePath() const
{
return m_proFilePath;
}
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h
index d4f91188c3..54dc0367a7 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunconfiguration.h
@@ -33,6 +33,8 @@
#include <android/androidrunconfiguration.h>
+#include <utils/fileutils.h>
+
namespace QmakeProjectManager { class QmakeProFileNode; }
namespace QmakeAndroidSupport {
@@ -44,9 +46,10 @@ class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
friend class QmakeAndroidRunConfigurationFactory;
public:
- QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path = QString());
+ QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
+ const Utils::FileName &path = Utils::FileName());
- QString proFilePath() const;
+ Utils::FileName proFilePath() const;
bool isEnabled() const;
QString disabledReason() const;
@@ -64,7 +67,7 @@ private slots:
private:
void init();
- mutable QString m_proFilePath;
+ mutable Utils::FileName m_proFilePath;
bool m_parseSuccess;
bool m_parseInProgress;
};
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
index 21d732c623..dbf112f7a0 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
@@ -52,9 +52,9 @@ namespace Internal {
static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
-static QString pathFromId(const Core::Id id)
+static Utils::FileName pathFromId(const Core::Id id)
{
- return id.suffixAfter(ANDROID_RC_ID_PREFIX);
+ return Utils::FileName::fromString(id.suffixAfter(ANDROID_RC_ID_PREFIX));
}
QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject *parent)
@@ -64,7 +64,7 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
QString QmakeAndroidRunConfigurationFactory::displayNameForId(Core::Id id) const
{
- return QFileInfo(pathFromId(id)).completeBaseName();
+ return pathFromId(id).toFileInfo().completeBaseName();
}
bool QmakeAndroidRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp
index 200a293349..f81cae8de5 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp
@@ -119,7 +119,8 @@ Utils::FileName QmakeAndroidSupport::androiddeployJsonPath(ProjectExplorer::Targ
if (!buildApkStep) // should never happen
return Utils::FileName();
- const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(buildApkStep->proFilePathForInputFile());
+ const QmakeProFileNode *node =
+ pro->rootQmakeProjectNode()->findProFileFor(buildApkStep->proFilePathForInputFile());
if (!node) // should never happen
return Utils::FileName();
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
index 19cd848559..3e37c83670 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
@@ -72,9 +72,9 @@ const char USE_TERMINAL_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseTermin
const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix";
const char USER_WORKING_DIRECTORY_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory";
-static QString pathFromId(Core::Id id)
+static Utils::FileName pathFromId(Core::Id id)
{
- return id.suffixAfter(QMAKE_RC_PREFIX);
+ return Utils::FileName::fromString(id.suffixAfter(QMAKE_RC_PREFIX));
}
//
@@ -123,7 +123,7 @@ QString DesktopQmakeRunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.")
- .arg(FileName::fromString(m_proFilePath).fileName());
+ .arg(m_proFilePath.fileName());
if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
@@ -425,7 +425,7 @@ QVariantMap DesktopQmakeRunConfiguration::toMap() const
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
QVariantMap map(LocalApplicationRunConfiguration::toMap());
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments);
- map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
+ map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath.toString()));
map.insert(QLatin1String(USE_TERMINAL_KEY), m_runMode == ApplicationLauncher::Console);
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory);
@@ -436,7 +436,7 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
{
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toString();
- m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
+ m_proFilePath = Utils::FileName::fromUserInput(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool()
? ApplicationLauncher::Console : ApplicationLauncher::Gui;
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
@@ -560,7 +560,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
}
-QString DesktopQmakeRunConfiguration::proFilePath() const
+Utils::FileName DesktopQmakeRunConfiguration::proFilePath() const
{
return m_proFilePath;
}
@@ -569,7 +569,7 @@ QString DesktopQmakeRunConfiguration::defaultDisplayName()
{
QString defaultName;
if (!m_proFilePath.isEmpty())
- defaultName = QFileInfo(m_proFilePath).completeBaseName();
+ defaultName = m_proFilePath.toFileInfo().completeBaseName();
else
defaultName = tr("Qt Run Configuration");
return defaultName;
@@ -691,7 +691,7 @@ QList<Core::Id> DesktopQmakeRunConfigurationFactory::availableCreationIds(Target
QString DesktopQmakeRunConfigurationFactory::displayNameForId(Core::Id id) const
{
- return QFileInfo(pathFromId(id)).completeBaseName();
+ return pathFromId(id).toFileInfo().completeBaseName();
}
bool DesktopQmakeRunConfigurationFactory::canHandle(Target *t) const
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
index 6daba27162..5d3b17fa12 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
@@ -35,6 +35,7 @@
#include <projectexplorer/localapplicationrunconfiguration.h>
+#include <utils/fileutils.h>
#include <QStringList>
#include <QLabel>
@@ -86,7 +87,7 @@ public:
bool isUsingDyldImageSuffix() const;
void setUsingDyldImageSuffix(bool state);
- QString proFilePath() const;
+ Utils::FileName proFilePath() const;
QVariantMap toMap() const;
@@ -126,7 +127,7 @@ private:
void updateTarget();
QString m_commandLineArguments;
- QString m_proFilePath; // Full path to the Application Pro File
+ Utils::FileName m_proFilePath; // Full path to the Application Pro File
// Cached startup sub project information
ProjectExplorer::ApplicationLauncher::Mode m_runMode;
diff --git a/src/plugins/qmakeprojectmanager/externaleditors.cpp b/src/plugins/qmakeprojectmanager/externaleditors.cpp
index c510c96d56..e77bee6c85 100644
--- a/src/plugins/qmakeprojectmanager/externaleditors.cpp
+++ b/src/plugins/qmakeprojectmanager/externaleditors.cpp
@@ -132,7 +132,7 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
QString *errorMessage) const
{
// Get the binary either from the current Qt version of the project or Path
- if (Project *project = SessionManager::projectForFile(fileName)) {
+ if (Project *project = SessionManager::projectForFile(Utils::FileName::fromString(fileName))) {
if (const Target *target = project->activeTarget()) {
if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit())) {
data->binary = (qtVersion->*commandAccessor)();
diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
index ef7c14bdfe..09790d4d29 100644
--- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
+++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp
@@ -85,7 +85,7 @@ LibraryDetailsController::LibraryDetailsController(
if (!Utils::HostOsInfo::isLinuxHost()) {
// project for which we are going to insert the snippet
- const Project *project = SessionManager::projectForFile(proFile);
+ const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile));
if (project && project->activeTarget()) {
// if its tool chain is maemo behave the same as we would be on linux
ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit());
@@ -884,7 +884,7 @@ QString PackageLibraryDetailsController::snippet() const
bool PackageLibraryDetailsController::isLinkPackageGenerated() const
{
- const Project *project = SessionManager::projectForFile(proFile());
+ const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile()));
if (!project)
return false;
@@ -892,7 +892,8 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const
if (!rootProject)
return false;
- const QmakeProFileNode *currentProject = rootProject->findProFileFor(proFile());
+ const QmakeProFileNode *currentProject =
+ rootProject->findProFileFor(Utils::FileName::fromString(proFile()));
if (!currentProject)
return false;
@@ -1013,13 +1014,11 @@ AddLibraryWizard::MacLibraryType InternalLibraryDetailsController::suggestedMacL
QString InternalLibraryDetailsController::suggestedIncludePath() const
{
const int currentIndex = libraryDetailsWidget()->libraryComboBox->currentIndex();
- QString includePath;
if (currentIndex >= 0) {
QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
- QFileInfo fi(proFileNode->path());
- includePath = fi.absolutePath();
+ return proFileNode->path().toFileInfo().absolutePath();
}
- return includePath;
+ return QString();
}
void InternalLibraryDetailsController::updateWindowsOptionsEnablement()
@@ -1036,20 +1035,19 @@ void InternalLibraryDetailsController::updateProFile()
m_proFileNodes.clear();
libraryDetailsWidget()->libraryComboBox->clear();
- const Project *project = SessionManager::projectForFile(proFile());
+ const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile()));
if (!project)
return;
setIgnoreGuiSignals(true);
ProjectExplorer::ProjectNode *rootProject = project->rootProjectNode();
- QFileInfo fi(rootProject->path());
- m_rootProjectPath = fi.absolutePath();
+ m_rootProjectPath = rootProject->path().toFileInfo().absolutePath();
QDir rootDir(m_rootProjectPath);
FindQmakeProFiles findQt4ProFiles;
QList<QmakeProFileNode *> proFiles = findQt4ProFiles(rootProject);
foreach (QmakeProFileNode *proFileNode, proFiles) {
- const QString proFilePath = proFileNode->path();
+ const QString proFilePath = proFileNode->path().toString();
if (proFileNode->projectType() == LibraryTemplate) {
const QStringList configVar = proFileNode->variableValue(ConfigVar);
if (!configVar.contains(QLatin1String("plugin"))) {
@@ -1119,7 +1117,7 @@ QString InternalLibraryDetailsController::snippet() const
const QString proRelavitePath = rootDir.relativeFilePath(proFile());
// project for which we insert the snippet
- const Project *project = SessionManager::projectForFile(proFile());
+ const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile()));
// the build directory of the active build configuration
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
diff --git a/src/plugins/qmakeprojectmanager/makestep.cpp b/src/plugins/qmakeprojectmanager/makestep.cpp
index bb9e84083c..cd64af84f8 100644
--- a/src/plugins/qmakeprojectmanager/makestep.cpp
+++ b/src/plugins/qmakeprojectmanager/makestep.cpp
@@ -237,7 +237,7 @@ bool MakeStep::init()
if (!relObjectsDir.isEmpty())
relObjectsDir += QLatin1Char('/');
QString objectFile = relObjectsDir +
- QFileInfo(bc->fileNodeBuild()->path()).baseName() +
+ bc->fileNodeBuild()->path().toFileInfo().baseName() +
subNode->objectExtension();
Utils::QtcProcess::addArg(&args, objectFile);
}
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index 442b0765ae..f6d0e07ae0 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -60,6 +60,7 @@
#include <cpptools/cpptoolsconstants.h>
#include <utils/algorithm.h>
+#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
@@ -111,11 +112,11 @@ class SortByPath
public:
bool operator()(Node *a, Node *b)
{ return operator()(a->path(), b->path()); }
- bool operator()(Node *a, const QString &b)
+ bool operator()(Node *a, const FileName &b)
{ return operator()(a->path(), b); }
- bool operator()(const QString &a, Node *b)
+ bool operator()(const FileName &a, Node *b)
{ return operator()(a, b->path()); }
- bool operator()(const QString &a, const QString &b)
+ bool operator()(const FileName &a, const FileName &b)
{ return a < b; }
};
@@ -195,7 +196,7 @@ class EvalInput
{
public:
QString projectDir;
- QString projectFilePath;
+ FileName projectFilePath;
QString buildDirectory;
QtSupport::ProFileReader *readerExact;
QtSupport::ProFileReader *readerCumulative;
@@ -220,18 +221,18 @@ public:
QmakeProjectType projectType;
QStringList subProjectsNotToDeploy;
- QHash<QString, ProFile*> includeFilesExact;
- QStringList newProjectFilesExact;
- QSet<QString> exactSubdirs;
+ QHash<FileName, ProFile*> includeFilesExact;
+ FileNameList newProjectFilesExact;
+ QSet<FileName> exactSubdirs;
ProFile *fileForCurrentProjectExact; // probably only used in parser thread
- QHash<QString, ProFile*> includeFilesCumlative;
- QStringList newProjectFilesCumlative;
+ QHash<FileName, ProFile*> includeFilesCumlative;
+ FileNameList newProjectFilesCumlative;
ProFile *fileForCurrentProjectCumlative; // probably only used in parser thread
TargetInformation targetInformation;
InstallsList installsList;
QHash<QmakeVariable, QStringList> newVarValues;
bool isDeployable;
- QHash<QString, PriFileEvalResult> priFileResults;
+ QHash<FileName, PriFileEvalResult> priFileResults;
QStringList errors;
};
}
@@ -242,7 +243,7 @@ QmakePriFile::QmakePriFile(QmakeProjectManager::QmakePriFileNode *qmakePriFile)
{
setId("Qmake.PriFile");
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
- setFilePath(FileName::fromString(m_priFile->path()));
+ setFilePath(m_priFile->path());
}
bool QmakePriFile::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -297,19 +298,20 @@ bool QmakePriFile::reload(QString *errorString, ReloadFlag flag, ChangeType type
namespace QmakeProjectManager {
-QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const QString &filePath)
+QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
+ const FileName &filePath)
: ProjectNode(filePath),
m_project(project),
m_qmakeProFileNode(qmakeProFileNode),
- m_projectFilePath(QDir::fromNativeSeparators(filePath)),
- m_projectDir(QFileInfo(filePath).absolutePath()),
+ m_projectFilePath(filePath),
+ m_projectDir(filePath.toFileInfo().absolutePath()),
m_includedInExactParse(true)
{
Q_ASSERT(project);
m_qmakePriFile = new QmakePriFile(this);
Core::DocumentManager::addDocument(m_qmakePriFile);
- setDisplayName(QFileInfo(filePath).completeBaseName());
+ setDisplayName(filePath.toFileInfo().completeBaseName());
setIcon(qmakeNodeStaticData()->projectIcon);
}
@@ -321,7 +323,7 @@ QmakePriFileNode::~QmakePriFileNode()
void QmakePriFileNode::scheduleUpdate()
{
- QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath);
+ QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath.toString());
m_qmakeProFileNode->scheduleUpdate(QmakeProFileNode::ParseLater);
}
@@ -330,7 +332,7 @@ struct InternalNode
{
QList<InternalNode *> virtualfolders;
QMap<QString, InternalNode *> subnodes;
- QStringList files;
+ FileNameList files;
FileType type;
int priority;
QString displayName;
@@ -404,7 +406,7 @@ struct InternalNode
}
path += separator;
} else { // key is filename
- currentNode->files.append(file.toString());
+ currentNode->files.append(file);
}
}
}
@@ -437,10 +439,12 @@ struct InternalNode
FolderNode *createFolderNode(InternalNode *node)
{
FolderNode *newNode = 0;
- if (node->typeName.isEmpty())
- newNode = new FolderNode(node->fullPath);
- else
- newNode = new ProVirtualFolderNode(node->fullPath, node->priority, node->typeName);
+ if (node->typeName.isEmpty()) {
+ newNode = new FolderNode(FileName::fromString(node->fullPath));
+ } else {
+ newNode = new ProVirtualFolderNode(FileName::fromString(node->fullPath),
+ node->priority, node->typeName);
+ }
newNode->setDisplayName(node->displayName);
if (!node->icon.isNull())
@@ -460,7 +464,7 @@ struct InternalNode
QMultiMap<QString, FolderNode *> existingFolderNodes;
foreach (FolderNode *node, folder->subFolderNodes())
if (node->nodeType() != ProjectNodeType && !dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node))
- existingFolderNodes.insert(node->path(), node);
+ existingFolderNodes.insert(node->path().toString(), node);
QList<FolderNode *> foldersToRemove;
QList<FolderNode *> foldersToAdd;
@@ -551,7 +555,7 @@ struct InternalNode
}
QList<FileNode*> filesToRemove;
- QStringList filesToAdd;
+ FileNameList filesToAdd;
SortByPath sortByPath;
Utils::sort(files, sortByPath);
@@ -560,7 +564,7 @@ struct InternalNode
ProjectExplorer::compareSortedLists(existingFileNodes, files, filesToRemove, filesToAdd, sortByPath);
QList<FileNode *> nodesToAdd;
- foreach (const QString &file, filesToAdd)
+ foreach (const FileName &file, filesToAdd)
nodesToAdd << new FileNode(file, type, false);
folder->removeFileNodes(filesToRemove);
@@ -577,7 +581,7 @@ struct InternalNode
}
QList<FolderNode *> resourcesToRemove;
- QStringList resourcesToAdd;
+ FileNameList resourcesToAdd;
SortByPath sortByPath;
Utils::sort(files, sortByPath);
@@ -588,7 +592,7 @@ struct InternalNode
QList<FolderNode *> nodesToAdd;
nodesToAdd.reserve(resourcesToAdd.size());
- foreach (const QString &file, resourcesToAdd)
+ foreach (const FileName &file, resourcesToAdd)
nodesToAdd.append(new ResourceEditor::ResourceTopLevelNode(file, folder));
folder->removeFolderNodes(resourcesToRemove);
@@ -918,7 +922,7 @@ QList<ProjectAction> QmakePriFileNode::supportedActions(Node *node) const
// work on a subset of the file types according to project type.
actions << AddNewFile;
- if (m_recursiveEnumerateFiles.contains(FileName::fromString(node->path())))
+ if (m_recursiveEnumerateFiles.contains(node->path()))
actions << EraseFile;
else
actions << RemoveFile;
@@ -930,13 +934,13 @@ QList<ProjectAction> QmakePriFileNode::supportedActions(Node *node) const
if (folder) {
QStringList list;
foreach (FolderNode *f, folder->subFolderNodes())
- list << f->path() + QLatin1Char('/');
+ list << f->path().toString() + QLatin1Char('/');
if (deploysFolder(Utils::commonPath(list)))
addExistingFiles = false;
}
}
- addExistingFiles = addExistingFiles && !deploysFolder(node->path());
+ addExistingFiles = addExistingFiles && !deploysFolder(node->path().toString());
if (addExistingFiles)
actions << AddExistingFile << AddExistingDirectory;
@@ -1116,7 +1120,7 @@ bool QmakePriFileNode::renameFile(const QString &filePath, const QString &newFil
FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files)
- return FolderNode::AddNewInformation(FileName::fromString(path()).fileName(), context && context->projectNode() == this ? 120 : 90);
+ return FolderNode::AddNewInformation(path().fileName(), context && context->projectNode() == this ? 120 : 90);
}
bool QmakePriFileNode::priFileWritable(const QString &path)
@@ -1129,7 +1133,7 @@ bool QmakePriFileNode::priFileWritable(const QString &path)
bool QmakePriFileNode::saveModifiedEditors()
{
Core::IDocument *document
- = Core::DocumentModel::documentForFilePath(m_projectFilePath);
+ = Core::DocumentModel::documentForFilePath(m_projectFilePath.toString());
if (!document || !document->isModified())
return true;
@@ -1137,7 +1141,7 @@ bool QmakePriFileNode::saveModifiedEditors()
return false;
// force instant reload of ourselves
- QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath);
+ QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath.toString());
m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath);
return true;
}
@@ -1235,9 +1239,9 @@ void QmakePriFileNode::changeFiles(const QString &mimeType,
if (!saveModifiedEditors())
return;
- if (!ensureWriteableProFile(m_projectFilePath))
+ if (!ensureWriteableProFile(m_projectFilePath.toString()))
return;
- QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath);
+ QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath.toString());
ProFile *includeFile = pair.first;
QStringList lines = pair.second;
@@ -1261,10 +1265,10 @@ void QmakePriFileNode::changeFiles(const QString &mimeType,
bool QmakePriFileNode::setProVariable(const QString &var, const QStringList &values, const QString &scope, int flags)
{
- if (!ensureWriteableProFile(m_projectFilePath))
+ if (!ensureWriteableProFile(m_projectFilePath.toString()))
return false;
- QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath);
+ QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath.toString());
ProFile *includeFile = pair.first;
QStringList lines = pair.second;
@@ -1281,20 +1285,20 @@ bool QmakePriFileNode::setProVariable(const QString &var, const QStringList &val
void QmakePriFileNode::save(const QStringList &lines)
{
- Core::DocumentManager::expectFileChange(m_projectFilePath);
- FileSaver saver(m_projectFilePath, QIODevice::Text);
+ Core::DocumentManager::expectFileChange(m_projectFilePath.toString());
+ FileSaver saver(m_projectFilePath.toString(), QIODevice::Text);
saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit());
saver.finalize(Core::ICore::mainWindow());
m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath);
- Core::DocumentManager::unexpectFileChange(m_projectFilePath);
+ Core::DocumentManager::unexpectFileChange(m_projectFilePath.toString());
// This is a hack.
// We are saving twice in a very short timeframe, once the editor and once the ProFile.
// So the modification time might not change between those two saves.
// We manually tell each editor to reload it's file.
// (The .pro files are notified by the file system watcher.)
QStringList errorStrings;
- Core::IDocument *document = Core::DocumentModel::documentForFilePath(m_projectFilePath);
+ Core::IDocument *document = Core::DocumentModel::documentForFilePath(m_projectFilePath.toString());
if (document) {
QString errorString;
if (!document->reload(&errorString, Core::IDocument::FlagReload, Core::IDocument::TypeContents))
@@ -1518,7 +1522,7 @@ namespace {
};
}
-const QmakeProFileNode *QmakeProFileNode::findProFileFor(const QString &fileName) const
+const QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) const
{
if (fileName == path())
return this;
@@ -1584,7 +1588,7 @@ bool QmakeProFileNode::isDeployable() const
Implements abstract ProjectNode class
*/
QmakeProFileNode::QmakeProFileNode(QmakeProject *project,
- const QString &filePath)
+ const FileName &filePath)
: QmakePriFileNode(project, this, filePath),
m_validParse(false),
m_parseInProgress(true),
@@ -1625,7 +1629,7 @@ bool QmakeProFileNode::showInSimpleTree() const
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files)
- return AddNewInformation(FileName::fromString(path()).fileName(), context && context->projectNode() == this ? 120 : 100);
+ return AddNewInformation(path().fileName(), context && context->projectNode() == this ? 120 : 100);
}
bool QmakeProFileNode::showInSimpleTree(QmakeProjectType projectType) const
@@ -1765,17 +1769,17 @@ void QmakeProFileNode::setupReader()
m_readerCumulative->setCumulative(true);
}
-static QStringList mergeList(const QStringList &listA, const QStringList &listB)
+static FileNameList mergeList(const FileNameList &listA, const FileNameList &listB)
{
- QStringList result;
+ FileNameList result;
result.reserve(qMax(listA.size(), listB.size()));
auto ait = listA.constBegin();
auto aend = listA.constEnd();
auto bit = listB.constBegin();
auto bend = listB.constEnd();
while (ait != aend && bit != bend) {
- const QString &a = *ait;
- const QString &b = *bit;
+ const FileName &a = *ait;
+ const FileName &b = *bit;
if (a < b) {
result.append(a);
++ait;
@@ -1802,7 +1806,7 @@ static QStringList mergeList(const QStringList &listA, const QStringList &listB)
EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
{
EvalResult *result = new EvalResult;
- if (ProFile *pro = input.readerExact->parsedProFile(input.projectFilePath)) {
+ if (ProFile *pro = input.readerExact->parsedProFile(input.projectFilePath.toString())) {
bool exactOk = input.readerExact->accept(pro, QMakeEvaluator::LoadAll);
bool cumulOk = input.readerCumulative->accept(pro, QMakeEvaluator::LoadPreFiles);
pro->deref();
@@ -1828,11 +1832,12 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
result->exactSubdirs = result->newProjectFilesExact.toSet();
}
foreach (ProFile *includeFile, input.readerExact->includeFiles()) {
- if (includeFile->fileName() == input.projectFilePath) { // this file
+ if (includeFile->fileName() == input.projectFilePath.toString()) { // this file
result->fileForCurrentProjectExact = includeFile;
} else {
- result->newProjectFilesExact << includeFile->fileName();
- result->includeFilesExact.insert(includeFile->fileName(), includeFile);
+ const FileName includeFileName = FileName::fromString(includeFile->fileName());
+ result->newProjectFilesExact << includeFileName;
+ result->includeFilesExact.insert(includeFileName, includeFile);
}
}
}
@@ -1840,11 +1845,12 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
if (result->projectType == SubDirsTemplate)
result->newProjectFilesCumlative = subDirsPaths(input.readerCumulative, input.projectDir, 0, 0);
foreach (ProFile *includeFile, input.readerCumulative->includeFiles()) {
- if (includeFile->fileName() == input.projectFilePath) {
+ if (includeFile->fileName() == input.projectFilePath.toString()) {
result->fileForCurrentProjectCumlative = includeFile;
} else {
- result->newProjectFilesCumlative << includeFile->fileName();
- result->includeFilesCumlative.insert(includeFile->fileName(), includeFile);
+ const FileName includeFileName = FileName::fromString(includeFile->fileName());
+ result->newProjectFilesCumlative << includeFileName;
+ result->includeFilesCumlative.insert(includeFileName, includeFile);
}
}
SortByPath sortByPath;
@@ -1874,7 +1880,7 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
readerBuildPass->setExtraConfigs(basecfgs);
EvalResult::EvalResultState evalResultBuildPass = EvalResult::EvalOk;
- if (ProFile *pro = readerBuildPass->parsedProFile(input.projectFilePath)) {
+ if (ProFile *pro = readerBuildPass->parsedProFile(input.projectFilePath.toString())) {
if (!readerBuildPass->accept(pro, QMakeEvaluator::LoadAll))
evalResultBuildPass = EvalResult::EvalPartial;
pro->deref();
@@ -1887,8 +1893,9 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
readerBuildPass = 0;
}
}
- result->targetInformation = targetInformation(input.readerExact, readerBuildPass, input.buildDirectory, input.projectFilePath);
- result->installsList = installsList(readerBuildPass, input.projectFilePath, input.projectDir);
+ result->targetInformation = targetInformation(input.readerExact, readerBuildPass,
+ input.buildDirectory, input.projectFilePath.toString());
+ result->installsList = installsList(readerBuildPass, input.projectFilePath.toString(), input.projectDir);
// update other variables
result->newVarValues[DefinesVar] = input.readerExact->values(QLatin1String("DEFINES"));
@@ -1979,8 +1986,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
}
// extract values
- QStringList allFiles = mergeList(result->newProjectFilesExact, result->newProjectFilesCumlative);
- foreach (const QString &file, allFiles) {
+ FileNameList allFiles = mergeList(result->newProjectFilesExact, result->newProjectFilesCumlative);
+ foreach (const FileName &file, allFiles) {
ProFile *fileExact = result->includeFilesExact.value(file);
ProFile *fileCumlative = result->includeFilesCumlative.value(file);
if (fileExact || fileCumlative) {
@@ -2037,7 +2044,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
setParseInProgressRecursive(false);
if (result->state == EvalResult::EvalFail) {
- QmakeProject::proFileParseError(QCoreApplication::translate("QmakeProFileNode", "Error while parsing file %1. Giving up.").arg(m_projectFilePath));
+ QmakeProject::proFileParseError(QCoreApplication::translate("QmakeProFileNode", "Error while parsing file %1. Giving up.")
+ .arg(m_projectFilePath.toUserOutput()));
if (m_projectType == InvalidProject)
return;
@@ -2094,8 +2102,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
QList<ProjectNode*> toRemove;
QList<ProjectNode*>::const_iterator existingIt = existingProjectNodes.constBegin();
- QStringList::const_iterator newExactIt = result->newProjectFilesExact.constBegin();
- QStringList::const_iterator newCumlativeIt = result->newProjectFilesCumlative.constBegin();
+ FileNameList::const_iterator newExactIt = result->newProjectFilesExact.constBegin();
+ FileNameList::const_iterator newCumlativeIt = result->newProjectFilesCumlative.constBegin();
forever {
bool existingAtEnd = (existingIt == existingProjectNodes.constEnd());
@@ -2111,7 +2119,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
// parsing, since the update call is diffrent for them
// I believe this code to be correct, be careful in changing it
- QString nodeToAdd;
+ FileName nodeToAdd;
if (! existingAtEnd
&& (newExactAtEnd || (*existingIt)->path() < *newExactIt)
&& (newCumlativeAtEnd || (*existingIt)->path() < *newCumlativeIt)) {
@@ -2165,7 +2173,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
// the .pro file is included in this .pro file
// So to compare that later parse with the sync one
QmakeProFileNode *proFileNode = static_cast<QmakeProFileNode *>(*existingIt);
- proFileNode->setIncludedInExactParse(result->exactSubdirs.contains(proFileNode->path()) && includedInExactParse());
+ proFileNode->setIncludedInExactParse(result->exactSubdirs.contains(proFileNode->path())
+ && includedInExactParse());
proFileNode->asyncUpdate();
}
++existingIt;
@@ -2189,18 +2198,22 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
if (loop) {
// Do nothing
- } else if (fileExact || fileCumlative) {
- QmakePriFileNode *qmakePriFileNode = new QmakePriFileNode(m_project, this, nodeToAdd);
- qmakePriFileNode->setParentFolderNode(this); // Needed for loop detection
- qmakePriFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse());
- qmakePriFileNode->update(result->priFileResults[nodeToAdd]);
- toAdd << qmakePriFileNode;
} else {
- QmakeProFileNode *qmakeProFileNode = new QmakeProFileNode(m_project, nodeToAdd);
- qmakeProFileNode->setParentFolderNode(this); // Needed for loop detection
- qmakeProFileNode->setIncludedInExactParse(result->exactSubdirs.contains(qmakeProFileNode->path()) && includedInExactParse());
- qmakeProFileNode->asyncUpdate();
- toAdd << qmakeProFileNode;
+ if (fileExact || fileCumlative) {
+ QmakePriFileNode *qmakePriFileNode = new QmakePriFileNode(m_project, this, nodeToAdd);
+ qmakePriFileNode->setParentFolderNode(this); // Needed for loop detection
+ qmakePriFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse());
+ qmakePriFileNode->update(result->priFileResults[nodeToAdd]);
+ toAdd << qmakePriFileNode;
+ } else {
+ QmakeProFileNode *qmakeProFileNode = new QmakeProFileNode(m_project, nodeToAdd);
+ qmakeProFileNode->setParentFolderNode(this); // Needed for loop detection
+ qmakeProFileNode->setIncludedInExactParse(
+ result->exactSubdirs.contains(qmakeProFileNode->path())
+ && includedInExactParse());
+ qmakeProFileNode->asyncUpdate();
+ toAdd << qmakeProFileNode;
+ }
}
}
} // for
@@ -2314,12 +2327,12 @@ QStringList QmakeProFileNode::libDirectories(QtSupport::ProFileReader *reader)
return result;
}
-QStringList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader,
- const QString &projectDir,
- QStringList *subProjectsNotToDeploy,
- QStringList *errors)
+FileNameList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader,
+ const QString &projectDir,
+ QStringList *subProjectsNotToDeploy,
+ QStringList *errors)
{
- QStringList subProjectPaths;
+ FileNameList subProjectPaths;
const QStringList subDirVars = reader->values(QLatin1String("SUBDIRS"));
@@ -2353,7 +2366,7 @@ QStringList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader,
if (QFile::exists(realFile)) {
realFile = QDir::cleanPath(realFile);
- subProjectPaths << realFile;
+ subProjectPaths << FileName::fromString(realFile);
if (subProjectsNotToDeploy && !subProjectsNotToDeploy->contains(realFile)
&& reader->values(subDirVar + QLatin1String(".CONFIG"))
.contains(QLatin1String("no_default_target"))) {
@@ -2476,11 +2489,11 @@ QString QmakeProFileNode::uiDirectory(const QString &buildDir) const
return buildDir;
}
-QString QmakeProFileNode::uiHeaderFile(const QString &uiDir, const QString &formFile)
+QString QmakeProFileNode::uiHeaderFile(const QString &uiDir, const FileName &formFile)
{
QString uiHeaderFilePath = uiDir;
uiHeaderFilePath += QLatin1String("/ui_");
- uiHeaderFilePath += QFileInfo(formFile).completeBaseName();
+ uiHeaderFilePath += formFile.toFileInfo().completeBaseName();
uiHeaderFilePath += QLatin1String(".h");
return QDir::cleanPath(uiHeaderFilePath);
}
@@ -2499,6 +2512,6 @@ void QmakeProFileNode::updateUiFiles(const QString &buildDir)
// Find the UiDir, there can only ever be one
const QString uiDir = uiDirectory(buildDir);
foreach (const FileNode *uiFile, uiFiles)
- m_uiFiles.insert(uiFile->path(), uiHeaderFile(uiDir, uiFile->path()));
+ m_uiFiles.insert(uiFile->path().toString(), uiHeaderFile(uiDir, uiFile->path()));
}
}
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h
index 33c3739821..7c7508530f 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.h
@@ -151,7 +151,7 @@ public:
class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode
{
public:
- QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const QString &filePath);
+ QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const Utils::FileName &filePath);
~QmakePriFileNode();
void update(const Internal::PriFileEvalResult &result);
@@ -226,7 +226,7 @@ private:
QmakeProject *m_project;
QmakeProFileNode *m_qmakeProFileNode;
- QString m_projectFilePath;
+ Utils::FileName m_projectFilePath;
QString m_projectDir;
QMap<QString, QtSupport::UiCodeModelSupport *> m_uiCodeModelSupport;
@@ -269,7 +269,7 @@ private:
class ProVirtualFolderNode : public ProjectExplorer::VirtualFolderNode
{
public:
- explicit ProVirtualFolderNode(const QString &folderPath, int priority, const QString &typeName)
+ explicit ProVirtualFolderNode(const Utils::FileName &folderPath, int priority, const QString &typeName)
: VirtualFolderNode(folderPath, priority), m_typeName(typeName)
{
@@ -349,8 +349,7 @@ struct QMAKEPROJECTMANAGER_EXPORT ProjectVersion {
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
{
public:
- QmakeProFileNode(QmakeProject *project,
- const QString &filePath);
+ QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath);
~QmakeProFileNode();
bool isParent(QmakeProFileNode *node);
@@ -372,10 +371,10 @@ public:
QString buildDir(QmakeBuildConfiguration *bc = 0) const;
QString uiDirectory(const QString &buildDir) const;
- static QString uiHeaderFile(const QString &uiDir, const QString &formFile);
+ static QString uiHeaderFile(const QString &uiDir, const Utils::FileName &formFile);
QHash<QString, QString> uiFiles() const;
- const QmakeProFileNode *findProFileFor(const QString &string) const;
+ const QmakeProFileNode *findProFileFor(const Utils::FileName &string) const;
TargetInformation targetInformation() const;
InstallsList installsList() const;
@@ -426,7 +425,7 @@ private:
static QString mocDirPath(QtSupport::ProFileReader *reader, const QString &buildDir);
static QStringList includePaths(QtSupport::ProFileReader *reader, const QString &buildDir, const QString &projectDir);
static QStringList libDirectories(QtSupport::ProFileReader *reader);
- static QStringList subDirsPaths(QtSupport::ProFileReader *reader, const QString &projectDir, QStringList *subProjectsNotToDeploy, QStringList *errors);
+ static Utils::FileNameList subDirsPaths(QtSupport::ProFileReader *reader, const QString &projectDir, QStringList *subProjectsNotToDeploy, QStringList *errors);
static TargetInformation targetInformation(QtSupport::ProFileReader *reader, QtSupport::ProFileReader *readerBuildPass, const QString &buildDir, const QString &projectFilePath);
static InstallsList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir);
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 34096c70ba..fe70b0731e 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -256,21 +256,19 @@ void ProjectFilesVisitor::findProjectFiles(QmakeProFileNode *rootNode, QmakeProj
void ProjectFilesVisitor::visitProjectNode(ProjectNode *projectNode)
{
- const QString path = projectNode->path();
- m_files->proFiles.append(path);
+ m_files->proFiles.append(projectNode->path().toString());
visitFolderNode(projectNode);
}
void ProjectFilesVisitor::visitFolderNode(FolderNode *folderNode)
{
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode))
- m_files->files[ResourceType].push_back(folderNode->path());
+ m_files->files[ResourceType].push_back(folderNode->path().toString());
foreach (FileNode *fileNode, folderNode->fileNodes()) {
- const QString path = fileNode->path();
const int type = fileNode->fileType();
QStringList &targetList = fileNode->isGenerated() ? m_files->generatedFiles[type] : m_files->files[type];
- targetList.push_back(path);
+ targetList.push_back(fileNode->path().toString());
}
}
@@ -413,7 +411,7 @@ bool QmakeProject::fromMap(const QVariantMap &map)
m_manager->registerProject(this);
- m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath().toString());
+ m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath());
// On active buildconfiguration changes, reevaluate the .pro files
m_activeTarget = activeTarget();
@@ -504,7 +502,7 @@ void QmakeProject::updateCppCodeModel()
ProjectPart::Ptr templatePart(new ProjectPart);
templatePart->project = this;
templatePart->displayName = pro->displayName();
- templatePart->projectFile = pro->path();
+ templatePart->projectFile = pro->path().toString();
templatePart->selectedForBuilding = pro->includedInExactParse();
if (pro->variableValue(ConfigVar).contains(QLatin1String("qt")))
@@ -834,7 +832,7 @@ void QmakeProject::decrementPendingEvaluateFutures()
QtQuickApp qtQuickApp;
foreach (QmakeProFileNode *node, applicationProFiles(QmakeProject::ExactAndCumulativeParse)) {
- const QString path = node->path();
+ const QString path = node->path().toString();
foreach (TemplateInfo info, QtQuickApp::templateInfos()) {
qtQuickApp.setTemplateInfo(info);
@@ -938,7 +936,7 @@ QStringList QmakeProject::files(FilesMode fileMode) const
}
// Find the folder that contains a file a certain type (recurse down)
-static FolderNode *folderOf(FolderNode *in, FileType fileType, const QString &fileName)
+static FolderNode *folderOf(FolderNode *in, FileType fileType, const FileName &fileName)
{
foreach (FileNode *fn, in->fileNodes())
if (fn->fileType() == fileType && fn->path() == fileName)
@@ -951,7 +949,7 @@ static FolderNode *folderOf(FolderNode *in, FileType fileType, const QString &fi
// Find the QmakeProFileNode that contains a file of a certain type.
// First recurse down to folder, then find the pro-file.
-static QmakeProFileNode *proFileNodeOf(QmakeProFileNode *in, FileType fileType, const QString &fileName)
+static QmakeProFileNode *proFileNodeOf(QmakeProFileNode *in, FileType fileType, const FileName &fileName)
{
for (FolderNode *folder = folderOf(in, fileType, fileName); folder; folder = folder->parentFolderNode())
if (QmakeProFileNode *proFile = dynamic_cast<QmakeProFileNode *>(folder))
@@ -959,7 +957,7 @@ static QmakeProFileNode *proFileNodeOf(QmakeProFileNode *in, FileType fileType,
return 0;
}
-QString QmakeProject::generatedUiHeader(const QString &formFile) const
+QString QmakeProject::generatedUiHeader(const FileName &formFile) const
{
// Look in sub-profiles as SessionManager::projectForFile returns
// the top-level project only.
@@ -1074,7 +1072,7 @@ QmakeProFileNode *QmakeProject::rootQmakeProjectNode() const
return m_rootProjectNode;
}
-bool QmakeProject::validParse(const QString &proFilePath) const
+bool QmakeProject::validParse(const FileName &proFilePath) const
{
if (!m_rootProjectNode)
return false;
@@ -1082,7 +1080,7 @@ bool QmakeProject::validParse(const QString &proFilePath) const
return node && node->validParse();
}
-bool QmakeProject::parseInProgress(const QString &proFilePath) const
+bool QmakeProject::parseInProgress(const FileName &proFilePath) const
{
if (!m_rootProjectNode)
return false;
@@ -1117,7 +1115,7 @@ QList<QmakeProFileNode *> QmakeProject::allProFiles(const QList<QmakeProjectType
return list;
}
-bool QmakeProject::hasApplicationProFile(const QString &path) const
+bool QmakeProject::hasApplicationProFile(const FileName &path) const
{
if (path.isEmpty())
return false;
@@ -1143,7 +1141,7 @@ QList<QmakeProFileNode *> QmakeProject::nodesWithQtcRunnable(QList<QmakeProFileN
QList<Core::Id> QmakeProject::idsForNodes(Core::Id base, const QList<QmakeProFileNode *> &nodes)
{
return Utils::transform(nodes, [&base](QmakeProFileNode *node) {
- return base.withSuffix(node->path());
+ return base.withSuffix(node->path().toString());
});
}
@@ -1165,7 +1163,7 @@ void QmakeProject::activeTargetWasChanged()
scheduleAsyncUpdate();
}
-bool QmakeProject::hasSubNode(QmakePriFileNode *root, const QString &path)
+bool QmakeProject::hasSubNode(QmakePriFileNode *root, const FileName &path)
{
if (root->path() == path)
return true;
@@ -1180,7 +1178,7 @@ bool QmakeProject::hasSubNode(QmakePriFileNode *root, const QString &path)
return false;
}
-void QmakeProject::findProFile(const QString& fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list)
+void QmakeProject::findProFile(const FileName &fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list)
{
if (hasSubNode(root, fileName))
list.append(root);
@@ -1190,13 +1188,13 @@ void QmakeProject::findProFile(const QString& fileName, QmakeProFileNode *root,
findProFile(fileName, qt4proFileNode, list);
}
-void QmakeProject::notifyChanged(const QString &name)
+void QmakeProject::notifyChanged(const FileName &name)
{
- if (files(QmakeProject::ExcludeGeneratedFiles).contains(name)) {
+ if (files(QmakeProject::ExcludeGeneratedFiles).contains(name.toString())) {
QList<QmakeProFileNode *> list;
findProFile(name, rootQmakeProjectNode(), list);
foreach (QmakeProFileNode *node, list) {
- QtSupport::ProFileCacheManager::instance()->discardFile(name);
+ QtSupport::ProFileCacheManager::instance()->discardFile(name.toString());
node->scheduleUpdate(QmakeProFileNode::ParseNow);
}
}
@@ -1435,21 +1433,21 @@ bool QmakeProject::requiresTargetPanel() const
// All the Qmake run configurations should share code.
// This is a rather suboptimal way to do that for disabledReason()
// but more pratical then duplicated the code everywhere
-QString QmakeProject::disabledReasonForRunConfiguration(const QString &proFilePath)
+QString QmakeProject::disabledReasonForRunConfiguration(const FileName &proFilePath)
{
- if (!QFileInfo::exists(proFilePath))
+ if (!proFilePath.exists())
return tr("The .pro file \"%1\" does not exist.")
- .arg(FileName::fromString(proFilePath).fileName());
+ .arg(proFilePath.fileName());
if (!m_rootProjectNode) // Shutting down
return QString();
if (!m_rootProjectNode->findProFileFor(proFilePath))
return tr("The .pro file \"%1\" is not part of the project.")
- .arg(FileName::fromString(proFilePath).fileName());
+ .arg(proFilePath.fileName());
return tr("The .pro file \"%1\" could not be parsed.")
- .arg(FileName::fromString(proFilePath).fileName());
+ .arg(proFilePath.fileName());
}
QString QmakeProject::buildNameFor(const Kit *k)
@@ -1477,14 +1475,14 @@ void QmakeProject::updateBuildSystemData()
foreach (const QmakeProFileNode * const node, applicationProFiles()) {
appTargetList.list << BuildTargetInfo(node->targetInformation().target,
FileName::fromString(executableFor(node)),
- FileName::fromString(node->path()));
+ node->path());
}
target->setApplicationTargets(appTargetList);
}
void QmakeProject::collectData(const QmakeProFileNode *node, DeploymentData &deploymentData)
{
- if (!node->isSubProjectDeployable(node->path()))
+ if (!node->isSubProjectDeployable(node->path().toString()))
return;
const InstallsList &installsList = node->installsList();
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h
index ea355a7936..d9fca176ea 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.h
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.h
@@ -80,22 +80,22 @@ public:
ProjectExplorer::ProjectNode *rootProjectNode() const;
QmakeProFileNode *rootQmakeProjectNode() const;
- bool validParse(const QString &proFilePath) const;
- bool parseInProgress(const QString &proFilePath) const;
+ bool validParse(const Utils::FileName &proFilePath) const;
+ bool parseInProgress(const Utils::FileName &proFilePath) const;
virtual QStringList files(FilesMode fileMode) const;
- virtual QString generatedUiHeader(const QString &formFile) const;
+ virtual QString generatedUiHeader(const Utils::FileName &formFile) const;
enum Parsing {ExactParse, ExactAndCumulativeParse };
QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(),
Parsing parse = ExactParse) const;
QList<QmakeProFileNode *> applicationProFiles(Parsing parse = ExactParse) const;
- bool hasApplicationProFile(const QString &path) const;
+ bool hasApplicationProFile(const Utils::FileName &path) const;
static QList<QmakeProFileNode *> nodesWithQtcRunnable(QList<QmakeProFileNode *> nodes);
static QList<Core::Id> idsForNodes(Core::Id base, const QList<QmakeProFileNode *> &nodes);
- void notifyChanged(const QString &name);
+ void notifyChanged(const Utils::FileName &name);
/// \internal
QtSupport::ProFileReader *createProFileReader(const QmakeProFileNode *qmakeProFileNode, QmakeBuildConfiguration *bc = 0);
@@ -130,7 +130,7 @@ public:
bool requiresTargetPanel() const;
/// \internal
- QString disabledReasonForRunConfiguration(const QString &proFilePath);
+ QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath);
/// used by the default implementation of shadowBuildDirectory
static QString buildNameFor(const ProjectExplorer::Kit *k);
@@ -170,8 +170,8 @@ private:
static void collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse,
const QList<QmakeProjectManager::QmakeProjectType> &projectTypes);
- static void findProFile(const QString& fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
- static bool hasSubNode(QmakePriFileNode *root, const QString &path);
+ static void findProFile(const Utils::FileName &fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
+ static bool hasSubNode(QmakePriFileNode *root, const Utils::FileName &path);
static bool equalFileList(const QStringList &a, const QStringList &b);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
index be99805b08..c145a00d6d 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
@@ -79,7 +79,7 @@ void QmakeManager::unregisterProject(QmakeProject *project)
m_projects.removeOne(project);
}
-void QmakeManager::notifyChanged(const QString &name)
+void QmakeManager::notifyChanged(const Utils::FileName &name)
{
foreach (QmakeProject *pro, m_projects)
pro->notifyChanged(name);
@@ -142,7 +142,7 @@ void QmakeManager::addLibraryContextMenu()
{
Node *node = ProjectTree::currentNode();
if (dynamic_cast<QmakeProFileNode *>(node))
- addLibrary(node->path());
+ addLibrary(node->path().toString());
}
void QmakeManager::addLibrary(const QString &fileName, BaseTextEditor *editor)
@@ -231,7 +231,7 @@ void QmakeManager::buildFileContextMenu()
void QmakeManager::buildFile()
{
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
- const QString file = currentDocument->filePath().toString();
+ const Utils::FileName file = currentDocument->filePath();
FileNode *node = dynamic_cast<FileNode *>(SessionManager::nodeForFile(file));
Project *project = SessionManager::projectForFile(file);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h
index 040fc0c3c8..e09aab9925 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.h
@@ -59,7 +59,7 @@ public:
void registerProject(QmakeProject *project);
void unregisterProject(QmakeProject *project);
- void notifyChanged(const QString &name);
+ void notifyChanged(const Utils::FileName &name);
virtual QString mimeType() const;
ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index 888e1e553f..78332c73e1 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -345,7 +345,7 @@ void QmakeProjectManagerPlugin::updateContextActions(ProjectExplorer::Node *node
m_rebuildSubProjectAction->setParameter(subProjectName);
m_cleanSubProjectAction->setParameter(subProjectName);
m_buildSubProjectContextMenu->setParameter(subProjectName);
- m_buildFileAction->setParameter(buildFilePossible ? Utils::FileName::fromString(fileNode->path()).fileName() : QString());
+ m_buildFileAction->setParameter(buildFilePossible ? fileNode->path().fileName() : QString());
QmakeBuildConfiguration *buildConfiguration = (qmakeProject && qmakeProject->activeTarget()) ?
static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()) : 0;
@@ -392,10 +392,10 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
bool enabled = false;
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
- QString file = currentDocument->filePath().toString();
+ Utils::FileName file = currentDocument->filePath();
Node *node = SessionManager::nodeForFile(file);
Project *project = SessionManager::projectForFile(file);
- m_buildFileAction->setParameter(Utils::FileName::fromString(file).fileName());
+ m_buildFileAction->setParameter(file.fileName());
visible = qobject_cast<QmakeProject *>(project)
&& node
&& dynamic_cast<QmakePriFileNode *>(node->projectNode());
diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp
index 98a168f9d3..d3a82f6b3d 100644
--- a/src/plugins/qmakeprojectmanager/qmakestep.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp
@@ -127,7 +127,7 @@ QString QMakeStep::allArguments(bool shorted)
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
- arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path());
+ arguments << bc->subNodeBuild()->path().toUserOutput();
else if (shorted)
arguments << project()->projectFilePath().fileName();
else
@@ -260,7 +260,7 @@ bool QMakeStep::init()
QmakeProFileNode *node = static_cast<QmakeProject *>(qt4bc->target()->project())->rootQmakeProjectNode();
if (qt4bc->subNodeBuild())
node = qt4bc->subNodeBuild();
- QString proFile = node->path();
+ QString proFile = node->path().toString();
QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
Utils::sort(tasks);
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp
index 3dde05b2c2..73e0942e23 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp
@@ -643,7 +643,7 @@ static inline Kit *getActiveKit(DesignDocument *designDocument)
Project *currentProject = ProjectTree::currentProject();
if (!currentProject)
- currentProject = SessionManager::projectForFile(designDocument->fileName());
+ currentProject = SessionManager::projectForFile(Utils::FileName::fromString(designDocument->fileName()));
if (!currentProject)
return 0;
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index 7f8d208fa1..4292b49c48 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -45,6 +45,8 @@
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/project.h>
+#include <utils/fileutils.h>
+
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
@@ -128,7 +130,8 @@ public:
if (path == QFileInfo(fileName()).path()) {
// hack for the common case, next version should use the wizard
- ProjectExplorer::Node * oldFileNode = ProjectExplorer::SessionManager::nodeForFile(fileName());
+ ProjectExplorer::Node * oldFileNode =
+ ProjectExplorer::SessionManager::nodeForFile(Utils::FileName::fromString(fileName()));
if (oldFileNode) {
ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode();
if (containingFolder)
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
index 8c299ce487..e630292376 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.cpp
@@ -68,11 +68,11 @@ void setupFileFilterItem(QmlProjectManager::FileFilterBaseItem *fileFilterItem,
namespace QmlProjectManager {
-QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const QString &fileName, QString *errorMessage)
+QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FileName &fileName, QString *errorMessage)
{
QmlJS::SimpleReader simpleQmlJSReader;
- const QmlJS::SimpleReaderNode::Ptr rootNode = simpleQmlJSReader.readFile(fileName);
+ const QmlJS::SimpleReaderNode::Ptr rootNode = simpleQmlJSReader.readFile(fileName.toString());
if (!simpleQmlJSReader.errors().isEmpty() || !rootNode->isValid()) {
qWarning() << "unable to parse:" << fileName;
diff --git a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h
index 9901bb90e8..c0631f66d8 100644
--- a/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h
+++ b/src/plugins/qmlprojectmanager/fileformat/qmlprojectfileformat.h
@@ -31,6 +31,8 @@
#ifndef QMLPROJECTFILEFORMAT_H
#define QMLPROJECTFILEFORMAT_H
+#include <utils/fileutils.h>
+
#include <QCoreApplication>
#include <QString>
@@ -43,7 +45,7 @@ class QmlProjectFileFormat
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectFileFormat)
public:
- static QmlProjectItem *parseProjectFile(const QString &fileName, QString *errorMessage = 0);
+ static QmlProjectItem *parseProjectFile(const Utils::FileName &fileName, QString *errorMessage = 0);
};
} // namespace QmlProjectManager
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 4647eede62..4444ab1db0 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -58,7 +58,7 @@ namespace Internal {
} // namespace Internal
-QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
+QmlProject::QmlProject(Internal::Manager *manager, const Utils::FileName &fileName)
: m_manager(manager),
m_fileName(fileName),
m_defaultImport(UnknownImport),
@@ -68,7 +68,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
- QFileInfo fileInfo(m_fileName);
+ QFileInfo fileInfo = m_fileName.toFileInfo();
m_projectName = fileInfo.completeBaseName();
m_file = new Internal::QmlProjectFile(this, fileName);
@@ -129,7 +129,7 @@ QDir QmlProject::projectDir() const
return projectFilePath().toFileInfo().dir();
}
-QString QmlProject::filesFileName() const
+Utils::FileName QmlProject::filesFileName() const
{ return m_fileName; }
static QmlProject::QmlImport detectImport(const QString &qml) {
@@ -157,7 +157,9 @@ void QmlProject::parseProject(RefreshOptions options)
this, SLOT(refreshFiles(QSet<QString>,QSet<QString>)));
} else {
- MessageManager::write(tr("Error while loading project file %1.").arg(m_fileName), MessageManager::NoModeSwitch);
+ MessageManager::write(tr("Error while loading project file %1.")
+ .arg(m_fileName.toUserOutput()),
+ MessageManager::NoModeSwitch);
MessageManager::write(errorMessage);
}
}
@@ -172,7 +174,8 @@ void QmlProject::parseProject(RefreshOptions options)
Utils::FileReader reader;
QString errorMessage;
if (!reader.fetch(mainFilePath, &errorMessage)) {
- MessageManager::write(tr("Warning while loading project file %1.").arg(m_fileName));
+ MessageManager::write(tr("Warning while loading project file %1.")
+ .arg(m_fileName.toUserOutput()));
MessageManager::write(errorMessage);
} else {
m_defaultImport = detectImport(QString::fromUtf8(reader.data()));
@@ -211,7 +214,7 @@ void QmlProject::refresh(RefreshOptions options)
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
{
- const QDir projectDir(QFileInfo(m_fileName).dir());
+ const QDir projectDir(m_fileName.toFileInfo().dir());
QStringList absolutePaths;
foreach (const QString &file, paths) {
QFileInfo fileInfo(projectDir, file);
diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h
index d150943bca..00dd5323a4 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.h
+++ b/src/plugins/qmlprojectmanager/qmlproject.h
@@ -56,10 +56,10 @@ class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
Q_OBJECT
public:
- QmlProject(Internal::Manager *manager, const QString &filename);
+ QmlProject(Internal::Manager *manager, const Utils::FileName &filename);
virtual ~QmlProject();
- QString filesFileName() const;
+ Utils::FileName filesFileName() const;
QString displayName() const;
Core::IDocument *document() const;
@@ -111,7 +111,7 @@ private:
QmlJS::ModelManagerInterface *modelManager() const;
Internal::Manager *m_manager;
- QString m_fileName;
+ Utils::FileName m_fileName;
Internal::QmlProjectFile *m_file;
QString m_projectName;
QmlImport m_defaultImport;
diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
index 801ef4b16e..7573730c71 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
@@ -36,7 +36,7 @@
namespace QmlProjectManager {
namespace Internal {
-QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName)
+QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName)
: Core::IDocument(parent),
m_project(parent)
{
@@ -44,7 +44,7 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName)
QTC_CHECK(!fileName.isEmpty());
setId("Qml.ProjectFile");
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
- setFilePath(Utils::FileName::fromString(fileName));
+ setFilePath(fileName);
}
QmlProjectFile::~QmlProjectFile()
diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.h b/src/plugins/qmlprojectmanager/qmlprojectfile.h
index b9cbbfd9fe..f8f1a6c353 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectfile.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectfile.h
@@ -44,7 +44,7 @@ class QmlProjectFile : public Core::IDocument
Q_OBJECT
public:
- QmlProjectFile(QmlProject *parent, const QString &fileName);
+ QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName);
virtual ~QmlProjectFile();
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
index 69d7a37e28..6a08357e76 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.cpp
@@ -57,7 +57,7 @@ ProjectExplorer::Project *Manager::openProject(const QString &fileName, QString
return 0;
}
- return new QmlProject(this, fileName);
+ return new QmlProject(this, Utils::FileName::fromString(fileName));
}
void Manager::registerProject(QmlProject *project)
@@ -68,8 +68,9 @@ void Manager::unregisterProject(QmlProject *project)
void Manager::notifyChanged(const QString &fileName)
{
+ const Utils::FileName file = Utils::FileName::fromString(fileName);
foreach (QmlProject *project, m_projects) {
- if (fileName == project->filesFileName())
+ if (file == project->filesFileName())
project->refresh(QmlProject::Files);
}
}
diff --git a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
index bab143e8d4..a31526c8af 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
@@ -42,7 +42,7 @@ namespace QmlProjectManager {
namespace Internal {
QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IDocument *projectFile)
- : ProjectExplorer::ProjectNode(projectFile->filePath().toString()),
+ : ProjectExplorer::ProjectNode(projectFile->filePath()),
m_project(project),
m_projectFile(projectFile)
{
@@ -80,7 +80,7 @@ void QmlProjectNode::refresh()
/* generated = */ false);
QStringList files = m_project->files();
- files.removeAll(m_project->filesFileName());
+ files.removeAll(m_project->filesFileName().toString());
addFileNodes(QList<FileNode *>()
<< projectFilesNode);
@@ -114,7 +114,8 @@ void QmlProjectNode::refresh()
QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) {
FileType fileType = SourceType; // ### FIXME
- FileNode *fileNode = new FileNode(file, fileType, /*generated = */ false);
+ FileNode *fileNode = new FileNode(Utils::FileName::fromString(file),
+ fileType, /*generated = */ false);
fileNodes.append(fileNode);
}
@@ -129,7 +130,7 @@ ProjectExplorer::FolderNode *QmlProjectNode::findOrCreateFolderByName(const QStr
if (! end)
return 0;
- QString baseDir = QFileInfo(path()).path();
+ Utils::FileName folderPath = path().parentDir();
QString folderName;
for (int i = 0; i < end; ++i) {
@@ -145,7 +146,8 @@ ProjectExplorer::FolderNode *QmlProjectNode::findOrCreateFolderByName(const QStr
else if (FolderNode *folder = m_folderByName.value(folderName))
return folder;
- FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
+ folderPath.appendPath(folderName);
+ FolderNode *folder = new FolderNode(folderPath);
folder->setDisplayName(component);
m_folderByName.insert(folderName, folder);
diff --git a/src/plugins/qnx/bardescriptorfilenode.cpp b/src/plugins/qnx/bardescriptorfilenode.cpp
index ca388e788b..65a48425fd 100644
--- a/src/plugins/qnx/bardescriptorfilenode.cpp
+++ b/src/plugins/qnx/bardescriptorfilenode.cpp
@@ -35,7 +35,7 @@
using namespace Qnx;
using namespace Qnx::Internal;
-BarDescriptorFileNode::BarDescriptorFileNode(const QString &filePath)
+BarDescriptorFileNode::BarDescriptorFileNode(const Utils::FileName &filePath)
: ProjectExplorer::FileNode(filePath, ProjectExplorer::ProjectFileType, false)
{
}
diff --git a/src/plugins/qnx/bardescriptorfilenode.h b/src/plugins/qnx/bardescriptorfilenode.h
index c9501ecab0..07f5e9b0fd 100644
--- a/src/plugins/qnx/bardescriptorfilenode.h
+++ b/src/plugins/qnx/bardescriptorfilenode.h
@@ -41,7 +41,7 @@ namespace Internal {
class BarDescriptorFileNode : public ProjectExplorer::FileNode
{
public:
- explicit BarDescriptorFileNode(const QString &filePath);
+ explicit BarDescriptorFileNode(const Utils::FileName &filePath);
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
};
diff --git a/src/plugins/qnx/bardescriptorfilenodemanager.cpp b/src/plugins/qnx/bardescriptorfilenodemanager.cpp
index 559d2f566d..0c777c6c45 100644
--- a/src/plugins/qnx/bardescriptorfilenodemanager.cpp
+++ b/src/plugins/qnx/bardescriptorfilenodemanager.cpp
@@ -150,7 +150,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
if (!projectNode)
continue;
- if (!QFileInfo::exists(package.appDescriptorPath())) {
+ if (!package.appDescriptorPath().exists()) {
if (!attemptCreate)
continue;
@@ -165,7 +165,8 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
if (existingNode) {
if (existingNode->path() != package.appDescriptorPath()) {
// Reload the new bar-descriptor document in the existing editor (if there is one)
- Core::IDocument *oldDocument = Core::DocumentModel::documentForFilePath(existingNode->path());
+ Core::IDocument *oldDocument = Core::DocumentModel::documentForFilePath(
+ existingNode->path().toString());
if (oldDocument) {
QString errorMessage;
@@ -173,7 +174,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
Core::MessageManager::write(tr("Cannot save bar descriptor file: %1").arg(errorMessage));
continue;
} else {
- oldDocument->setFilePath(Utils::FileName::fromString(package.appDescriptorPath()));
+ oldDocument->setFilePath(package.appDescriptorPath());
if (!oldDocument->reload(&errorMessage, Core::IDocument::FlagReload, Core::IDocument::TypeContents))
Core::MessageManager::write(tr("Cannot reload bar descriptor file: %1").arg(errorMessage));
@@ -190,17 +191,17 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
}
bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project *project,
- const QString &barDescriptorPath,
+ const Utils::FileName &barDescriptorPath,
ProjectExplorer::ProjectNode *projectNode)
{
- const QString projectName = QFileInfo(projectNode->path()).completeBaseName();
+ const QString projectName = projectNode->path().toFileInfo().completeBaseName();
QmakeProjectManager::QmakeProFileNode *proFileNode =
dynamic_cast<QmakeProjectManager::QmakeProFileNode*>(projectNode);
QTC_ASSERT(proFileNode, return false);
const QString targetName = proFileNode->targetInformation().target;
- const QFile barDescriptorFile(barDescriptorPath);
+ const QFile barDescriptorFile(barDescriptorPath.toString());
if (barDescriptorFile.exists())
return false;
@@ -261,13 +262,13 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
return true;
}
-void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescriptorPath,
+void BarDescriptorFileNodeManager::updateBarDescriptor(const Utils::FileName &barDescriptorPath,
ProjectExplorer::Target *target,
bool skipConfirmation)
{
BarDescriptorDocument doc;
QString errorString;
- if (!doc.open(&errorString, barDescriptorPath)) {
+ if (!doc.open(&errorString, barDescriptorPath.toString())) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Error"),
tr("Cannot open BAR application descriptor file"));
return;
@@ -335,8 +336,9 @@ BarDescriptorFileNode *BarDescriptorFileNodeManager::findBarDescriptorFileNode(P
return 0;
}
-ProjectExplorer::ProjectNode *BarDescriptorFileNodeManager::findProjectNode(ProjectExplorer::ProjectNode *parent,
- const QString &projectFilePath) const
+ProjectExplorer::ProjectNode *BarDescriptorFileNodeManager::findProjectNode(
+ ProjectExplorer::ProjectNode *parent,
+ const Utils::FileName &projectFilePath) const
{
QTC_ASSERT(parent, return 0);
diff --git a/src/plugins/qnx/bardescriptorfilenodemanager.h b/src/plugins/qnx/bardescriptorfilenodemanager.h
index 4a751ee2ec..b47fa3f8a5 100644
--- a/src/plugins/qnx/bardescriptorfilenodemanager.h
+++ b/src/plugins/qnx/bardescriptorfilenodemanager.h
@@ -35,6 +35,10 @@
#include <QObject>
+namespace Utils {
+class FileName;
+}
+
namespace ProjectExplorer {
class DeployConfiguration;
class Project;
@@ -64,12 +68,12 @@ private slots:
private:
BarDescriptorFileNode *findBarDescriptorFileNode(ProjectExplorer::ProjectNode *parent) const;
ProjectExplorer::ProjectNode *findProjectNode(ProjectExplorer::ProjectNode *parent,
- const QString &projectFilePath) const;
+ const Utils::FileName &projectFilePath) const;
void updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate);
- bool createBarDescriptor(ProjectExplorer::Project *project, const QString &barDescriptorPath,
+ bool createBarDescriptor(ProjectExplorer::Project *project, const Utils::FileName &barDescriptorPath,
ProjectExplorer::ProjectNode *projectNode);
- void updateBarDescriptor(const QString &barDescriptorPath, ProjectExplorer::Target *target,
+ void updateBarDescriptor(const Utils::FileName &barDescriptorPath, ProjectExplorer::Target *target,
bool skipConfirmation = false);
void removeBarDescriptorNodes(ProjectExplorer::Project *project);
diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp
index 883f4bb643..7d7b3f63db 100644
--- a/src/plugins/qnx/blackberryapplicationrunner.cpp
+++ b/src/plugins/qnx/blackberryapplicationrunner.cpp
@@ -225,7 +225,7 @@ RunControl::StopResult BlackBerryApplicationRunner::stop()
args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password;
- args << m_barPackage;
+ args << m_barPackage.toUserOutput();
if (!m_stopProcess) {
m_stopProcess = new QProcess(this);
@@ -322,7 +322,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArguments()
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded()));
QStringList args;
- args << QLatin1String("-listManifest") << QDir::toNativeSeparators(m_barPackage);
+ args << QLatin1String("-listManifest") << m_barPackage.toUserOutput();
if (debugCheckQmlJSArgs)
qDebug() << "get manifest:" << nativePackagerCmd << args.join(QLatin1Char(' '));
m_checkQmlJsDebugArgumentsProcess->start(nativePackagerCmd, args);
@@ -379,7 +379,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestLoaded()
args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password;
- args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage);
+ args << QLatin1String("-package") << m_barPackage.toUserOutput();
args << QLatin1String("-putFile");
args << manifestFile->fileName();
args << QLatin1String("app/META-INF/MANIFEST.MF");
@@ -416,7 +416,7 @@ void BlackBerryApplicationRunner::launchApplication()
args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password;
- args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage);
+ args << QLatin1String("-package") << m_barPackage.toUserOutput();
if (!m_launchProcess) {
m_launchProcess = new QProcess(this);
@@ -460,7 +460,7 @@ void BlackBerryApplicationRunner::determineRunningState()
args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password;
- args << m_barPackage;
+ args << m_barPackage.toUserOutput();
if (!m_runningStateProcess) {
m_runningStateProcess = new QProcess(this);
diff --git a/src/plugins/qnx/blackberryapplicationrunner.h b/src/plugins/qnx/blackberryapplicationrunner.h
index 73acaa7e2b..792c587428 100644
--- a/src/plugins/qnx/blackberryapplicationrunner.h
+++ b/src/plugins/qnx/blackberryapplicationrunner.h
@@ -41,6 +41,7 @@
#include <ssh/sshconnection.h>
#include <utils/environment.h>
+#include <utils/fileutils.h>
#include <QObject>
#include <QProcess>
@@ -126,7 +127,7 @@ private:
Utils::Environment m_environment;
QString m_deployCmd;
BlackBerryDeviceConfiguration::ConstPtr m_device;
- QString m_barPackage;
+ Utils::FileName m_barPackage;
QSsh::SshConnectionParameters m_sshParams;
QProcess *m_launchProcess;
diff --git a/src/plugins/qnx/blackberrycreatepackagestep.cpp b/src/plugins/qnx/blackberrycreatepackagestep.cpp
index dd8e63fec9..da34a85afc 100644
--- a/src/plugins/qnx/blackberrycreatepackagestep.cpp
+++ b/src/plugins/qnx/blackberrycreatepackagestep.cpp
@@ -254,7 +254,7 @@ bool BlackBerryCreatePackageStep::init()
return false;
}
- const QString buildDir = QFileInfo(info.packagePath()).absolutePath();
+ const QString buildDir = info.packagePath().toFileInfo().absolutePath();
QDir dir(buildDir);
if (!dir.exists()) {
if (!dir.mkpath(buildDir)) {
@@ -263,7 +263,7 @@ bool BlackBerryCreatePackageStep::init()
}
}
- const QString appDescriptorPath = info.appDescriptorPath();
+ const Utils::FileName appDescriptorPath = info.appDescriptorPath();
if (!doUpdateAppDescriptorFile(appDescriptorPath, PlaceHolders))
// If there is an error, prepareAppDescriptorFile() will raise it
return false;
@@ -295,8 +295,8 @@ bool BlackBerryCreatePackageStep::init()
args << QLatin1String("-storepass");
args << m_keystorePassword;
}
- args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath()));
- args << QnxUtils::addQuotes(QDir::toNativeSeparators(appDescriptorPath));
+ args << QLatin1String("-package") << QnxUtils::addQuotes(info.packagePath().toUserOutput());
+ args << QnxUtils::addQuotes(appDescriptorPath.toUserOutput());
addCommand(packageCmd.toString(), args);
}
@@ -428,16 +428,16 @@ void BlackBerryCreatePackageStep::updateAppDescriptorFile()
doUpdateAppDescriptorFile(info.appDescriptorPath(), QtEnvironment);
}
-bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDescriptorPath,
+bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const Utils::FileName &appDescriptorPath,
QFlags<EditMode> types,
bool skipConfirmation)
{
- Core::FileChangeBlocker fb(appDescriptorPath);
+ Core::FileChangeBlocker fb(appDescriptorPath.toString());
BarDescriptorDocument doc;
QString errorString;
- if (!doc.open(&errorString, appDescriptorPath)) {
+ if (!doc.open(&errorString, appDescriptorPath.toString())) {
raiseError(tr("Error opening BAR application descriptor file \"%1\" - %2")
- .arg(QDir::toNativeSeparators(appDescriptorPath))
+ .arg(appDescriptorPath.toUserOutput())
.arg(errorString));
return false;
}
@@ -548,7 +548,7 @@ bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDe
if (!doc.save(&errorString)) {
raiseError(tr("Error saving BAR application descriptor file \"%1\" - %2")
- .arg(QDir::toNativeSeparators(appDescriptorPath))
+ .arg(appDescriptorPath.toUserOutput())
.arg(errorString));
return false;
}
diff --git a/src/plugins/qnx/blackberrycreatepackagestep.h b/src/plugins/qnx/blackberrycreatepackagestep.h
index 4be0c946c7..721d48cb8b 100644
--- a/src/plugins/qnx/blackberrycreatepackagestep.h
+++ b/src/plugins/qnx/blackberrycreatepackagestep.h
@@ -106,7 +106,7 @@ protected:
private:
void ctor();
- bool doUpdateAppDescriptorFile(const QString &appDescriptorPath,
+ bool doUpdateAppDescriptorFile(const Utils::FileName &appDescriptorPath,
QFlags<EditMode> types,
bool skipConfirmation = false);
diff --git a/src/plugins/qnx/blackberrydeployinformation.cpp b/src/plugins/qnx/blackberrydeployinformation.cpp
index 126f4d20a6..fa81f9b403 100644
--- a/src/plugins/qnx/blackberrydeployinformation.cpp
+++ b/src/plugins/qnx/blackberrydeployinformation.cpp
@@ -56,18 +56,18 @@ const char TARGET_KEY[] = "Qnx.BlackBerry.DeployInformation.Target";
const char SOURCE_KEY[] = "Qnx.BlackBerry.DeployInformation.Source";
}
-QString BarPackageDeployInformation::appDescriptorPath() const
+Utils::FileName BarPackageDeployInformation::appDescriptorPath() const
{
if (userAppDescriptorPath.isEmpty())
- return sourceDir + QLatin1String("/bar-descriptor.xml");
+ return Utils::FileName(sourceDir).appendPath(QLatin1String("bar-descriptor.xml"));
return userAppDescriptorPath;
}
-QString BarPackageDeployInformation::packagePath() const
+Utils::FileName BarPackageDeployInformation::packagePath() const
{
if (userPackagePath.isEmpty())
- return buildDir + QLatin1Char('/') + targetName + QLatin1String(".bar");
+ return Utils::FileName(buildDir).appendPath(targetName).appendString(QLatin1String(".bar"));
return userPackagePath;
}
@@ -111,9 +111,9 @@ QVariant BlackBerryDeployInformation::data(const QModelIndex &index, int role) c
return di.enabled ? Qt::Checked : Qt::Unchecked;
} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn)
- return QDir::toNativeSeparators(di.appDescriptorPath());
+ return di.appDescriptorPath().toUserOutput();
else if (index.column() == PackageColumn)
- return QDir::toNativeSeparators(di.packagePath());
+ return di.packagePath().toUserOutput();
}
return QVariant();
@@ -148,9 +148,9 @@ bool BlackBerryDeployInformation::setData(const QModelIndex &index, const QVaria
di.enabled = static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked;
} else if (role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn)
- di.userAppDescriptorPath = value.toString();
+ di.userAppDescriptorPath = Utils::FileName::fromString(value.toString());
else if (index.column() == PackageColumn)
- di.userPackagePath = value.toString();
+ di.userPackagePath = Utils::FileName::fromString(value.toString());
}
emit dataChanged(index, index);
@@ -200,11 +200,11 @@ QVariantMap BlackBerryDeployInformation::toMap() const
QVariantMap deployInfoMap;
deployInfoMap[QLatin1String(ENABLED_KEY)] = deployInfo.enabled;
- deployInfoMap[QLatin1String(APPDESCRIPTOR_KEY)] = deployInfo.userAppDescriptorPath;
- deployInfoMap[QLatin1String(PACKAGE_KEY)] = deployInfo.userPackagePath;
- deployInfoMap[QLatin1String(PROFILE_KEY)] = deployInfo.proFilePath;
+ deployInfoMap[QLatin1String(APPDESCRIPTOR_KEY)] = deployInfo.userAppDescriptorPath.toString();
+ deployInfoMap[QLatin1String(PACKAGE_KEY)] = deployInfo.userPackagePath.toString();
+ deployInfoMap[QLatin1String(PROFILE_KEY)] = deployInfo.proFilePath.toString();
deployInfoMap[QLatin1String(TARGET_KEY)] = deployInfo.targetName;
- deployInfoMap[QLatin1String(SOURCE_KEY)] = deployInfo.sourceDir;
+ deployInfoMap[QLatin1String(SOURCE_KEY)] = deployInfo.sourceDir.toString();
outerMap[QString::fromLatin1(DEPLOYINFO_KEY).arg(i)] = deployInfoMap;
}
@@ -228,11 +228,12 @@ void BlackBerryDeployInformation::fromMap(const QVariantMap &map)
const QString targetName = innerMap.value(QLatin1String(TARGET_KEY)).toString();
const QString sourceDir = innerMap.value(QLatin1String(SOURCE_KEY)).toString();
- BarPackageDeployInformation deployInformation(enabled, proFilePath, sourceDir,
- m_target->activeBuildConfiguration()->buildDirectory().toString(),
+ BarPackageDeployInformation deployInformation(enabled, Utils::FileName::fromString(proFilePath),
+ Utils::FileName::fromString(sourceDir),
+ m_target->activeBuildConfiguration()->buildDirectory(),
targetName);
- deployInformation.userAppDescriptorPath = appDescriptorPath;
- deployInformation.userPackagePath = packagePath;
+ deployInformation.userAppDescriptorPath = Utils::FileName::fromString(appDescriptorPath);
+ deployInformation.userPackagePath = Utils::FileName::fromString(packagePath);
m_deployInformation << deployInformation;
}
@@ -262,7 +263,7 @@ void BlackBerryDeployInformation::updateModel()
|| !m_deployInformation[i].userPackagePath.isEmpty())) {
BarPackageDeployInformation deployInformation = m_deployInformation[i];
// In case the user resets the bar package path (or if it is empty already), we need the current build dir
- deployInformation.buildDir = m_target->activeBuildConfiguration()->buildDirectory().toString();
+ deployInformation.buildDir = m_target->activeBuildConfiguration()->buildDirectory();
keep << deployInformation;
nodeFound = true;
break;
@@ -315,8 +316,7 @@ BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNo
{
QmakeProjectManager::TargetInformation ti = node->targetInformation();
- QFileInfo fi(node->path());
- const QString buildDir = m_target->activeBuildConfiguration()->buildDirectory().toString();
+ const Utils::FileName buildDir = m_target->activeBuildConfiguration()->buildDirectory();
- return BarPackageDeployInformation(true, node->path(), fi.absolutePath(), buildDir, ti.target);
+ return BarPackageDeployInformation(true, node->path(), node->path(), buildDir, ti.target);
}
diff --git a/src/plugins/qnx/blackberrydeployinformation.h b/src/plugins/qnx/blackberrydeployinformation.h
index a53612ff5c..0e05941006 100644
--- a/src/plugins/qnx/blackberrydeployinformation.h
+++ b/src/plugins/qnx/blackberrydeployinformation.h
@@ -33,6 +33,8 @@
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
+#include <utils/fileutils.h>
+
#include <QAbstractTableModel>
namespace ProjectExplorer { class Target; }
@@ -47,8 +49,11 @@ namespace Internal {
class BarPackageDeployInformation {
public:
- BarPackageDeployInformation(bool enabled, const QString &proFilePath, const QString &sourceDir,
- const QString &buildDir, const QString &targetName)
+ BarPackageDeployInformation(bool enabled,
+ const Utils::FileName &proFilePath,
+ const Utils::FileName &sourceDir,
+ const Utils::FileName &buildDir,
+ const QString &targetName)
: enabled(enabled)
, proFilePath(proFilePath)
, sourceDir(sourceDir)
@@ -57,17 +62,17 @@ public:
{
}
- QString appDescriptorPath() const;
- QString packagePath() const;
+ Utils::FileName appDescriptorPath() const;
+ Utils::FileName packagePath() const;
bool enabled;
- QString proFilePath;
- QString sourceDir;
- QString buildDir;
+ Utils::FileName proFilePath;
+ Utils::FileName sourceDir;
+ Utils::FileName buildDir;
QString targetName;
- QString userAppDescriptorPath;
- QString userPackagePath;
+ Utils::FileName userAppDescriptorPath;
+ Utils::FileName userPackagePath;
};
class BlackBerryDeployInformation : public QAbstractTableModel
diff --git a/src/plugins/qnx/blackberrydeploystep.cpp b/src/plugins/qnx/blackberrydeploystep.cpp
index 82d9826e21..ebce6d5029 100644
--- a/src/plugins/qnx/blackberrydeploystep.cpp
+++ b/src/plugins/qnx/blackberrydeploystep.cpp
@@ -99,7 +99,7 @@ bool BlackBerryDeployStep::init()
args << QLatin1String("-device") << deviceHost();
if (!password().isEmpty())
args << QLatin1String("-password") << password();
- args << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath()));
+ args << QnxUtils::addQuotes(info.packagePath().toUserOutput());
addCommand(deployCmd.toString(), args);
}
@@ -114,8 +114,9 @@ void BlackBerryDeployStep::run(QFutureInterface<bool> &fi)
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
- if (!QFileInfo::exists(info.packagePath())) {
- raiseError(tr("Package \"%1\" does not exist. Create the package first.").arg(info.packagePath()));
+ if (!info.packagePath().exists()) {
+ raiseError(tr("Package \"%1\" does not exist. Create the package first.")
+ .arg(info.packagePath().toUserOutput()));
fi.reportResult(false);
return;
}
diff --git a/src/plugins/qnx/blackberryrunconfiguration.cpp b/src/plugins/qnx/blackberryrunconfiguration.cpp
index 99612ac010..aca6eda098 100644
--- a/src/plugins/qnx/blackberryrunconfiguration.cpp
+++ b/src/plugins/qnx/blackberryrunconfiguration.cpp
@@ -46,7 +46,7 @@ using namespace Qnx;
using namespace Qnx::Internal;
using namespace ProjectExplorer;
-BlackBerryRunConfiguration::BlackBerryRunConfiguration(Target *parent, Core::Id id, const QString &path)
+BlackBerryRunConfiguration::BlackBerryRunConfiguration(Target *parent, Core::Id id, const Utils::FileName &path)
: RunConfiguration(parent, id)
, m_proFilePath(path)
{
@@ -72,7 +72,7 @@ void BlackBerryRunConfiguration::init()
void BlackBerryRunConfiguration::updateDisplayName()
{
if (!m_proFilePath.isEmpty())
- setDefaultDisplayName(QFileInfo(m_proFilePath).completeBaseName());
+ setDefaultDisplayName(m_proFilePath.toFileInfo().completeBaseName());
else
setDefaultDisplayName(tr("Run on BlackBerry device"));
}
@@ -82,7 +82,7 @@ QWidget *BlackBerryRunConfiguration::createConfigurationWidget()
return new BlackBerryRunConfigurationWidget(this);
}
-QString BlackBerryRunConfiguration::proFilePath() const
+Utils::FileName BlackBerryRunConfiguration::proFilePath() const
{
return m_proFilePath;
}
@@ -97,24 +97,23 @@ QString BlackBerryRunConfiguration::deviceName() const
return device->displayName();
}
-QString BlackBerryRunConfiguration::barPackage() const
+Utils::FileName BlackBerryRunConfiguration::barPackage() const
{
BlackBerryDeployConfiguration *dc = deployConfiguration();
if (!dc)
- return QString();
+ return Utils::FileName();
QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation package, packages) {
if (package.proFilePath == proFilePath())
return package.packagePath();
}
- return QString();
+ return Utils::FileName();
}
QString BlackBerryRunConfiguration::localExecutableFilePath() const
{
- return target()->applicationTargets()
- .targetForProject(Utils::FileName::fromString(m_proFilePath)).toString();
+ return target()->applicationTargets().targetForProject(m_proFilePath).toString();
}
bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
@@ -122,8 +121,9 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
if (!RunConfiguration::fromMap(map))
return false;
- m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString();
- if (m_proFilePath.isEmpty() || !QFileInfo::exists(m_proFilePath))
+ m_proFilePath = Utils::FileName::fromUserInput(
+ map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString());
+ if (m_proFilePath.isEmpty() || !m_proFilePath.exists())
return false;
init();
@@ -133,7 +133,7 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
QVariantMap BlackBerryRunConfiguration::toMap() const
{
QVariantMap map(RunConfiguration::toMap());
- map.insert(QLatin1String(Constants::QNX_PROFILEPATH_KEY), m_proFilePath);
+ map.insert(QLatin1String(Constants::QNX_PROFILEPATH_KEY), m_proFilePath.toString());
return map;
}
@@ -144,5 +144,6 @@ BlackBerryDeployConfiguration *BlackBerryRunConfiguration::deployConfiguration()
QString BlackBerryRunConfiguration::key() const
{
- return barPackage() + QLatin1Char('_') + BlackBerryDeviceConfiguration::device(target()->kit())->sshParameters().host;
+ return barPackage().toString() + QLatin1Char('_')
+ + BlackBerryDeviceConfiguration::device(target()->kit())->sshParameters().host;
}
diff --git a/src/plugins/qnx/blackberryrunconfiguration.h b/src/plugins/qnx/blackberryrunconfiguration.h
index 1d3940c751..daf3fcc892 100644
--- a/src/plugins/qnx/blackberryrunconfiguration.h
+++ b/src/plugins/qnx/blackberryrunconfiguration.h
@@ -35,6 +35,8 @@
#include <projectexplorer/runconfiguration.h>
+#include <utils/fileutils.h>
+
namespace ProjectExplorer { class Target; }
namespace QmakeProjectManager {
@@ -53,14 +55,15 @@ class BlackBerryRunConfiguration : public ProjectExplorer::RunConfiguration
friend class BlackBerryRunConfigurationFactory;
public:
- explicit BlackBerryRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
+ explicit BlackBerryRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
+ const Utils::FileName &path);
QWidget *createConfigurationWidget();
- QString proFilePath() const;
+ Utils::FileName proFilePath() const;
QString deviceName() const;
- QString barPackage() const;
+ Utils::FileName barPackage() const;
QString localExecutableFilePath() const;
@@ -82,7 +85,7 @@ private:
void init();
void updateDisplayName();
- QString m_proFilePath;
+ Utils::FileName m_proFilePath;
};
} // namespace Internal
diff --git a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
index 3a29033bca..f8d2160f90 100644
--- a/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
+++ b/src/plugins/qnx/blackberryrunconfigurationfactory.cpp
@@ -43,9 +43,9 @@
using namespace Qnx;
using namespace Qnx::Internal;
-static QString pathFromId(Core::Id id)
+static Utils::FileName pathFromId(Core::Id id)
{
- return id.suffixAfter(Constants::QNX_BB_RUNCONFIGURATION_PREFIX);
+ return Utils::FileName::fromString(id.suffixAfter(Constants::QNX_BB_RUNCONFIGURATION_PREFIX));
}
BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) :
@@ -72,12 +72,12 @@ QList<Core::Id> BlackBerryRunConfigurationFactory::availableCreationIds(ProjectE
QString BlackBerryRunConfigurationFactory::displayNameForId(Core::Id id) const
{
- const QString path = pathFromId(id);
+ const Utils::FileName path = pathFromId(id);
if (path.isEmpty())
return QString();
if (id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))
- return QFileInfo(path).completeBaseName();
+ return path.toFileInfo().completeBaseName();
return QString();
}
@@ -117,7 +117,8 @@ ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::doRestore(
const QVariantMap &map)
{
Q_UNUSED(map);
- return new BlackBerryRunConfiguration(parent, Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX), QString());
+ return new BlackBerryRunConfiguration(parent, Core::Id(Constants::QNX_BB_RUNCONFIGURATION_PREFIX),
+ Utils::FileName());
}
bool BlackBerryRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,
diff --git a/src/plugins/qnx/blackberryrunconfigurationwidget.cpp b/src/plugins/qnx/blackberryrunconfigurationwidget.cpp
index 1621b0ddfd..0cebcc9105 100644
--- a/src/plugins/qnx/blackberryrunconfigurationwidget.cpp
+++ b/src/plugins/qnx/blackberryrunconfigurationwidget.cpp
@@ -57,5 +57,5 @@ BlackBerryRunConfigurationWidget::~BlackBerryRunConfigurationWidget()
void BlackBerryRunConfigurationWidget::updateUi()
{
m_ui->deviceLabel->setText(m_runConfiguration->deviceName());
- m_ui->packageLabel->setText(m_runConfiguration->barPackage());
+ m_ui->packageLabel->setText(m_runConfiguration->barPackage().toString());
}
diff --git a/src/plugins/qnx/qnxrunconfigurationfactory.cpp b/src/plugins/qnx/qnxrunconfigurationfactory.cpp
index 74cda47b7c..cd5ad7b035 100644
--- a/src/plugins/qnx/qnxrunconfigurationfactory.cpp
+++ b/src/plugins/qnx/qnxrunconfigurationfactory.cpp
@@ -44,9 +44,9 @@
using namespace Qnx;
using namespace Qnx::Internal;
-static QString pathFromId(Core::Id id)
+static Utils::FileName pathFromId(Core::Id id)
{
- return id.suffixAfter(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
+ return Utils::FileName::fromString(id.suffixAfter(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX));
}
QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
@@ -74,12 +74,12 @@ QList<Core::Id> QnxRunConfigurationFactory::availableCreationIds(ProjectExplorer
QString QnxRunConfigurationFactory::displayNameForId(Core::Id id) const
{
- const QString path = pathFromId(id);
+ const Utils::FileName path = pathFromId(id);
if (path.isEmpty())
return QString();
if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))
- return tr("%1 on QNX Device").arg(QFileInfo(path).completeBaseName());
+ return tr("%1 on QNX Device").arg(path.toFileInfo().completeBaseName());
return QString();
}
@@ -98,7 +98,7 @@ bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, Core
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id)
{
- const QString projectFilePath = pathFromId(id);
+ const Utils::FileName projectFilePath = pathFromId(id);
const QmakeProjectManager::QmakeProject * const qt4Project
= qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project());
QTC_ASSERT(qt4Project, return 0);
diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp
index 2b92b1f309..90361b2463 100644
--- a/src/plugins/resourceeditor/resourceeditorplugin.cpp
+++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp
@@ -263,7 +263,7 @@ void ResourceEditorPlugin::renameFileContextMenu()
void ResourceEditorPlugin::removeFileContextMenu()
{
ResourceFolderNode *rfn = static_cast<ResourceFolderNode *>(ProjectTree::currentNode());
- QString path = rfn->path();
+ QString path = rfn->path().toString();
FolderNode *parent = rfn->parentFolderNode();
if (!parent->removeFiles(QStringList() << path))
QMessageBox::warning(Core::ICore::mainWindow(),
@@ -273,7 +273,7 @@ void ResourceEditorPlugin::removeFileContextMenu()
void ResourceEditorPlugin::openEditorContextMenu()
{
- Core::EditorManager::openEditor(ProjectTree::currentNode()->path());
+ Core::EditorManager::openEditor(ProjectTree::currentNode()->path().toString());
}
void ResourceEditorPlugin::copyPathContextMenu()
@@ -333,7 +333,7 @@ void ResourceEditorPlugin::updateContextActions(Node *node, Project *)
m_renamePrefix->setVisible(isResourceFolder);
if (isResourceNode)
- Core::DocumentManager::populateOpenWithMenu(m_openWithMenu, node->path());
+ Core::DocumentManager::populateOpenWithMenu(m_openWithMenu, node->path().toString());
else
m_openWithMenu->clear();
m_openWithMenu->menuAction()->setVisible(!m_openWithMenu->actions().isEmpty());
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index ca15ac51ba..96ed4ea5cc 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -60,13 +60,16 @@ static bool priority(const QStringList &files)
return false;
}
-static bool addFilesToResource(const QString &resourceFile, const QStringList &filePaths, QStringList *notAdded,
- const QString &prefix, const QString &lang)
+static bool addFilesToResource(const Utils::FileName &resourceFile,
+ const QStringList &filePaths,
+ QStringList *notAdded,
+ const QString &prefix,
+ const QString &lang)
{
if (notAdded)
*notAdded = filePaths;
- ResourceFile file(resourceFile);
+ ResourceFile file(resourceFile.toString());
if (!file.load())
return false;
@@ -85,9 +88,9 @@ static bool addFilesToResource(const QString &resourceFile, const QStringList &f
}
}
- Core::DocumentManager::expectFileChange(resourceFile);
+ Core::DocumentManager::expectFileChange(resourceFile.toString());
file.save();
- Core::DocumentManager::unexpectFileChange(resourceFile);
+ Core::DocumentManager::unexpectFileChange(resourceFile.toString());
return true;
}
@@ -109,19 +112,18 @@ static bool sortNodesByPath(ProjectExplorer::Node *a, ProjectExplorer::Node *b)
return a->path() < b->path();
}
-ResourceTopLevelNode::ResourceTopLevelNode(const QString &filePath, FolderNode *parent)
+ResourceTopLevelNode::ResourceTopLevelNode(const Utils::FileName &filePath, FolderNode *parent)
: ProjectExplorer::FolderNode(filePath)
{
- setIcon(Core::FileIconProvider::icon(filePath));
+ setIcon(Core::FileIconProvider::icon(filePath.toString()));
m_document = new ResourceFileWatcher(this);
Core::DocumentManager::addDocument(m_document);
- Utils::FileName base = Utils::FileName::fromString(parent->path());
- Utils::FileName file = Utils::FileName::fromString(filePath);
- if (file.isChildOf(base))
- setDisplayName(file.relativeChildPath(base).toString());
+ Utils::FileName base = parent->path();
+ if (filePath.isChildOf(base))
+ setDisplayName(filePath.relativeChildPath(base).toString());
else
- setDisplayName(file.toString());
+ setDisplayName(filePath.toString());
}
ResourceTopLevelNode::~ResourceTopLevelNode()
@@ -135,7 +137,7 @@ void ResourceTopLevelNode::update()
QList<ProjectExplorer::FolderNode *> newFolderList;
QMap<QPair<QString, QString>, QList<ProjectExplorer::FileNode *> > filesToAdd;
- ResourceFile file(path());
+ ResourceFile file(path().toString());
if (file.load()) {
QSet<QPair<QString, QString > > prefixes;
@@ -156,9 +158,8 @@ void ResourceTopLevelNode::update()
for (int j = 0; j < filecount; ++j) {
const QString &fileName = file.file(i, j);
QString alias = file.alias(i, j);
- if (alias.isEmpty()) {
- alias = QFileInfo(path()).absoluteDir().relativeFilePath(fileName);
- }
+ if (alias.isEmpty())
+ alias = path().toFileInfo().absoluteDir().relativeFilePath(fileName);
if (fileNames.contains(fileName)) {
// The file name is duplicated, skip it
// Note: this is wrong, but the qrceditor doesn't allow it either
@@ -170,7 +171,8 @@ void ResourceTopLevelNode::update()
const QString qrcPath = QDir::cleanPath(prefixWithSlash + alias);
fileNames.insert(fileName);
filesToAdd[qMakePair(prefix, lang)]
- << new ResourceFileNode(fileName, qrcPath, this);
+ << new ResourceFileNode(Utils::FileName::fromString(fileName),
+ qrcPath, this);
}
}
@@ -222,31 +224,31 @@ bool ResourceTopLevelNode::removeFiles(const QStringList &filePaths, QStringList
bool ResourceTopLevelNode::addPrefix(const QString &prefix, const QString &lang)
{
- ResourceFile file(path());
+ ResourceFile file(path().toString());
if (!file.load())
return false;
int index = file.addPrefix(prefix, lang);
if (index == -1)
return false;
- Core::DocumentManager::expectFileChange(path());
+ Core::DocumentManager::expectFileChange(path().toString());
file.save();
- Core::DocumentManager::unexpectFileChange(path());
+ Core::DocumentManager::unexpectFileChange(path().toString());
return true;
}
bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &lang)
{
- ResourceFile file(path());
+ ResourceFile file(path().toString());
if (!file.load())
return false;
for (int i = 0; i < file.prefixCount(); ++i) {
if (file.prefix(i) == prefix
&& file.lang(i) == lang) {
file.removePrefix(i);
- Core::DocumentManager::expectFileChange(path());
+ Core::DocumentManager::expectFileChange(path().toString());
file.save();
- Core::DocumentManager::unexpectFileChange(path());
+ Core::DocumentManager::unexpectFileChange(path().toString());
return true;
}
}
@@ -256,7 +258,7 @@ bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &la
ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
- .arg(Utils::FileName::fromString(path()).fileName())
+ .arg(path().fileName())
.arg(QLatin1Char('/'));
int p = -1;
@@ -283,7 +285,7 @@ bool ResourceTopLevelNode::showInSimpleTree() const
}
ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lang, ResourceTopLevelNode *parent)
- : ProjectExplorer::FolderNode(parent->path() + QLatin1Char('/') + prefix),
+ : ProjectExplorer::FolderNode(parent->path().appendPath(prefix)),
// TOOD Why add existing directory doesn't work
m_topLevelNode(parent),
m_prefix(prefix),
@@ -325,7 +327,7 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *
{
if (notRemoved)
*notRemoved = filePaths;
- ResourceFile file(m_topLevelNode->path());
+ ResourceFile file(m_topLevelNode->path().toString());
if (!file.load())
return false;
int index = file.indexOfPrefix(m_prefix, m_lang);
@@ -340,16 +342,16 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *
file.removeFile(index, j);
--j;
}
- Core::DocumentManager::expectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save();
- Core::DocumentManager::unexpectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true;
}
bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newFilePath)
{
- ResourceFile file(m_topLevelNode->path());
+ ResourceFile file(m_topLevelNode->path().toString());
if (!file.load())
return false;
int index = file.indexOfPrefix(m_prefix, m_lang);
@@ -359,9 +361,9 @@ bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newF
for (int j = 0; j < file.fileCount(index); ++j) {
if (file.file(index, j) == filePath) {
file.replaceFile(index, j, newFilePath);
- Core::DocumentManager::expectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save();
- Core::DocumentManager::unexpectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true;
}
}
@@ -371,7 +373,7 @@ bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newF
bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang)
{
- ResourceFile file(m_topLevelNode->path());
+ ResourceFile file(m_topLevelNode->path().toString());
if (!file.load())
return false;
int index = file.indexOfPrefix(m_prefix, m_lang);
@@ -381,16 +383,16 @@ bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang
if (!file.replacePrefixAndLang(index, prefix, lang))
return false;
- Core::DocumentManager::expectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save();
- Core::DocumentManager::unexpectFileChange(m_topLevelNode->path());
+ Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true;
}
ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files, Node *context) const
{
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
- .arg(Utils::FileName::fromString(m_topLevelNode->path()).fileName())
+ .arg(m_topLevelNode->path().fileName())
.arg(displayName());
int p = -1; // never the default
@@ -447,7 +449,7 @@ ResourceFileWatcher::ResourceFileWatcher(ResourceTopLevelNode *node)
{
setId("ResourceNodeWatcher");
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
- setFilePath(Utils::FileName::fromString(node->path()));
+ setFilePath(node->path());
}
bool ResourceFileWatcher::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -495,13 +497,13 @@ bool ResourceFileWatcher::reload(QString *errorString, ReloadFlag flag, ChangeTy
return true;
}
-ResourceFileNode::ResourceFileNode(const QString &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel)
+ResourceFileNode::ResourceFileNode(const Utils::FileName &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel)
: ProjectExplorer::FileNode(filePath, ProjectExplorer::UnknownFileType, false),
m_qrcPath(qrcPath)
{
- QString baseDir = QFileInfo(topLevel->path()).absolutePath();
- m_displayName = QDir(baseDir).relativeFilePath(filePath);
+ QDir baseDir = topLevel->path().toFileInfo().absoluteDir();
+ m_displayName = QDir(baseDir).relativeFilePath(filePath.toString());
}
QString ResourceFileNode::displayName() const
diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h
index 7baf92f7aa..139029978b 100644
--- a/src/plugins/resourceeditor/resourcenode.h
+++ b/src/plugins/resourceeditor/resourcenode.h
@@ -45,7 +45,7 @@ namespace Internal { class ResourceFileWatcher; }
class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode
{
public:
- ResourceTopLevelNode(const QString &filePath, FolderNode *parent);
+ ResourceTopLevelNode(const Utils::FileName &filePath, FolderNode *parent);
~ResourceTopLevelNode();
void update();
@@ -96,7 +96,7 @@ private:
class ResourceFileNode : public ProjectExplorer::FileNode
{
public:
- ResourceFileNode(const QString &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel);
+ ResourceFileNode(const Utils::FileName &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel);
QString displayName() const;
QString qrcPath() const;
diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp
index 2e6ae768d8..78838263fb 100644
--- a/src/plugins/valgrind/suppressiondialog.cpp
+++ b/src/plugins/valgrind/suppressiondialog.cpp
@@ -213,7 +213,7 @@ void SuppressionDialog::accept()
return;
// Add file to project if there is a project containing this file on the file system.
- if (!ProjectExplorer::SessionManager::projectForFile(path)) {
+ if (!ProjectExplorer::SessionManager::projectForFile(Utils::FileName::fromString(path))) {
foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
if (path.startsWith(p->projectDirectory().toString())) {
p->rootProjectNode()->addFiles(QStringList() << path);
diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
index 678ed2d975..d57fea1732 100644
--- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
+++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp
@@ -61,7 +61,8 @@ QString testDataDir = QLatin1String(SRCDIR "/data");
static QmlProjectItem *loadQmlProject(QString name, QString *error)
{
- return QmlProjectFileFormat::parseProjectFile(testDataDir + "/" + name + ".qmlproject", error);
+ return QmlProjectFileFormat::parseProjectFile(
+ Utils::FileName::fromString(testDataDir).appendPath(name).appendString(".qmlproject"), error);
}
void tst_FileFormat::testFileFilter()