diff options
Diffstat (limited to 'utils/themeeditor/gui/skindocument.cpp')
| -rw-r--r-- | utils/themeeditor/gui/skindocument.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/utils/themeeditor/gui/skindocument.cpp b/utils/themeeditor/gui/skindocument.cpp index bd52685..1ee6b6e 100644 --- a/utils/themeeditor/gui/skindocument.cpp +++ b/utils/themeeditor/gui/skindocument.cpp @@ -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); |