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 4c073b9..171e7b7 100644
--- a/utils/themeeditor/gui/editorwindow.cpp
+++ b/utils/themeeditor/gui/editorwindow.cpp
@@ -22,6 +22,8 @@
#include "editorwindow.h"
#include "projectmodel.h"
#include "ui_editorwindow.h"
+#include "rbfontcache.h"
+#include "rbtextcache.h"
#include <QDesktopWidget>
#include <QFileSystemModel>
@@ -49,6 +51,9 @@ EditorWindow::~EditorWindow()
delete project;
delete deviceConfig;
delete deviceDock;
+
+ RBFontCache::clearCache();
+ RBTextCache::clearCache();
}
void EditorWindow::loadTabFromSkinFile(QString fileName)
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp
index 9a381a9..f04c12d 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();
}
diff --git a/utils/themeeditor/gui/skindocument.h b/utils/themeeditor/gui/skindocument.h
index 7563b3c..f7ac2bb 100644
--- a/utils/themeeditor/gui/skindocument.h
+++ b/utils/themeeditor/gui/skindocument.h
@@ -26,6 +26,8 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QGraphicsScene>
+#include <QTime>
+#include <QTimer>
#include "findreplacedialog.h"
@@ -113,6 +115,10 @@ private:
DeviceState* device;
FindReplaceDialog* findReplace;
+
+ QTime lastUpdate;
+ static const int updateInterval;
+ QTimer checkUpdate;
};
#endif // SKINDOCUMENT_H