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)
downloadrockbox-6d609e009f4836418bbe5b404be8ae03d29ef8cb.tar.gz
rockbox-6d609e009f4836418bbe5b404be8ae03d29ef8cb.zip
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 @@
31 31
32#include <QDebug> 32#include <QDebug>
33 33
34const int SkinDocument::updateInterval = 500;
35
34SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project, 36SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
35 DeviceState* device, QWidget *parent) 37 DeviceState* device, QWidget *parent)
36 :TabContent(parent), statusLabel(statusLabel), 38 :TabContent(parent), statusLabel(statusLabel),
@@ -70,6 +72,8 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
70 /* Setting the title */ 72 /* Setting the title */
71 QStringList decomposed = fileName.split('/'); 73 QStringList decomposed = fileName.split('/');
72 titleText = decomposed.last(); 74 titleText = decomposed.last();
75
76 lastUpdate = QTime::currentTime();
73} 77}
74 78
75SkinDocument::~SkinDocument() 79SkinDocument::~SkinDocument()
@@ -161,6 +165,11 @@ void SkinDocument::setupUI()
161 findReplace->hide(); 165 findReplace->hide();
162 166
163 settingsChanged(); 167 settingsChanged();
168
169 /* Setting up a timer to check for updates */
170 checkUpdate.setInterval(500);
171 QObject::connect(&checkUpdate, SIGNAL(timeout()),
172 this, SLOT(codeChanged()));
164} 173}
165 174
166void SkinDocument::settingsChanged() 175void SkinDocument::settingsChanged()
@@ -273,8 +282,16 @@ void SkinDocument::codeChanged()
273 else 282 else
274 emit titleChanged(titleText); 283 emit titleChanged(titleText);
275 284
276 model->render(project, device, &fileName); 285 if(lastUpdate.msecsTo(QTime::currentTime()) >= updateInterval)
277 286 {
287 model->render(project, device, &fileName);
288 checkUpdate.stop();
289 lastUpdate = QTime::currentTime();
290 }
291 else
292 {
293 checkUpdate.start();
294 }
278 cursorChanged(); 295 cursorChanged();
279 296
280} 297}