summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/gui')
-rw-r--r--utils/themeeditor/gui/editorwindow.cpp5
-rw-r--r--utils/themeeditor/gui/skindocument.cpp21
-rw-r--r--utils/themeeditor/gui/skindocument.h6
3 files changed, 30 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/editorwindow.cpp b/utils/themeeditor/gui/editorwindow.cpp
index 4c073b9e0b..171e7b7019 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -22,6 +22,8 @@
22#include "editorwindow.h" 22#include "editorwindow.h"
23#include "projectmodel.h" 23#include "projectmodel.h"
24#include "ui_editorwindow.h" 24#include "ui_editorwindow.h"
25#include "rbfontcache.h"
26#include "rbtextcache.h"
25 27
26#include <QDesktopWidget> 28#include <QDesktopWidget>
27#include <QFileSystemModel> 29#include <QFileSystemModel>
@@ -49,6 +51,9 @@ EditorWindow::~EditorWindow()
49 delete project; 51 delete project;
50 delete deviceConfig; 52 delete deviceConfig;
51 delete deviceDock; 53 delete deviceDock;
54
55 RBFontCache::clearCache();
56 RBTextCache::clearCache();
52} 57}
53 58
54void EditorWindow::loadTabFromSkinFile(QString fileName) 59void EditorWindow::loadTabFromSkinFile(QString fileName)
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}
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h
index 7563b3cb53..f7ac2bbc2c 100644
--- a/utils/themeeditor/gui/skindocument.h
+++ b/utils/themeeditor/gui/skindocument.h
@@ -26,6 +26,8 @@
26#include <QLabel> 26#include <QLabel>
27#include <QHBoxLayout> 27#include <QHBoxLayout>
28#include <QGraphicsScene> 28#include <QGraphicsScene>
29#include <QTime>
30#include <QTimer>
29 31
30#include "findreplacedialog.h" 32#include "findreplacedialog.h"
31 33
@@ -113,6 +115,10 @@ private:
113 DeviceState* device; 115 DeviceState* device;
114 116
115 FindReplaceDialog* findReplace; 117 FindReplaceDialog* findReplace;
118
119 QTime lastUpdate;
120 static const int updateInterval;
121 QTimer checkUpdate;
116}; 122};
117 123
118#endif // SKINDOCUMENT_H 124#endif // SKINDOCUMENT_H