summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui/skindocument.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-07-07 09:33:47 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-07-07 09:33:47 +0000
commit6d609e009f4836418bbe5b404be8ae03d29ef8cb (patch)
tree708bc7ba7bce2c7fc01cb719b594b296e51b17d0 /utils/themeeditor/gui/skindocument.cpp
parent6f06793f58f520ec7d44683f6447c0b540a265b3 (diff)
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
Diffstat (limited to 'utils/themeeditor/gui/skindocument.cpp')
-rw-r--r--utils/themeeditor/gui/skindocument.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index 9a381a9589..f04c12d213 100644
--- a/utils/themeeditor/gui/skindocument.cpp
+++ b/utils/themeeditor/gui/skindocument.cpp
@@ -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();
}