1
0
Fork 0
forked from len0rd/rockbox

Theme Editor: Implemented caching for rendered text, added profiling info to debug build, added a 500msec delay when rendering after code changes to prevent editor from hanging on large themes

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27332 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-07-07 09:33:47 +00:00
parent 6f06793f58
commit 6d609e009f
11 changed files with 158 additions and 18 deletions

View file

@ -31,6 +31,8 @@
#include <QDebug>
const int SkinDocument::updateInterval = 500;
SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
DeviceState* device, QWidget *parent)
:TabContent(parent), statusLabel(statusLabel),
@ -70,6 +72,8 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
/* Setting the title */
QStringList decomposed = fileName.split('/');
titleText = decomposed.last();
lastUpdate = QTime::currentTime();
}
SkinDocument::~SkinDocument()
@ -161,6 +165,11 @@ void SkinDocument::setupUI()
findReplace->hide();
settingsChanged();
/* Setting up a timer to check for updates */
checkUpdate.setInterval(500);
QObject::connect(&checkUpdate, SIGNAL(timeout()),
this, SLOT(codeChanged()));
}
void SkinDocument::settingsChanged()
@ -273,8 +282,16 @@ void SkinDocument::codeChanged()
else
emit titleChanged(titleText);
model->render(project, device, &fileName);
if(lastUpdate.msecsTo(QTime::currentTime()) >= updateInterval)
{
model->render(project, device, &fileName);
checkUpdate.stop();
lastUpdate = QTime::currentTime();
}
else
{
checkUpdate.start();
}
cursorChanged();
}