2010-05-29 00:04:04 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Robert Bieber
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-05-26 21:13:14 +00:00
|
|
|
#ifndef PARSETREENODE_H
|
|
|
|
#define PARSETREENODE_H
|
|
|
|
|
|
|
|
#include "skin_parser.h"
|
2010-06-18 21:10:01 +00:00
|
|
|
#include "rbviewport.h"
|
|
|
|
#include "rbscreen.h"
|
|
|
|
#include "rbrenderinfo.h"
|
2010-05-26 21:13:14 +00:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
class ParseTreeNode
|
|
|
|
{
|
|
|
|
public:
|
2010-08-05 00:43:33 +00:00
|
|
|
ParseTreeNode(struct skin_element* data, ParseTreeModel* model);
|
|
|
|
ParseTreeNode(struct skin_element* data, ParseTreeNode* parent,
|
|
|
|
ParseTreeModel* model);
|
|
|
|
ParseTreeNode(struct skin_tag_parameter* data, ParseTreeNode* parent,
|
|
|
|
ParseTreeModel* model);
|
2010-05-30 01:20:05 +00:00
|
|
|
virtual ~ParseTreeNode();
|
2010-05-26 21:13:14 +00:00
|
|
|
|
2010-05-29 00:04:04 +00:00
|
|
|
QString genCode() const;
|
2010-06-02 20:36:30 +00:00
|
|
|
int genHash() const;
|
|
|
|
|
2010-06-01 19:55:20 +00:00
|
|
|
bool isParam() const{ if(param) return true; else return false; }
|
|
|
|
struct skin_tag_parameter* getParam(){ return param;}
|
|
|
|
struct skin_element* getElement(){return element;}
|
2010-05-26 21:13:14 +00:00
|
|
|
|
|
|
|
ParseTreeNode* child(int row);
|
2010-05-29 00:04:04 +00:00
|
|
|
int numChildren() const;
|
2010-05-26 21:13:14 +00:00
|
|
|
QVariant data(int column) const;
|
2010-05-29 00:04:04 +00:00
|
|
|
int getRow() const;
|
2010-05-30 01:20:05 +00:00
|
|
|
ParseTreeNode* getParent() const;
|
2010-06-02 20:36:30 +00:00
|
|
|
ParseTreeNode* getChild(int row) const
|
|
|
|
{
|
|
|
|
if(row < children.count())
|
|
|
|
return children[row];
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2010-05-26 21:13:14 +00:00
|
|
|
|
2010-06-18 21:10:01 +00:00
|
|
|
void render(const RBRenderInfo& info);
|
2010-06-29 20:39:45 +00:00
|
|
|
void render(const RBRenderInfo &info, RBViewport* viewport,
|
|
|
|
bool noBreak = false);
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-29 19:59:33 +00:00
|
|
|
double findBranchTime(ParseTreeNode* branch, const RBRenderInfo& info);
|
|
|
|
double findConditionalTime(ParseTreeNode* conditional,
|
|
|
|
const RBRenderInfo& info);
|
|
|
|
|
2010-08-04 09:16:52 +00:00
|
|
|
void modParam(QVariant value, int index = -1);
|
|
|
|
|
2010-05-26 21:13:14 +00:00
|
|
|
private:
|
2010-06-29 05:23:22 +00:00
|
|
|
|
|
|
|
bool execTag(const RBRenderInfo& info, RBViewport* viewport);
|
|
|
|
QVariant evalTag(const RBRenderInfo& info, bool conditional = false,
|
|
|
|
int branches = 0);
|
|
|
|
|
2010-05-29 00:04:04 +00:00
|
|
|
ParseTreeNode* parent;
|
2010-05-26 21:13:14 +00:00
|
|
|
struct skin_element* element;
|
2010-05-27 19:57:15 +00:00
|
|
|
struct skin_tag_parameter* param;
|
2010-05-29 00:04:04 +00:00
|
|
|
QList<ParseTreeNode*> children;
|
2010-05-26 21:13:14 +00:00
|
|
|
|
2010-06-02 07:48:48 +00:00
|
|
|
static int openConditionals;
|
2010-07-04 01:39:57 +00:00
|
|
|
static bool breakFlag;
|
2010-06-18 21:10:01 +00:00
|
|
|
QGraphicsItem* rendered;
|
2010-06-02 07:48:48 +00:00
|
|
|
|
2010-08-05 00:43:33 +00:00
|
|
|
ParseTreeModel* model;
|
|
|
|
|
2010-08-05 19:05:36 +00:00
|
|
|
QList<int> extraParams;
|
|
|
|
|
2010-05-26 21:13:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PARSETREENODE_H
|