summaryrefslogtreecommitdiff
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
parent82ff776fbbf32e86cbc4c41b1290e369876f9f07 (diff)
downloadrockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.tar.gz
rockbox-fa08c83e29c3957dc433067bd874c4f0e82dd9f1.zip
Theme Editor: Fixed status bar update bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26798 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/skindocument.cpp34
-rw-r--r--utils/themeeditor/skindocument.h2
2 files changed, 30 insertions, 6 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 93c2f6531d..53e480cbe3 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -37,13 +37,15 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
37 title = "Untitled"; 37 title = "Untitled";
38 fileName = ""; 38 fileName = "";
39 saved = ""; 39 saved = "";
40 parseStatus = tr("Empty Document"); 40 parseStatus = tr("Empty document");
41 blockUpdate = false;
41} 42}
42 43
43SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent): 44SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent):
44 QWidget(parent), fileName(file), statusLabel(statusLabel) 45 QWidget(parent), fileName(file), statusLabel(statusLabel)
45{ 46{
46 setupUI(); 47 setupUI();
48 blockUpdate = false;
47 49
48 /* Loading the file */ 50 /* Loading the file */
49 if(QFile::exists(fileName)) 51 if(QFile::exists(fileName))
@@ -77,6 +79,8 @@ void SkinDocument::connectPrefs(PreferencesDialog* prefs)
77 79
78bool SkinDocument::requestClose() 80bool SkinDocument::requestClose()
79{ 81{
82 /* Storing the response in blockUpdate will also block updates to the
83 status bar if the tab is being closed */
80 if(editor->document()->toPlainText() != saved) 84 if(editor->document()->toPlainText() != saved)
81 { 85 {
82 /* Spawning the "Are you sure?" dialog */ 86 /* Spawning the "Are you sure?" dialog */
@@ -95,19 +99,24 @@ bool SkinDocument::requestClose()
95 save(); 99 save();
96 /* After calling save, make sure the user actually went through */ 100 /* After calling save, make sure the user actually went through */
97 if(editor->document()->toPlainText() != saved) 101 if(editor->document()->toPlainText() != saved)
98 return false; 102 blockUpdate = false;
99 else 103 else
100 return true; 104 blockUpdate = true;
105 break;
101 106
102 case QMessageBox::Discard: 107 case QMessageBox::Discard:
103 return true; 108 blockUpdate = true;
109 break;
104 110
105 case QMessageBox::Cancel: 111 case QMessageBox::Cancel:
106 return false; 112 blockUpdate = false;
113 break;
107 } 114 }
108 } 115 }
116 else
117 blockUpdate = true;
109 118
110 return true; 119 return blockUpdate;
111} 120}
112 121
113void SkinDocument::setupUI() 122void SkinDocument::setupUI()
@@ -164,11 +173,24 @@ void SkinDocument::settingsChanged()
164 173
165void SkinDocument::codeChanged() 174void SkinDocument::codeChanged()
166{ 175{
176 if(blockUpdate)
177 return;
178
179 if(editor->document()->isEmpty())
180 {
181 parseStatus = tr("Empty document");
182 statusLabel->setText(parseStatus);
183 return;
184 }
185
167 editor->clearErrors(); 186 editor->clearErrors();
168 parseStatus = model->changeTree(editor->document()-> 187 parseStatus = model->changeTree(editor->document()->
169 toPlainText().toAscii()); 188 toPlainText().toAscii());
189 if(skin_error_line() > 0)
190 parseStatus = tr("Errors in document");
170 statusLabel->setText(parseStatus); 191 statusLabel->setText(parseStatus);
171 192
193
172 /* Highlighting if an error was found */ 194 /* Highlighting if an error was found */
173 if(skin_error_line() > 0) 195 if(skin_error_line() > 0)
174 { 196 {
diff --git a/utils/themeeditor/skindocument.h b/utils/themeeditor/skindocument.h
index 741359b7a7..ccbb228dc1 100644
--- a/utils/themeeditor/skindocument.h
+++ b/utils/themeeditor/skindocument.h
@@ -86,6 +86,8 @@ private:
86 ParseTreeModel* model; 86 ParseTreeModel* model;
87 87
88 QLabel* statusLabel; 88 QLabel* statusLabel;
89
90 bool blockUpdate;
89}; 91};
90 92
91#endif // SKINDOCUMENT_H 93#endif // SKINDOCUMENT_H