summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skindocument.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-15 06:54:58 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-15 06:54:58 +0000
commit2e320f66f4f3c831dcfd232b33da0e6ab6dd7dd0 (patch)
treea6ef8001d797213e9dd81cd41c48f5065c33f3f0 /utils/themeeditor/skindocument.cpp
parent1d4dc9b3b0f094a70463395138fc920e5107eabc (diff)
downloadrockbox-2e320f66f4f3c831dcfd232b33da0e6ab6dd7dd0.tar.gz
rockbox-2e320f66f4f3c831dcfd232b33da0e6ab6dd7dd0.zip
Theme Editor: Changed color to colour in preferences. Made parse tree viewer alternate line colors and auto-scroll/expand with cursor in editor window. Implemented TabContent abstract class so that more than just skin documents can be loaded in tabs. Made SkinDocument implement TabContent. Began implementing ConfigDocument for editing configuration files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26851 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/skindocument.cpp')
-rw-r--r--utils/themeeditor/skindocument.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 9a9bf5c85f..82c7106051 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -9,10 +9,10 @@
9 * 9 *
10 * Copyright (C) 2010 Robert Bieber 10 * Copyright (C) 2010 Robert Bieber
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your optiyouon) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
@@ -30,11 +30,11 @@
30#include <iostream> 30#include <iostream>
31 31
32SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) : 32SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
33 QWidget(parent), statusLabel(statusLabel) 33 TabContent(parent), statusLabel(statusLabel)
34{ 34{
35 setupUI(); 35 setupUI();
36 36
37 title = "Untitled"; 37 titleText = "Untitled";
38 fileName = ""; 38 fileName = "";
39 saved = ""; 39 saved = "";
40 parseStatus = tr("Empty document"); 40 parseStatus = tr("Empty document");
@@ -42,7 +42,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QWidget *parent) :
42} 42}
43 43
44SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent): 44SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent):
45 QWidget(parent), fileName(file), statusLabel(statusLabel) 45 TabContent(parent), fileName(file), statusLabel(statusLabel)
46{ 46{
47 setupUI(); 47 setupUI();
48 blockUpdate = false; 48 blockUpdate = false;
@@ -60,7 +60,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QString file, QWidget *parent):
60 60
61 /* Setting the title */ 61 /* Setting the title */
62 QStringList decomposed = fileName.split('/'); 62 QStringList decomposed = fileName.split('/');
63 title = decomposed.last(); 63 titleText = decomposed.last();
64} 64}
65 65
66SkinDocument::~SkinDocument() 66SkinDocument::~SkinDocument()
@@ -86,7 +86,7 @@ bool SkinDocument::requestClose()
86 /* Spawning the "Are you sure?" dialog */ 86 /* Spawning the "Are you sure?" dialog */
87 QMessageBox confirm(this); 87 QMessageBox confirm(this);
88 confirm.setWindowTitle(tr("Confirm Close")); 88 confirm.setWindowTitle(tr("Confirm Close"));
89 confirm.setText(title + tr(" has been modified.")); 89 confirm.setText(titleText + tr(" has been modified."));
90 confirm.setInformativeText(tr("Do you want to save your changes?")); 90 confirm.setInformativeText(tr("Do you want to save your changes?"));
91 confirm.setStandardButtons(QMessageBox::Save | QMessageBox::Discard 91 confirm.setStandardButtons(QMessageBox::Save | QMessageBox::Discard
92 | QMessageBox::Cancel); 92 | QMessageBox::Cancel);
@@ -192,6 +192,10 @@ void SkinDocument::cursorChanged()
192 parseStatus = tr("Errors in document"); 192 parseStatus = tr("Errors in document");
193 statusLabel->setText(parseStatus); 193 statusLabel->setText(parseStatus);
194 } 194 }
195 else
196 {
197 emit lineChanged(editor->textCursor().blockNumber() + 1);
198 }
195 199
196} 200}
197 201
@@ -245,9 +249,9 @@ void SkinDocument::codeChanged()
245 } 249 }
246 250
247 if(editor->document()->toPlainText() != saved) 251 if(editor->document()->toPlainText() != saved)
248 emit titleChanged(title + QChar('*')); 252 emit titleChanged(titleText + QChar('*'));
249 else 253 else
250 emit titleChanged(title); 254 emit titleChanged(titleText);
251 255
252 cursorChanged(); 256 cursorChanged();
253 257
@@ -269,8 +273,8 @@ void SkinDocument::save()
269 273
270 saved = editor->document()->toPlainText(); 274 saved = editor->document()->toPlainText();
271 QStringList decompose = fileName.split('/'); 275 QStringList decompose = fileName.split('/');
272 title = decompose.last(); 276 titleText = decompose.last();
273 emit titleChanged(title); 277 emit titleChanged(titleText);
274 278
275} 279}
276 280
@@ -301,7 +305,7 @@ void SkinDocument::saveAs()
301 305
302 saved = editor->document()->toPlainText(); 306 saved = editor->document()->toPlainText();
303 QStringList decompose = fileName.split('/'); 307 QStringList decompose = fileName.split('/');
304 title = decompose[decompose.count() - 1]; 308 titleText = decompose[decompose.count() - 1];
305 emit titleChanged(title); 309 emit titleChanged(titleText);
306 310
307} 311}