Theme Editor: Added a reset zoom button, made icons for all the zoom buttons
[kugel-rb.git] / utils / themeeditor / gui / skinviewer.cpp
blob95caf1e3930bbbf24c711519c953c0e7762b467c
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 #include "skinviewer.h"
23 #include "ui_skinviewer.h"
25 SkinViewer::SkinViewer(QWidget *parent) :
26 QWidget(parent),
27 ui(new Ui::SkinViewer)
29 ui->setupUi(this);
31 QObject::connect(ui->zoomOutButton, SIGNAL(pressed()),
32 this, SLOT(zoomOut()));
33 QObject::connect(ui->zoomInButton, SIGNAL(pressed()),
34 this, SLOT(zoomIn()));
35 QObject::connect(ui->zoomEvenButton, SIGNAL(pressed()),
36 this, SLOT(zoomEven()));
38 ui->viewer->setDragMode(QGraphicsView::ScrollHandDrag);
41 SkinViewer::~SkinViewer()
43 delete ui;
46 void SkinViewer::changeEvent(QEvent *e)
48 QWidget::changeEvent(e);
49 switch (e->type()) {
50 case QEvent::LanguageChange:
51 ui->retranslateUi(this);
52 break;
53 default:
54 break;
58 void SkinViewer::setScene(QGraphicsScene *scene)
60 ui->viewer->setScene(scene);
63 void SkinViewer::zoomIn()
65 ui->viewer->scale(1.2, 1.2);
68 void SkinViewer::zoomOut()
70 ui->viewer->scale(1/1.2, 1/1.2);
73 void SkinViewer::zoomEven()
75 ui->viewer->resetTransform();