ProjectNodes: Add line information and act on it

Also allow for the path to be set. Qbs can move products from one
file to the next, so that is needed there.

Change-Id: Iebaf3be40fdb0e5e462d45b00cf46d58f985a163
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Tobias Hunger
2013-01-30 18:13:46 +01:00
committed by hjk
parent 1fda2111d4
commit f20b92f913
3 changed files with 46 additions and 5 deletions

View File

@@ -73,6 +73,16 @@ Node::Node(NodeType nodeType,
}
/*!
* \brief The path of the file representing this node.
*
* This method does not emit any signals, that has to be done by the calling class!
*/
void Node::setPath(const QString &path)
{
m_path = path;
}
NodeType Node::nodeType() const
{
return m_nodeType;
@@ -102,6 +112,11 @@ QString Node::path() const
return m_path;
}
int Node::line() const
{
return -1;
}
QString Node::displayName() const
{
return QFileInfo(path()).fileName();
@@ -241,6 +256,24 @@ void FolderNode::setIcon(const QIcon &icon)
m_icon = icon;
}
FileNode *FolderNode::findFile(const QString &path)
{
foreach (FileNode *n, fileNodes()) {
if (n->path() == path)
return n;
}
return 0;
}
FolderNode *FolderNode::findSubFolder(const QString &path)
{
foreach (FolderNode *n, subFolderNodes()) {
if (n->path() == path)
return n;
}
return 0;
}
/*!
\class ProjectExplorer::VirtualFolderNode