Theme Editor: Fixed bug in parser handling empty lines and made ParseTreeModel handle...
[kugel-rb.git] / utils / themeeditor / skindocument.h
blob741359b7a7bf84c6eb8bb1c37dbb9a47aedfac22
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>
29 #include "skinhighlighter.h"
30 #include "parsetreemodel.h"
31 #include "preferencesdialog.h"
32 #include "codeeditor.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 getFile(){ return fileName; }
56 QString getTitle(){ return title; }
57 QString getStatus(){ return parseStatus; }
58 void genCode(){ editor->document()->setPlainText(model->genCode()); }
60 void save();
61 void saveAs();
63 bool requestClose();
65 signals:
66 void titleChanged(QString);
68 public slots:
69 void settingsChanged();
71 private slots:
72 void codeChanged();
74 private:
75 void setupUI();
77 QString title;
78 QString fileName;
79 QString saved;
80 QString parseStatus;
82 QLayout* layout;
83 CodeEditor* editor;
85 SkinHighlighter* highlighter;
86 ParseTreeModel* model;
88 QLabel* statusLabel;
91 #endif // SKINDOCUMENT_H