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>
30 #include "findreplacedialog.h"
32 #include "skinhighlighter.h"
33 #include "parsetreemodel.h"
34 #include "preferencesdialog.h"
35 #include "codeeditor.h"
36 #include "tabcontent.h"
37 #include "projectmodel.h"
38 #include "devicestate.h"
40 class SkinDocument
: public TabContent
44 static QString
fileFilter()
46 return tr("WPS Files (*.wps *.rwps);;"
47 "SBS Files (*.sbs *.rsbs);;"
48 "FMS Files (*.fms *.rfms);;"
49 "All Skin Files (*.wps *.rwps *.sbs "
50 "*.rsbs *.fms *.rfms);;"
54 SkinDocument(QLabel
* statusLabel
, ProjectModel
* project
= 0,
55 DeviceState
* device
= 0, QWidget
*parent
= 0);
56 SkinDocument(QLabel
* statusLabel
, QString file
, ProjectModel
* project
= 0,
57 DeviceState
* device
= 0, QWidget
* parent
= 0);
58 virtual ~SkinDocument();
60 void connectPrefs(PreferencesDialog
* prefs
);
62 ParseTreeModel
* getModel(){ return model
; }
63 QString
file() const{ return fileName
; }
64 QString
title() const{ return titleText
; }
65 QString
getStatus(){ return parseStatus
; }
66 CodeEditor
* getEditor(){ return editor
; }
67 void genCode(){ editor
->document()->setPlainText(model
->genCode()); }
68 void setProject(ProjectModel
* project
){ this->project
= project
; }
75 TabType
type() const{ return Skin
; }
77 QGraphicsScene
* scene(){ return model
->render(project
, device
, &fileName
); }
79 void showFind(){ findReplace
->show(); }
80 void hideFind(){ findReplace
->hide(); }
85 void settingsChanged();
90 void deviceChanged(){ scene(); }
94 QString
findSetting(QString key
, QString fallback
);
104 SkinHighlighter
* highlighter
;
105 ParseTreeModel
* model
;
111 ProjectModel
* project
;
114 FindReplaceDialog
* findReplace
;
117 #endif // SKINDOCUMENT_H