summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-17 00:40:07 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-17 00:40:07 +0000
commit604b17aa082160cd0347e16fdf245000e3ada3f0 (patch)
tree85372b911ed9017c7c5bbed76a705828c119c60f
parent6c94ce590dadf6e80a029828e65f676bf79e0537 (diff)
downloadrockbox-604b17aa082160cd0347e16fdf245000e3ada3f0.tar.gz
rockbox-604b17aa082160cd0347e16fdf245000e3ada3f0.zip
Theme Editor: Began working on skin preview viewer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26874 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/editorwindow.cpp12
-rw-r--r--utils/themeeditor/editorwindow.h2
-rw-r--r--utils/themeeditor/editorwindow.ui7
-rw-r--r--utils/themeeditor/skinviewer.cpp67
-rw-r--r--utils/themeeditor/skinviewer.h51
-rw-r--r--utils/themeeditor/skinviewer.ui42
-rw-r--r--utils/themeeditor/themeeditor.pro9
7 files changed, 183 insertions, 7 deletions
diff --git a/utils/themeeditor/editorwindow.cpp b/utils/themeeditor/editorwindow.cpp
index 0721ee9131..675520dc28 100644
--- a/utils/themeeditor/editorwindow.cpp
+++ b/utils/themeeditor/editorwindow.cpp
@@ -27,6 +27,7 @@
27#include <QFileSystemModel> 27#include <QFileSystemModel>
28#include <QSettings> 28#include <QSettings>
29#include <QFileDialog> 29#include <QFileDialog>
30#include <QGraphicsScene>
30 31
31EditorWindow::EditorWindow(QWidget *parent) : 32EditorWindow::EditorWindow(QWidget *parent) :
32 QMainWindow(parent), 33 QMainWindow(parent),
@@ -136,7 +137,18 @@ void EditorWindow::setupUI()
136 parseStatus = new QLabel(this); 137 parseStatus = new QLabel(this);
137 ui->statusbar->addPermanentWidget(parseStatus); 138 ui->statusbar->addPermanentWidget(parseStatus);
138 139
140 /* Setting the selection for parse tree highlighting initially NULL */
139 parseTreeSelection = 0; 141 parseTreeSelection = 0;
142
143 /* Adding the skin viewer */
144 viewer = new SkinViewer(this);
145 ui->skinPreviewLayout->addWidget(viewer);
146
147 //TODO: Remove this test code
148 QGraphicsScene* test = new QGraphicsScene();
149 test->addRect(0,0,50,50);
150
151 viewer->setScene(test);
140} 152}
141 153
142void EditorWindow::setupMenus() 154void EditorWindow::setupMenus()
diff --git a/utils/themeeditor/editorwindow.h b/utils/themeeditor/editorwindow.h
index 0dee4a1e6e..6f73735100 100644
--- a/utils/themeeditor/editorwindow.h
+++ b/utils/themeeditor/editorwindow.h
@@ -31,6 +31,7 @@
31#include "skindocument.h" 31#include "skindocument.h"
32#include "configdocument.h" 32#include "configdocument.h"
33#include "preferencesdialog.h" 33#include "preferencesdialog.h"
34#include "skinviewer.h"
34 35
35class ProjectModel; 36class ProjectModel;
36class TabContent; 37class TabContent;
@@ -86,6 +87,7 @@ private:
86 QLabel* parseStatus; 87 QLabel* parseStatus;
87 ProjectModel* project; 88 ProjectModel* project;
88 QItemSelectionModel* parseTreeSelection; 89 QItemSelectionModel* parseTreeSelection;
90 SkinViewer* viewer;
89}; 91};
90 92
91#endif // EDITORWINDOW_H 93#endif // EDITORWINDOW_H
diff --git a/utils/themeeditor/editorwindow.ui b/utils/themeeditor/editorwindow.ui
index 11cfb6b94f..10e2c524c6 100644
--- a/utils/themeeditor/editorwindow.ui
+++ b/utils/themeeditor/editorwindow.ui
@@ -40,7 +40,7 @@
40 <x>0</x> 40 <x>0</x>
41 <y>0</y> 41 <y>0</y>
42 <width>628</width> 42 <width>628</width>
43 <height>27</height> 43 <height>25</height>
44 </rect> 44 </rect>
45 </property> 45 </property>
46 <widget class="QMenu" name="menuFile"> 46 <widget class="QMenu" name="menuFile">
@@ -79,10 +79,10 @@
79 <attribute name="dockWidgetArea"> 79 <attribute name="dockWidgetArea">
80 <number>2</number> 80 <number>2</number>
81 </attribute> 81 </attribute>
82 <widget class="QWidget" name="dockWidgetContents"> 82 <widget class="QWidget" name="skinPreviewContents">
83 <layout class="QVBoxLayout" name="verticalLayout_2"> 83 <layout class="QVBoxLayout" name="verticalLayout_2">
84 <item> 84 <item>
85 <widget class="QGraphicsView" name="skinPreview"/> 85 <layout class="QVBoxLayout" name="skinPreviewLayout"/>
86 </item> 86 </item>
87 </layout> 87 </layout>
88 </widget> 88 </widget>
@@ -296,7 +296,6 @@
296 </widget> 296 </widget>
297 <tabstops> 297 <tabstops>
298 <tabstop>projectTree</tabstop> 298 <tabstop>projectTree</tabstop>
299 <tabstop>skinPreview</tabstop>
300 <tabstop>parseTree</tabstop> 299 <tabstop>parseTree</tabstop>
301 <tabstop>fromTree</tabstop> 300 <tabstop>fromTree</tabstop>
302 <tabstop>editorTabs</tabstop> 301 <tabstop>editorTabs</tabstop>
diff --git a/utils/themeeditor/skinviewer.cpp b/utils/themeeditor/skinviewer.cpp
new file mode 100644
index 0000000000..152450e149
--- /dev/null
+++ b/utils/themeeditor/skinviewer.cpp
@@ -0,0 +1,67 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Robert Bieber
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "skinviewer.h"
23#include "ui_skinviewer.h"
24
25SkinViewer::SkinViewer(QWidget *parent) :
26 QWidget(parent),
27 ui(new Ui::SkinViewer)
28{
29 ui->setupUi(this);
30
31 QObject::connect(ui->zoomOutButton, SIGNAL(pressed()),
32 this, SLOT(zoomOut()));
33 QObject::connect(ui->zoomInButton, SIGNAL(pressed()),
34 this, SLOT(zoomIn()));
35}
36
37SkinViewer::~SkinViewer()
38{
39 delete ui;
40}
41
42void SkinViewer::changeEvent(QEvent *e)
43{
44 QWidget::changeEvent(e);
45 switch (e->type()) {
46 case QEvent::LanguageChange:
47 ui->retranslateUi(this);
48 break;
49 default:
50 break;
51 }
52}
53
54void SkinViewer::setScene(QGraphicsScene *scene)
55{
56 ui->viewer->setScene(scene);
57}
58
59void SkinViewer::zoomIn()
60{
61 ui->viewer->scale(1.2, 1.2);
62}
63
64void SkinViewer::zoomOut()
65{
66 ui->viewer->scale(1/1.2, 1/1.2);
67}
diff --git a/utils/themeeditor/skinviewer.h b/utils/themeeditor/skinviewer.h
new file mode 100644
index 0000000000..599a204fd7
--- /dev/null
+++ b/utils/themeeditor/skinviewer.h
@@ -0,0 +1,51 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Robert Bieber
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef SKINVIEWER_H
23#define SKINVIEWER_H
24
25#include <QWidget>
26#include <QGraphicsScene>
27
28namespace Ui {
29 class SkinViewer;
30}
31
32class SkinViewer : public QWidget {
33 Q_OBJECT
34public:
35 SkinViewer(QWidget *parent = 0);
36 ~SkinViewer();
37
38 void setScene(QGraphicsScene* scene);
39
40public slots:
41 void zoomIn();
42 void zoomOut();
43
44protected:
45 void changeEvent(QEvent *e);
46
47private:
48 Ui::SkinViewer *ui;
49};
50
51#endif // SKINVIEWER_H
diff --git a/utils/themeeditor/skinviewer.ui b/utils/themeeditor/skinviewer.ui
new file mode 100644
index 0000000000..ed260d0650
--- /dev/null
+++ b/utils/themeeditor/skinviewer.ui
@@ -0,0 +1,42 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>SkinViewer</class>
4 <widget class="QWidget" name="SkinViewer">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <widget class="QGraphicsView" name="viewer"/>
19 </item>
20 <item>
21 <layout class="QHBoxLayout" name="horizontalLayout">
22 <item>
23 <widget class="QToolButton" name="zoomInButton">
24 <property name="text">
25 <string>Zoom In</string>
26 </property>
27 </widget>
28 </item>
29 <item>
30 <widget class="QToolButton" name="zoomOutButton">
31 <property name="text">
32 <string>Zoom Out</string>
33 </property>
34 </widget>
35 </item>
36 </layout>
37 </item>
38 </layout>
39 </widget>
40 <resources/>
41 <connections/>
42</ui>
diff --git a/utils/themeeditor/themeeditor.pro b/utils/themeeditor/themeeditor.pro
index c336edf2f5..ef3f4995ff 100644
--- a/utils/themeeditor/themeeditor.pro
+++ b/utils/themeeditor/themeeditor.pro
@@ -18,7 +18,8 @@ HEADERS += tag_table.h \
18 codeeditor.h \ 18 codeeditor.h \
19 projectmodel.h \ 19 projectmodel.h \
20 tabcontent.h \ 20 tabcontent.h \
21 configdocument.h 21 configdocument.h \
22 skinviewer.h
22SOURCES += tag_table.c \ 23SOURCES += tag_table.c \
23 skin_parser.c \ 24 skin_parser.c \
24 skin_scan.c \ 25 skin_scan.c \
@@ -32,7 +33,8 @@ SOURCES += tag_table.c \
32 preferencesdialog.cpp \ 33 preferencesdialog.cpp \
33 codeeditor.cpp \ 34 codeeditor.cpp \
34 projectmodel.cpp \ 35 projectmodel.cpp \
35 configdocument.cpp 36 configdocument.cpp \
37 skinviewer.cpp
36OTHER_FILES += README \ 38OTHER_FILES += README \
37 resources/windowicon.png \ 39 resources/windowicon.png \
38 resources/appicon.xcf \ 40 resources/appicon.xcf \
@@ -42,5 +44,6 @@ OTHER_FILES += README \
42 resources/document-new.png 44 resources/document-new.png
43FORMS += editorwindow.ui \ 45FORMS += editorwindow.ui \
44 preferencesdialog.ui \ 46 preferencesdialog.ui \
45 configdocument.ui 47 configdocument.ui \
48 skinviewer.ui
46RESOURCES += resources.qrc 49RESOURCES += resources.qrc