Theme Editor: Renderer now allows multiple viewports to share an identifier

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27112 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-06-24 18:55:04 +00:00
parent d7ee0fe076
commit 481bcf2632
2 changed files with 33 additions and 13 deletions

View file

@ -70,8 +70,11 @@ RBScreen::~RBScreen()
QMap<int, RBFont*>::iterator i;
for(i = fonts.begin(); i != fonts.end(); i++)
if(*i)
delete (*i);
delete (*i);
QMap<QString, QList<RBViewport*>*>::iterator it;
for(it = namedViewports.begin(); it != namedViewports.end(); it++)
delete (*it);
}
QPainterPath RBScreen::shape() const
@ -99,13 +102,30 @@ void RBScreen::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
}
}
void RBScreen::loadViewport(QString name, RBViewport *view)
{
QList<RBViewport*>* list;
if(namedViewports.value(name, 0) == 0)
{
list = new QList<RBViewport*>;
list->append(view);
namedViewports.insert(name, list);
}
else
{
list = namedViewports.value(name, 0);
list->append(view);
}
}
void RBScreen::showViewport(QString name)
{
if(namedViewports.value(name, 0) == 0)
return;
namedViewports.value(name)->show();
update();
QList<RBViewport*>* list = namedViewports.value(name, 0);
for(int i = 0; i < list->count(); i++)
list->at(i)->show();
}
void RBScreen::loadFont(int id, RBFont* font)
@ -143,11 +163,14 @@ void RBScreen::makeCustomUI(QString id)
{
if(namedViewports.value(id, 0) != 0)
{
QMap<QString, RBViewport*>::iterator i;
QMap<QString, QList<RBViewport*>*>::iterator i;
for(i = namedViewports.begin(); i != namedViewports.end(); i++)
(*i)->clearCustomUI();
namedViewports.value(id)->makeCustomUI();
namedViewports.value(id)->show();
for(int j = 0; j < (*i)->count(); j++)
(*i)->at(j)->clearCustomUI();
for(int i = 0; i < namedViewports.value(id)->count(); i++)
namedViewports.value(id)->at(i)->makeCustomUI();
for(int i = 0; i < namedViewports.value(id)->count(); i++)
namedViewports.value(id)->at(i)->show();
}
}

View file

@ -46,10 +46,7 @@ public:
int getWidth() const{ return width; }
int getHeight() const{ return height; }
void loadViewport(QString name, RBViewport* view)
{
namedViewports.insert(name, view);
}
void loadViewport(QString name, RBViewport* view);
void showViewport(QString name);
void loadImage(QString name, RBImage* image)
@ -78,7 +75,7 @@ private:
ProjectModel* project;
QMap<QString, RBViewport*> namedViewports;
QMap<QString, QList<RBViewport*>*> namedViewports;
QMap<QString, RBImage*> images;
QMap<QString, QString>* settings;
QMap<int, RBFont*> fonts;