Commit 8c6fc0c4 authored by con's avatar con
Browse files

Don't begin global paths with '/' on windows.

Doing it creates huge delays, because it resolves to a network path.
Also rename FolderNode::setFolderName to FolderNode::setDisplayName,
because that's the name of the property.

Task-number: QTCREATORBUG-695
parent 9087e2ff
......@@ -173,7 +173,7 @@ bool CMakeProject::parseCMakeLists()
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
// setFolderName
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
m_rootNode->setDisplayName(QFileInfo(cbpFile).completeBaseName());
CMakeCbpParser cbpparser;
// Parsing
//qDebug()<<"Parsing file "<<cbpFile;
......@@ -188,7 +188,7 @@ bool CMakeProject::parseCMakeLists()
// ToolChain
// activeBC->updateToolChain(cbpparser.compilerName());
m_projectName = cbpparser.projectName();
m_rootNode->setFolderName(cbpparser.projectName());
m_rootNode->setDisplayName(cbpparser.projectName());
//qDebug()<<"Building Tree";
QList<ProjectExplorer::FileNode *> fileList = cbpparser.fileList();
......@@ -394,7 +394,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
if (!found) {
// No FolderNode yet, so create it
ProjectExplorer::FolderNode *tmp = new ProjectExplorer::FolderNode(path);
tmp->setFolderName(part);
tmp->setDisplayName(part);
rootNode->addFolderNodes(QList<ProjectExplorer::FolderNode *>() << tmp, parent);
parent = tmp;
}
......
......@@ -43,7 +43,7 @@ GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IFile *pro
m_project(project),
m_projectFile(projectFile)
{
setFolderName(QFileInfo(projectFile->fileName()).completeBaseName());
setDisplayName(QFileInfo(projectFile->fileName()).completeBaseName());
}
GenericProjectNode::~GenericProjectNode()
......@@ -145,7 +145,7 @@ ProjectExplorer::FolderNode *GenericProjectNode::findOrCreateFolderByName(const
return folder;
FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName);
folder->setFolderName(component);
folder->setDisplayName(component);
m_folderByName.insert(folderName, folder);
FolderNode *parent = findOrCreateFolderByName(components, end - 1);
......
......@@ -36,6 +36,7 @@
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtGui/QApplication>
#include <QtGui/QIcon>
#include <QtGui/QStyle>
......@@ -151,7 +152,7 @@ bool FileNode::isGenerated() const
*/
FolderNode::FolderNode(const QString &folderPath) :
Node(FolderNodeType, folderPath),
m_folderName(folderPath),
m_displayName(QDir::toNativeSeparators(folderPath)),
m_icon(QApplication::style()->standardIcon(QStyle::SP_DirIcon))
{
}
......@@ -170,7 +171,7 @@ FolderNode::~FolderNode()
*/
QString FolderNode::displayName() const
{
return m_folderName;
return m_displayName;
}
/*
......@@ -199,9 +200,9 @@ void FolderNode::accept(NodesVisitor *visitor)
subFolder->accept(visitor);
}
void FolderNode::setFolderName(const QString &name)
void FolderNode::setDisplayName(const QString &name)
{
m_folderName = name;
m_displayName = name;
}
void FolderNode::setIcon(const QIcon &icon)
......@@ -228,7 +229,7 @@ ProjectNode::ProjectNode(const QString &projectFilePath)
setNodeType(ProjectNodeType);
// project node "manages" itself
setProjectNode(this);
setFolderName(QFileInfo(m_folderName).fileName());
setDisplayName(QFileInfo(projectFilePath).fileName());
}
QList<ProjectNode*> ProjectNode::subProjectNodes() const
......
......@@ -136,7 +136,7 @@ public:
virtual void accept(NodesVisitor *visitor);
void setFolderName(const QString &name);
void setDisplayName(const QString &name);
void setIcon(const QIcon &icon);
protected:
......@@ -146,7 +146,7 @@ protected:
private:
// managed by ProjectNode
friend class ProjectNode;
QString m_folderName;
QString m_displayName;
QIcon m_icon;
};
......
......@@ -359,7 +359,7 @@ void Internal::SessionNodeImpl::removeProjectNode(ProjectNode *projectNode)
void Internal::SessionNodeImpl::setFileName(const QString &fileName)
{
setPath(fileName);
setFolderName(fileName);
setDisplayName(fileName);
}
/* --------------------------------- */
......
......@@ -46,7 +46,7 @@ QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IFile *projectFile)
m_project(project),
m_projectFile(projectFile)
{
setFolderName(QFileInfo(projectFile->fileName()).completeBaseName());
setDisplayName(QFileInfo(projectFile->fileName()).completeBaseName());
}
QmlProjectNode::~QmlProjectNode()
......
......@@ -229,7 +229,7 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo
m_qt4PriFile = new Qt4PriFile(this);
Core::ICore::instance()->fileManager()->addFile(m_qt4PriFile);
setFolderName(QFileInfo(filePath).completeBaseName());
setDisplayName(QFileInfo(filePath).completeBaseName());
setIcon(qt4NodeStaticData()->projectIcon);
}
......@@ -285,15 +285,17 @@ struct InternalNode
fileWithoutPrefix = file;
}
QStringList parts = fileWithoutPrefix.split(separator, QString::SkipEmptyParts);
#ifndef Q_OS_WIN
if (!isRelative && parts.count() > 0)
parts[0].prepend(separator);
#endif
QStringListIterator it(parts);
InternalNode *currentNode = this;
QString path = (isRelative ? projectDir : "");
while (it.hasNext()) {
const QString &key = it.next();
path += separator + key;
if (it.hasNext()) { // key is directory
path += key;
if (!currentNode->subnodes.contains(key)) {
InternalNode *val = new InternalNode;
val->type = type;
......@@ -303,6 +305,7 @@ struct InternalNode
} else {
currentNode = currentNode->subnodes.value(key);
}
path += separator;
} else { // key is filename
currentNode->files.append(file);
}
......@@ -361,7 +364,7 @@ struct InternalNode
++existingNodeIter;
} else if ((*existingNodeIter)->displayName() > newNodeIter.key()) {
FolderNode *newNode = new FolderNode(newNodeIter.value()->fullName);
newNode->setFolderName(newNodeIter.key());
newNode->setDisplayName(newNodeIter.key());
if (!newNodeIter.value()->icon.isNull())
newNode->setIcon(newNodeIter.value()->icon);
foldersToAdd << newNode;
......@@ -380,7 +383,7 @@ struct InternalNode
}
while (newNodeIter != subnodes.constEnd()) {
FolderNode *newNode = new FolderNode(newNodeIter.value()->fullName);
newNode->setFolderName(newNodeIter.key());
newNode->setDisplayName(newNodeIter.key());
if (!newNodeIter.value()->icon.isNull())
newNode->setIcon(newNodeIter.value()->icon);
foldersToAdd << newNode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment