1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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
27 #include <QHBoxLayout>
28 #include <QGraphicsScene>
32 #include "findreplacedialog.h"
34 #include "skinhighlighter.h"
35 #include "parsetreemodel.h"
36 #include "preferencesdialog.h"
37 #include "codeeditor.h"
38 #include "tabcontent.h"
39 #include "projectmodel.h"
40 #include "devicestate.h"
42 class SkinDocument
: public TabContent
46 static QString
fileFilter()
48 return tr("WPS Files (*.wps *.rwps);;"
49 "SBS Files (*.sbs *.rsbs);;"
50 "FMS Files (*.fms *.rfms);;"
51 "All Skin Files (*.wps *.rwps *.sbs "
52 "*.rsbs *.fms *.rfms);;"
56 SkinDocument(QLabel
* statusLabel
, ProjectModel
* project
= 0,
57 DeviceState
* device
= 0, QWidget
*parent
= 0);
58 SkinDocument(QLabel
* statusLabel
, QString file
, ProjectModel
* project
= 0,
59 DeviceState
* device
= 0, QWidget
* parent
= 0);
60 virtual ~SkinDocument();
62 void connectPrefs(PreferencesDialog
* prefs
);
64 ParseTreeModel
* getModel(){ return model
; }
65 QString
file() const{ return fileName
; }
66 QString
title() const{ return titleText
; }
67 QString
getStatus(){ return parseStatus
; }
68 CodeEditor
* getEditor(){ return editor
; }
69 void genCode(){ editor
->document()->setPlainText(model
->genCode()); }
70 void setProject(ProjectModel
* project
){ this->project
= project
; }
77 TabType
type() const{ return Skin
; }
79 QGraphicsScene
* scene(){ return model
->render(project
, device
, &fileName
); }
81 void showFind(){ findReplace
->show(); }
82 void hideFind(){ findReplace
->hide(); }
87 void settingsChanged();
92 void deviceChanged(){ scene(); }
96 QString
findSetting(QString key
, QString fallback
);
107 SkinHighlighter
* highlighter
;
108 ParseTreeModel
* model
;
114 ProjectModel
* project
;
117 FindReplaceDialog
* findReplace
;
120 static const int updateInterval
;
124 #endif // SKINDOCUMENT_H