1
0
Fork 0
forked from len0rd/rockbox

Theme Editor: Added code generate/undo functionality to SkinViewer

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27704 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-08-05 00:43:33 +00:00
parent 4674518787
commit 054a85fdca
15 changed files with 154 additions and 39 deletions

View file

@ -36,7 +36,8 @@ const int SkinDocument::updateInterval = 500;
SkinDocument::SkinDocument(QLabel* statusLabel, ProjectModel* project,
DeviceState* device, QWidget *parent)
:TabContent(parent), statusLabel(statusLabel),
project(project), device(device)
project(project), device(device),
treeInSync(true)
{
setupUI();
@ -53,7 +54,7 @@ SkinDocument::SkinDocument(QLabel* statusLabel, QString file,
QWidget *parent)
:TabContent(parent), fileName(file),
statusLabel(statusLabel), project(project),
device(device)
device(device), treeInSync(true)
{
setupUI();
blockUpdate = false;
@ -163,6 +164,9 @@ void SkinDocument::setupUI()
/* Setting up the model */
model = new ParseTreeModel("");
QObject::connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(modelChanged()));
/* Connecting the editor's signal */
QObject::connect(editor, SIGNAL(textChanged()),
this, SLOT(codeChanged()));
@ -260,6 +264,10 @@ void SkinDocument::codeChanged()
editor->clearErrors();
parseStatus = model->changeTree(editor->document()->
toPlainText().toAscii());
treeInSync = true;
emit antiSync(false);
if(skin_error_line() > 0)
parseStatus = tr("Errors in document");
statusLabel->setText(parseStatus);
@ -313,6 +321,12 @@ void SkinDocument::codeChanged()
}
void SkinDocument::modelChanged()
{
treeInSync = false;
emit antiSync(true);
}
void SkinDocument::save()
{
QFile fout(fileName);