1
0
Fork 0
forked from len0rd/rockbox

Changed build subdirectory

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26492 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-06-02 20:36:30 +00:00
parent 87174d83fd
commit e5a3ec2baf
6 changed files with 130 additions and 8 deletions

View file

@ -31,7 +31,11 @@ ParseTreeModel::ParseTreeModel(const char* document, QObject* parent):
QAbstractItemModel(parent)
{
this->tree = skin_parse(document);
this->root = new ParseTreeNode(tree);
if(tree)
this->root = new ParseTreeNode(tree);
else
this->root = 0;
}
@ -48,6 +52,36 @@ QString ParseTreeModel::genCode()
return root->genCode();
}
bool ParseTreeModel::changeTree(const char *document)
{
struct skin_element* test = skin_parse(document);
if(!test)
return false;
ParseTreeNode* temp = new ParseTreeNode(test);
if(root && temp->genHash() == root->genHash())
{
delete temp;
return true;
}
if(root)
{
emit beginRemoveRows(QModelIndex(), 0, root->numChildren() - 1);
delete root;
emit endRemoveRows();
}
root = temp;
emit beginInsertRows(QModelIndex(), 0, temp->numChildren() - 1);
emit endInsertRows();
return true;
}
QModelIndex ParseTreeModel::index(int row, int column,
const QModelIndex& parent) const
{
@ -83,6 +117,9 @@ QModelIndex ParseTreeModel::parent(const QModelIndex &child) const
int ParseTreeModel::rowCount(const QModelIndex &parent) const
{
if(!root)
return 0;
if(!parent.isValid())
return root->numChildren();