ProjectExplorer: Use FileName for Node::path

Change-Id: I4a41cfb629be8bb06b4b0616cd4475525e617a51
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-02-02 00:37:38 +02:00
committed by Orgad Shaneh
parent 033a628cdc
commit 88e7f935f4
86 changed files with 616 additions and 551 deletions

View File

@@ -87,9 +87,8 @@ bool checkPackageName(const QString &packageName)
return QRegExp(packageNameRegExp).exactMatch(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()) { foreach (Project *project, SessionManager::projects()) {
if (!project->activeTarget()) if (!project->activeTarget())
continue; continue;
@@ -476,8 +475,7 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox() void AndroidManifestEditorWidget::updateTargetComboBox()
{ {
const QString docPath(m_textEditorWidget->textDocument()->filePath().toString()); Project *project = androidProject(m_textEditorWidget->textDocument()->filePath());
Project *project = androidProject(docPath);
QStringList items; QStringList items;
if (project) { if (project) {
Kit *kit = project->activeTarget()->kit(); Kit *kit = project->activeTarget()->kit();
@@ -696,7 +694,6 @@ void AndroidManifestEditorWidget::updateInfoBar()
void AndroidManifestEditorWidget::updateSdkVersions() void AndroidManifestEditorWidget::updateSdkVersions()
{ {
const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
QPair<int, int> apiLevels = AndroidManager::apiLevelRange(); QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i) for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
m_androidMinSdkVersion->addItem(tr("API %1: %2") m_androidMinSdkVersion->addItem(tr("API %1: %2")

View File

@@ -272,7 +272,7 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
// nodes later. // nodes later.
QHash<QString, Node *> nodeHash; QHash<QString, Node *> nodeHash;
foreach (Node * node, nodes(m_rootNode)) 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 // Add the sources to the filenode project tree. Sources
// inside the same directory are grouped into a folder-node. // 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); const QString filePath = directory.absoluteFilePath(file);
if (nodeHash.contains(filePath)) { if (nodeHash.contains(filePath)) {
nodeHash.remove(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 { } else {
if (file == QLatin1String("Makefile.am") || file == QLatin1String("configure.ac")) fileNodes.append(new FileNode(Utils::FileName::fromString(filePath),
fileNodes.append(new FileNode(filePath, ProjectFileType, false)); ResourceType, false));
else
fileNodes.append(new FileNode(filePath, ResourceType, false));
} }
} }
@@ -351,9 +352,9 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
FolderNode *AutotoolsProject::insertFolderNode(const QDir &nodeDir, QHash<QString, Node *> &nodes) FolderNode *AutotoolsProject::insertFolderNode(const QDir &nodeDir, QHash<QString, Node *> &nodes)
{ {
const QString nodePath = nodeDir.absolutePath(); const Utils::FileName nodePath = Utils::FileName::fromString(nodeDir.absolutePath());
QFileInfo rootInfo(m_rootNode->path()); QFileInfo rootInfo = m_rootNode->path().toFileInfo();
const QString rootPath = rootInfo.absolutePath(); const Utils::FileName rootPath = Utils::FileName::fromString(rootInfo.absolutePath());
// Do not create a folder for the root node // Do not create a folder for the root node
if (rootPath == nodePath) if (rootPath == nodePath)
@@ -379,7 +380,7 @@ FolderNode *AutotoolsProject::insertFolderNode(const QDir &nodeDir, QHash<QStrin
} }
parentFolder->addFolderNodes(QList<FolderNode *>() << folder); parentFolder->addFolderNodes(QList<FolderNode *>() << folder);
nodes.insert(nodePath, folder); nodes.insert(nodePath.toString(), folder);
return folder; return folder;
} }

View File

@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) : AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
ProjectNode(projectFile->filePath().toString()), ProjectNode(projectFile->filePath()),
m_project(project), m_project(project),
m_projectFile(projectFile) m_projectFile(projectFile)
{ {

View File

@@ -731,7 +731,7 @@ QStringList Parser::projectNodeFileList(const FolderNode *node) const
if (file->isGenerated()) if (file->isGenerated())
continue; continue;
list << file->path(); list << file->path().toString();
} }
foreach (const FolderNode *folder, subFolderNodes) { foreach (const FolderNode *folder, subFolderNodes) {
@@ -756,7 +756,7 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
if (!node) if (!node)
return projectList; return projectList;
const QString &nodePath = node->path(); const QString nodePath = node->path().toString();
// our own files // our own files
QStringList fileList; QStringList fileList;
@@ -770,8 +770,8 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
d->cachedPrjFileLists[nodePath] = fileList; d->cachedPrjFileLists[nodePath] = fileList;
} }
if (fileList.count() > 0) { if (fileList.count() > 0) {
addProject(item, fileList, node->path()); addProject(item, fileList, node->path().toString());
projectList << node->path(); projectList << node->path().toString();
} }
// subnodes // subnodes
@@ -779,7 +779,7 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const Projec
foreach (const ProjectNode *project, projectNodes) { foreach (const ProjectNode *project, projectNodes) {
ParserTreeItem::Ptr itemPrj(new ParserTreeItem()); ParserTreeItem::Ptr itemPrj(new ParserTreeItem());
SymbolInformation information(project->displayName(), project->path()); SymbolInformation information(project->displayName(), project->path().toString());
projectList += addProjectNode(itemPrj, project); projectList += addProjectNode(itemPrj, project);
@@ -800,7 +800,7 @@ QStringList Parser::getAllFiles(const ProjectNode *node)
if (!node) if (!node)
return fileList; return fileList;
const QString &nodePath = node->path(); const QString nodePath = node->path().toString();
CitCachedPrjFileLists cit = d->cachedPrjFileLists.find(nodePath); CitCachedPrjFileLists cit = d->cachedPrjFileLists.find(nodePath);
// try to improve parsing speed by internal cache // try to improve parsing speed by internal cache
@@ -827,7 +827,7 @@ void Parser::addFlatTree(const ParserTreeItem::Ptr &item, const ProjectNode *nod
fileList.removeDuplicates(); fileList.removeDuplicates();
if (fileList.count() > 0) { if (fileList.count() > 0) {
addProject(item, fileList, node->path()); addProject(item, fileList, node->path().toString());
} }
} }

View File

@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
info.setCustomButtonInfo(tr("Build now"), [document]() { info.setCustomButtonInfo(tr("Build now"), [document]() {
foreach (Project *p, SessionManager::projects()) { foreach (Project *p, SessionManager::projects()) {
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) { if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
if (cmakeProject->isProjectFile(document->filePath().toString())) { if (cmakeProject->isProjectFile(document->filePath())) {
ProjectExplorerPlugin::buildProject(cmakeProject); ProjectExplorerPlugin::buildProject(cmakeProject);
break; break;
} }

View File

@@ -85,7 +85,7 @@ using namespace Utils;
/*! /*!
\class CMakeProject \class CMakeProject
*/ */
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName) CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
: m_manager(manager), : m_manager(manager),
m_activeTarget(0), m_activeTarget(0),
m_fileName(fileName), m_fileName(fileName),
@@ -96,7 +96,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT)); setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
m_projectName = QFileInfo(fileName).absoluteDir().dirName(); m_projectName = fileName.parentDir().fileName();
m_file = new CMakeFile(this, fileName); m_file = new CMakeFile(this, fileName);
@@ -133,8 +133,8 @@ void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfigur
if (!cbpFileFi.exists()) { if (!cbpFileFi.exists()) {
mode = CMakeOpenProjectWizard::NeedToCreate; mode = CMakeOpenProjectWizard::NeedToCreate;
} else { } else {
foreach (const QString &file, m_watchedFiles) { foreach (const FileName &file, m_watchedFiles) {
if (QFileInfo(file).lastModified() > cbpFileFi.lastModified()) { if (file.toFileInfo().lastModified() > cbpFileFi.lastModified()) {
mode = CMakeOpenProjectWizard::NeedToUpdate; mode = CMakeOpenProjectWizard::NeedToUpdate;
break; break;
} }
@@ -234,7 +234,7 @@ bool CMakeProject::parseCMakeLists()
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments())
if (isProjectFile(document->filePath().toString())) if (isProjectFile(document->filePath()))
document->infoBar()->removeInfo("CMakeEditor.RunCMake"); document->infoBar()->removeInfo("CMakeEditor.RunCMake");
// Find cbp file // Find cbp file
@@ -268,14 +268,14 @@ bool CMakeProject::parseCMakeLists()
//qDebug()<<"Building Tree"; //qDebug()<<"Building Tree";
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList(); QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
QSet<QString> projectFiles; QSet<FileName> projectFiles;
if (cbpparser.hasCMakeFiles()) { if (cbpparser.hasCMakeFiles()) {
fileList.append(cbpparser.cmakeFileList()); fileList.append(cbpparser.cmakeFileList());
foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList()) foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList())
projectFiles.insert(node->path()); projectFiles.insert(node->path());
} else { } else {
// Manually add the CMakeLists.txt file // Manually add the CMakeLists.txt file
QString cmakeListTxt = projectDirectory().toString() + QLatin1String("/CMakeLists.txt"); FileName cmakeListTxt = projectDirectory().appendPath(QLatin1String("CMakeLists.txt"));
bool generated = false; bool generated = false;
fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated)); fileList.append(new ProjectExplorer::FileNode(cmakeListTxt, ProjectExplorer::ProjectFileType, generated));
projectFiles.insert(cmakeListTxt); projectFiles.insert(cmakeListTxt);
@@ -285,7 +285,7 @@ bool CMakeProject::parseCMakeLists()
m_files.clear(); m_files.clear();
foreach (ProjectExplorer::FileNode *fn, fileList) foreach (ProjectExplorer::FileNode *fn, fileList)
m_files.append(fn->path()); m_files.append(fn->path().toString());
m_files.sort(); m_files.sort();
buildTree(m_rootNode, fileList); buildTree(m_rootNode, fileList);
@@ -347,7 +347,7 @@ bool CMakeProject::parseCMakeLists()
return true; return true;
} }
bool CMakeProject::isProjectFile(const QString &fileName) bool CMakeProject::isProjectFile(const FileName &fileName)
{ {
return m_watchedFiles.contains(fileName); return m_watchedFiles.contains(fileName);
} }
@@ -409,7 +409,7 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
foreach (ProjectExplorer::FileNode *fn, added) { foreach (ProjectExplorer::FileNode *fn, added) {
// qDebug()<<"added"<<fn->path(); // qDebug()<<"added"<<fn->path();
// Get relative path to rootNode // Get relative path to rootNode
QString parentDir = QFileInfo(fn->path()).absolutePath(); QString parentDir = fn->path().toFileInfo().absolutePath();
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir); ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
folder->addFileNodes(QList<ProjectExplorer::FileNode *>()<< fn); 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) 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); QStringList parts = relativePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
ProjectExplorer::FolderNode *parent = rootNode; ProjectExplorer::FolderNode *parent = rootNode;
QString path = QFileInfo(rootNode->path()).path();
foreach (const QString &part, parts) { foreach (const QString &part, parts) {
path += QLatin1Char('/'); path.appendPath(part);
path += part;
// Find folder in subFolders // Find folder in subFolders
bool found = false; bool found = false;
foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) { foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
@@ -522,7 +522,6 @@ bool CMakeProject::fromMap(const QVariantMap &map)
} else { } else {
// We have a user file, but we could still be missing the cbp file // We have a user file, but we could still be missing the cbp file
// or simply run createXml with the saved settings // or simply run createXml with the saved settings
QFileInfo sourceFileInfo(m_fileName);
CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
if (!activeBC) if (!activeBC)
return false; return false;
@@ -532,7 +531,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing; CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
if (!cbpFileFi.exists()) if (!cbpFileFi.exists())
mode = CMakeOpenProjectWizard::NeedToCreate; mode = CMakeOpenProjectWizard::NeedToCreate;
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified()) else if (cbpFileFi.lastModified() < m_fileName.toFileInfo().lastModified())
mode = CMakeOpenProjectWizard::NeedToUpdate; mode = CMakeOpenProjectWizard::NeedToUpdate;
if (mode != CMakeOpenProjectWizard::Nothing) { if (mode != CMakeOpenProjectWizard::Nothing) {
@@ -737,12 +736,12 @@ void CMakeProject::createUiCodeModelSupport()
// CMakeFile // CMakeFile
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName) CMakeFile::CMakeFile(CMakeProject *parent, const FileName &fileName)
: Core::IDocument(parent), m_project(parent) : Core::IDocument(parent), m_project(parent)
{ {
setId("Cmake.ProjectFile"); setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE)); setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
setFilePath(FileName::fromString(fileName)); setFilePath(fileName);
} }
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave) bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -873,7 +872,7 @@ void CMakeCbpParser::sortFiles()
{ {
QLoggingCategory log("qtc.cmakeprojectmanager.filetargetmapping"); QLoggingCategory log("qtc.cmakeprojectmanager.filetargetmapping");
QList<FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) { QList<FileName> fileNames = Utils::transform(m_fileList, [] (FileNode *node) {
return FileName::fromString(node->path()); return node->path();
}); });
Utils::sort(fileNames); Utils::sort(fileNames);
@@ -1203,7 +1202,8 @@ void CMakeCbpParser::parseAdd()
void CMakeCbpParser::parseUnit() void CMakeCbpParser::parseUnit()
{ {
//qDebug()<<stream.attributes().value("filename"); //qDebug()<<stream.attributes().value("filename");
QString fileName = attributes().value(QLatin1String("filename")).toString(); FileName fileName =
FileName::fromUserInput(attributes().value(QLatin1String("filename")).toString());
m_parsingCmakeUnit = false; m_parsingCmakeUnit = false;
while (!atEnd()) { while (!atEnd()) {
readNext(); readNext();
@@ -1214,7 +1214,7 @@ void CMakeCbpParser::parseUnit()
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false)); m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else { } else {
bool generated = false; bool generated = false;
QString onlyFileName = FileName::fromString(fileName).fileName(); QString onlyFileName = fileName.fileName();
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))) if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h"))) || (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))) || (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))

View File

@@ -44,6 +44,8 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <utils/fileutils.h>
#include <QFuture> #include <QFuture>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QPushButton> #include <QPushButton>
@@ -92,7 +94,7 @@ class CMakeProject : public ProjectExplorer::Project
// for changeBuildDirectory // for changeBuildDirectory
friend class CMakeBuildSettingsWidget; friend class CMakeBuildSettingsWidget;
public: public:
CMakeProject(CMakeManager *manager, const QString &filename); CMakeProject(CMakeManager *manager, const Utils::FileName &filename);
~CMakeProject(); ~CMakeProject();
QString displayName() const; QString displayName() const;
@@ -108,7 +110,7 @@ public:
CMakeBuildTarget buildTargetForTitle(const QString &title); CMakeBuildTarget buildTargetForTitle(const QString &title);
bool isProjectFile(const QString &fileName); bool isProjectFile(const Utils::FileName &fileName);
bool parseCMakeLists(); bool parseCMakeLists();
@@ -142,7 +144,7 @@ private:
CMakeManager *m_manager; CMakeManager *m_manager;
ProjectExplorer::Target *m_activeTarget; ProjectExplorer::Target *m_activeTarget;
QString m_fileName; Utils::FileName m_fileName;
CMakeFile *m_file; CMakeFile *m_file;
QString m_projectName; QString m_projectName;
@@ -151,7 +153,7 @@ private:
QStringList m_files; QStringList m_files;
QList<CMakeBuildTarget> m_buildTargets; QList<CMakeBuildTarget> m_buildTargets;
QFileSystemWatcher *m_watcher; QFileSystemWatcher *m_watcher;
QSet<QString> m_watchedFiles; QSet<Utils::FileName> m_watchedFiles;
QFuture<void> m_codeModelFuture; QFuture<void> m_codeModelFuture;
}; };
@@ -185,7 +187,7 @@ private:
QList<ProjectExplorer::FileNode *> m_fileList; QList<ProjectExplorer::FileNode *> m_fileList;
QList<ProjectExplorer::FileNode *> m_cmakeFileList; QList<ProjectExplorer::FileNode *> m_cmakeFileList;
QSet<QString> m_processedUnits; QSet<Utils::FileName> m_processedUnits;
bool m_parsingCmakeUnit; bool m_parsingCmakeUnit;
CMakeBuildTarget m_buildTarget; CMakeBuildTarget m_buildTarget;
@@ -200,7 +202,7 @@ class CMakeFile : public Core::IDocument
{ {
Q_OBJECT Q_OBJECT
public: public:
CMakeFile(CMakeProject *parent, QString fileName); CMakeFile(CMakeProject *parent, const Utils::FileName &fileName);
bool save(QString *errorString, const QString &fileName, bool autoSave); bool save(QString *errorString, const QString &fileName, bool autoSave);

View File

@@ -112,14 +112,15 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QString *errorString) 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) if (errorString)
*errorString = tr("Failed opening project \"%1\": Project is not a file") *errorString = tr("Failed opening project \"%1\": Project is not a file")
.arg(fileName); .arg(file.toUserOutput());
return 0; return 0;
} }
return new CMakeProject(this, fileName); return new CMakeProject(this, file);
} }
QString CMakeManager::mimeType() const QString CMakeManager::mimeType() const

View File

@@ -33,7 +33,7 @@
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
CMakeProjectNode::CMakeProjectNode(const QString &fileName) CMakeProjectNode::CMakeProjectNode(const Utils::FileName &fileName)
: ProjectExplorer::ProjectNode(fileName) : ProjectExplorer::ProjectNode(fileName)
{ {
} }

View File

@@ -40,7 +40,7 @@ class CMakeProjectNode : public ProjectExplorer::ProjectNode
{ {
friend class CMakeProject; friend class CMakeProject;
public: public:
CMakeProjectNode(const QString &fileName); CMakeProjectNode(const Utils::FileName &fileName);
virtual bool showInSimpleTree() const; virtual bool showInSimpleTree() const;
virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const; virtual QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;

View File

@@ -51,8 +51,10 @@ static const char setupUiC[] = "setupUi";
// Find the generated "ui_form.h" header of the form via project. // Find the generated "ui_form.h" header of the form via project.
static QString generatedHeaderOf(const QString &uiFileName) 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 uiProject->generatedUiHeader(uiFileName);
}
return QString(); return QString();
} }

View File

@@ -513,16 +513,17 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
{ {
typedef QMap<int, Document::Ptr> DocumentMap; typedef QMap<int, Document::Ptr> DocumentMap;
const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath().toString(); const Utils::FileName currentUiFile = FormEditorW::activeEditor()->document()->filePath();
#if 0 #if 0
return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage); return Designer::Internal::navigateToSlot(currentUiFile.toString(), objectName,
signalSignature, parameterNames, errorMessage);
#endif #endif
// TODO: we should pass to findDocumentsIncluding an absolute path to generated .h file from ui. // 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(). // 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 // 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. // 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 (?) // 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 uiFolder = fi.absolutePath();
const QString uicedName = QLatin1String("ui_") + fi.completeBaseName() + QLatin1String(".h"); 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); const Project *uiProject = SessionManager::projectForFile(currentUiFile);
if (uiProject) { if (uiProject) {
for (Snapshot::const_iterator i = docTable.begin(), ei = docTable.end(); i != ei; ++i) { 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) if (project == uiProject)
newDocTable.insert(i.value()); newDocTable.insert(i.value());
} }

View File

@@ -74,10 +74,10 @@ void QrcFilesVisitor::visitFolderNode(FolderNode *folderNode)
{ {
foreach (const FileNode *fileNode, folderNode->fileNodes()) { foreach (const FileNode *fileNode, folderNode->fileNodes()) {
if (fileNode->fileType() == ResourceType) if (fileNode->fileType() == ResourceType)
m_qrcFiles.append(fileNode->path()); m_qrcFiles.append(fileNode->path().toString());
} }
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode)) if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(folderNode))
m_qrcFiles.append(folderNode->path()); m_qrcFiles.append(folderNode->path().toString());
} }
// ------------ ResourceHandler // ------------ ResourceHandler
@@ -125,7 +125,8 @@ void ResourceHandler::updateResources(bool updateProjectResources)
qDebug() << "ResourceHandler::updateResources()" << fileName; qDebug() << "ResourceHandler::updateResources()" << fileName;
// Filename could change in the meantime. // 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(); const bool dirty = m_form->property("_q_resourcepathchanged").toBool();
if (dirty) if (dirty)
m_form->setDirty(true); m_form->setDirty(true);

View File

@@ -94,15 +94,15 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
m_rootNode = new GenericProjectNode(this, m_creatorIDocument); m_rootNode = new GenericProjectNode(this, m_creatorIDocument);
FileNode *projectFilesNode = new FileNode(m_filesFileName, FileNode *projectFilesNode = new FileNode(Utils::FileName::fromString(m_filesFileName),
ProjectFileType, ProjectFileType,
/* generated = */ false); /* generated = */ false);
FileNode *projectIncludesNode = new FileNode(m_includesFileName, FileNode *projectIncludesNode = new FileNode(Utils::FileName::fromString(m_includesFileName),
ProjectFileType, ProjectFileType,
/* generated = */ false); /* generated = */ false);
FileNode *projectConfigNode = new FileNode(m_configFileName, FileNode *projectConfigNode = new FileNode(Utils::FileName::fromString(m_configFileName),
ProjectFileType, ProjectFileType,
/* generated = */ false); /* generated = */ false);

View File

@@ -43,7 +43,7 @@ namespace GenericProjectManager {
namespace Internal { namespace Internal {
GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IDocument *projectFile) GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IDocument *projectFile)
: ProjectNode(projectFile->filePath().toString()) : ProjectNode(projectFile->filePath())
, m_project(project) , m_project(project)
, m_projectFile(projectFile) , m_projectFile(projectFile)
{ {
@@ -104,7 +104,7 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QSet<QString> added = newFileList; QSet<QString> added = newFileList;
added.subtract(oldFileList); added.subtract(oldFileList);
QString baseDir = QFileInfo(path()).absolutePath(); QString baseDir = path().toFileInfo().absolutePath();
FilesInPathHash filesInPaths = sortFilesIntoPaths(baseDir, added); FilesInPathHash filesInPaths = sortFilesIntoPaths(baseDir, added);
FilesInPathHashConstIt cend = filesInPaths.constEnd(); FilesInPathHashConstIt cend = filesInPaths.constEnd();
@@ -120,7 +120,8 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QList<FileNode *> fileNodes; QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) { foreach (const QString &file, it.value()) {
FileType fileType = SourceType; // ### FIXME 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); fileNodes.append(fileNode);
} }
@@ -138,10 +139,11 @@ void GenericProjectNode::refresh(QSet<QString> oldFileList)
QList<FileNode *> fileNodes; QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) { foreach (const QString &file, it.value()) {
foreach (FileNode *fn, folder->fileNodes()) foreach (FileNode *fn, folder->fileNodes()) {
if (fn->path() == file) if (fn->path().toString() == file)
fileNodes.append(fn); fileNodes.append(fn);
} }
}
folder->removeFileNodes(fileNodes); folder->removeFileNodes(fileNodes);
} }
@@ -173,8 +175,8 @@ FolderNode *GenericProjectNode::createFolderByName(const QStringList &components
const QString component = components.at(end - 1); const QString component = components.at(end - 1);
const QString baseDir = QFileInfo(path()).path(); const Utils::FileName folderPath = path().parentDir().appendPath(folderName);
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); FolderNode *folder = new FolderNode(folderPath);
folder->setDisplayName(component); folder->setDisplayName(component);
FolderNode *parent = findFolderByName(components, end - 1); FolderNode *parent = findFolderByName(components, end - 1);
@@ -201,10 +203,11 @@ FolderNode *GenericProjectNode::findFolderByName(const QStringList &components,
if (!parent) if (!parent)
return 0; return 0;
const QString baseDir = QFileInfo(path()).path(); const QString baseDir = path().toFileInfo().path();
foreach (FolderNode *fn, parent->subFolderNodes()) foreach (FolderNode *fn, parent->subFolderNodes()) {
if (fn->path() == baseDir + QLatin1Char('/') + folderName) if (fn->path().toString() == baseDir + QLatin1Char('/') + folderName)
return fn; return fn;
}
return 0; return 0;
} }

View File

@@ -85,7 +85,7 @@ private:
QStandardItemModel m_deviceTypeModel; 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) : RunConfiguration(parent, id)
, m_profilePath(path) , m_profilePath(path)
{ {
@@ -190,7 +190,7 @@ IosDeployStep *IosRunConfiguration::deployStep() const
return step; return step;
} }
QString IosRunConfiguration::profilePath() const FileName IosRunConfiguration::profilePath() const
{ {
return m_profilePath; return m_profilePath;
} }
@@ -302,8 +302,7 @@ bool IosRunConfiguration::isEnabled() const
QString IosRunConfiguration::disabledReason() const QString IosRunConfiguration::disabledReason() const
{ {
if (m_parseInProgress) if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.") return tr("The .pro file \"%1\" is currently being parsed.").arg(m_profilePath.fileName());
.arg(FileName::fromString(m_profilePath).fileName());
if (!m_parseSuccess) if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project()) return static_cast<QmakeProject *>(target()->project())
->disabledReasonForRunConfiguration(m_profilePath); ->disabledReasonForRunConfiguration(m_profilePath);

View File

@@ -54,14 +54,14 @@ class IosRunConfiguration : public ProjectExplorer::RunConfiguration
friend class IosRunConfigurationFactory; friend class IosRunConfigurationFactory;
public: 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; QWidget *createConfigurationWidget() Q_DECL_OVERRIDE;
Utils::OutputFormatter *createOutputFormatter() const Q_DECL_OVERRIDE; Utils::OutputFormatter *createOutputFormatter() const Q_DECL_OVERRIDE;
IosDeployStep *deployStep() const; IosDeployStep *deployStep() const;
QStringList commandLineArguments(); QStringList commandLineArguments();
QString profilePath() const; Utils::FileName profilePath() const;
QString applicationName() const; QString applicationName() const;
Utils::FileName bundleDirectory() const; Utils::FileName bundleDirectory() const;
Utils::FileName localExecutable() const; Utils::FileName localExecutable() const;
@@ -87,7 +87,7 @@ private:
friend class IosRunConfigurationWidget; friend class IosRunConfigurationWidget;
void updateDisplayNames(); void updateDisplayNames();
QString m_profilePath; Utils::FileName m_profilePath;
QStringList m_arguments; QStringList m_arguments;
QString m_lastDisabledReason; QString m_lastDisabledReason;
bool m_lastIsEnabled; bool m_lastIsEnabled;

View File

@@ -58,13 +58,13 @@ namespace Internal {
#define IOS_PREFIX "Qt4ProjectManager.IosRunConfiguration" #define IOS_PREFIX "Qt4ProjectManager.IosRunConfiguration"
#define IOS_RC_ID_PREFIX IOS_PREFIX ":" #define IOS_RC_ID_PREFIX IOS_PREFIX ":"
static QString pathFromId(Core::Id id) static Utils::FileName pathFromId(Core::Id id)
{ {
QString pathStr = id.toString(); QString pathStr = id.toString();
const QString prefix = QLatin1String(IOS_RC_ID_PREFIX); const QString prefix = QLatin1String(IOS_RC_ID_PREFIX);
if (!pathStr.startsWith(prefix)) if (!pathStr.startsWith(prefix))
return QString(); return Utils::FileName();
return pathStr.mid(prefix.size()); return Utils::FileName::fromString(pathStr.mid(prefix.size()));
} }
IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent) IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
@@ -111,7 +111,7 @@ QList<Core::Id> IosRunConfigurationFactory::availableCreationIds(Target *parent,
QString IosRunConfigurationFactory::displayNameForId(Core::Id id) const QString IosRunConfigurationFactory::displayNameForId(Core::Id id) const
{ {
return QFileInfo(pathFromId(id)).completeBaseName(); return pathFromId(id).toFileInfo().completeBaseName();
} }
RunConfiguration *IosRunConfigurationFactory::clone(Target *parent, RunConfiguration *source) 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 *> IosRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
{ {
QList<RunConfiguration *> result; QList<RunConfiguration *> result;
foreach (RunConfiguration *rc, t->runConfigurations()) foreach (RunConfiguration *rc, t->runConfigurations()) {
if (IosRunConfiguration *qt4c = qobject_cast<IosRunConfiguration *>(rc)) if (IosRunConfiguration *qt4c = qobject_cast<IosRunConfiguration *>(rc)) {
if (qt4c->profilePath() == n->path()) if (qt4c->profilePath() == n->path())
result << rc; result << rc;
}
}
return result; return result;
} }

View File

@@ -281,7 +281,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0); d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0);
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) { if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
Project *project = SessionManager::projectForFile(editor->document()->filePath().toString()); Project *project = SessionManager::projectForFile(editor->document()->filePath());
if (project && project->editorConfiguration() == this) if (project && project->editorConfiguration() == this)
switchSettings(widget); switchSettings(widget);
} }
@@ -407,7 +407,7 @@ TabSettings actualTabSettings(const QString &fileName,
{ {
if (baseTextdocument) if (baseTextdocument)
return baseTextdocument->tabSettings(); return baseTextdocument->tabSettings();
if (Project *project = SessionManager::projectForFile(fileName)) if (Project *project = SessionManager::projectForFile(Utils::FileName::fromString(fileName)))
return project->editorConfiguration()->codeStyle()->tabSettings(); return project->editorConfiguration()->codeStyle()->tabSettings();
return TextEditorSettings::codeStyle()->tabSettings(); return TextEditorSettings::codeStyle()->tabSettings();
} }

View File

@@ -169,7 +169,7 @@ void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
QMessageBox::critical(m_wizard, tr("Failed to Add to Project"), QMessageBox::critical(m_wizard, tr("Failed to Add to Project"),
tr("Failed to add subproject \"%1\"\nto project \"%2\".") tr("Failed to add subproject \"%1\"\nto project \"%2\".")
.arg(QDir::toNativeSeparators(generatedProject)) .arg(QDir::toNativeSeparators(generatedProject))
.arg(QDir::toNativeSeparators(folder->path()))); .arg(folder->path().toUserOutput()));
return; return;
} }
m_wizard->removeAttributeFromAllFiles(GeneratedFile::OpenProjectAttribute); m_wizard->removeAttributeFromAllFiles(GeneratedFile::OpenProjectAttribute);
@@ -181,7 +181,7 @@ void JsonSummaryPage::addToProject(const JsonWizard::GeneratorFiles &files)
QStringList nativeFilePaths = Utils::transform(filePaths, &QDir::toNativeSeparators); QStringList nativeFilePaths = Utils::transform(filePaths, &QDir::toNativeSeparators);
QMessageBox::critical(wizard(), tr("Failed to Add to Project"), QMessageBox::critical(wizard(), tr("Failed to Add to Project"),
tr("Failed to add one or more files to project\n\"%1\" (%2).") 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(", ")))); nativeFilePaths.join(QLatin1String(", "))));
return; return;
} }

View File

@@ -93,10 +93,10 @@ void FindNodesForFileVisitor::visitProjectNode(ProjectNode *node)
void FindNodesForFileVisitor::visitFolderNode(FolderNode *node) void FindNodesForFileVisitor::visitFolderNode(FolderNode *node)
{ {
if (node->path() == m_path) if (node->path().toString() == m_path)
m_nodes << node; m_nodes << node;
foreach (FileNode *fileNode, node->fileNodes()) { foreach (FileNode *fileNode, node->fileNodes()) {
if (fileNode->path() == m_path) if (fileNode->path().toString() == m_path)
m_nodes << fileNode; m_nodes << fileNode;
} }
} }
@@ -124,7 +124,7 @@ void FindAllFilesVisitor::visitProjectNode(ProjectNode *projectNode)
void FindAllFilesVisitor::visitFolderNode(FolderNode *folderNode) void FindAllFilesVisitor::visitFolderNode(FolderNode *folderNode)
{ {
m_filePaths.append(folderNode->path()); m_filePaths.append(folderNode->path().toString());
foreach (const FileNode *fileNode, folderNode->fileNodes()) foreach (const FileNode *fileNode, folderNode->fileNodes())
m_filePaths.append(fileNode->path()); m_filePaths.append(fileNode->path().toString());
} }

View File

@@ -1902,29 +1902,28 @@ void ProjectExplorerPlugin::runConfigurationConfigurationFinished()
static QString pathOrDirectoryFor(Node *node, bool dir) static QString pathOrDirectoryFor(Node *node, bool dir)
{ {
QString path = node->path(); Utils::FileName path = node->path();
QString location; QString location;
FolderNode *folder = dynamic_cast<FolderNode *>(node); FolderNode *folder = dynamic_cast<FolderNode *>(node);
if (node->nodeType() == VirtualFolderNodeType && folder) { if (node->nodeType() == VirtualFolderNodeType && folder) {
// Virtual Folder case // Virtual Folder case
// If there are files directly below or no subfolders, take the folder path // If there are files directly below or no subfolders, take the folder path
if (!folder->fileNodes().isEmpty() || folder->subFolderNodes().isEmpty()) { if (!folder->fileNodes().isEmpty() || folder->subFolderNodes().isEmpty()) {
location = path; location = path.toString();
} else { } else {
// Otherwise we figure out a commonPath from the subfolders // Otherwise we figure out a commonPath from the subfolders
QStringList list; QStringList list;
foreach (FolderNode *f, folder->subFolderNodes()) foreach (FolderNode *f, folder->subFolderNodes())
list << f->path() + QLatin1Char('/'); list << f->path().toString() + QLatin1Char('/');
location = Utils::commonPath(list); location = Utils::commonPath(list);
} }
QFileInfo fi(location); QFileInfo fi(location);
while ((!fi.exists() || !fi.isDir()) while ((!fi.exists() || !fi.isDir()) && !fi.isRoot())
&& !fi.isRoot())
fi.setFile(fi.absolutePath()); fi.setFile(fi.absolutePath());
location = fi.absoluteFilePath(); location = fi.absoluteFilePath();
} else { } else {
QFileInfo fi(path); QFileInfo fi = path.toFileInfo();
// remove any /suffixes, which e.g. ResourceNode uses // remove any /suffixes, which e.g. ResourceNode uses
// Note this should be removed again by making node->path() a true path again // Note this should be removed again by making node->path() a true path again
// That requires changes in both the VirtualFolderNode and ResourceNode // That requires changes in both the VirtualFolderNode and ResourceNode
@@ -2827,7 +2826,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
m_removeFileAction->setVisible(!enableDelete || enableRemove); m_removeFileAction->setVisible(!enableDelete || enableRemove);
m_renameFileAction->setEnabled(actions.contains(Rename)); 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)) { if (actions.contains(HidePathActions)) {
@@ -2945,17 +2944,17 @@ void ProjectExplorerPlugin::removeProject()
ProjectNode *subProjectNode = dynamic_cast<ProjectNode*>(ProjectTree::currentNode()->projectNode()); ProjectNode *subProjectNode = dynamic_cast<ProjectNode*>(ProjectTree::currentNode()->projectNode());
ProjectNode *projectNode = dynamic_cast<ProjectNode *>(subProjectNode->parentFolderNode()); ProjectNode *projectNode = dynamic_cast<ProjectNode *>(subProjectNode->parentFolderNode());
if (projectNode) { if (projectNode) {
RemoveFileDialog removeFileDialog(subProjectNode->path(), ICore::mainWindow()); RemoveFileDialog removeFileDialog(subProjectNode->path().toString(), ICore::mainWindow());
removeFileDialog.setDeleteFileVisible(false); removeFileDialog.setDeleteFileVisible(false);
if (removeFileDialog.exec() == QDialog::Accepted) if (removeFileDialog.exec() == QDialog::Accepted)
projectNode->removeSubProjects(QStringList() << subProjectNode->path()); projectNode->removeSubProjects(QStringList() << subProjectNode->path().toString());
} }
} }
void ProjectExplorerPlugin::openFile() void ProjectExplorerPlugin::openFile()
{ {
QTC_ASSERT(ProjectTree::currentNode(), return); QTC_ASSERT(ProjectTree::currentNode(), return);
EditorManager::openEditor(ProjectTree::currentNode()->path()); EditorManager::openEditor(ProjectTree::currentNode()->path().toString());
} }
void ProjectExplorerPlugin::searchOnFileSystem() void ProjectExplorerPlugin::searchOnFileSystem()
@@ -2983,7 +2982,7 @@ void ProjectExplorerPlugin::removeFile()
FileNode *fileNode = dynamic_cast<FileNode*>(currentNode); FileNode *fileNode = dynamic_cast<FileNode*>(currentNode);
QString filePath = currentNode->path(); QString filePath = currentNode->path().toString();
RemoveFileDialog removeFileDialog(filePath, ICore::mainWindow()); RemoveFileDialog removeFileDialog(filePath, ICore::mainWindow());
if (removeFileDialog.exec() == QDialog::Accepted) { if (removeFileDialog.exec() == QDialog::Accepted) {
@@ -3012,7 +3011,7 @@ void ProjectExplorerPlugin::deleteFile()
FileNode *fileNode = dynamic_cast<FileNode*>(currentNode); FileNode *fileNode = dynamic_cast<FileNode*>(currentNode);
QString filePath = currentNode->path(); QString filePath = currentNode->path().toString();
QMessageBox::StandardButton button = QMessageBox::StandardButton button =
QMessageBox::question(ICore::mainWindow(), QMessageBox::question(ICore::mainWindow(),
tr("Delete File"), tr("Delete File"),
@@ -3055,7 +3054,7 @@ void ProjectExplorerPlugin::renameFile()
void ProjectExplorerPlugin::renameFile(Node *node, const QString &newFilePath) 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)) { if (FileUtils::renameFile(orgFilePath, newFilePath)) {
// Tell the project plugin about rename // Tell the project plugin about rename

View File

@@ -199,7 +199,7 @@ bool ProjectFileWizardExtension::processProject(
if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) { if (m_context->wizard->kind() == IWizardFactory::ProjectWizard) {
if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) { if (!static_cast<ProjectNode *>(folder)->addSubProjects(QStringList(generatedProject))) {
*errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".") *errorMessage = tr("Failed to add subproject \"%1\"\nto project \"%2\".")
.arg(generatedProject).arg(folder->path()); .arg(generatedProject).arg(folder->path().toUserOutput());
return false; return false;
} }
*removeOpenProjectAttribute = true; *removeOpenProjectAttribute = true;
@@ -207,7 +207,7 @@ bool ProjectFileWizardExtension::processProject(
QStringList filePaths = Utils::transform(files, &GeneratedFile::path); QStringList filePaths = Utils::transform(files, &GeneratedFile::path);
if (!folder->addFiles(filePaths)) { if (!folder->addFiles(filePaths)) {
*errorMessage = tr("Failed to add one or more files to project\n\"%1\" (%2)."). *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; return false;
} }
} }

View File

@@ -63,8 +63,8 @@ bool sortNodes(Node *n1, Node *n2)
FileNode *file2 = dynamic_cast<FileNode*>(n2); FileNode *file2 = dynamic_cast<FileNode*>(n2);
if (file1 && file1->fileType() == ProjectFileType) { if (file1 && file1->fileType() == ProjectFileType) {
if (file2 && file2->fileType() == ProjectFileType) { if (file2 && file2->fileType() == ProjectFileType) {
const QString fileName1 = Utils::FileName::fromString(file1->path()).fileName(); const QString fileName1 = file1->path().fileName();
const QString fileName2 = Utils::FileName::fromString(file2->path()).fileName(); const QString fileName2 = file2->path().fileName();
int result = caseFriendlyCompare(fileName1, fileName2); int result = caseFriendlyCompare(fileName1, fileName2);
if (result != 0) if (result != 0)
@@ -89,7 +89,7 @@ bool sortNodes(Node *n1, Node *n2)
if (result != 0) if (result != 0)
return result < 0; return result < 0;
result = caseFriendlyCompare(project1->path(), project2->path()); result = caseFriendlyCompare(project1->path().toString(), project2->path().toString());
if (result != 0) if (result != 0)
return result < 0; return result < 0;
return project1 < project2; // sort by pointer value return project1 < project2; // sort by pointer value
@@ -109,7 +109,7 @@ bool sortNodes(Node *n1, Node *n2)
return true; return true;
if (folder1->priority() < folder2->priority()) if (folder1->priority() < folder2->priority())
return false; return false;
int result = caseFriendlyCompare(folder1->path(), folder2->path()); int result = caseFriendlyCompare(folder1->path().toString(), folder2->path().toString());
if (result != 0) if (result != 0)
return result < 0; return result < 0;
else else
@@ -128,7 +128,7 @@ bool sortNodes(Node *n1, Node *n2)
FolderNode *folder1 = static_cast<FolderNode*>(n1); FolderNode *folder1 = static_cast<FolderNode*>(n1);
FolderNode *folder2 = static_cast<FolderNode*>(n2); 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) if (result != 0)
return result < 0; return result < 0;
else else
@@ -146,8 +146,8 @@ bool sortNodes(Node *n1, Node *n2)
if (result != 0) if (result != 0)
return result < 0; return result < 0;
const QString filePath1 = n1->path(); const QString filePath1 = n1->path().toString();
const QString filePath2 = n2->path(); const QString filePath2 = n2->path().toString();
const QString fileName1 = Utils::FileName::fromString(filePath1).fileName(); const QString fileName1 = Utils::FileName::fromString(filePath1).fileName();
const QString fileName2 = Utils::FileName::fromString(filePath2).fileName(); const QString fileName2 = Utils::FileName::fromString(filePath2).fileName();
@@ -288,7 +288,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break; break;
} }
case Qt::EditRole: { case Qt::EditRole: {
result = Utils::FileName::fromString(node->path()).fileName(); result = node->path().fileName();
break; break;
} }
case Qt::ToolTipRole: { case Qt::ToolTipRole: {
@@ -299,7 +299,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
if (folderNode) if (folderNode)
result = folderNode->icon(); result = folderNode->icon();
else else
result = Core::FileIconProvider::icon(node->path()); result = Core::FileIconProvider::icon(node->path().toString());
break; break;
} }
case Qt::FontRole: { case Qt::FontRole: {
@@ -310,7 +310,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
break; break;
} }
case Project::FilePathRole: { case Project::FilePathRole: {
result = node->path(); result = node->path().toString();
break; break;
} }
case Project::EnabledRole: { case Project::EnabledRole: {
@@ -354,11 +354,10 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol
Node *node = nodeForIndex(index); Node *node = nodeForIndex(index);
QString orgFilePath = QFileInfo(node->path()).absoluteFilePath(); Utils::FileName orgFilePath = node->path();
QString dir = QFileInfo(orgFilePath).absolutePath(); Utils::FileName newFilePath = orgFilePath.parentDir().appendPath(value.toString());
QString newFilePath = dir + QLatin1Char('/') + value.toString();
ProjectExplorerPlugin::renameFile(node, newFilePath); ProjectExplorerPlugin::renameFile(node, newFilePath.toString());
emit renamed(orgFilePath, newFilePath); emit renamed(orgFilePath, newFilePath);
return true; return true;
} }
@@ -515,7 +514,7 @@ QMimeData *FlatModel::mimeData(const QModelIndexList &indexes) const
foreach (const QModelIndex &index, indexes) { foreach (const QModelIndex &index, indexes) {
Node *node = nodeForIndex(index); Node *node = nodeForIndex(index);
if (dynamic_cast<FileNode *>(node)) if (dynamic_cast<FileNode *>(node))
data->addFile(node->path()); data->addFile(node->path().toString());
} }
return data; return data;
} }

View File

@@ -31,6 +31,8 @@
#ifndef PROJECTMODELS_H #ifndef PROJECTMODELS_H
#define PROJECTMODELS_H #define PROJECTMODELS_H
#include <utils/fileutils.h>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QSet> #include <QSet>
@@ -79,7 +81,7 @@ public:
bool generatedFilesFilterEnabled(); bool generatedFilesFilterEnabled();
signals: signals:
void renamed(const QString &oldName, const QString &newName); void renamed(const Utils::FileName &oldName, const Utils::FileName &newName);
public slots: public slots:
void setProjectFilterEnabled(bool filter); void setProjectFilterEnabled(bool filter);

View File

@@ -65,8 +65,7 @@ using namespace ProjectExplorer;
\sa ProjectExplorer::NodesWatcher, ProjectExplorer::NodesVisitor \sa ProjectExplorer::NodesWatcher, ProjectExplorer::NodesVisitor
*/ */
Node::Node(NodeType nodeType, Node::Node(NodeType nodeType, const Utils::FileName &filePath, int line)
const QString &filePath, int line)
: m_nodeType(nodeType), : m_nodeType(nodeType),
m_line(line), m_line(line),
m_projectNode(0), 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 * This function does not emit any signals. That has to be done by the calling
* class. * class.
*/ */
void Node::setPath(const QString &path) void Node::setPath(const Utils::FileName &path)
{ {
if (m_path == path) if (m_path == path)
return; return;
@@ -120,7 +119,7 @@ void Node::setLine(int line)
emitNodeUpdated(); emitNodeUpdated();
} }
void Node::setPathAndLine(const QString &path, int line) void Node::setPathAndLine(const Utils::FileName &path, int line)
{ {
if (m_path == path if (m_path == path
&& m_line == line) && m_line == line)
@@ -157,7 +156,7 @@ FolderNode *Node::parentFolderNode() const
/*! /*!
The path of the file or folder in the filesystem the node represents. 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; return m_path;
} }
@@ -169,12 +168,12 @@ int Node::line() const
QString Node::displayName() const QString Node::displayName() const
{ {
return Utils::FileName::fromString(path()).fileName(); return path().fileName();
} }
QString Node::tooltip() const QString Node::tooltip() const
{ {
return QDir::toNativeSeparators(path()); return path().toUserOutput();
} }
bool Node::isEnabled() const bool Node::isEnabled() const
@@ -220,7 +219,7 @@ void Node::setParentFolderNode(FolderNode *parentFolder)
\sa ProjectExplorer::FolderNode, ProjectExplorer::ProjectNode \sa ProjectExplorer::FolderNode, ProjectExplorer::ProjectNode
*/ */
FileNode::FileNode(const QString &filePath, FileNode::FileNode(const Utils::FileName &filePath,
const FileType fileType, const FileType fileType,
bool generated, int line) bool generated, int line)
: Node(FileNodeType, filePath, line), : Node(FileNodeType, filePath, line),
@@ -249,12 +248,12 @@ bool FileNode::isGenerated() const
\sa ProjectExplorer::FileNode, ProjectExplorer::ProjectNode \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), Node(nodeType, folderPath),
m_displayName(displayName) m_displayName(displayName)
{ {
if (m_displayName.isEmpty()) if (m_displayName.isEmpty())
m_displayName = QDir::toNativeSeparators(folderPath); m_displayName = folderPath.toUserOutput();
} }
FolderNode::~FolderNode() 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 FolderNode::AddNewInformation FolderNode::addNewInformation(const QStringList &files, Node *context) const
{ {
Q_UNUSED(files); 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 \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) : FolderNode(folderPath, VirtualFolderNodeType), m_priority(priority)
{ {
} }
@@ -544,18 +543,18 @@ int VirtualFolderNode::priority() const
/*! /*!
Creates an uninitialized project node object. Creates an uninitialized project node object.
*/ */
ProjectNode::ProjectNode(const QString &projectFilePath) ProjectNode::ProjectNode(const Utils::FileName &projectFilePath)
: FolderNode(projectFilePath) : FolderNode(projectFilePath)
{ {
setNodeType(ProjectNodeType); setNodeType(ProjectNodeType);
// project node "manages" itself // project node "manages" itself
setProjectNode(this); setProjectNode(this);
setDisplayName(Utils::FileName::fromString(projectFilePath).fileName()); setDisplayName(projectFilePath.fileName());
} }
QString ProjectNode::vcsTopic() const QString ProjectNode::vcsTopic() const
{ {
const QString dir = QFileInfo(path()).absolutePath(); const QString dir = path().toFileInfo().absolutePath();
if (Core::IVersionControl *const vc = if (Core::IVersionControl *const vc =
Core::VcsManager::findVersionControlForDirectory(dir)) Core::VcsManager::findVersionControlForDirectory(dir))
@@ -686,7 +685,7 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
*/ */
SessionNode::SessionNode() SessionNode::SessionNode()
: FolderNode(QLatin1String("session")) : FolderNode(Utils::FileName::fromString(QLatin1String("session")))
{ {
setNodeType(SessionNodeType); setNodeType(SessionNodeType);
} }

View File

@@ -33,6 +33,8 @@
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <utils/fileutils.h>
#include <QIcon> #include <QIcon>
#include <QObject> #include <QObject>
@@ -111,7 +113,7 @@ public:
NodeType nodeType() const; NodeType nodeType() const;
ProjectNode *projectNode() const; // managing project ProjectNode *projectNode() const; // managing project
FolderNode *parentFolderNode() const; // parent folder or project FolderNode *parentFolderNode() const; // parent folder or project
QString path() const; // file system path Utils::FileName path() const; // file system path
int line() const; int line() const;
virtual QString displayName() const; virtual QString displayName() const;
virtual QString tooltip() const; virtual QString tooltip() const;
@@ -119,13 +121,13 @@ public:
virtual QList<ProjectAction> supportedActions(Node *node) const; virtual QList<ProjectAction> supportedActions(Node *node) const;
void setPath(const QString &path); void setPath(const Utils::FileName &path);
void setLine(int line); void setLine(int line);
void setPathAndLine(const QString &path, int line); void setPathAndLine(const Utils::FileName &path, int line);
void emitNodeUpdated(); void emitNodeUpdated();
protected: 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 setNodeType(NodeType type);
void setProjectNode(ProjectNode *project); void setProjectNode(ProjectNode *project);
@@ -139,13 +141,13 @@ private:
int m_line; int m_line;
ProjectNode *m_projectNode; ProjectNode *m_projectNode;
FolderNode *m_folderNode; FolderNode *m_folderNode;
QString m_path; Utils::FileName m_path;
}; };
class PROJECTEXPLORER_EXPORT FileNode : public Node class PROJECTEXPLORER_EXPORT FileNode : public Node
{ {
public: 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; FileType fileType() const;
bool isGenerated() const; bool isGenerated() const;
@@ -163,7 +165,7 @@ private:
class PROJECTEXPLORER_EXPORT FolderNode : public Node class PROJECTEXPLORER_EXPORT FolderNode : public Node
{ {
public: public:
explicit FolderNode(const QString &folderPath, NodeType nodeType = FolderNodeType, explicit FolderNode(const Utils::FileName &folderPath, NodeType nodeType = FolderNodeType,
const QString &displayName = QString()); const QString &displayName = QString());
virtual ~FolderNode(); virtual ~FolderNode();
@@ -220,7 +222,7 @@ private:
class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode class PROJECTEXPLORER_EXPORT VirtualFolderNode : public FolderNode
{ {
public: public:
explicit VirtualFolderNode(const QString &folderPath, int priority); explicit VirtualFolderNode(const Utils::FileName &folderPath, int priority);
virtual ~VirtualFolderNode(); virtual ~VirtualFolderNode();
int priority() const; int priority() const;
@@ -260,7 +262,7 @@ public:
protected: protected:
// this is just the in-memory representation, a subclass // this is just the in-memory representation, a subclass
// will add the persistent stuff // will add the persistent stuff
explicit ProjectNode(const QString &projectFilePath); explicit ProjectNode(const Utils::FileName &projectFilePath);
private: private:
QList<ProjectNode*> m_subProjectNodes; QList<ProjectNode*> m_subProjectNodes;

View File

@@ -177,7 +177,7 @@ Project *ProjectTree::projectForNode(Node *node)
void ProjectTree::updateFromDocumentManager(bool invalidCurrentNode) void ProjectTree::updateFromDocumentManager(bool invalidCurrentNode)
{ {
Core::IDocument *document = Core::EditorManager::currentDocument(); Core::IDocument *document = Core::EditorManager::currentDocument();
const QString &fileName = document ? document->filePath().toString() : QString(); const FileName fileName = document ? document->filePath() : FileName();
Node *currentNode = 0; Node *currentNode = 0;
if (!invalidCurrentNode && m_currentNode && m_currentNode->path() == fileName) if (!invalidCurrentNode && m_currentNode && m_currentNode->path() == fileName)

View File

@@ -217,7 +217,7 @@ int ProjectTreeWidget::expandedCount(Node *node)
void ProjectTreeWidget::rowsInserted(const QModelIndex &parent, int start, int end) 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)) { if (m_toExpand.contains(path)) {
m_view->expand(parent); m_view->expand(parent);
m_toExpand.remove(path); 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; Node *bestNode = 0;
int bestNodeExpandCount = INT_MAX; int bestNodeExpandCount = INT_MAX;
@@ -276,7 +276,7 @@ void ProjectTreeWidget::loadExpandData()
void ProjectTreeWidget::recursiveLoadExpandData(const QModelIndex &index, QSet<QString> &data) 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)) { if (data.contains(path)) {
m_view->expand(index); m_view->expand(index);
data.remove(path); data.remove(path);
@@ -300,7 +300,7 @@ void ProjectTreeWidget::recursiveSaveExpandData(const QModelIndex &index, QStrin
if (m_view->isExpanded(index) || index == m_view->rootIndex()) { 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 // Note: We store the path of the node, which isn't unique for e.g. .pri files
// but works for most nodes // 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); int count = m_model->rowCount(index);
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
recursiveSaveExpandData(index.child(i, 0), data); recursiveSaveExpandData(index.child(i, 0), data);
@@ -335,9 +335,9 @@ void ProjectTreeWidget::setAutoSynchronization(bool sync)
if (m_autoSync) { if (m_autoSync) {
// sync from document manager // sync from document manager
QString fileName; Utils::FileName fileName;
if (IDocument *doc = EditorManager::currentDocument()) if (IDocument *doc = EditorManager::currentDocument())
fileName = doc->filePath().toString(); fileName = doc->filePath();
if (!currentNode() || currentNode()->path() != fileName) if (!currentNode() || currentNode()->path() != fileName)
setCurrentItem(ProjectTreeWidget::nodeForFile(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); Q_UNUSED(oldPath);
if (!currentNode() || currentNode()->path() != newPath) { if (!currentNode() || currentNode()->path() != newPath) {
@@ -452,7 +452,7 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex)
Node *node = m_model->nodeForIndex(mainIndex); Node *node = m_model->nodeForIndex(mainIndex);
if (node->nodeType() != FileNodeType) if (node->nodeType() != FileNodeType)
return; return;
IEditor *editor = EditorManager::openEditor(node->path()); IEditor *editor = EditorManager::openEditor(node->path().toString());
if (editor && node->line() >= 0) if (editor && node->line() >= 0)
editor->gotoLine(node->line()); editor->gotoLine(node->line());
} }

View File

@@ -33,6 +33,8 @@
#include <coreplugin/inavigationwidgetfactory.h> #include <coreplugin/inavigationwidgetfactory.h>
#include <utils/fileutils.h>
#include <QWidget> #include <QWidget>
#include <QModelIndex> #include <QModelIndex>
#include <QSet> #include <QSet>
@@ -65,7 +67,7 @@ public:
Node *currentNode(); Node *currentNode();
void sync(ProjectExplorer::Node *node); void sync(ProjectExplorer::Node *node);
static Node *nodeForFile(const QString &fileName); static Node *nodeForFile(const Utils::FileName &fileName);
public slots: public slots:
void toggleAutoSynchronization(); void toggleAutoSynchronization();
@@ -93,7 +95,7 @@ private:
void recursiveSaveExpandData(const QModelIndex &index, QStringList *data); void recursiveSaveExpandData(const QModelIndex &index, QStringList *data);
static int expandedCount(Node *node); static int expandedCount(Node *node);
void rowsInserted(const QModelIndex &parent, int start, int end); 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; QSet<QString> m_toExpand;
QTreeView *m_view; QTreeView *m_view;
@@ -106,7 +108,7 @@ private:
QString m_modelId; QString m_modelId;
bool m_autoSync; bool m_autoSync;
bool m_autoExpand; bool m_autoExpand;
QString m_delayedRename; Utils::FileName m_delayedRename;
static QList<ProjectTreeWidget *> m_projectTreeWidgets; static QList<ProjectTreeWidget *> m_projectTreeWidgets;
friend class ProjectTreeWidgetFactory; friend class ProjectTreeWidgetFactory;

View File

@@ -86,7 +86,7 @@ public:
m_writer(0) 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 restoreValues(const PersistentSettingsReader &reader);
void restoreDependencies(const PersistentSettingsReader &reader); void restoreDependencies(const PersistentSettingsReader &reader);
void restoreStartupProject(const PersistentSettingsReader &reader); void restoreStartupProject(const PersistentSettingsReader &reader);
@@ -135,8 +135,8 @@ SessionManager::SessionManager(QObject *parent)
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(saveActiveMode(Core::IMode*))); this, SLOT(saveActiveMode(Core::IMode*)));
connect(EditorManager::instance(), SIGNAL(editorCreated(Core::IEditor*,QString)), connect(EditorManager::instance(), &EditorManager::editorCreated,
this, SLOT(configureEditor(Core::IEditor*,QString))); this, &SessionManager::configureEditor);
connect(this, SIGNAL(projectAdded(ProjectExplorer::Project*)), connect(this, SIGNAL(projectAdded(ProjectExplorer::Project*)),
EditorManager::instance(), SLOT(updateWindowTitles())); EditorManager::instance(), SLOT(updateWindowTitles()));
connect(this, SIGNAL(projectRemoved(ProjectExplorer::Project*)), connect(this, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
@@ -217,7 +217,7 @@ QList<Project *> SessionManager::dependencies(const Project *project)
QList<Project *> projects; QList<Project *> projects;
foreach (const QString &dep, proDeps) { foreach (const QString &dep, proDeps) {
if (Project *pro = projectForFile(dep)) if (Project *pro = projectForFile(Utils::FileName::fromString(dep)))
projects += pro; projects += pro;
} }
@@ -469,7 +469,8 @@ QString SessionManagerPrivate::windowTitleAddition(const QString &filePath)
if (projects.size() == 1) if (projects.size() == 1)
return projects.first()->displayName(); return projects.first()->displayName();
return QString(); return QString();
} else if (Project *project = SessionManager::projectForFile(filePath)) { } else if (Project *project = SessionManager::projectForFile(
Utils::FileName::fromString(filePath))) {
return project->displayName(); return project->displayName();
} else { } else {
return QString(); return QString();
@@ -537,16 +538,16 @@ QList<Project *> SessionManager::projectOrder(Project *project)
return result; 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); sessionNode()->accept(&findNodes);
return findNodes.nodes(); return findNodes.nodes();
} }
// node for file returns a randomly selected node if there are multiple // node for file returns a randomly selected node if there are multiple
// prefer to use nodesForFile and figure out which node you want // 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; Node *node = 0;
foreach (Node *n, nodesForFile(fileName)) { 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)); 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) if (debug)
qDebug() << "SessionManager::projectForFile(" << fileName << ")"; qDebug() << "SessionManager::projectForFile(" << fileName << ")";
@@ -587,18 +588,18 @@ Project *SessionManager::projectForFile(const QString &fileName)
return 0; 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)) if (!m_projectFileCache.contains(p))
m_projectFileCache.insert(p, p->files(Project::AllFiles)); 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) void SessionManager::configureEditor(IEditor *editor, const QString &fileName)
{ {
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) { 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. // Global settings are the default.
if (project) if (project)
project->editorConfiguration()->configureEditor(textEditor); project->editorConfiguration()->configureEditor(textEditor);
@@ -608,7 +609,7 @@ void SessionManager::configureEditor(IEditor *editor, const QString &fileName)
void SessionManager::configureEditors(Project *project) void SessionManager::configureEditors(Project *project)
{ {
foreach (IDocument *document, DocumentModel::openedDocuments()) { foreach (IDocument *document, DocumentModel::openedDocuments()) {
if (d->projectContainsFile(project, document->filePath().toString())) { if (d->projectContainsFile(project, document->filePath())) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) { foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) {
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) { if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
project->editorConfiguration()->configureEditor(textEditor); project->editorConfiguration()->configureEditor(textEditor);

View File

@@ -117,9 +117,9 @@ public:
static SessionNode *sessionNode(); static SessionNode *sessionNode();
static Project *projectForNode(Node *node); static Project *projectForNode(Node *node);
static QList<Node *> nodesForFile(const QString &fileName); static QList<Node *> nodesForFile(const Utils::FileName &fileName);
static Node *nodeForFile(const QString &fileName); static Node *nodeForFile(const Utils::FileName &fileName);
static Project *projectForFile(const QString &fileName); static Project *projectForFile(const Utils::FileName &fileName);
static QStringList projectsForSessionName(const QString &session); static QStringList projectsForSessionName(const QString &session);

View File

@@ -248,8 +248,10 @@ public:
// QbsFileNode: // QbsFileNode:
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
QbsFileNode::QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType, QbsFileNode::QbsFileNode(const Utils::FileName &filePath,
bool generated, int line) : const ProjectExplorer::FileType fileType,
bool generated,
int line) :
ProjectExplorer::FileNode(filePath, fileType, generated, line) ProjectExplorer::FileNode(filePath, fileType, generated, line)
{ } { }
@@ -265,7 +267,7 @@ QString QbsFileNode::displayName() const
// QbsBaseProjectNode: // QbsBaseProjectNode:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
QbsBaseProjectNode::QbsBaseProjectNode(const QString &path) : QbsBaseProjectNode::QbsBaseProjectNode(const Utils::FileName &path) :
ProjectExplorer::ProjectNode(path) ProjectExplorer::ProjectNode(path)
{ } { }
@@ -334,7 +336,7 @@ static QList<ProjectExplorer::ProjectAction> supportedNodeActions(ProjectExplore
return actions; return actions;
actions << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile; actions << ProjectExplorer::AddNewFile << ProjectExplorer::AddExistingFile;
if (node->nodeType() == ProjectExplorer::FileNodeType if (node->nodeType() == ProjectExplorer::FileNodeType
&& !project->qbsProject().buildSystemFiles().contains(node->path())) { && !project->qbsProject().buildSystemFiles().contains(node->path().toString())) {
actions << ProjectExplorer::RemoveFile; actions << ProjectExplorer::RemoveFile;
actions << ProjectExplorer::Rename; actions << ProjectExplorer::Rename;
} }
@@ -346,14 +348,14 @@ static QList<ProjectExplorer::ProjectAction> supportedNodeActions(ProjectExplore
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath) : QbsGroupNode::QbsGroupNode(const qbs::GroupData &grp, const QString &productPath) :
QbsBaseProjectNode(QString()) QbsBaseProjectNode(Utils::FileName())
{ {
if (m_groupIcon.isNull()) if (m_groupIcon.isNull())
m_groupIcon = QIcon(QString::fromLatin1(Constants::QBS_GROUP_ICON)); m_groupIcon = QIcon(QString::fromLatin1(Constants::QBS_GROUP_ICON));
setIcon(m_groupIcon); setIcon(m_groupIcon);
QbsFileNode *idx = new QbsFileNode(grp.location().filePath(), QbsFileNode *idx = new QbsFileNode(Utils::FileName::fromString(grp.location().filePath()),
ProjectExplorer::ProjectFileType, false, ProjectExplorer::ProjectFileType, false,
grp.location().line()); grp.location().line());
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx); addFileNodes(QList<ProjectExplorer::FileNode *>() << idx);
@@ -447,7 +449,7 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData &grp, const QString &
m_productPath = productPath; m_productPath = productPath;
m_qbsGroupData = grp; m_qbsGroupData = grp;
setPath(grp.location().filePath()); setPath(Utils::FileName::fromString(grp.location().filePath()));
setDisplayName(grp.name()); setDisplayName(grp.name());
QbsFileNode *idx = 0; QbsFileNode *idx = 0;
@@ -457,7 +459,8 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData &grp, const QString &
break; break;
} }
QTC_ASSERT(idx, return); 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); setupFiles(this, grp.allFilePaths(), productPath, updateExisting);
@@ -511,7 +514,7 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
} }
foreach (FileTreeNode *c, fileTree->children) { foreach (FileTreeNode *c, fileTree->children) {
QString path = c->path(); Utils::FileName path = Utils::FileName::fromString(c->path());
// Handle files: // Handle files:
if (c->isFile()) { if (c->isFile()) {
@@ -542,7 +545,8 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
break; break;
} }
if (!fn) { if (!fn) {
fn = new FolderNode(c->path(), ProjectExplorer::FolderNodeType, fn = new FolderNode(Utils::FileName::fromString(c->path()),
ProjectExplorer::FolderNodeType,
displayNameFromPath(c->path(), baseDir)); displayNameFromPath(c->path(), baseDir));
root->addFolderNodes(QList<FolderNode *>() << fn); root->addFolderNodes(QList<FolderNode *>() << fn);
} else { } else {
@@ -565,14 +569,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsProductNode::QbsProductNode(const qbs::Project &project, const qbs::ProductData &prd) : 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()) if (m_productIcon.isNull())
m_productIcon = generateIcon(QString::fromLatin1(Constants::QBS_PRODUCT_OVERLAY_ICON)); m_productIcon = generateIcon(QString::fromLatin1(Constants::QBS_PRODUCT_OVERLAY_ICON));
setIcon(m_productIcon); setIcon(m_productIcon);
ProjectExplorer::FileNode *idx = new QbsFileNode(prd.location().filePath(), auto idx = new QbsFileNode(Utils::FileName::fromString(prd.location().filePath()),
ProjectExplorer::ProjectFileType, false, ProjectExplorer::ProjectFileType, false,
prd.location().line()); prd.location().line());
addFileNodes(QList<ProjectExplorer::FileNode *>() << idx); addFileNodes(QList<ProjectExplorer::FileNode *>() << idx);
@@ -658,7 +662,7 @@ void QbsProductNode::setQbsProductData(const qbs::Project &project, const qbs::P
bool updateExisting = productWasEnabled != productIsEnabled; bool updateExisting = productWasEnabled != productIsEnabled;
setDisplayName(QbsProject::productDisplayName(project, prd)); setDisplayName(QbsProject::productDisplayName(project, prd));
setPath(prd.location().filePath()); setPath(Utils::FileName::fromString(prd.location().filePath()));
const QString &productPath = QFileInfo(prd.location().filePath()).absolutePath(); const QString &productPath = QFileInfo(prd.location().filePath()).absolutePath();
// Find the QbsFileNode we added earlier: // Find the QbsFileNode we added earlier:
@@ -669,7 +673,8 @@ void QbsProductNode::setQbsProductData(const qbs::Project &project, const qbs::P
break; break;
} }
QTC_ASSERT(idx, return); 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 *> toAdd;
QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes(); QList<ProjectExplorer::ProjectNode *> toRemove = subProjectNodes();
@@ -732,7 +737,7 @@ QbsGroupNode *QbsProductNode::findGroupNode(const QString &name)
// QbsProjectNode: // QbsProjectNode:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsProjectNode::QbsProjectNode(const QString &path) : QbsProjectNode::QbsProjectNode(const Utils::FileName &path) :
QbsBaseProjectNode(path) QbsBaseProjectNode(path)
{ {
ctor(); ctor();
@@ -751,7 +756,8 @@ void QbsProjectNode::update(const qbs::Project &qbsProject, const qbs::ProjectDa
foreach (const qbs::ProjectData &subData, prjData.subProjects()) { foreach (const qbs::ProjectData &subData, prjData.subProjects()) {
QbsProjectNode *qn = findProjectNode(subData.name()); QbsProjectNode *qn = findProjectNode(subData.name());
if (!qn) { if (!qn) {
QbsProjectNode *subProject = new QbsProjectNode(subData.location().filePath()); auto subProject =
new QbsProjectNode(Utils::FileName::fromString(subData.location().filePath()));
subProject->update(qbsProject, subData); subProject->update(qbsProject, subData);
toAdd << subProject; toAdd << subProject;
} else { } else {
@@ -830,9 +836,9 @@ QbsProjectNode *QbsProjectNode::findProjectNode(const QString &name)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) : QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
QbsProjectNode(project->projectFilePath().toString()), QbsProjectNode(project->projectFilePath()),
m_project(project), m_project(project),
m_buildSystemFiles(new ProjectExplorer::FolderNode(project->projectDirectory().toString(), m_buildSystemFiles(new ProjectExplorer::FolderNode(project->projectDirectory(),
ProjectExplorer::FolderNodeType, ProjectExplorer::FolderNodeType,
QCoreApplication::translate("QbsRootProjectNode", "Qbs files"))) QCoreApplication::translate("QbsRootProjectNode", "Qbs files")))
{ {

View File

@@ -51,7 +51,7 @@ class QbsProjectFile;
class QbsFileNode : public ProjectExplorer::FileNode class QbsFileNode : public ProjectExplorer::FileNode
{ {
public: public:
QbsFileNode(const QString &filePath, const ProjectExplorer::FileType fileType, bool generated, QbsFileNode(const Utils::FileName &filePath, const ProjectExplorer::FileType fileType, bool generated,
int line); int line);
QString displayName() const; QString displayName() const;
@@ -66,7 +66,7 @@ class QbsGroupNode;
class QbsBaseProjectNode : public ProjectExplorer::ProjectNode class QbsBaseProjectNode : public ProjectExplorer::ProjectNode
{ {
public: public:
explicit QbsBaseProjectNode(const QString &path); explicit QbsBaseProjectNode(const Utils::FileName &path);
bool showInSimpleTree() const; bool showInSimpleTree() const;
@@ -155,7 +155,7 @@ private:
class QbsProjectNode : public QbsBaseProjectNode class QbsProjectNode : public QbsBaseProjectNode
{ {
public: public:
explicit QbsProjectNode(const QString &path); explicit QbsProjectNode(const Utils::FileName &path);
~QbsProjectNode(); ~QbsProjectNode();
virtual QbsProject *project() const; virtual QbsProject *project() const;

View File

@@ -73,13 +73,13 @@ namespace Internal {
static Node *currentEditorNode() static Node *currentEditorNode()
{ {
Core::IDocument *doc = Core::EditorManager::currentDocument(); Core::IDocument *doc = Core::EditorManager::currentDocument();
return doc ? SessionManager::nodeForFile(doc->filePath().toString()) : 0; return doc ? SessionManager::nodeForFile(doc->filePath()) : 0;
} }
static QbsProject *currentEditorProject() static QbsProject *currentEditorProject()
{ {
Core::IDocument *doc = Core::EditorManager::currentDocument(); Core::IDocument *doc = Core::EditorManager::currentDocument();
return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath().toString())) : 0; return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : 0;
} }
QbsProjectManagerPlugin::QbsProjectManagerPlugin() : QbsProjectManagerPlugin::QbsProjectManagerPlugin() :
@@ -288,7 +288,7 @@ void QbsProjectManagerPlugin::updateBuildActions()
&& !BuildManager::isBuilding(m_editorProject) && !BuildManager::isBuilding(m_editorProject)
&& !m_editorProject->isParsing(); && !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()); fileVisible = m_editorProject && m_editorNode && dynamic_cast<QbsBaseProjectNode *>(m_editorNode->projectNode());
QbsProductNode *productNode QbsProductNode *productNode
@@ -361,7 +361,7 @@ void QbsProjectManagerPlugin::buildFileContextMenu()
QTC_ASSERT(m_selectedNode, return); QTC_ASSERT(m_selectedNode, return);
QTC_ASSERT(m_selectedProject, return); QTC_ASSERT(m_selectedProject, return);
buildSingleFile(m_selectedProject, m_selectedNode->path()); buildSingleFile(m_selectedProject, m_selectedNode->path().toString());
} }
void QbsProjectManagerPlugin::buildFile() void QbsProjectManagerPlugin::buildFile()
@@ -369,7 +369,7 @@ void QbsProjectManagerPlugin::buildFile()
if (!m_editorProject || !m_editorNode) if (!m_editorProject || !m_editorNode)
return; return;
buildSingleFile(m_editorProject, m_editorNode->path()); buildSingleFile(m_editorProject, m_editorNode->path().toString());
} }
void QbsProjectManagerPlugin::buildProductContextMenu() void QbsProjectManagerPlugin::buildProductContextMenu()

View File

@@ -156,7 +156,7 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
void ChooseDirectoryPage::checkPackageSourceDir() void ChooseDirectoryPage::checkPackageSourceDir()
{ {
QString projectDir = QFileInfo(m_wizard->node()->path()).absolutePath(); QString projectDir = m_wizard->node()->path().toFileInfo().absolutePath();
QString newDir = m_androidPackageSourceDir->path(); QString newDir = m_androidPackageSourceDir->path();
bool isComplete = QFileInfo(projectDir) != QFileInfo(newDir); 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 " "The files in the Android package source directory are copied to the build directory's "
"Android directory and the default files are overwritten.")); "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)), connect(m_androidPackageSourceDir, SIGNAL(changed(QString)),
this, SLOT(checkPackageSourceDir())); this, SLOT(checkPackageSourceDir()));
} else { } else {
@@ -343,13 +343,14 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (m_node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir).isEmpty()) { if (m_node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir).isEmpty()) {
// and now time for some magic // and now time for some magic
QString value = QLatin1String("$$PWD/") QString value = QLatin1String("$$PWD/")
+ QDir(QFileInfo(m_node->path()).absolutePath()).relativeFilePath(m_directory); + m_node->path().toFileInfo().absoluteDir().relativeFilePath(m_directory);
bool result = bool result =
m_node->setProVariable(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR"), QStringList(value)); m_node->setProVariable(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR"), QStringList(value));
if (!result) { if (!result) {
QMessageBox::warning(this, tr("Project File not Updated"), 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")); Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));

View File

@@ -142,12 +142,12 @@ QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepLis
ctor(); ctor();
} }
QString QmakeAndroidBuildApkStep::proFilePathForInputFile() const Utils::FileName QmakeAndroidBuildApkStep::proFilePathForInputFile() const
{ {
ProjectExplorer::RunConfiguration *rc = target()->activeRunConfiguration(); ProjectExplorer::RunConfiguration *rc = target()->activeRunConfiguration();
if (auto *arc = qobject_cast<QmakeAndroidRunConfiguration *>(rc)) if (auto *arc = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
return arc->proFilePath(); return arc->proFilePath();
return QString(); return Utils::FileName();
} }
QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep *other) QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep *other)

View File

@@ -66,7 +66,7 @@ class QmakeAndroidBuildApkStep : public Android::AndroidBuildApkStep
Q_OBJECT Q_OBJECT
public: public:
QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc); QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc);
QString proFilePathForInputFile() const; Utils::FileName proFilePathForInputFile() const;
void setProFilePathForInputFile(const QString &path); void setProFilePathForInputFile(const QString &path);

View File

@@ -59,7 +59,7 @@ static QString pathFromId(const Core::Id id)
return id.suffixAfter(ANDROID_RC_ID_PREFIX); 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) : AndroidRunConfiguration(parent, id)
, m_proFilePath(path) , m_proFilePath(path)
{ {
@@ -88,7 +88,7 @@ void QmakeAndroidRunConfiguration::init()
bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map) bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
{ {
const QDir projectDir = QDir(target()->project()->projectDirectory().toString()); 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_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(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()); const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
QVariantMap map(RunConfiguration::toMap()); 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; return map;
} }
@@ -123,7 +123,7 @@ QString QmakeAndroidRunConfiguration::disabledReason() const
{ {
if (m_parseInProgress) if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.") return tr("The .pro file \"%1\" is currently being parsed.")
.arg(Utils::FileName::fromString(m_proFilePath).fileName()); .arg(m_proFilePath.fileName());
if (!m_parseSuccess) if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath); return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
@@ -147,7 +147,7 @@ void QmakeAndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProF
emit enabledChanged(); emit enabledChanged();
} }
QString QmakeAndroidRunConfiguration::proFilePath() const Utils::FileName QmakeAndroidRunConfiguration::proFilePath() const
{ {
return m_proFilePath; return m_proFilePath;
} }

View File

@@ -33,6 +33,8 @@
#include <android/androidrunconfiguration.h> #include <android/androidrunconfiguration.h>
#include <utils/fileutils.h>
namespace QmakeProjectManager { class QmakeProFileNode; } namespace QmakeProjectManager { class QmakeProFileNode; }
namespace QmakeAndroidSupport { namespace QmakeAndroidSupport {
@@ -44,9 +46,10 @@ class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
friend class QmakeAndroidRunConfigurationFactory; friend class QmakeAndroidRunConfigurationFactory;
public: 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; bool isEnabled() const;
QString disabledReason() const; QString disabledReason() const;
@@ -64,7 +67,7 @@ private slots:
private: private:
void init(); void init();
mutable QString m_proFilePath; mutable Utils::FileName m_proFilePath;
bool m_parseSuccess; bool m_parseSuccess;
bool m_parseInProgress; bool m_parseInProgress;
}; };

View File

@@ -52,9 +52,9 @@ namespace Internal {
static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:"; 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) QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject *parent)
@@ -64,7 +64,7 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
QString QmakeAndroidRunConfigurationFactory::displayNameForId(Core::Id id) const 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 bool QmakeAndroidRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const

View File

@@ -119,7 +119,8 @@ Utils::FileName QmakeAndroidSupport::androiddeployJsonPath(ProjectExplorer::Targ
if (!buildApkStep) // should never happen if (!buildApkStep) // should never happen
return Utils::FileName(); return Utils::FileName();
const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(buildApkStep->proFilePathForInputFile()); const QmakeProFileNode *node =
pro->rootQmakeProjectNode()->findProFileFor(buildApkStep->proFilePathForInputFile());
if (!node) // should never happen if (!node) // should never happen
return Utils::FileName(); return Utils::FileName();

View File

@@ -72,9 +72,9 @@ const char USE_TERMINAL_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseTermin
const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix"; const char USE_DYLD_IMAGE_SUFFIX_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix";
const char USER_WORKING_DIRECTORY_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"; 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) if (m_parseInProgress)
return tr("The .pro file \"%1\" is currently being parsed.") return tr("The .pro file \"%1\" is currently being parsed.")
.arg(FileName::fromString(m_proFilePath).fileName()); .arg(m_proFilePath.fileName());
if (!m_parseSuccess) if (!m_parseSuccess)
return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath); 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()); const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
QVariantMap map(LocalApplicationRunConfiguration::toMap()); QVariantMap map(LocalApplicationRunConfiguration::toMap());
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments); 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_TERMINAL_KEY), m_runMode == ApplicationLauncher::Console);
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix); map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
map.insert(QLatin1String(USER_WORKING_DIRECTORY_KEY), m_userWorkingDirectory); 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()); const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).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() m_runMode = map.value(QLatin1String(USE_TERMINAL_KEY), false).toBool()
? ApplicationLauncher::Console : ApplicationLauncher::Gui; ? ApplicationLauncher::Console : ApplicationLauncher::Gui;
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool(); 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")); env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
} }
QString DesktopQmakeRunConfiguration::proFilePath() const Utils::FileName DesktopQmakeRunConfiguration::proFilePath() const
{ {
return m_proFilePath; return m_proFilePath;
} }
@@ -569,7 +569,7 @@ QString DesktopQmakeRunConfiguration::defaultDisplayName()
{ {
QString defaultName; QString defaultName;
if (!m_proFilePath.isEmpty()) if (!m_proFilePath.isEmpty())
defaultName = QFileInfo(m_proFilePath).completeBaseName(); defaultName = m_proFilePath.toFileInfo().completeBaseName();
else else
defaultName = tr("Qt Run Configuration"); defaultName = tr("Qt Run Configuration");
return defaultName; return defaultName;
@@ -691,7 +691,7 @@ QList<Core::Id> DesktopQmakeRunConfigurationFactory::availableCreationIds(Target
QString DesktopQmakeRunConfigurationFactory::displayNameForId(Core::Id id) const QString DesktopQmakeRunConfigurationFactory::displayNameForId(Core::Id id) const
{ {
return QFileInfo(pathFromId(id)).completeBaseName(); return pathFromId(id).toFileInfo().completeBaseName();
} }
bool DesktopQmakeRunConfigurationFactory::canHandle(Target *t) const bool DesktopQmakeRunConfigurationFactory::canHandle(Target *t) const

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/localapplicationrunconfiguration.h> #include <projectexplorer/localapplicationrunconfiguration.h>
#include <utils/fileutils.h>
#include <QStringList> #include <QStringList>
#include <QLabel> #include <QLabel>
@@ -86,7 +87,7 @@ public:
bool isUsingDyldImageSuffix() const; bool isUsingDyldImageSuffix() const;
void setUsingDyldImageSuffix(bool state); void setUsingDyldImageSuffix(bool state);
QString proFilePath() const; Utils::FileName proFilePath() const;
QVariantMap toMap() const; QVariantMap toMap() const;
@@ -126,7 +127,7 @@ private:
void updateTarget(); void updateTarget();
QString m_commandLineArguments; 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 // Cached startup sub project information
ProjectExplorer::ApplicationLauncher::Mode m_runMode; ProjectExplorer::ApplicationLauncher::Mode m_runMode;

View File

@@ -132,7 +132,7 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
QString *errorMessage) const QString *errorMessage) const
{ {
// Get the binary either from the current Qt version of the project or Path // 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 Target *target = project->activeTarget()) {
if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit())) { if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit())) {
data->binary = (qtVersion->*commandAccessor)(); data->binary = (qtVersion->*commandAccessor)();

View File

@@ -85,7 +85,7 @@ LibraryDetailsController::LibraryDetailsController(
if (!Utils::HostOsInfo::isLinuxHost()) { if (!Utils::HostOsInfo::isLinuxHost()) {
// project for which we are going to insert the snippet // 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 (project && project->activeTarget()) {
// if its tool chain is maemo behave the same as we would be on linux // if its tool chain is maemo behave the same as we would be on linux
ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit()); ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit());
@@ -884,7 +884,7 @@ QString PackageLibraryDetailsController::snippet() const
bool PackageLibraryDetailsController::isLinkPackageGenerated() const bool PackageLibraryDetailsController::isLinkPackageGenerated() const
{ {
const Project *project = SessionManager::projectForFile(proFile()); const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile()));
if (!project) if (!project)
return false; return false;
@@ -892,7 +892,8 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const
if (!rootProject) if (!rootProject)
return false; return false;
const QmakeProFileNode *currentProject = rootProject->findProFileFor(proFile()); const QmakeProFileNode *currentProject =
rootProject->findProFileFor(Utils::FileName::fromString(proFile()));
if (!currentProject) if (!currentProject)
return false; return false;
@@ -1013,13 +1014,11 @@ AddLibraryWizard::MacLibraryType InternalLibraryDetailsController::suggestedMacL
QString InternalLibraryDetailsController::suggestedIncludePath() const QString InternalLibraryDetailsController::suggestedIncludePath() const
{ {
const int currentIndex = libraryDetailsWidget()->libraryComboBox->currentIndex(); const int currentIndex = libraryDetailsWidget()->libraryComboBox->currentIndex();
QString includePath;
if (currentIndex >= 0) { if (currentIndex >= 0) {
QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex); QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
QFileInfo fi(proFileNode->path()); return proFileNode->path().toFileInfo().absolutePath();
includePath = fi.absolutePath();
} }
return includePath; return QString();
} }
void InternalLibraryDetailsController::updateWindowsOptionsEnablement() void InternalLibraryDetailsController::updateWindowsOptionsEnablement()
@@ -1036,20 +1035,19 @@ void InternalLibraryDetailsController::updateProFile()
m_proFileNodes.clear(); m_proFileNodes.clear();
libraryDetailsWidget()->libraryComboBox->clear(); libraryDetailsWidget()->libraryComboBox->clear();
const Project *project = SessionManager::projectForFile(proFile()); const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile()));
if (!project) if (!project)
return; return;
setIgnoreGuiSignals(true); setIgnoreGuiSignals(true);
ProjectExplorer::ProjectNode *rootProject = project->rootProjectNode(); ProjectExplorer::ProjectNode *rootProject = project->rootProjectNode();
QFileInfo fi(rootProject->path()); m_rootProjectPath = rootProject->path().toFileInfo().absolutePath();
m_rootProjectPath = fi.absolutePath();
QDir rootDir(m_rootProjectPath); QDir rootDir(m_rootProjectPath);
FindQmakeProFiles findQt4ProFiles; FindQmakeProFiles findQt4ProFiles;
QList<QmakeProFileNode *> proFiles = findQt4ProFiles(rootProject); QList<QmakeProFileNode *> proFiles = findQt4ProFiles(rootProject);
foreach (QmakeProFileNode *proFileNode, proFiles) { foreach (QmakeProFileNode *proFileNode, proFiles) {
const QString proFilePath = proFileNode->path(); const QString proFilePath = proFileNode->path().toString();
if (proFileNode->projectType() == LibraryTemplate) { if (proFileNode->projectType() == LibraryTemplate) {
const QStringList configVar = proFileNode->variableValue(ConfigVar); const QStringList configVar = proFileNode->variableValue(ConfigVar);
if (!configVar.contains(QLatin1String("plugin"))) { if (!configVar.contains(QLatin1String("plugin"))) {
@@ -1119,7 +1117,7 @@ QString InternalLibraryDetailsController::snippet() const
const QString proRelavitePath = rootDir.relativeFilePath(proFile()); const QString proRelavitePath = rootDir.relativeFilePath(proFile());
// project for which we insert the snippet // 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 // the build directory of the active build configuration
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir

View File

@@ -237,7 +237,7 @@ bool MakeStep::init()
if (!relObjectsDir.isEmpty()) if (!relObjectsDir.isEmpty())
relObjectsDir += QLatin1Char('/'); relObjectsDir += QLatin1Char('/');
QString objectFile = relObjectsDir + QString objectFile = relObjectsDir +
QFileInfo(bc->fileNodeBuild()->path()).baseName() + bc->fileNodeBuild()->path().toFileInfo().baseName() +
subNode->objectExtension(); subNode->objectExtension();
Utils::QtcProcess::addArg(&args, objectFile); Utils::QtcProcess::addArg(&args, objectFile);
} }

View File

@@ -60,6 +60,7 @@
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
@@ -111,11 +112,11 @@ class SortByPath
public: public:
bool operator()(Node *a, Node *b) bool operator()(Node *a, Node *b)
{ return operator()(a->path(), b->path()); } { 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); } { return operator()(a->path(), b); }
bool operator()(const QString &a, Node *b) bool operator()(const FileName &a, Node *b)
{ return operator()(a, b->path()); } { return operator()(a, b->path()); }
bool operator()(const QString &a, const QString &b) bool operator()(const FileName &a, const FileName &b)
{ return a < b; } { return a < b; }
}; };
@@ -195,7 +196,7 @@ class EvalInput
{ {
public: public:
QString projectDir; QString projectDir;
QString projectFilePath; FileName projectFilePath;
QString buildDirectory; QString buildDirectory;
QtSupport::ProFileReader *readerExact; QtSupport::ProFileReader *readerExact;
QtSupport::ProFileReader *readerCumulative; QtSupport::ProFileReader *readerCumulative;
@@ -220,18 +221,18 @@ public:
QmakeProjectType projectType; QmakeProjectType projectType;
QStringList subProjectsNotToDeploy; QStringList subProjectsNotToDeploy;
QHash<QString, ProFile*> includeFilesExact; QHash<FileName, ProFile*> includeFilesExact;
QStringList newProjectFilesExact; FileNameList newProjectFilesExact;
QSet<QString> exactSubdirs; QSet<FileName> exactSubdirs;
ProFile *fileForCurrentProjectExact; // probably only used in parser thread ProFile *fileForCurrentProjectExact; // probably only used in parser thread
QHash<QString, ProFile*> includeFilesCumlative; QHash<FileName, ProFile*> includeFilesCumlative;
QStringList newProjectFilesCumlative; FileNameList newProjectFilesCumlative;
ProFile *fileForCurrentProjectCumlative; // probably only used in parser thread ProFile *fileForCurrentProjectCumlative; // probably only used in parser thread
TargetInformation targetInformation; TargetInformation targetInformation;
InstallsList installsList; InstallsList installsList;
QHash<QmakeVariable, QStringList> newVarValues; QHash<QmakeVariable, QStringList> newVarValues;
bool isDeployable; bool isDeployable;
QHash<QString, PriFileEvalResult> priFileResults; QHash<FileName, PriFileEvalResult> priFileResults;
QStringList errors; QStringList errors;
}; };
} }
@@ -242,7 +243,7 @@ QmakePriFile::QmakePriFile(QmakeProjectManager::QmakePriFileNode *qmakePriFile)
{ {
setId("Qmake.PriFile"); setId("Qmake.PriFile");
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE)); setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
setFilePath(FileName::fromString(m_priFile->path())); setFilePath(m_priFile->path());
} }
bool QmakePriFile::save(QString *errorString, const QString &fileName, bool autoSave) 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 { namespace QmakeProjectManager {
QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const QString &filePath) QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
const FileName &filePath)
: ProjectNode(filePath), : ProjectNode(filePath),
m_project(project), m_project(project),
m_qmakeProFileNode(qmakeProFileNode), m_qmakeProFileNode(qmakeProFileNode),
m_projectFilePath(QDir::fromNativeSeparators(filePath)), m_projectFilePath(filePath),
m_projectDir(QFileInfo(filePath).absolutePath()), m_projectDir(filePath.toFileInfo().absolutePath()),
m_includedInExactParse(true) m_includedInExactParse(true)
{ {
Q_ASSERT(project); Q_ASSERT(project);
m_qmakePriFile = new QmakePriFile(this); m_qmakePriFile = new QmakePriFile(this);
Core::DocumentManager::addDocument(m_qmakePriFile); Core::DocumentManager::addDocument(m_qmakePriFile);
setDisplayName(QFileInfo(filePath).completeBaseName()); setDisplayName(filePath.toFileInfo().completeBaseName());
setIcon(qmakeNodeStaticData()->projectIcon); setIcon(qmakeNodeStaticData()->projectIcon);
} }
@@ -321,7 +323,7 @@ QmakePriFileNode::~QmakePriFileNode()
void QmakePriFileNode::scheduleUpdate() void QmakePriFileNode::scheduleUpdate()
{ {
QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath); QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath.toString());
m_qmakeProFileNode->scheduleUpdate(QmakeProFileNode::ParseLater); m_qmakeProFileNode->scheduleUpdate(QmakeProFileNode::ParseLater);
} }
@@ -330,7 +332,7 @@ struct InternalNode
{ {
QList<InternalNode *> virtualfolders; QList<InternalNode *> virtualfolders;
QMap<QString, InternalNode *> subnodes; QMap<QString, InternalNode *> subnodes;
QStringList files; FileNameList files;
FileType type; FileType type;
int priority; int priority;
QString displayName; QString displayName;
@@ -404,7 +406,7 @@ struct InternalNode
} }
path += separator; path += separator;
} else { // key is filename } else { // key is filename
currentNode->files.append(file.toString()); currentNode->files.append(file);
} }
} }
} }
@@ -437,10 +439,12 @@ struct InternalNode
FolderNode *createFolderNode(InternalNode *node) FolderNode *createFolderNode(InternalNode *node)
{ {
FolderNode *newNode = 0; FolderNode *newNode = 0;
if (node->typeName.isEmpty()) if (node->typeName.isEmpty()) {
newNode = new FolderNode(node->fullPath); newNode = new FolderNode(FileName::fromString(node->fullPath));
else } else {
newNode = new ProVirtualFolderNode(node->fullPath, node->priority, node->typeName); newNode = new ProVirtualFolderNode(FileName::fromString(node->fullPath),
node->priority, node->typeName);
}
newNode->setDisplayName(node->displayName); newNode->setDisplayName(node->displayName);
if (!node->icon.isNull()) if (!node->icon.isNull())
@@ -460,7 +464,7 @@ struct InternalNode
QMultiMap<QString, FolderNode *> existingFolderNodes; QMultiMap<QString, FolderNode *> existingFolderNodes;
foreach (FolderNode *node, folder->subFolderNodes()) foreach (FolderNode *node, folder->subFolderNodes())
if (node->nodeType() != ProjectNodeType && !dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node)) 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 *> foldersToRemove;
QList<FolderNode *> foldersToAdd; QList<FolderNode *> foldersToAdd;
@@ -551,7 +555,7 @@ struct InternalNode
} }
QList<FileNode*> filesToRemove; QList<FileNode*> filesToRemove;
QStringList filesToAdd; FileNameList filesToAdd;
SortByPath sortByPath; SortByPath sortByPath;
Utils::sort(files, sortByPath); Utils::sort(files, sortByPath);
@@ -560,7 +564,7 @@ struct InternalNode
ProjectExplorer::compareSortedLists(existingFileNodes, files, filesToRemove, filesToAdd, sortByPath); ProjectExplorer::compareSortedLists(existingFileNodes, files, filesToRemove, filesToAdd, sortByPath);
QList<FileNode *> nodesToAdd; QList<FileNode *> nodesToAdd;
foreach (const QString &file, filesToAdd) foreach (const FileName &file, filesToAdd)
nodesToAdd << new FileNode(file, type, false); nodesToAdd << new FileNode(file, type, false);
folder->removeFileNodes(filesToRemove); folder->removeFileNodes(filesToRemove);
@@ -577,7 +581,7 @@ struct InternalNode
} }
QList<FolderNode *> resourcesToRemove; QList<FolderNode *> resourcesToRemove;
QStringList resourcesToAdd; FileNameList resourcesToAdd;
SortByPath sortByPath; SortByPath sortByPath;
Utils::sort(files, sortByPath); Utils::sort(files, sortByPath);
@@ -588,7 +592,7 @@ struct InternalNode
QList<FolderNode *> nodesToAdd; QList<FolderNode *> nodesToAdd;
nodesToAdd.reserve(resourcesToAdd.size()); nodesToAdd.reserve(resourcesToAdd.size());
foreach (const QString &file, resourcesToAdd) foreach (const FileName &file, resourcesToAdd)
nodesToAdd.append(new ResourceEditor::ResourceTopLevelNode(file, folder)); nodesToAdd.append(new ResourceEditor::ResourceTopLevelNode(file, folder));
folder->removeFolderNodes(resourcesToRemove); 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. // work on a subset of the file types according to project type.
actions << AddNewFile; actions << AddNewFile;
if (m_recursiveEnumerateFiles.contains(FileName::fromString(node->path()))) if (m_recursiveEnumerateFiles.contains(node->path()))
actions << EraseFile; actions << EraseFile;
else else
actions << RemoveFile; actions << RemoveFile;
@@ -930,13 +934,13 @@ QList<ProjectAction> QmakePriFileNode::supportedActions(Node *node) const
if (folder) { if (folder) {
QStringList list; QStringList list;
foreach (FolderNode *f, folder->subFolderNodes()) foreach (FolderNode *f, folder->subFolderNodes())
list << f->path() + QLatin1Char('/'); list << f->path().toString() + QLatin1Char('/');
if (deploysFolder(Utils::commonPath(list))) if (deploysFolder(Utils::commonPath(list)))
addExistingFiles = false; addExistingFiles = false;
} }
} }
addExistingFiles = addExistingFiles && !deploysFolder(node->path()); addExistingFiles = addExistingFiles && !deploysFolder(node->path().toString());
if (addExistingFiles) if (addExistingFiles)
actions << AddExistingFile << AddExistingDirectory; 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 FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringList &files, Node *context) const
{ {
Q_UNUSED(files) 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) bool QmakePriFileNode::priFileWritable(const QString &path)
@@ -1129,7 +1133,7 @@ bool QmakePriFileNode::priFileWritable(const QString &path)
bool QmakePriFileNode::saveModifiedEditors() bool QmakePriFileNode::saveModifiedEditors()
{ {
Core::IDocument *document Core::IDocument *document
= Core::DocumentModel::documentForFilePath(m_projectFilePath); = Core::DocumentModel::documentForFilePath(m_projectFilePath.toString());
if (!document || !document->isModified()) if (!document || !document->isModified())
return true; return true;
@@ -1137,7 +1141,7 @@ bool QmakePriFileNode::saveModifiedEditors()
return false; return false;
// force instant reload of ourselves // force instant reload of ourselves
QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath); QtSupport::ProFileCacheManager::instance()->discardFile(m_projectFilePath.toString());
m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath); m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath);
return true; return true;
} }
@@ -1235,9 +1239,9 @@ void QmakePriFileNode::changeFiles(const QString &mimeType,
if (!saveModifiedEditors()) if (!saveModifiedEditors())
return; return;
if (!ensureWriteableProFile(m_projectFilePath)) if (!ensureWriteableProFile(m_projectFilePath.toString()))
return; return;
QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath); QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath.toString());
ProFile *includeFile = pair.first; ProFile *includeFile = pair.first;
QStringList lines = pair.second; 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) 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; return false;
QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath); QPair<ProFile *, QStringList> pair = readProFile(m_projectFilePath.toString());
ProFile *includeFile = pair.first; ProFile *includeFile = pair.first;
QStringList lines = pair.second; QStringList lines = pair.second;
@@ -1281,20 +1285,20 @@ bool QmakePriFileNode::setProVariable(const QString &var, const QStringList &val
void QmakePriFileNode::save(const QStringList &lines) void QmakePriFileNode::save(const QStringList &lines)
{ {
Core::DocumentManager::expectFileChange(m_projectFilePath); Core::DocumentManager::expectFileChange(m_projectFilePath.toString());
FileSaver saver(m_projectFilePath, QIODevice::Text); FileSaver saver(m_projectFilePath.toString(), QIODevice::Text);
saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit()); saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit());
saver.finalize(Core::ICore::mainWindow()); saver.finalize(Core::ICore::mainWindow());
m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath); m_project->qmakeProjectManager()->notifyChanged(m_projectFilePath);
Core::DocumentManager::unexpectFileChange(m_projectFilePath); Core::DocumentManager::unexpectFileChange(m_projectFilePath.toString());
// This is a hack. // This is a hack.
// We are saving twice in a very short timeframe, once the editor and once the ProFile. // 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. // So the modification time might not change between those two saves.
// We manually tell each editor to reload it's file. // We manually tell each editor to reload it's file.
// (The .pro files are notified by the file system watcher.) // (The .pro files are notified by the file system watcher.)
QStringList errorStrings; QStringList errorStrings;
Core::IDocument *document = Core::DocumentModel::documentForFilePath(m_projectFilePath); Core::IDocument *document = Core::DocumentModel::documentForFilePath(m_projectFilePath.toString());
if (document) { if (document) {
QString errorString; QString errorString;
if (!document->reload(&errorString, Core::IDocument::FlagReload, Core::IDocument::TypeContents)) 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()) if (fileName == path())
return this; return this;
@@ -1584,7 +1588,7 @@ bool QmakeProFileNode::isDeployable() const
Implements abstract ProjectNode class Implements abstract ProjectNode class
*/ */
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, QmakeProFileNode::QmakeProFileNode(QmakeProject *project,
const QString &filePath) const FileName &filePath)
: QmakePriFileNode(project, this, filePath), : QmakePriFileNode(project, this, filePath),
m_validParse(false), m_validParse(false),
m_parseInProgress(true), m_parseInProgress(true),
@@ -1625,7 +1629,7 @@ bool QmakeProFileNode::showInSimpleTree() const
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
{ {
Q_UNUSED(files) 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 bool QmakeProFileNode::showInSimpleTree(QmakeProjectType projectType) const
@@ -1765,17 +1769,17 @@ void QmakeProFileNode::setupReader()
m_readerCumulative->setCumulative(true); 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())); result.reserve(qMax(listA.size(), listB.size()));
auto ait = listA.constBegin(); auto ait = listA.constBegin();
auto aend = listA.constEnd(); auto aend = listA.constEnd();
auto bit = listB.constBegin(); auto bit = listB.constBegin();
auto bend = listB.constEnd(); auto bend = listB.constEnd();
while (ait != aend && bit != bend) { while (ait != aend && bit != bend) {
const QString &a = *ait; const FileName &a = *ait;
const QString &b = *bit; const FileName &b = *bit;
if (a < b) { if (a < b) {
result.append(a); result.append(a);
++ait; ++ait;
@@ -1802,7 +1806,7 @@ static QStringList mergeList(const QStringList &listA, const QStringList &listB)
EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
{ {
EvalResult *result = new EvalResult; 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 exactOk = input.readerExact->accept(pro, QMakeEvaluator::LoadAll);
bool cumulOk = input.readerCumulative->accept(pro, QMakeEvaluator::LoadPreFiles); bool cumulOk = input.readerCumulative->accept(pro, QMakeEvaluator::LoadPreFiles);
pro->deref(); pro->deref();
@@ -1828,11 +1832,12 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
result->exactSubdirs = result->newProjectFilesExact.toSet(); result->exactSubdirs = result->newProjectFilesExact.toSet();
} }
foreach (ProFile *includeFile, input.readerExact->includeFiles()) { foreach (ProFile *includeFile, input.readerExact->includeFiles()) {
if (includeFile->fileName() == input.projectFilePath) { // this file if (includeFile->fileName() == input.projectFilePath.toString()) { // this file
result->fileForCurrentProjectExact = includeFile; result->fileForCurrentProjectExact = includeFile;
} else { } else {
result->newProjectFilesExact << includeFile->fileName(); const FileName includeFileName = FileName::fromString(includeFile->fileName());
result->includeFilesExact.insert(includeFile->fileName(), includeFile); result->newProjectFilesExact << includeFileName;
result->includeFilesExact.insert(includeFileName, includeFile);
} }
} }
} }
@@ -1840,11 +1845,12 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
if (result->projectType == SubDirsTemplate) if (result->projectType == SubDirsTemplate)
result->newProjectFilesCumlative = subDirsPaths(input.readerCumulative, input.projectDir, 0, 0); result->newProjectFilesCumlative = subDirsPaths(input.readerCumulative, input.projectDir, 0, 0);
foreach (ProFile *includeFile, input.readerCumulative->includeFiles()) { foreach (ProFile *includeFile, input.readerCumulative->includeFiles()) {
if (includeFile->fileName() == input.projectFilePath) { if (includeFile->fileName() == input.projectFilePath.toString()) {
result->fileForCurrentProjectCumlative = includeFile; result->fileForCurrentProjectCumlative = includeFile;
} else { } else {
result->newProjectFilesCumlative << includeFile->fileName(); const FileName includeFileName = FileName::fromString(includeFile->fileName());
result->includeFilesCumlative.insert(includeFile->fileName(), includeFile); result->newProjectFilesCumlative << includeFileName;
result->includeFilesCumlative.insert(includeFileName, includeFile);
} }
} }
SortByPath sortByPath; SortByPath sortByPath;
@@ -1874,7 +1880,7 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
readerBuildPass->setExtraConfigs(basecfgs); readerBuildPass->setExtraConfigs(basecfgs);
EvalResult::EvalResultState evalResultBuildPass = EvalResult::EvalOk; 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)) if (!readerBuildPass->accept(pro, QMakeEvaluator::LoadAll))
evalResultBuildPass = EvalResult::EvalPartial; evalResultBuildPass = EvalResult::EvalPartial;
pro->deref(); pro->deref();
@@ -1887,8 +1893,9 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
readerBuildPass = 0; readerBuildPass = 0;
} }
} }
result->targetInformation = targetInformation(input.readerExact, readerBuildPass, input.buildDirectory, input.projectFilePath); result->targetInformation = targetInformation(input.readerExact, readerBuildPass,
result->installsList = installsList(readerBuildPass, input.projectFilePath, input.projectDir); input.buildDirectory, input.projectFilePath.toString());
result->installsList = installsList(readerBuildPass, input.projectFilePath.toString(), input.projectDir);
// update other variables // update other variables
result->newVarValues[DefinesVar] = input.readerExact->values(QLatin1String("DEFINES")); result->newVarValues[DefinesVar] = input.readerExact->values(QLatin1String("DEFINES"));
@@ -1979,8 +1986,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
} }
// extract values // extract values
QStringList allFiles = mergeList(result->newProjectFilesExact, result->newProjectFilesCumlative); FileNameList allFiles = mergeList(result->newProjectFilesExact, result->newProjectFilesCumlative);
foreach (const QString &file, allFiles) { foreach (const FileName &file, allFiles) {
ProFile *fileExact = result->includeFilesExact.value(file); ProFile *fileExact = result->includeFilesExact.value(file);
ProFile *fileCumlative = result->includeFilesCumlative.value(file); ProFile *fileCumlative = result->includeFilesCumlative.value(file);
if (fileExact || fileCumlative) { if (fileExact || fileCumlative) {
@@ -2037,7 +2044,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
setParseInProgressRecursive(false); setParseInProgressRecursive(false);
if (result->state == EvalResult::EvalFail) { 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) if (m_projectType == InvalidProject)
return; return;
@@ -2094,8 +2102,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
QList<ProjectNode*> toRemove; QList<ProjectNode*> toRemove;
QList<ProjectNode*>::const_iterator existingIt = existingProjectNodes.constBegin(); QList<ProjectNode*>::const_iterator existingIt = existingProjectNodes.constBegin();
QStringList::const_iterator newExactIt = result->newProjectFilesExact.constBegin(); FileNameList::const_iterator newExactIt = result->newProjectFilesExact.constBegin();
QStringList::const_iterator newCumlativeIt = result->newProjectFilesCumlative.constBegin(); FileNameList::const_iterator newCumlativeIt = result->newProjectFilesCumlative.constBegin();
forever { forever {
bool existingAtEnd = (existingIt == existingProjectNodes.constEnd()); bool existingAtEnd = (existingIt == existingProjectNodes.constEnd());
@@ -2111,7 +2119,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
// parsing, since the update call is diffrent for them // parsing, since the update call is diffrent for them
// I believe this code to be correct, be careful in changing it // I believe this code to be correct, be careful in changing it
QString nodeToAdd; FileName nodeToAdd;
if (! existingAtEnd if (! existingAtEnd
&& (newExactAtEnd || (*existingIt)->path() < *newExactIt) && (newExactAtEnd || (*existingIt)->path() < *newExactIt)
&& (newCumlativeAtEnd || (*existingIt)->path() < *newCumlativeIt)) { && (newCumlativeAtEnd || (*existingIt)->path() < *newCumlativeIt)) {
@@ -2165,7 +2173,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
// the .pro file is included in this .pro file // the .pro file is included in this .pro file
// So to compare that later parse with the sync one // So to compare that later parse with the sync one
QmakeProFileNode *proFileNode = static_cast<QmakeProFileNode *>(*existingIt); QmakeProFileNode *proFileNode = static_cast<QmakeProFileNode *>(*existingIt);
proFileNode->setIncludedInExactParse(result->exactSubdirs.contains(proFileNode->path()) && includedInExactParse()); proFileNode->setIncludedInExactParse(result->exactSubdirs.contains(proFileNode->path())
&& includedInExactParse());
proFileNode->asyncUpdate(); proFileNode->asyncUpdate();
} }
++existingIt; ++existingIt;
@@ -2189,7 +2198,8 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
if (loop) { if (loop) {
// Do nothing // Do nothing
} else if (fileExact || fileCumlative) { } else {
if (fileExact || fileCumlative) {
QmakePriFileNode *qmakePriFileNode = new QmakePriFileNode(m_project, this, nodeToAdd); QmakePriFileNode *qmakePriFileNode = new QmakePriFileNode(m_project, this, nodeToAdd);
qmakePriFileNode->setParentFolderNode(this); // Needed for loop detection qmakePriFileNode->setParentFolderNode(this); // Needed for loop detection
qmakePriFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse()); qmakePriFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse());
@@ -2198,11 +2208,14 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
} else { } else {
QmakeProFileNode *qmakeProFileNode = new QmakeProFileNode(m_project, nodeToAdd); QmakeProFileNode *qmakeProFileNode = new QmakeProFileNode(m_project, nodeToAdd);
qmakeProFileNode->setParentFolderNode(this); // Needed for loop detection qmakeProFileNode->setParentFolderNode(this); // Needed for loop detection
qmakeProFileNode->setIncludedInExactParse(result->exactSubdirs.contains(qmakeProFileNode->path()) && includedInExactParse()); qmakeProFileNode->setIncludedInExactParse(
result->exactSubdirs.contains(qmakeProFileNode->path())
&& includedInExactParse());
qmakeProFileNode->asyncUpdate(); qmakeProFileNode->asyncUpdate();
toAdd << qmakeProFileNode; toAdd << qmakeProFileNode;
} }
} }
}
} // for } // for
foreach (ProjectNode *node, toRemove) { foreach (ProjectNode *node, toRemove) {
@@ -2314,12 +2327,12 @@ QStringList QmakeProFileNode::libDirectories(QtSupport::ProFileReader *reader)
return result; return result;
} }
QStringList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader, FileNameList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader,
const QString &projectDir, const QString &projectDir,
QStringList *subProjectsNotToDeploy, QStringList *subProjectsNotToDeploy,
QStringList *errors) QStringList *errors)
{ {
QStringList subProjectPaths; FileNameList subProjectPaths;
const QStringList subDirVars = reader->values(QLatin1String("SUBDIRS")); const QStringList subDirVars = reader->values(QLatin1String("SUBDIRS"));
@@ -2353,7 +2366,7 @@ QStringList QmakeProFileNode::subDirsPaths(QtSupport::ProFileReader *reader,
if (QFile::exists(realFile)) { if (QFile::exists(realFile)) {
realFile = QDir::cleanPath(realFile); realFile = QDir::cleanPath(realFile);
subProjectPaths << realFile; subProjectPaths << FileName::fromString(realFile);
if (subProjectsNotToDeploy && !subProjectsNotToDeploy->contains(realFile) if (subProjectsNotToDeploy && !subProjectsNotToDeploy->contains(realFile)
&& reader->values(subDirVar + QLatin1String(".CONFIG")) && reader->values(subDirVar + QLatin1String(".CONFIG"))
.contains(QLatin1String("no_default_target"))) { .contains(QLatin1String("no_default_target"))) {
@@ -2476,11 +2489,11 @@ QString QmakeProFileNode::uiDirectory(const QString &buildDir) const
return buildDir; return buildDir;
} }
QString QmakeProFileNode::uiHeaderFile(const QString &uiDir, const QString &formFile) QString QmakeProFileNode::uiHeaderFile(const QString &uiDir, const FileName &formFile)
{ {
QString uiHeaderFilePath = uiDir; QString uiHeaderFilePath = uiDir;
uiHeaderFilePath += QLatin1String("/ui_"); uiHeaderFilePath += QLatin1String("/ui_");
uiHeaderFilePath += QFileInfo(formFile).completeBaseName(); uiHeaderFilePath += formFile.toFileInfo().completeBaseName();
uiHeaderFilePath += QLatin1String(".h"); uiHeaderFilePath += QLatin1String(".h");
return QDir::cleanPath(uiHeaderFilePath); return QDir::cleanPath(uiHeaderFilePath);
} }
@@ -2499,6 +2512,6 @@ void QmakeProFileNode::updateUiFiles(const QString &buildDir)
// Find the UiDir, there can only ever be one // Find the UiDir, there can only ever be one
const QString uiDir = uiDirectory(buildDir); const QString uiDir = uiDirectory(buildDir);
foreach (const FileNode *uiFile, uiFiles) foreach (const FileNode *uiFile, uiFiles)
m_uiFiles.insert(uiFile->path(), uiHeaderFile(uiDir, uiFile->path())); m_uiFiles.insert(uiFile->path().toString(), uiHeaderFile(uiDir, uiFile->path()));
} }
} }

View File

@@ -151,7 +151,7 @@ public:
class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::ProjectNode
{ {
public: public:
QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const QString &filePath); QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, const Utils::FileName &filePath);
~QmakePriFileNode(); ~QmakePriFileNode();
void update(const Internal::PriFileEvalResult &result); void update(const Internal::PriFileEvalResult &result);
@@ -226,7 +226,7 @@ private:
QmakeProject *m_project; QmakeProject *m_project;
QmakeProFileNode *m_qmakeProFileNode; QmakeProFileNode *m_qmakeProFileNode;
QString m_projectFilePath; Utils::FileName m_projectFilePath;
QString m_projectDir; QString m_projectDir;
QMap<QString, QtSupport::UiCodeModelSupport *> m_uiCodeModelSupport; QMap<QString, QtSupport::UiCodeModelSupport *> m_uiCodeModelSupport;
@@ -269,7 +269,7 @@ private:
class ProVirtualFolderNode : public ProjectExplorer::VirtualFolderNode class ProVirtualFolderNode : public ProjectExplorer::VirtualFolderNode
{ {
public: 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) : VirtualFolderNode(folderPath, priority), m_typeName(typeName)
{ {
@@ -349,8 +349,7 @@ struct QMAKEPROJECTMANAGER_EXPORT ProjectVersion {
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
{ {
public: public:
QmakeProFileNode(QmakeProject *project, QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath);
const QString &filePath);
~QmakeProFileNode(); ~QmakeProFileNode();
bool isParent(QmakeProFileNode *node); bool isParent(QmakeProFileNode *node);
@@ -372,10 +371,10 @@ public:
QString buildDir(QmakeBuildConfiguration *bc = 0) const; QString buildDir(QmakeBuildConfiguration *bc = 0) const;
QString uiDirectory(const QString &buildDir) 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; QHash<QString, QString> uiFiles() const;
const QmakeProFileNode *findProFileFor(const QString &string) const; const QmakeProFileNode *findProFileFor(const Utils::FileName &string) const;
TargetInformation targetInformation() const; TargetInformation targetInformation() const;
InstallsList installsList() const; InstallsList installsList() const;
@@ -426,7 +425,7 @@ private:
static QString mocDirPath(QtSupport::ProFileReader *reader, const QString &buildDir); static QString mocDirPath(QtSupport::ProFileReader *reader, const QString &buildDir);
static QStringList includePaths(QtSupport::ProFileReader *reader, const QString &buildDir, const QString &projectDir); static QStringList includePaths(QtSupport::ProFileReader *reader, const QString &buildDir, const QString &projectDir);
static QStringList libDirectories(QtSupport::ProFileReader *reader); 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 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); static InstallsList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir);

View File

@@ -256,21 +256,19 @@ void ProjectFilesVisitor::findProjectFiles(QmakeProFileNode *rootNode, QmakeProj
void ProjectFilesVisitor::visitProjectNode(ProjectNode *projectNode) void ProjectFilesVisitor::visitProjectNode(ProjectNode *projectNode)
{ {
const QString path = projectNode->path(); m_files->proFiles.append(projectNode->path().toString());
m_files->proFiles.append(path);
visitFolderNode(projectNode); visitFolderNode(projectNode);
} }
void ProjectFilesVisitor::visitFolderNode(FolderNode *folderNode) void ProjectFilesVisitor::visitFolderNode(FolderNode *folderNode)
{ {
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(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()) { foreach (FileNode *fileNode, folderNode->fileNodes()) {
const QString path = fileNode->path();
const int type = fileNode->fileType(); const int type = fileNode->fileType();
QStringList &targetList = fileNode->isGenerated() ? m_files->generatedFiles[type] : m_files->files[type]; 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_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 // On active buildconfiguration changes, reevaluate the .pro files
m_activeTarget = activeTarget(); m_activeTarget = activeTarget();
@@ -504,7 +502,7 @@ void QmakeProject::updateCppCodeModel()
ProjectPart::Ptr templatePart(new ProjectPart); ProjectPart::Ptr templatePart(new ProjectPart);
templatePart->project = this; templatePart->project = this;
templatePart->displayName = pro->displayName(); templatePart->displayName = pro->displayName();
templatePart->projectFile = pro->path(); templatePart->projectFile = pro->path().toString();
templatePart->selectedForBuilding = pro->includedInExactParse(); templatePart->selectedForBuilding = pro->includedInExactParse();
if (pro->variableValue(ConfigVar).contains(QLatin1String("qt"))) if (pro->variableValue(ConfigVar).contains(QLatin1String("qt")))
@@ -834,7 +832,7 @@ void QmakeProject::decrementPendingEvaluateFutures()
QtQuickApp qtQuickApp; QtQuickApp qtQuickApp;
foreach (QmakeProFileNode *node, applicationProFiles(QmakeProject::ExactAndCumulativeParse)) { foreach (QmakeProFileNode *node, applicationProFiles(QmakeProject::ExactAndCumulativeParse)) {
const QString path = node->path(); const QString path = node->path().toString();
foreach (TemplateInfo info, QtQuickApp::templateInfos()) { foreach (TemplateInfo info, QtQuickApp::templateInfos()) {
qtQuickApp.setTemplateInfo(info); 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) // 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()) foreach (FileNode *fn, in->fileNodes())
if (fn->fileType() == fileType && fn->path() == fileName) 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. // Find the QmakeProFileNode that contains a file of a certain type.
// First recurse down to folder, then find the pro-file. // 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()) for (FolderNode *folder = folderOf(in, fileType, fileName); folder; folder = folder->parentFolderNode())
if (QmakeProFileNode *proFile = dynamic_cast<QmakeProFileNode *>(folder)) if (QmakeProFileNode *proFile = dynamic_cast<QmakeProFileNode *>(folder))
@@ -959,7 +957,7 @@ static QmakeProFileNode *proFileNodeOf(QmakeProFileNode *in, FileType fileType,
return 0; return 0;
} }
QString QmakeProject::generatedUiHeader(const QString &formFile) const QString QmakeProject::generatedUiHeader(const FileName &formFile) const
{ {
// Look in sub-profiles as SessionManager::projectForFile returns // Look in sub-profiles as SessionManager::projectForFile returns
// the top-level project only. // the top-level project only.
@@ -1074,7 +1072,7 @@ QmakeProFileNode *QmakeProject::rootQmakeProjectNode() const
return m_rootProjectNode; return m_rootProjectNode;
} }
bool QmakeProject::validParse(const QString &proFilePath) const bool QmakeProject::validParse(const FileName &proFilePath) const
{ {
if (!m_rootProjectNode) if (!m_rootProjectNode)
return false; return false;
@@ -1082,7 +1080,7 @@ bool QmakeProject::validParse(const QString &proFilePath) const
return node && node->validParse(); return node && node->validParse();
} }
bool QmakeProject::parseInProgress(const QString &proFilePath) const bool QmakeProject::parseInProgress(const FileName &proFilePath) const
{ {
if (!m_rootProjectNode) if (!m_rootProjectNode)
return false; return false;
@@ -1117,7 +1115,7 @@ QList<QmakeProFileNode *> QmakeProject::allProFiles(const QList<QmakeProjectType
return list; return list;
} }
bool QmakeProject::hasApplicationProFile(const QString &path) const bool QmakeProject::hasApplicationProFile(const FileName &path) const
{ {
if (path.isEmpty()) if (path.isEmpty())
return false; return false;
@@ -1143,7 +1141,7 @@ QList<QmakeProFileNode *> QmakeProject::nodesWithQtcRunnable(QList<QmakeProFileN
QList<Core::Id> QmakeProject::idsForNodes(Core::Id base, const QList<QmakeProFileNode *> &nodes) QList<Core::Id> QmakeProject::idsForNodes(Core::Id base, const QList<QmakeProFileNode *> &nodes)
{ {
return Utils::transform(nodes, [&base](QmakeProFileNode *node) { 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(); scheduleAsyncUpdate();
} }
bool QmakeProject::hasSubNode(QmakePriFileNode *root, const QString &path) bool QmakeProject::hasSubNode(QmakePriFileNode *root, const FileName &path)
{ {
if (root->path() == path) if (root->path() == path)
return true; return true;
@@ -1180,7 +1178,7 @@ bool QmakeProject::hasSubNode(QmakePriFileNode *root, const QString &path)
return false; 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)) if (hasSubNode(root, fileName))
list.append(root); list.append(root);
@@ -1190,13 +1188,13 @@ void QmakeProject::findProFile(const QString& fileName, QmakeProFileNode *root,
findProFile(fileName, qt4proFileNode, list); 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; QList<QmakeProFileNode *> list;
findProFile(name, rootQmakeProjectNode(), list); findProFile(name, rootQmakeProjectNode(), list);
foreach (QmakeProFileNode *node, list) { foreach (QmakeProFileNode *node, list) {
QtSupport::ProFileCacheManager::instance()->discardFile(name); QtSupport::ProFileCacheManager::instance()->discardFile(name.toString());
node->scheduleUpdate(QmakeProFileNode::ParseNow); node->scheduleUpdate(QmakeProFileNode::ParseNow);
} }
} }
@@ -1435,21 +1433,21 @@ bool QmakeProject::requiresTargetPanel() const
// All the Qmake run configurations should share code. // All the Qmake run configurations should share code.
// This is a rather suboptimal way to do that for disabledReason() // This is a rather suboptimal way to do that for disabledReason()
// but more pratical then duplicated the code everywhere // 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.") return tr("The .pro file \"%1\" does not exist.")
.arg(FileName::fromString(proFilePath).fileName()); .arg(proFilePath.fileName());
if (!m_rootProjectNode) // Shutting down if (!m_rootProjectNode) // Shutting down
return QString(); return QString();
if (!m_rootProjectNode->findProFileFor(proFilePath)) if (!m_rootProjectNode->findProFileFor(proFilePath))
return tr("The .pro file \"%1\" is not part of the project.") 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.") return tr("The .pro file \"%1\" could not be parsed.")
.arg(FileName::fromString(proFilePath).fileName()); .arg(proFilePath.fileName());
} }
QString QmakeProject::buildNameFor(const Kit *k) QString QmakeProject::buildNameFor(const Kit *k)
@@ -1477,14 +1475,14 @@ void QmakeProject::updateBuildSystemData()
foreach (const QmakeProFileNode * const node, applicationProFiles()) { foreach (const QmakeProFileNode * const node, applicationProFiles()) {
appTargetList.list << BuildTargetInfo(node->targetInformation().target, appTargetList.list << BuildTargetInfo(node->targetInformation().target,
FileName::fromString(executableFor(node)), FileName::fromString(executableFor(node)),
FileName::fromString(node->path())); node->path());
} }
target->setApplicationTargets(appTargetList); target->setApplicationTargets(appTargetList);
} }
void QmakeProject::collectData(const QmakeProFileNode *node, DeploymentData &deploymentData) void QmakeProject::collectData(const QmakeProFileNode *node, DeploymentData &deploymentData)
{ {
if (!node->isSubProjectDeployable(node->path())) if (!node->isSubProjectDeployable(node->path().toString()))
return; return;
const InstallsList &installsList = node->installsList(); const InstallsList &installsList = node->installsList();

View File

@@ -80,22 +80,22 @@ public:
ProjectExplorer::ProjectNode *rootProjectNode() const; ProjectExplorer::ProjectNode *rootProjectNode() const;
QmakeProFileNode *rootQmakeProjectNode() const; QmakeProFileNode *rootQmakeProjectNode() const;
bool validParse(const QString &proFilePath) const; bool validParse(const Utils::FileName &proFilePath) const;
bool parseInProgress(const QString &proFilePath) const; bool parseInProgress(const Utils::FileName &proFilePath) const;
virtual QStringList files(FilesMode fileMode) 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 }; enum Parsing {ExactParse, ExactAndCumulativeParse };
QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(), QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(),
Parsing parse = ExactParse) const; Parsing parse = ExactParse) const;
QList<QmakeProFileNode *> applicationProFiles(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<QmakeProFileNode *> nodesWithQtcRunnable(QList<QmakeProFileNode *> nodes);
static QList<Core::Id> idsForNodes(Core::Id base, const 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 /// \internal
QtSupport::ProFileReader *createProFileReader(const QmakeProFileNode *qmakeProFileNode, QmakeBuildConfiguration *bc = 0); QtSupport::ProFileReader *createProFileReader(const QmakeProFileNode *qmakeProFileNode, QmakeBuildConfiguration *bc = 0);
@@ -130,7 +130,7 @@ public:
bool requiresTargetPanel() const; bool requiresTargetPanel() const;
/// \internal /// \internal
QString disabledReasonForRunConfiguration(const QString &proFilePath); QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath);
/// used by the default implementation of shadowBuildDirectory /// used by the default implementation of shadowBuildDirectory
static QString buildNameFor(const ProjectExplorer::Kit *k); static QString buildNameFor(const ProjectExplorer::Kit *k);
@@ -170,8 +170,8 @@ private:
static void collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse, static void collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse,
const QList<QmakeProjectManager::QmakeProjectType> &projectTypes); const QList<QmakeProjectManager::QmakeProjectType> &projectTypes);
static void findProFile(const QString& fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list); static void findProFile(const Utils::FileName &fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
static bool hasSubNode(QmakePriFileNode *root, const QString &path); static bool hasSubNode(QmakePriFileNode *root, const Utils::FileName &path);
static bool equalFileList(const QStringList &a, const QStringList &b); static bool equalFileList(const QStringList &a, const QStringList &b);

View File

@@ -79,7 +79,7 @@ void QmakeManager::unregisterProject(QmakeProject *project)
m_projects.removeOne(project); m_projects.removeOne(project);
} }
void QmakeManager::notifyChanged(const QString &name) void QmakeManager::notifyChanged(const Utils::FileName &name)
{ {
foreach (QmakeProject *pro, m_projects) foreach (QmakeProject *pro, m_projects)
pro->notifyChanged(name); pro->notifyChanged(name);
@@ -142,7 +142,7 @@ void QmakeManager::addLibraryContextMenu()
{ {
Node *node = ProjectTree::currentNode(); Node *node = ProjectTree::currentNode();
if (dynamic_cast<QmakeProFileNode *>(node)) if (dynamic_cast<QmakeProFileNode *>(node))
addLibrary(node->path()); addLibrary(node->path().toString());
} }
void QmakeManager::addLibrary(const QString &fileName, BaseTextEditor *editor) void QmakeManager::addLibrary(const QString &fileName, BaseTextEditor *editor)
@@ -231,7 +231,7 @@ void QmakeManager::buildFileContextMenu()
void QmakeManager::buildFile() void QmakeManager::buildFile()
{ {
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) { if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
const QString file = currentDocument->filePath().toString(); const Utils::FileName file = currentDocument->filePath();
FileNode *node = dynamic_cast<FileNode *>(SessionManager::nodeForFile(file)); FileNode *node = dynamic_cast<FileNode *>(SessionManager::nodeForFile(file));
Project *project = SessionManager::projectForFile(file); Project *project = SessionManager::projectForFile(file);

View File

@@ -59,7 +59,7 @@ public:
void registerProject(QmakeProject *project); void registerProject(QmakeProject *project);
void unregisterProject(QmakeProject *project); void unregisterProject(QmakeProject *project);
void notifyChanged(const QString &name); void notifyChanged(const Utils::FileName &name);
virtual QString mimeType() const; virtual QString mimeType() const;
ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString); ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString);

View File

@@ -345,7 +345,7 @@ void QmakeProjectManagerPlugin::updateContextActions(ProjectExplorer::Node *node
m_rebuildSubProjectAction->setParameter(subProjectName); m_rebuildSubProjectAction->setParameter(subProjectName);
m_cleanSubProjectAction->setParameter(subProjectName); m_cleanSubProjectAction->setParameter(subProjectName);
m_buildSubProjectContextMenu->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()) ? QmakeBuildConfiguration *buildConfiguration = (qmakeProject && qmakeProject->activeTarget()) ?
static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()) : 0; static_cast<QmakeBuildConfiguration *>(qmakeProject->activeTarget()->activeBuildConfiguration()) : 0;
@@ -392,10 +392,10 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
bool enabled = false; bool enabled = false;
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) { if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
QString file = currentDocument->filePath().toString(); Utils::FileName file = currentDocument->filePath();
Node *node = SessionManager::nodeForFile(file); Node *node = SessionManager::nodeForFile(file);
Project *project = SessionManager::projectForFile(file); Project *project = SessionManager::projectForFile(file);
m_buildFileAction->setParameter(Utils::FileName::fromString(file).fileName()); m_buildFileAction->setParameter(file.fileName());
visible = qobject_cast<QmakeProject *>(project) visible = qobject_cast<QmakeProject *>(project)
&& node && node
&& dynamic_cast<QmakePriFileNode *>(node->projectNode()); && dynamic_cast<QmakePriFileNode *>(node->projectNode());

View File

@@ -127,7 +127,7 @@ QString QMakeStep::allArguments(bool shorted)
QmakeBuildConfiguration *bc = qmakeBuildConfiguration(); QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
QStringList arguments; QStringList arguments;
if (bc->subNodeBuild()) if (bc->subNodeBuild())
arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path()); arguments << bc->subNodeBuild()->path().toUserOutput();
else if (shorted) else if (shorted)
arguments << project()->projectFilePath().fileName(); arguments << project()->projectFilePath().fileName();
else else
@@ -260,7 +260,7 @@ bool QMakeStep::init()
QmakeProFileNode *node = static_cast<QmakeProject *>(qt4bc->target()->project())->rootQmakeProjectNode(); QmakeProFileNode *node = static_cast<QmakeProject *>(qt4bc->target()->project())->rootQmakeProjectNode();
if (qt4bc->subNodeBuild()) if (qt4bc->subNodeBuild())
node = qt4bc->subNodeBuild(); node = qt4bc->subNodeBuild();
QString proFile = node->path(); QString proFile = node->path().toString();
QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory); QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
Utils::sort(tasks); Utils::sort(tasks);

View File

@@ -643,7 +643,7 @@ static inline Kit *getActiveKit(DesignDocument *designDocument)
Project *currentProject = ProjectTree::currentProject(); Project *currentProject = ProjectTree::currentProject();
if (!currentProject) if (!currentProject)
currentProject = SessionManager::projectForFile(designDocument->fileName()); currentProject = SessionManager::projectForFile(Utils::FileName::fromString(designDocument->fileName()));
if (!currentProject) if (!currentProject)
return 0; return 0;

View File

@@ -45,6 +45,8 @@
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <utils/fileutils.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@@ -128,7 +130,8 @@ public:
if (path == QFileInfo(fileName()).path()) { if (path == QFileInfo(fileName()).path()) {
// hack for the common case, next version should use the wizard // 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) { if (oldFileNode) {
ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode(); ProjectExplorer::FolderNode *containingFolder = oldFileNode->parentFolderNode();
if (containingFolder) if (containingFolder)

View File

@@ -68,11 +68,11 @@ void setupFileFilterItem(QmlProjectManager::FileFilterBaseItem *fileFilterItem,
namespace QmlProjectManager { namespace QmlProjectManager {
QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const QString &fileName, QString *errorMessage) QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FileName &fileName, QString *errorMessage)
{ {
QmlJS::SimpleReader simpleQmlJSReader; 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()) { if (!simpleQmlJSReader.errors().isEmpty() || !rootNode->isValid()) {
qWarning() << "unable to parse:" << fileName; qWarning() << "unable to parse:" << fileName;

View File

@@ -31,6 +31,8 @@
#ifndef QMLPROJECTFILEFORMAT_H #ifndef QMLPROJECTFILEFORMAT_H
#define QMLPROJECTFILEFORMAT_H #define QMLPROJECTFILEFORMAT_H
#include <utils/fileutils.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QString> #include <QString>
@@ -43,7 +45,7 @@ class QmlProjectFileFormat
Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectFileFormat) Q_DECLARE_TR_FUNCTIONS(QmlProjectManager::QmlProjectFileFormat)
public: public:
static QmlProjectItem *parseProjectFile(const QString &fileName, QString *errorMessage = 0); static QmlProjectItem *parseProjectFile(const Utils::FileName &fileName, QString *errorMessage = 0);
}; };
} // namespace QmlProjectManager } // namespace QmlProjectManager

View File

@@ -58,7 +58,7 @@ namespace Internal {
} // 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_manager(manager),
m_fileName(fileName), m_fileName(fileName),
m_defaultImport(UnknownImport), m_defaultImport(UnknownImport),
@@ -68,7 +68,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT)); setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS)); setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
QFileInfo fileInfo(m_fileName); QFileInfo fileInfo = m_fileName.toFileInfo();
m_projectName = fileInfo.completeBaseName(); m_projectName = fileInfo.completeBaseName();
m_file = new Internal::QmlProjectFile(this, fileName); m_file = new Internal::QmlProjectFile(this, fileName);
@@ -129,7 +129,7 @@ QDir QmlProject::projectDir() const
return projectFilePath().toFileInfo().dir(); return projectFilePath().toFileInfo().dir();
} }
QString QmlProject::filesFileName() const Utils::FileName QmlProject::filesFileName() const
{ return m_fileName; } { return m_fileName; }
static QmlProject::QmlImport detectImport(const QString &qml) { static QmlProject::QmlImport detectImport(const QString &qml) {
@@ -157,7 +157,9 @@ void QmlProject::parseProject(RefreshOptions options)
this, SLOT(refreshFiles(QSet<QString>,QSet<QString>))); this, SLOT(refreshFiles(QSet<QString>,QSet<QString>)));
} else { } 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); MessageManager::write(errorMessage);
} }
} }
@@ -172,7 +174,8 @@ void QmlProject::parseProject(RefreshOptions options)
Utils::FileReader reader; Utils::FileReader reader;
QString errorMessage; QString errorMessage;
if (!reader.fetch(mainFilePath, &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); MessageManager::write(errorMessage);
} else { } else {
m_defaultImport = detectImport(QString::fromUtf8(reader.data())); m_defaultImport = detectImport(QString::fromUtf8(reader.data()));
@@ -211,7 +214,7 @@ void QmlProject::refresh(RefreshOptions options)
QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
{ {
const QDir projectDir(QFileInfo(m_fileName).dir()); const QDir projectDir(m_fileName.toFileInfo().dir());
QStringList absolutePaths; QStringList absolutePaths;
foreach (const QString &file, paths) { foreach (const QString &file, paths) {
QFileInfo fileInfo(projectDir, file); QFileInfo fileInfo(projectDir, file);

View File

@@ -56,10 +56,10 @@ class QMLPROJECTMANAGER_EXPORT QmlProject : public ProjectExplorer::Project
Q_OBJECT Q_OBJECT
public: public:
QmlProject(Internal::Manager *manager, const QString &filename); QmlProject(Internal::Manager *manager, const Utils::FileName &filename);
virtual ~QmlProject(); virtual ~QmlProject();
QString filesFileName() const; Utils::FileName filesFileName() const;
QString displayName() const; QString displayName() const;
Core::IDocument *document() const; Core::IDocument *document() const;
@@ -111,7 +111,7 @@ private:
QmlJS::ModelManagerInterface *modelManager() const; QmlJS::ModelManagerInterface *modelManager() const;
Internal::Manager *m_manager; Internal::Manager *m_manager;
QString m_fileName; Utils::FileName m_fileName;
Internal::QmlProjectFile *m_file; Internal::QmlProjectFile *m_file;
QString m_projectName; QString m_projectName;
QmlImport m_defaultImport; QmlImport m_defaultImport;

View File

@@ -36,7 +36,7 @@
namespace QmlProjectManager { namespace QmlProjectManager {
namespace Internal { namespace Internal {
QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName) QmlProjectFile::QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName)
: Core::IDocument(parent), : Core::IDocument(parent),
m_project(parent) m_project(parent)
{ {
@@ -44,7 +44,7 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName)
QTC_CHECK(!fileName.isEmpty()); QTC_CHECK(!fileName.isEmpty());
setId("Qml.ProjectFile"); setId("Qml.ProjectFile");
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE)); setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
setFilePath(Utils::FileName::fromString(fileName)); setFilePath(fileName);
} }
QmlProjectFile::~QmlProjectFile() QmlProjectFile::~QmlProjectFile()

View File

@@ -44,7 +44,7 @@ class QmlProjectFile : public Core::IDocument
Q_OBJECT Q_OBJECT
public: public:
QmlProjectFile(QmlProject *parent, const QString &fileName); QmlProjectFile(QmlProject *parent, const Utils::FileName &fileName);
virtual ~QmlProjectFile(); virtual ~QmlProjectFile();
virtual bool save(QString *errorString, const QString &fileName, bool autoSave); virtual bool save(QString *errorString, const QString &fileName, bool autoSave);

View File

@@ -57,7 +57,7 @@ ProjectExplorer::Project *Manager::openProject(const QString &fileName, QString
return 0; return 0;
} }
return new QmlProject(this, fileName); return new QmlProject(this, Utils::FileName::fromString(fileName));
} }
void Manager::registerProject(QmlProject *project) void Manager::registerProject(QmlProject *project)
@@ -68,8 +68,9 @@ void Manager::unregisterProject(QmlProject *project)
void Manager::notifyChanged(const QString &fileName) void Manager::notifyChanged(const QString &fileName)
{ {
const Utils::FileName file = Utils::FileName::fromString(fileName);
foreach (QmlProject *project, m_projects) { foreach (QmlProject *project, m_projects) {
if (fileName == project->filesFileName()) if (file == project->filesFileName())
project->refresh(QmlProject::Files); project->refresh(QmlProject::Files);
} }
} }

View File

@@ -42,7 +42,7 @@ namespace QmlProjectManager {
namespace Internal { namespace Internal {
QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IDocument *projectFile) QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IDocument *projectFile)
: ProjectExplorer::ProjectNode(projectFile->filePath().toString()), : ProjectExplorer::ProjectNode(projectFile->filePath()),
m_project(project), m_project(project),
m_projectFile(projectFile) m_projectFile(projectFile)
{ {
@@ -80,7 +80,7 @@ void QmlProjectNode::refresh()
/* generated = */ false); /* generated = */ false);
QStringList files = m_project->files(); QStringList files = m_project->files();
files.removeAll(m_project->filesFileName()); files.removeAll(m_project->filesFileName().toString());
addFileNodes(QList<FileNode *>() addFileNodes(QList<FileNode *>()
<< projectFilesNode); << projectFilesNode);
@@ -114,7 +114,8 @@ void QmlProjectNode::refresh()
QList<FileNode *> fileNodes; QList<FileNode *> fileNodes;
foreach (const QString &file, it.value()) { foreach (const QString &file, it.value()) {
FileType fileType = SourceType; // ### FIXME 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); fileNodes.append(fileNode);
} }
@@ -129,7 +130,7 @@ ProjectExplorer::FolderNode *QmlProjectNode::findOrCreateFolderByName(const QStr
if (! end) if (! end)
return 0; return 0;
QString baseDir = QFileInfo(path()).path(); Utils::FileName folderPath = path().parentDir();
QString folderName; QString folderName;
for (int i = 0; i < end; ++i) { 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)) else if (FolderNode *folder = m_folderByName.value(folderName))
return folder; return folder;
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); folderPath.appendPath(folderName);
FolderNode *folder = new FolderNode(folderPath);
folder->setDisplayName(component); folder->setDisplayName(component);
m_folderByName.insert(folderName, folder); m_folderByName.insert(folderName, folder);

View File

@@ -35,7 +35,7 @@
using namespace Qnx; using namespace Qnx;
using namespace Qnx::Internal; using namespace Qnx::Internal;
BarDescriptorFileNode::BarDescriptorFileNode(const QString &filePath) BarDescriptorFileNode::BarDescriptorFileNode(const Utils::FileName &filePath)
: ProjectExplorer::FileNode(filePath, ProjectExplorer::ProjectFileType, false) : ProjectExplorer::FileNode(filePath, ProjectExplorer::ProjectFileType, false)
{ {
} }

View File

@@ -41,7 +41,7 @@ namespace Internal {
class BarDescriptorFileNode : public ProjectExplorer::FileNode class BarDescriptorFileNode : public ProjectExplorer::FileNode
{ {
public: public:
explicit BarDescriptorFileNode(const QString &filePath); explicit BarDescriptorFileNode(const Utils::FileName &filePath);
QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const; QList<ProjectExplorer::ProjectAction> supportedActions(Node *node) const;
}; };

View File

@@ -150,7 +150,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
if (!projectNode) if (!projectNode)
continue; continue;
if (!QFileInfo::exists(package.appDescriptorPath())) { if (!package.appDescriptorPath().exists()) {
if (!attemptCreate) if (!attemptCreate)
continue; continue;
@@ -165,7 +165,8 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
if (existingNode) { if (existingNode) {
if (existingNode->path() != package.appDescriptorPath()) { if (existingNode->path() != package.appDescriptorPath()) {
// Reload the new bar-descriptor document in the existing editor (if there is one) // 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) { if (oldDocument) {
QString errorMessage; QString errorMessage;
@@ -173,7 +174,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
Core::MessageManager::write(tr("Cannot save bar descriptor file: %1").arg(errorMessage)); Core::MessageManager::write(tr("Cannot save bar descriptor file: %1").arg(errorMessage));
continue; continue;
} else { } else {
oldDocument->setFilePath(Utils::FileName::fromString(package.appDescriptorPath())); oldDocument->setFilePath(package.appDescriptorPath());
if (!oldDocument->reload(&errorMessage, Core::IDocument::FlagReload, Core::IDocument::TypeContents)) if (!oldDocument->reload(&errorMessage, Core::IDocument::FlagReload, Core::IDocument::TypeContents))
Core::MessageManager::write(tr("Cannot reload bar descriptor file: %1").arg(errorMessage)); 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, bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project *project,
const QString &barDescriptorPath, const Utils::FileName &barDescriptorPath,
ProjectExplorer::ProjectNode *projectNode) ProjectExplorer::ProjectNode *projectNode)
{ {
const QString projectName = QFileInfo(projectNode->path()).completeBaseName(); const QString projectName = projectNode->path().toFileInfo().completeBaseName();
QmakeProjectManager::QmakeProFileNode *proFileNode = QmakeProjectManager::QmakeProFileNode *proFileNode =
dynamic_cast<QmakeProjectManager::QmakeProFileNode*>(projectNode); dynamic_cast<QmakeProjectManager::QmakeProFileNode*>(projectNode);
QTC_ASSERT(proFileNode, return false); QTC_ASSERT(proFileNode, return false);
const QString targetName = proFileNode->targetInformation().target; const QString targetName = proFileNode->targetInformation().target;
const QFile barDescriptorFile(barDescriptorPath); const QFile barDescriptorFile(barDescriptorPath.toString());
if (barDescriptorFile.exists()) if (barDescriptorFile.exists())
return false; return false;
@@ -261,13 +262,13 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
return true; return true;
} }
void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescriptorPath, void BarDescriptorFileNodeManager::updateBarDescriptor(const Utils::FileName &barDescriptorPath,
ProjectExplorer::Target *target, ProjectExplorer::Target *target,
bool skipConfirmation) bool skipConfirmation)
{ {
BarDescriptorDocument doc; BarDescriptorDocument doc;
QString errorString; QString errorString;
if (!doc.open(&errorString, barDescriptorPath)) { if (!doc.open(&errorString, barDescriptorPath.toString())) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Error"), QMessageBox::warning(Core::ICore::mainWindow(), tr("Error"),
tr("Cannot open BAR application descriptor file")); tr("Cannot open BAR application descriptor file"));
return; return;
@@ -335,8 +336,9 @@ BarDescriptorFileNode *BarDescriptorFileNodeManager::findBarDescriptorFileNode(P
return 0; return 0;
} }
ProjectExplorer::ProjectNode *BarDescriptorFileNodeManager::findProjectNode(ProjectExplorer::ProjectNode *parent, ProjectExplorer::ProjectNode *BarDescriptorFileNodeManager::findProjectNode(
const QString &projectFilePath) const ProjectExplorer::ProjectNode *parent,
const Utils::FileName &projectFilePath) const
{ {
QTC_ASSERT(parent, return 0); QTC_ASSERT(parent, return 0);

View File

@@ -35,6 +35,10 @@
#include <QObject> #include <QObject>
namespace Utils {
class FileName;
}
namespace ProjectExplorer { namespace ProjectExplorer {
class DeployConfiguration; class DeployConfiguration;
class Project; class Project;
@@ -64,12 +68,12 @@ private slots:
private: private:
BarDescriptorFileNode *findBarDescriptorFileNode(ProjectExplorer::ProjectNode *parent) const; BarDescriptorFileNode *findBarDescriptorFileNode(ProjectExplorer::ProjectNode *parent) const;
ProjectExplorer::ProjectNode *findProjectNode(ProjectExplorer::ProjectNode *parent, ProjectExplorer::ProjectNode *findProjectNode(ProjectExplorer::ProjectNode *parent,
const QString &projectFilePath) const; const Utils::FileName &projectFilePath) const;
void updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate); 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); ProjectExplorer::ProjectNode *projectNode);
void updateBarDescriptor(const QString &barDescriptorPath, ProjectExplorer::Target *target, void updateBarDescriptor(const Utils::FileName &barDescriptorPath, ProjectExplorer::Target *target,
bool skipConfirmation = false); bool skipConfirmation = false);
void removeBarDescriptorNodes(ProjectExplorer::Project *project); void removeBarDescriptorNodes(ProjectExplorer::Project *project);

View File

@@ -225,7 +225,7 @@ RunControl::StopResult BlackBerryApplicationRunner::stop()
args << QLatin1String("-device") << m_sshParams.host; args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty()) if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password; args << QLatin1String("-password") << m_sshParams.password;
args << m_barPackage; args << m_barPackage.toUserOutput();
if (!m_stopProcess) { if (!m_stopProcess) {
m_stopProcess = new QProcess(this); m_stopProcess = new QProcess(this);
@@ -322,7 +322,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArguments()
connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded())); connect(m_checkQmlJsDebugArgumentsProcess, SIGNAL(finished(int)), this, SLOT(checkQmlJsDebugArgumentsManifestLoaded()));
QStringList args; QStringList args;
args << QLatin1String("-listManifest") << QDir::toNativeSeparators(m_barPackage); args << QLatin1String("-listManifest") << m_barPackage.toUserOutput();
if (debugCheckQmlJSArgs) if (debugCheckQmlJSArgs)
qDebug() << "get manifest:" << nativePackagerCmd << args.join(QLatin1Char(' ')); qDebug() << "get manifest:" << nativePackagerCmd << args.join(QLatin1Char(' '));
m_checkQmlJsDebugArgumentsProcess->start(nativePackagerCmd, args); m_checkQmlJsDebugArgumentsProcess->start(nativePackagerCmd, args);
@@ -379,7 +379,7 @@ void BlackBerryApplicationRunner::checkQmlJsDebugArgumentsManifestLoaded()
args << QLatin1String("-device") << m_sshParams.host; args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty()) if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password; args << QLatin1String("-password") << m_sshParams.password;
args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage); args << QLatin1String("-package") << m_barPackage.toUserOutput();
args << QLatin1String("-putFile"); args << QLatin1String("-putFile");
args << manifestFile->fileName(); args << manifestFile->fileName();
args << QLatin1String("app/META-INF/MANIFEST.MF"); args << QLatin1String("app/META-INF/MANIFEST.MF");
@@ -416,7 +416,7 @@ void BlackBerryApplicationRunner::launchApplication()
args << QLatin1String("-device") << m_sshParams.host; args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty()) if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password; args << QLatin1String("-password") << m_sshParams.password;
args << QLatin1String("-package") << QDir::toNativeSeparators(m_barPackage); args << QLatin1String("-package") << m_barPackage.toUserOutput();
if (!m_launchProcess) { if (!m_launchProcess) {
m_launchProcess = new QProcess(this); m_launchProcess = new QProcess(this);
@@ -460,7 +460,7 @@ void BlackBerryApplicationRunner::determineRunningState()
args << QLatin1String("-device") << m_sshParams.host; args << QLatin1String("-device") << m_sshParams.host;
if (!m_sshParams.password.isEmpty()) if (!m_sshParams.password.isEmpty())
args << QLatin1String("-password") << m_sshParams.password; args << QLatin1String("-password") << m_sshParams.password;
args << m_barPackage; args << m_barPackage.toUserOutput();
if (!m_runningStateProcess) { if (!m_runningStateProcess) {
m_runningStateProcess = new QProcess(this); m_runningStateProcess = new QProcess(this);

View File

@@ -41,6 +41,7 @@
#include <ssh/sshconnection.h> #include <ssh/sshconnection.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/fileutils.h>
#include <QObject> #include <QObject>
#include <QProcess> #include <QProcess>
@@ -126,7 +127,7 @@ private:
Utils::Environment m_environment; Utils::Environment m_environment;
QString m_deployCmd; QString m_deployCmd;
BlackBerryDeviceConfiguration::ConstPtr m_device; BlackBerryDeviceConfiguration::ConstPtr m_device;
QString m_barPackage; Utils::FileName m_barPackage;
QSsh::SshConnectionParameters m_sshParams; QSsh::SshConnectionParameters m_sshParams;
QProcess *m_launchProcess; QProcess *m_launchProcess;

View File

@@ -254,7 +254,7 @@ bool BlackBerryCreatePackageStep::init()
return false; return false;
} }
const QString buildDir = QFileInfo(info.packagePath()).absolutePath(); const QString buildDir = info.packagePath().toFileInfo().absolutePath();
QDir dir(buildDir); QDir dir(buildDir);
if (!dir.exists()) { if (!dir.exists()) {
if (!dir.mkpath(buildDir)) { 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 (!doUpdateAppDescriptorFile(appDescriptorPath, PlaceHolders))
// If there is an error, prepareAppDescriptorFile() will raise it // If there is an error, prepareAppDescriptorFile() will raise it
return false; return false;
@@ -295,8 +295,8 @@ bool BlackBerryCreatePackageStep::init()
args << QLatin1String("-storepass"); args << QLatin1String("-storepass");
args << m_keystorePassword; args << m_keystorePassword;
} }
args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath())); args << QLatin1String("-package") << QnxUtils::addQuotes(info.packagePath().toUserOutput());
args << QnxUtils::addQuotes(QDir::toNativeSeparators(appDescriptorPath)); args << QnxUtils::addQuotes(appDescriptorPath.toUserOutput());
addCommand(packageCmd.toString(), args); addCommand(packageCmd.toString(), args);
} }
@@ -428,16 +428,16 @@ void BlackBerryCreatePackageStep::updateAppDescriptorFile()
doUpdateAppDescriptorFile(info.appDescriptorPath(), QtEnvironment); doUpdateAppDescriptorFile(info.appDescriptorPath(), QtEnvironment);
} }
bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDescriptorPath, bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const Utils::FileName &appDescriptorPath,
QFlags<EditMode> types, QFlags<EditMode> types,
bool skipConfirmation) bool skipConfirmation)
{ {
Core::FileChangeBlocker fb(appDescriptorPath); Core::FileChangeBlocker fb(appDescriptorPath.toString());
BarDescriptorDocument doc; BarDescriptorDocument doc;
QString errorString; QString errorString;
if (!doc.open(&errorString, appDescriptorPath)) { if (!doc.open(&errorString, appDescriptorPath.toString())) {
raiseError(tr("Error opening BAR application descriptor file \"%1\" - %2") raiseError(tr("Error opening BAR application descriptor file \"%1\" - %2")
.arg(QDir::toNativeSeparators(appDescriptorPath)) .arg(appDescriptorPath.toUserOutput())
.arg(errorString)); .arg(errorString));
return false; return false;
} }
@@ -548,7 +548,7 @@ bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDe
if (!doc.save(&errorString)) { if (!doc.save(&errorString)) {
raiseError(tr("Error saving BAR application descriptor file \"%1\" - %2") raiseError(tr("Error saving BAR application descriptor file \"%1\" - %2")
.arg(QDir::toNativeSeparators(appDescriptorPath)) .arg(appDescriptorPath.toUserOutput())
.arg(errorString)); .arg(errorString));
return false; return false;
} }

View File

@@ -106,7 +106,7 @@ protected:
private: private:
void ctor(); void ctor();
bool doUpdateAppDescriptorFile(const QString &appDescriptorPath, bool doUpdateAppDescriptorFile(const Utils::FileName &appDescriptorPath,
QFlags<EditMode> types, QFlags<EditMode> types,
bool skipConfirmation = false); bool skipConfirmation = false);

View File

@@ -56,18 +56,18 @@ const char TARGET_KEY[] = "Qnx.BlackBerry.DeployInformation.Target";
const char SOURCE_KEY[] = "Qnx.BlackBerry.DeployInformation.Source"; const char SOURCE_KEY[] = "Qnx.BlackBerry.DeployInformation.Source";
} }
QString BarPackageDeployInformation::appDescriptorPath() const Utils::FileName BarPackageDeployInformation::appDescriptorPath() const
{ {
if (userAppDescriptorPath.isEmpty()) if (userAppDescriptorPath.isEmpty())
return sourceDir + QLatin1String("/bar-descriptor.xml"); return Utils::FileName(sourceDir).appendPath(QLatin1String("bar-descriptor.xml"));
return userAppDescriptorPath; return userAppDescriptorPath;
} }
QString BarPackageDeployInformation::packagePath() const Utils::FileName BarPackageDeployInformation::packagePath() const
{ {
if (userPackagePath.isEmpty()) if (userPackagePath.isEmpty())
return buildDir + QLatin1Char('/') + targetName + QLatin1String(".bar"); return Utils::FileName(buildDir).appendPath(targetName).appendString(QLatin1String(".bar"));
return userPackagePath; return userPackagePath;
} }
@@ -111,9 +111,9 @@ QVariant BlackBerryDeployInformation::data(const QModelIndex &index, int role) c
return di.enabled ? Qt::Checked : Qt::Unchecked; return di.enabled ? Qt::Checked : Qt::Unchecked;
} else if (role == Qt::DisplayRole || role == Qt::EditRole) { } else if (role == Qt::DisplayRole || role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn) if (index.column() == AppDescriptorColumn)
return QDir::toNativeSeparators(di.appDescriptorPath()); return di.appDescriptorPath().toUserOutput();
else if (index.column() == PackageColumn) else if (index.column() == PackageColumn)
return QDir::toNativeSeparators(di.packagePath()); return di.packagePath().toUserOutput();
} }
return QVariant(); return QVariant();
@@ -148,9 +148,9 @@ bool BlackBerryDeployInformation::setData(const QModelIndex &index, const QVaria
di.enabled = static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked; di.enabled = static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked;
} else if (role == Qt::EditRole) { } else if (role == Qt::EditRole) {
if (index.column() == AppDescriptorColumn) if (index.column() == AppDescriptorColumn)
di.userAppDescriptorPath = value.toString(); di.userAppDescriptorPath = Utils::FileName::fromString(value.toString());
else if (index.column() == PackageColumn) else if (index.column() == PackageColumn)
di.userPackagePath = value.toString(); di.userPackagePath = Utils::FileName::fromString(value.toString());
} }
emit dataChanged(index, index); emit dataChanged(index, index);
@@ -200,11 +200,11 @@ QVariantMap BlackBerryDeployInformation::toMap() const
QVariantMap deployInfoMap; QVariantMap deployInfoMap;
deployInfoMap[QLatin1String(ENABLED_KEY)] = deployInfo.enabled; deployInfoMap[QLatin1String(ENABLED_KEY)] = deployInfo.enabled;
deployInfoMap[QLatin1String(APPDESCRIPTOR_KEY)] = deployInfo.userAppDescriptorPath; deployInfoMap[QLatin1String(APPDESCRIPTOR_KEY)] = deployInfo.userAppDescriptorPath.toString();
deployInfoMap[QLatin1String(PACKAGE_KEY)] = deployInfo.userPackagePath; deployInfoMap[QLatin1String(PACKAGE_KEY)] = deployInfo.userPackagePath.toString();
deployInfoMap[QLatin1String(PROFILE_KEY)] = deployInfo.proFilePath; deployInfoMap[QLatin1String(PROFILE_KEY)] = deployInfo.proFilePath.toString();
deployInfoMap[QLatin1String(TARGET_KEY)] = deployInfo.targetName; 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; 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 targetName = innerMap.value(QLatin1String(TARGET_KEY)).toString();
const QString sourceDir = innerMap.value(QLatin1String(SOURCE_KEY)).toString(); const QString sourceDir = innerMap.value(QLatin1String(SOURCE_KEY)).toString();
BarPackageDeployInformation deployInformation(enabled, proFilePath, sourceDir, BarPackageDeployInformation deployInformation(enabled, Utils::FileName::fromString(proFilePath),
m_target->activeBuildConfiguration()->buildDirectory().toString(), Utils::FileName::fromString(sourceDir),
m_target->activeBuildConfiguration()->buildDirectory(),
targetName); targetName);
deployInformation.userAppDescriptorPath = appDescriptorPath; deployInformation.userAppDescriptorPath = Utils::FileName::fromString(appDescriptorPath);
deployInformation.userPackagePath = packagePath; deployInformation.userPackagePath = Utils::FileName::fromString(packagePath);
m_deployInformation << deployInformation; m_deployInformation << deployInformation;
} }
@@ -262,7 +263,7 @@ void BlackBerryDeployInformation::updateModel()
|| !m_deployInformation[i].userPackagePath.isEmpty())) { || !m_deployInformation[i].userPackagePath.isEmpty())) {
BarPackageDeployInformation deployInformation = m_deployInformation[i]; 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 // 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; keep << deployInformation;
nodeFound = true; nodeFound = true;
break; break;
@@ -315,8 +316,7 @@ BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNo
{ {
QmakeProjectManager::TargetInformation ti = node->targetInformation(); QmakeProjectManager::TargetInformation ti = node->targetInformation();
QFileInfo fi(node->path()); const Utils::FileName buildDir = m_target->activeBuildConfiguration()->buildDirectory();
const QString buildDir = m_target->activeBuildConfiguration()->buildDirectory().toString();
return BarPackageDeployInformation(true, node->path(), fi.absolutePath(), buildDir, ti.target); return BarPackageDeployInformation(true, node->path(), node->path(), buildDir, ti.target);
} }

View File

@@ -33,6 +33,8 @@
#ifndef QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H #ifndef QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
#define QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H #define QNX_INTERNAL_BLACKBERRYDEPLOYINFORMATION_H
#include <utils/fileutils.h>
#include <QAbstractTableModel> #include <QAbstractTableModel>
namespace ProjectExplorer { class Target; } namespace ProjectExplorer { class Target; }
@@ -47,8 +49,11 @@ namespace Internal {
class BarPackageDeployInformation { class BarPackageDeployInformation {
public: public:
BarPackageDeployInformation(bool enabled, const QString &proFilePath, const QString &sourceDir, BarPackageDeployInformation(bool enabled,
const QString &buildDir, const QString &targetName) const Utils::FileName &proFilePath,
const Utils::FileName &sourceDir,
const Utils::FileName &buildDir,
const QString &targetName)
: enabled(enabled) : enabled(enabled)
, proFilePath(proFilePath) , proFilePath(proFilePath)
, sourceDir(sourceDir) , sourceDir(sourceDir)
@@ -57,17 +62,17 @@ public:
{ {
} }
QString appDescriptorPath() const; Utils::FileName appDescriptorPath() const;
QString packagePath() const; Utils::FileName packagePath() const;
bool enabled; bool enabled;
QString proFilePath; Utils::FileName proFilePath;
QString sourceDir; Utils::FileName sourceDir;
QString buildDir; Utils::FileName buildDir;
QString targetName; QString targetName;
QString userAppDescriptorPath; Utils::FileName userAppDescriptorPath;
QString userPackagePath; Utils::FileName userPackagePath;
}; };
class BlackBerryDeployInformation : public QAbstractTableModel class BlackBerryDeployInformation : public QAbstractTableModel

View File

@@ -99,7 +99,7 @@ bool BlackBerryDeployStep::init()
args << QLatin1String("-device") << deviceHost(); args << QLatin1String("-device") << deviceHost();
if (!password().isEmpty()) if (!password().isEmpty())
args << QLatin1String("-password") << password(); args << QLatin1String("-password") << password();
args << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath())); args << QnxUtils::addQuotes(info.packagePath().toUserOutput());
addCommand(deployCmd.toString(), args); addCommand(deployCmd.toString(), args);
} }
@@ -114,8 +114,9 @@ void BlackBerryDeployStep::run(QFutureInterface<bool> &fi)
QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages(); QList<BarPackageDeployInformation> packagesToDeploy = deployConfig->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation &info, packagesToDeploy) { foreach (const BarPackageDeployInformation &info, packagesToDeploy) {
if (!QFileInfo::exists(info.packagePath())) { if (!info.packagePath().exists()) {
raiseError(tr("Package \"%1\" does not exist. Create the package first.").arg(info.packagePath())); raiseError(tr("Package \"%1\" does not exist. Create the package first.")
.arg(info.packagePath().toUserOutput()));
fi.reportResult(false); fi.reportResult(false);
return; return;
} }

View File

@@ -46,7 +46,7 @@ using namespace Qnx;
using namespace Qnx::Internal; using namespace Qnx::Internal;
using namespace ProjectExplorer; 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) : RunConfiguration(parent, id)
, m_proFilePath(path) , m_proFilePath(path)
{ {
@@ -72,7 +72,7 @@ void BlackBerryRunConfiguration::init()
void BlackBerryRunConfiguration::updateDisplayName() void BlackBerryRunConfiguration::updateDisplayName()
{ {
if (!m_proFilePath.isEmpty()) if (!m_proFilePath.isEmpty())
setDefaultDisplayName(QFileInfo(m_proFilePath).completeBaseName()); setDefaultDisplayName(m_proFilePath.toFileInfo().completeBaseName());
else else
setDefaultDisplayName(tr("Run on BlackBerry device")); setDefaultDisplayName(tr("Run on BlackBerry device"));
} }
@@ -82,7 +82,7 @@ QWidget *BlackBerryRunConfiguration::createConfigurationWidget()
return new BlackBerryRunConfigurationWidget(this); return new BlackBerryRunConfigurationWidget(this);
} }
QString BlackBerryRunConfiguration::proFilePath() const Utils::FileName BlackBerryRunConfiguration::proFilePath() const
{ {
return m_proFilePath; return m_proFilePath;
} }
@@ -97,24 +97,23 @@ QString BlackBerryRunConfiguration::deviceName() const
return device->displayName(); return device->displayName();
} }
QString BlackBerryRunConfiguration::barPackage() const Utils::FileName BlackBerryRunConfiguration::barPackage() const
{ {
BlackBerryDeployConfiguration *dc = deployConfiguration(); BlackBerryDeployConfiguration *dc = deployConfiguration();
if (!dc) if (!dc)
return QString(); return Utils::FileName();
QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->enabledPackages(); QList<BarPackageDeployInformation> packages = dc->deploymentInfo()->enabledPackages();
foreach (const BarPackageDeployInformation package, packages) { foreach (const BarPackageDeployInformation package, packages) {
if (package.proFilePath == proFilePath()) if (package.proFilePath == proFilePath())
return package.packagePath(); return package.packagePath();
} }
return QString(); return Utils::FileName();
} }
QString BlackBerryRunConfiguration::localExecutableFilePath() const QString BlackBerryRunConfiguration::localExecutableFilePath() const
{ {
return target()->applicationTargets() return target()->applicationTargets().targetForProject(m_proFilePath).toString();
.targetForProject(Utils::FileName::fromString(m_proFilePath)).toString();
} }
bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map) bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
@@ -122,8 +121,9 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
if (!RunConfiguration::fromMap(map)) if (!RunConfiguration::fromMap(map))
return false; return false;
m_proFilePath = map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString(); m_proFilePath = Utils::FileName::fromUserInput(
if (m_proFilePath.isEmpty() || !QFileInfo::exists(m_proFilePath)) map.value(QLatin1String(Constants::QNX_PROFILEPATH_KEY)).toString());
if (m_proFilePath.isEmpty() || !m_proFilePath.exists())
return false; return false;
init(); init();
@@ -133,7 +133,7 @@ bool BlackBerryRunConfiguration::fromMap(const QVariantMap &map)
QVariantMap BlackBerryRunConfiguration::toMap() const QVariantMap BlackBerryRunConfiguration::toMap() const
{ {
QVariantMap map(RunConfiguration::toMap()); 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; return map;
} }
@@ -144,5 +144,6 @@ BlackBerryDeployConfiguration *BlackBerryRunConfiguration::deployConfiguration()
QString BlackBerryRunConfiguration::key() const QString BlackBerryRunConfiguration::key() const
{ {
return barPackage() + QLatin1Char('_') + BlackBerryDeviceConfiguration::device(target()->kit())->sshParameters().host; return barPackage().toString() + QLatin1Char('_')
+ BlackBerryDeviceConfiguration::device(target()->kit())->sshParameters().host;
} }

View File

@@ -35,6 +35,8 @@
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <utils/fileutils.h>
namespace ProjectExplorer { class Target; } namespace ProjectExplorer { class Target; }
namespace QmakeProjectManager { namespace QmakeProjectManager {
@@ -53,14 +55,15 @@ class BlackBerryRunConfiguration : public ProjectExplorer::RunConfiguration
friend class BlackBerryRunConfigurationFactory; friend class BlackBerryRunConfigurationFactory;
public: 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(); QWidget *createConfigurationWidget();
QString proFilePath() const; Utils::FileName proFilePath() const;
QString deviceName() const; QString deviceName() const;
QString barPackage() const; Utils::FileName barPackage() const;
QString localExecutableFilePath() const; QString localExecutableFilePath() const;
@@ -82,7 +85,7 @@ private:
void init(); void init();
void updateDisplayName(); void updateDisplayName();
QString m_proFilePath; Utils::FileName m_proFilePath;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -43,9 +43,9 @@
using namespace Qnx; using namespace Qnx;
using namespace Qnx::Internal; 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) : BlackBerryRunConfigurationFactory::BlackBerryRunConfigurationFactory(QObject *parent) :
@@ -72,12 +72,12 @@ QList<Core::Id> BlackBerryRunConfigurationFactory::availableCreationIds(ProjectE
QString BlackBerryRunConfigurationFactory::displayNameForId(Core::Id id) const QString BlackBerryRunConfigurationFactory::displayNameForId(Core::Id id) const
{ {
const QString path = pathFromId(id); const Utils::FileName path = pathFromId(id);
if (path.isEmpty()) if (path.isEmpty())
return QString(); return QString();
if (id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX)) if (id.name().startsWith(Constants::QNX_BB_RUNCONFIGURATION_PREFIX))
return QFileInfo(path).completeBaseName(); return path.toFileInfo().completeBaseName();
return QString(); return QString();
} }
@@ -117,7 +117,8 @@ ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::doRestore(
const QVariantMap &map) const QVariantMap &map)
{ {
Q_UNUSED(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, bool BlackBerryRunConfigurationFactory::canClone(ProjectExplorer::Target *parent,

View File

@@ -57,5 +57,5 @@ BlackBerryRunConfigurationWidget::~BlackBerryRunConfigurationWidget()
void BlackBerryRunConfigurationWidget::updateUi() void BlackBerryRunConfigurationWidget::updateUi()
{ {
m_ui->deviceLabel->setText(m_runConfiguration->deviceName()); m_ui->deviceLabel->setText(m_runConfiguration->deviceName());
m_ui->packageLabel->setText(m_runConfiguration->barPackage()); m_ui->packageLabel->setText(m_runConfiguration->barPackage().toString());
} }

View File

@@ -44,9 +44,9 @@
using namespace Qnx; using namespace Qnx;
using namespace Qnx::Internal; 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) : QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
@@ -74,12 +74,12 @@ QList<Core::Id> QnxRunConfigurationFactory::availableCreationIds(ProjectExplorer
QString QnxRunConfigurationFactory::displayNameForId(Core::Id id) const QString QnxRunConfigurationFactory::displayNameForId(Core::Id id) const
{ {
const QString path = pathFromId(id); const Utils::FileName path = pathFromId(id);
if (path.isEmpty()) if (path.isEmpty())
return QString(); return QString();
if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) 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(); return QString();
} }
@@ -98,7 +98,7 @@ bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, Core
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id) 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 const QmakeProjectManager::QmakeProject * const qt4Project
= qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project()); = qobject_cast<QmakeProjectManager::QmakeProject *>(parent->project());
QTC_ASSERT(qt4Project, return 0); QTC_ASSERT(qt4Project, return 0);

View File

@@ -263,7 +263,7 @@ void ResourceEditorPlugin::renameFileContextMenu()
void ResourceEditorPlugin::removeFileContextMenu() void ResourceEditorPlugin::removeFileContextMenu()
{ {
ResourceFolderNode *rfn = static_cast<ResourceFolderNode *>(ProjectTree::currentNode()); ResourceFolderNode *rfn = static_cast<ResourceFolderNode *>(ProjectTree::currentNode());
QString path = rfn->path(); QString path = rfn->path().toString();
FolderNode *parent = rfn->parentFolderNode(); FolderNode *parent = rfn->parentFolderNode();
if (!parent->removeFiles(QStringList() << path)) if (!parent->removeFiles(QStringList() << path))
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
@@ -273,7 +273,7 @@ void ResourceEditorPlugin::removeFileContextMenu()
void ResourceEditorPlugin::openEditorContextMenu() void ResourceEditorPlugin::openEditorContextMenu()
{ {
Core::EditorManager::openEditor(ProjectTree::currentNode()->path()); Core::EditorManager::openEditor(ProjectTree::currentNode()->path().toString());
} }
void ResourceEditorPlugin::copyPathContextMenu() void ResourceEditorPlugin::copyPathContextMenu()
@@ -333,7 +333,7 @@ void ResourceEditorPlugin::updateContextActions(Node *node, Project *)
m_renamePrefix->setVisible(isResourceFolder); m_renamePrefix->setVisible(isResourceFolder);
if (isResourceNode) if (isResourceNode)
Core::DocumentManager::populateOpenWithMenu(m_openWithMenu, node->path()); Core::DocumentManager::populateOpenWithMenu(m_openWithMenu, node->path().toString());
else else
m_openWithMenu->clear(); m_openWithMenu->clear();
m_openWithMenu->menuAction()->setVisible(!m_openWithMenu->actions().isEmpty()); m_openWithMenu->menuAction()->setVisible(!m_openWithMenu->actions().isEmpty());

View File

@@ -60,13 +60,16 @@ static bool priority(const QStringList &files)
return false; return false;
} }
static bool addFilesToResource(const QString &resourceFile, const QStringList &filePaths, QStringList *notAdded, static bool addFilesToResource(const Utils::FileName &resourceFile,
const QString &prefix, const QString &lang) const QStringList &filePaths,
QStringList *notAdded,
const QString &prefix,
const QString &lang)
{ {
if (notAdded) if (notAdded)
*notAdded = filePaths; *notAdded = filePaths;
ResourceFile file(resourceFile); ResourceFile file(resourceFile.toString());
if (!file.load()) if (!file.load())
return false; 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(); file.save();
Core::DocumentManager::unexpectFileChange(resourceFile); Core::DocumentManager::unexpectFileChange(resourceFile.toString());
return true; return true;
} }
@@ -109,19 +112,18 @@ static bool sortNodesByPath(ProjectExplorer::Node *a, ProjectExplorer::Node *b)
return a->path() < b->path(); return a->path() < b->path();
} }
ResourceTopLevelNode::ResourceTopLevelNode(const QString &filePath, FolderNode *parent) ResourceTopLevelNode::ResourceTopLevelNode(const Utils::FileName &filePath, FolderNode *parent)
: ProjectExplorer::FolderNode(filePath) : ProjectExplorer::FolderNode(filePath)
{ {
setIcon(Core::FileIconProvider::icon(filePath)); setIcon(Core::FileIconProvider::icon(filePath.toString()));
m_document = new ResourceFileWatcher(this); m_document = new ResourceFileWatcher(this);
Core::DocumentManager::addDocument(m_document); Core::DocumentManager::addDocument(m_document);
Utils::FileName base = Utils::FileName::fromString(parent->path()); Utils::FileName base = parent->path();
Utils::FileName file = Utils::FileName::fromString(filePath); if (filePath.isChildOf(base))
if (file.isChildOf(base)) setDisplayName(filePath.relativeChildPath(base).toString());
setDisplayName(file.relativeChildPath(base).toString());
else else
setDisplayName(file.toString()); setDisplayName(filePath.toString());
} }
ResourceTopLevelNode::~ResourceTopLevelNode() ResourceTopLevelNode::~ResourceTopLevelNode()
@@ -135,7 +137,7 @@ void ResourceTopLevelNode::update()
QList<ProjectExplorer::FolderNode *> newFolderList; QList<ProjectExplorer::FolderNode *> newFolderList;
QMap<QPair<QString, QString>, QList<ProjectExplorer::FileNode *> > filesToAdd; QMap<QPair<QString, QString>, QList<ProjectExplorer::FileNode *> > filesToAdd;
ResourceFile file(path()); ResourceFile file(path().toString());
if (file.load()) { if (file.load()) {
QSet<QPair<QString, QString > > prefixes; QSet<QPair<QString, QString > > prefixes;
@@ -156,9 +158,8 @@ void ResourceTopLevelNode::update()
for (int j = 0; j < filecount; ++j) { for (int j = 0; j < filecount; ++j) {
const QString &fileName = file.file(i, j); const QString &fileName = file.file(i, j);
QString alias = file.alias(i, j); QString alias = file.alias(i, j);
if (alias.isEmpty()) { if (alias.isEmpty())
alias = QFileInfo(path()).absoluteDir().relativeFilePath(fileName); alias = path().toFileInfo().absoluteDir().relativeFilePath(fileName);
}
if (fileNames.contains(fileName)) { if (fileNames.contains(fileName)) {
// The file name is duplicated, skip it // The file name is duplicated, skip it
// Note: this is wrong, but the qrceditor doesn't allow it either // 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); const QString qrcPath = QDir::cleanPath(prefixWithSlash + alias);
fileNames.insert(fileName); fileNames.insert(fileName);
filesToAdd[qMakePair(prefix, lang)] 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) bool ResourceTopLevelNode::addPrefix(const QString &prefix, const QString &lang)
{ {
ResourceFile file(path()); ResourceFile file(path().toString());
if (!file.load()) if (!file.load())
return false; return false;
int index = file.addPrefix(prefix, lang); int index = file.addPrefix(prefix, lang);
if (index == -1) if (index == -1)
return false; return false;
Core::DocumentManager::expectFileChange(path()); Core::DocumentManager::expectFileChange(path().toString());
file.save(); file.save();
Core::DocumentManager::unexpectFileChange(path()); Core::DocumentManager::unexpectFileChange(path().toString());
return true; return true;
} }
bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &lang) bool ResourceTopLevelNode::removePrefix(const QString &prefix, const QString &lang)
{ {
ResourceFile file(path()); ResourceFile file(path().toString());
if (!file.load()) if (!file.load())
return false; return false;
for (int i = 0; i < file.prefixCount(); ++i) { for (int i = 0; i < file.prefixCount(); ++i) {
if (file.prefix(i) == prefix if (file.prefix(i) == prefix
&& file.lang(i) == lang) { && file.lang(i) == lang) {
file.removePrefix(i); file.removePrefix(i);
Core::DocumentManager::expectFileChange(path()); Core::DocumentManager::expectFileChange(path().toString());
file.save(); file.save();
Core::DocumentManager::unexpectFileChange(path()); Core::DocumentManager::unexpectFileChange(path().toString());
return true; 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 ProjectExplorer::FolderNode::AddNewInformation ResourceTopLevelNode::addNewInformation(const QStringList &files, Node *context) const
{ {
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2") QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(Utils::FileName::fromString(path()).fileName()) .arg(path().fileName())
.arg(QLatin1Char('/')); .arg(QLatin1Char('/'));
int p = -1; int p = -1;
@@ -283,7 +285,7 @@ bool ResourceTopLevelNode::showInSimpleTree() const
} }
ResourceFolderNode::ResourceFolderNode(const QString &prefix, const QString &lang, ResourceTopLevelNode *parent) 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 // TOOD Why add existing directory doesn't work
m_topLevelNode(parent), m_topLevelNode(parent),
m_prefix(prefix), m_prefix(prefix),
@@ -325,7 +327,7 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *
{ {
if (notRemoved) if (notRemoved)
*notRemoved = filePaths; *notRemoved = filePaths;
ResourceFile file(m_topLevelNode->path()); ResourceFile file(m_topLevelNode->path().toString());
if (!file.load()) if (!file.load())
return false; return false;
int index = file.indexOfPrefix(m_prefix, m_lang); int index = file.indexOfPrefix(m_prefix, m_lang);
@@ -340,16 +342,16 @@ bool ResourceFolderNode::removeFiles(const QStringList &filePaths, QStringList *
file.removeFile(index, j); file.removeFile(index, j);
--j; --j;
} }
Core::DocumentManager::expectFileChange(m_topLevelNode->path()); Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save(); file.save();
Core::DocumentManager::unexpectFileChange(m_topLevelNode->path()); Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true; return true;
} }
bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newFilePath) bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newFilePath)
{ {
ResourceFile file(m_topLevelNode->path()); ResourceFile file(m_topLevelNode->path().toString());
if (!file.load()) if (!file.load())
return false; return false;
int index = file.indexOfPrefix(m_prefix, m_lang); 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) { for (int j = 0; j < file.fileCount(index); ++j) {
if (file.file(index, j) == filePath) { if (file.file(index, j) == filePath) {
file.replaceFile(index, j, newFilePath); file.replaceFile(index, j, newFilePath);
Core::DocumentManager::expectFileChange(m_topLevelNode->path()); Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save(); file.save();
Core::DocumentManager::unexpectFileChange(m_topLevelNode->path()); Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true; return true;
} }
} }
@@ -371,7 +373,7 @@ bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newF
bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang) bool ResourceFolderNode::renamePrefix(const QString &prefix, const QString &lang)
{ {
ResourceFile file(m_topLevelNode->path()); ResourceFile file(m_topLevelNode->path().toString());
if (!file.load()) if (!file.load())
return false; return false;
int index = file.indexOfPrefix(m_prefix, m_lang); 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)) if (!file.replacePrefixAndLang(index, prefix, lang))
return false; return false;
Core::DocumentManager::expectFileChange(m_topLevelNode->path()); Core::DocumentManager::expectFileChange(m_topLevelNode->path().toString());
file.save(); file.save();
Core::DocumentManager::unexpectFileChange(m_topLevelNode->path()); Core::DocumentManager::unexpectFileChange(m_topLevelNode->path().toString());
return true; return true;
} }
ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files, Node *context) const ProjectExplorer::FolderNode::AddNewInformation ResourceFolderNode::addNewInformation(const QStringList &files, Node *context) const
{ {
QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2") QString name = QCoreApplication::translate("ResourceTopLevelNode", "%1 Prefix: %2")
.arg(Utils::FileName::fromString(m_topLevelNode->path()).fileName()) .arg(m_topLevelNode->path().fileName())
.arg(displayName()); .arg(displayName());
int p = -1; // never the default int p = -1; // never the default
@@ -447,7 +449,7 @@ ResourceFileWatcher::ResourceFileWatcher(ResourceTopLevelNode *node)
{ {
setId("ResourceNodeWatcher"); setId("ResourceNodeWatcher");
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE)); 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) bool ResourceFileWatcher::save(QString *errorString, const QString &fileName, bool autoSave)
@@ -495,13 +497,13 @@ bool ResourceFileWatcher::reload(QString *errorString, ReloadFlag flag, ChangeTy
return true; 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), : ProjectExplorer::FileNode(filePath, ProjectExplorer::UnknownFileType, false),
m_qrcPath(qrcPath) m_qrcPath(qrcPath)
{ {
QString baseDir = QFileInfo(topLevel->path()).absolutePath(); QDir baseDir = topLevel->path().toFileInfo().absoluteDir();
m_displayName = QDir(baseDir).relativeFilePath(filePath); m_displayName = QDir(baseDir).relativeFilePath(filePath.toString());
} }
QString ResourceFileNode::displayName() const QString ResourceFileNode::displayName() const

View File

@@ -45,7 +45,7 @@ namespace Internal { class ResourceFileWatcher; }
class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode class RESOURCE_EXPORT ResourceTopLevelNode : public ProjectExplorer::FolderNode
{ {
public: public:
ResourceTopLevelNode(const QString &filePath, FolderNode *parent); ResourceTopLevelNode(const Utils::FileName &filePath, FolderNode *parent);
~ResourceTopLevelNode(); ~ResourceTopLevelNode();
void update(); void update();
@@ -96,7 +96,7 @@ private:
class ResourceFileNode : public ProjectExplorer::FileNode class ResourceFileNode : public ProjectExplorer::FileNode
{ {
public: public:
ResourceFileNode(const QString &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel); ResourceFileNode(const Utils::FileName &filePath, const QString &qrcPath, ResourceTopLevelNode *topLevel);
QString displayName() const; QString displayName() const;
QString qrcPath() const; QString qrcPath() const;

View File

@@ -213,7 +213,7 @@ void SuppressionDialog::accept()
return; return;
// Add file to project if there is a project containing this file on the file system. // 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()) { foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
if (path.startsWith(p->projectDirectory().toString())) { if (path.startsWith(p->projectDirectory().toString())) {
p->rootProjectNode()->addFiles(QStringList() << path); p->rootProjectNode()->addFiles(QStringList() << path);

View File

@@ -61,7 +61,8 @@ QString testDataDir = QLatin1String(SRCDIR "/data");
static QmlProjectItem *loadQmlProject(QString name, QString *error) 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() void tst_FileFormat::testFileFilter()