Theme Editor: Changed anged error reporting method in parser, added error messages...
[kugel-rb.git] / utils / themeeditor / skindocument.h
blob4a6516f6ded0051dc7042ce28d8c4e4c5175ea93
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef SKINDOCUMENT_H
23 #define SKINDOCUMENT_H
25 #include <QWidget>
26 #include <QLabel>
27 #include <QHBoxLayout>
28 #include <QPlainTextEdit>
30 #include "skinhighlighter.h"
31 #include "parsetreemodel.h"
32 #include "preferencesdialog.h"
34 class SkinDocument : public QWidget
36 Q_OBJECT
37 public:
38 static QString fileFilter()
40 return tr("WPS Files (*.wps *.rwps);;"
41 "SBS Files (*.sbs *.rsbs);;"
42 "FMS Files (*.fms *.rfms);;"
43 "All Skin Files (*.wps *.rwps *.sbs "
44 "*.rsbs *.fms *.rfms);;"
45 "All Files (*.*)");
48 SkinDocument(QLabel* statusLabel, QWidget *parent = 0);
49 SkinDocument(QLabel* statusLabel, QString file, QWidget* parent = 0);
50 virtual ~SkinDocument();
52 void connectPrefs(PreferencesDialog* prefs);
54 ParseTreeModel* getModel(){ return model; }
55 QString getTitle(){ return title; }
56 QString getStatus(){ return parseStatus; }
57 void genCode(){ editor->document()->setPlainText(model->genCode()); }
59 void save();
60 void saveAs();
62 bool requestClose();
64 signals:
65 void titleChanged(QString);
67 public slots:
68 void settingsChanged();
70 private slots:
71 void codeChanged();
73 private:
74 void setupUI();
76 QString title;
77 QString fileName;
78 QString saved;
79 QString parseStatus;
81 QLayout* layout;
82 QPlainTextEdit* editor;
84 SkinHighlighter* highlighter;
85 ParseTreeModel* model;
87 QLabel* statusLabel;
90 #endif // SKINDOCUMENT_H