summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skindocument.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-11 20:51:49 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-11 20:51:49 +0000
commitfa08c83e29c3957dc433067bd874c4f0e82dd9f1 (patch)
tree1a48af9eb2153a631136e7e4b57fb4bcf7d4c450 /utils/themeeditor/skindocument.cpp
parent82ff776fbbf32e86cbc4c41b1290e369876f9f07 (diff)
downloadrockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.zip
rockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.tar.gz
rockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.tar.bz2
rockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.tar.xz
Theme Editor: Fixed status bar update bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26798 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to '')
-rw-r--r--utils/themeeditor/skindocument.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 93c2f65..53e480c 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -37,13 +37,15 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
title = "Untitled";
fileName = "";
saved = "";
- parseStatus = tr("Empty Document");
+ parseStatus = tr("Empty document");
+ blockUpdate = false;
}
SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent):
QWidget(parent), fileName(file), statusLabel(statusLabel)
{
setupUI();
+ blockUpdate = false;
/* Loading the file */
if(QFile::exists(fileName))
@@ -77,6 +79,8 @@ void SkinDocument::connectPrefs(PreferencesDialog* prefs)
bool SkinDocument::requestClose()
{
+ /* Storing the response in blockUpdate will also block updates to the
+ status bar if the tab is being closed */
if(editor->document()->toPlainText() != saved)
{
/* Spawning the "Are you sure?" dialog */
@@ -95,19 +99,24 @@ bool SkinDocument::requestClose()
save();
/* After calling save, make sure the user actually went through */
if(editor->document()->toPlainText() != saved)
- return false;
+ blockUpdate = false;
else
- return true;
+ blockUpdate = true;
+ break;
case QMessageBox::Discard:
- return true;
+ blockUpdate = true;
+ break;
case QMessageBox::Cancel:
- return false;
+ blockUpdate = false;
+ break;
}
}
+ else
+ blockUpdate = true;
- return true;
+ return blockUpdate;
}
void SkinDocument::setupUI()
@@ -164,11 +173,24 @@ void SkinDocument::settingsChanged()
void SkinDocument::codeChanged()
{
+ if(blockUpdate)
+ return;
+
+ if(editor->document()->isEmpty())
+ {
+ parseStatus = tr("Empty document");
+ statusLabel->setText(parseStatus);
+ return;
+ }
+
editor->clearErrors();
parseStatus = model->changeTree(editor->document()->
toPlainText().toAscii());
+ if(skin_error_line() > 0)
+ parseStatus = tr("Errors in document");
statusLabel->setText(parseStatus);
+
/* Highlighting if an error was found */
if(skin_error_line() > 0)
{