diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-06-17 00:40:07 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-06-17 00:40:07 +0000 |
commit | 604b17aa082160cd0347e16fdf245000e3ada3f0 (patch) | |
tree | 85372b911ed9017c7c5bbed76a705828c119c60f /utils/themeeditor | |
parent | 6c94ce590dadf6e80a029828e65f676bf79e0537 (diff) | |
download | rockbox-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
Diffstat (limited to 'utils/themeeditor')
-rw-r--r-- | utils/themeeditor/editorwindow.cpp | 12 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.h | 2 | ||||
-rw-r--r-- | utils/themeeditor/editorwindow.ui | 7 | ||||
-rw-r--r-- | utils/themeeditor/skinviewer.cpp | 67 | ||||
-rw-r--r-- | utils/themeeditor/skinviewer.h | 51 | ||||
-rw-r--r-- | utils/themeeditor/skinviewer.ui | 42 | ||||
-rw-r--r-- | utils/themeeditor/themeeditor.pro | 9 |
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 @@ #include <QFileSystemModel> #include <QSettings> #include <QFileDialog> +#include <QGraphicsScene> EditorWindow::EditorWindow(QWidget *parent) : QMainWindow(parent), @@ -136,7 +137,18 @@ void EditorWindow::setupUI() parseStatus = new QLabel(this); ui->statusbar->addPermanentWidget(parseStatus); + /* Setting the selection for parse tree highlighting initially NULL */ parseTreeSelection = 0; + + /* Adding the skin viewer */ + viewer = new SkinViewer(this); + ui->skinPreviewLayout->addWidget(viewer); + + //TODO: Remove this test code + QGraphicsScene* test = new QGraphicsScene(); + test->addRect(0,0,50,50); + + viewer->setScene(test); } void 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 @@ #include "skindocument.h" #include "configdocument.h" #include "preferencesdialog.h" +#include "skinviewer.h" class ProjectModel; class TabContent; @@ -86,6 +87,7 @@ private: QLabel* parseStatus; ProjectModel* project; QItemSelectionModel* parseTreeSelection; + SkinViewer* viewer; }; #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 @@ <x>0</x> <y>0</y> <width>628</width> - <height>27</height> + <height>25</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -79,10 +79,10 @@ <attribute name="dockWidgetArea"> <number>2</number> </attribute> - <widget class="QWidget" name="dockWidgetContents"> + <widget class="QWidget" name="skinPreviewContents"> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QGraphicsView" name="skinPreview"/> + <layout class="QVBoxLayout" name="skinPreviewLayout"/> </item> </layout> </widget> @@ -296,7 +296,6 @@ </widget> <tabstops> <tabstop>projectTree</tabstop> - <tabstop>skinPreview</tabstop> <tabstop>parseTree</tabstop> <tabstop>fromTree</tabstop> <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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "skinviewer.h" +#include "ui_skinviewer.h" + +SkinViewer::SkinViewer(QWidget *parent) : + QWidget(parent), + ui(new Ui::SkinViewer) +{ + ui->setupUi(this); + + QObject::connect(ui->zoomOutButton, SIGNAL(pressed()), + this, SLOT(zoomOut())); + QObject::connect(ui->zoomInButton, SIGNAL(pressed()), + this, SLOT(zoomIn())); +} + +SkinViewer::~SkinViewer() +{ + delete ui; +} + +void SkinViewer::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void SkinViewer::setScene(QGraphicsScene *scene) +{ + ui->viewer->setScene(scene); +} + +void SkinViewer::zoomIn() +{ + ui->viewer->scale(1.2, 1.2); +} + +void SkinViewer::zoomOut() +{ + ui->viewer->scale(1/1.2, 1/1.2); +} 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 Robert Bieber + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef SKINVIEWER_H +#define SKINVIEWER_H + +#include <QWidget> +#include <QGraphicsScene> + +namespace Ui { + class SkinViewer; +} + +class SkinViewer : public QWidget { + Q_OBJECT +public: + SkinViewer(QWidget *parent = 0); + ~SkinViewer(); + + void setScene(QGraphicsScene* scene); + +public slots: + void zoomIn(); + void zoomOut(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::SkinViewer *ui; +}; + +#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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SkinViewer</class> + <widget class="QWidget" name="SkinViewer"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGraphicsView" name="viewer"/> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="zoomInButton"> + <property name="text"> + <string>Zoom In</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="zoomOutButton"> + <property name="text"> + <string>Zoom Out</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</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 \ codeeditor.h \ projectmodel.h \ tabcontent.h \ - configdocument.h + configdocument.h \ + skinviewer.h SOURCES += tag_table.c \ skin_parser.c \ skin_scan.c \ @@ -32,7 +33,8 @@ SOURCES += tag_table.c \ preferencesdialog.cpp \ codeeditor.cpp \ projectmodel.cpp \ - configdocument.cpp + configdocument.cpp \ + skinviewer.cpp OTHER_FILES += README \ resources/windowicon.png \ resources/appicon.xcf \ @@ -42,5 +44,6 @@ OTHER_FILES += README \ resources/document-new.png FORMS += editorwindow.ui \ preferencesdialog.ui \ - configdocument.ui + configdocument.ui \ + skinviewer.ui RESOURCES += resources.qrc |