Exemple #1
0
void RDirNode::addNode(RDirNode* node) {
    // does this node prefix any other nodes, if so, add them to it

    std::vector<RDirNode*> matches;
    std::string path = node->getPath();

    //debugLog("adding node %s to %s\n", path.c_str(), abspath.c_str());

    for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); ) {
        RDirNode* child = (*it);

        if(child->prefixedBy(path)) {
            it = children.erase(it);
            node->addNode(child);
        } else {
            it++;
        }
    }

    // add to this node
    children.push_back(node);
    node->setParent(this);

    //debugLog("added node %s to %s\n", node->getPath().c_str(), getPath().c_str());

    nodeUpdated(false);
}
Exemple #2
0
void RDirNode::fileUpdated(bool userInitiated) {
    calcRadius();

    if(userInitiated) since_last_file_change = 0.0;

    nodeUpdated(userInitiated);
}
NodeModel::NodeModel(QObject *parent) :
	QAbstractListModel(parent),
	m_qmlNode(0)
{
	Settings *s = Settings::get();

	m_nodes = s->nodes();

	connect(s, SIGNAL(nodeAdded(Node)), this, SLOT(addNode(Node)));
	connect(s, SIGNAL(nodeUpdated(Node)), this, SLOT(updateNode(Node)));
}
Exemple #4
0
// note - you still need to delete the file yourself
bool RDirNode::removeFile(RFile* f) {
    //doesnt match this path at all
    if(f->path.find(abspath) != 0) {
        return false;
    }

    //is this dir - add to this node
    if(f->path.compare(abspath) == 0) {

        for(std::list<RFile*>::iterator it = files.begin(); it != files.end(); it++) {
            if((*it)==f) {
                files.erase(it);
                if(!f->isHidden()) visible_count--;

                fileUpdated(false);

                return true;
            }
        }

        return false;
    }

    //does this belong to one of the children ?
    for(std::list<RDirNode*>::iterator it = children.begin(); it != children.end(); it++) {
        RDirNode* node = (*it);
        bool removed = node->removeFile(f);

        if(removed) {
            //fprintf(stderr, "%s file removed from a child. child file count=%d, dir count =%d\n", getPath().c_str(), node->fileCount(), node->dirCount());
            //node->printFiles();

            //node is now empty, reap!
            if(node->noFiles() && node->noDirs()) {
                children.erase(it);
                //fprintf(stderr, "deleting node %s from %s\n", node->getPath().c_str(), getPath().c_str());
                delete node;
                nodeUpdated(false);
            }

            return true;
        }
    }

    return false;
}
Exemple #5
0
void ContextPrivate::nodeNameChanged( QSharedPointer<fugio::NodeInterface> pNode )
{
	emit nodeUpdated( pNode->uuid() );
}