fuze+: use mdelay and not udelay in lcd sequences
[kugel-rb.git] / utils / themeeditor / gui / skinviewer.cpp
blobab4d522f2a5506146041812c4ba7d3ffaa7f7b81
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()));
40 SkinViewer::~SkinViewer()
42 delete ui;
45 void SkinViewer::changeEvent(QEvent *e)
47 QWidget::changeEvent(e);
48 switch (e->type()) {
49 case QEvent::LanguageChange:
50 ui->retranslateUi(this);
51 break;
52 default:
53 break;
57 void SkinViewer::connectSkin(SkinDocument *skin)
59 if(skin)
61 ui->viewer->setScene(skin->scene());
62 QObject::connect(skin, SIGNAL(antiSync(bool)),
63 ui->codeGenButton, SLOT(setEnabled(bool)));
64 QObject::connect(skin, SIGNAL(antiSync(bool)),
65 ui->codeUndoButton, SLOT(setEnabled(bool)));
67 QObject::connect(ui->codeGenButton, SIGNAL(pressed()),
68 skin, SLOT(genCode()));
69 QObject::connect(ui->codeUndoButton, SIGNAL(pressed()),
70 skin, SLOT(parseCode()));
72 QObject::connect(skin->scene(), SIGNAL(mouseMoved(QString)),
73 ui->coordinateLabel, SLOT(setText(QString)));
75 doc = skin;
77 else
79 ui->viewer->setScene(0);
80 ui->coordinateLabel->setText("");
82 doc = 0;
85 bool antiSync;
86 if(skin && !skin->isSynced())
87 antiSync = true;
88 else
89 antiSync = false;
91 ui->codeGenButton->setEnabled(antiSync);
92 ui->codeUndoButton->setEnabled(antiSync);
95 void SkinViewer::zoomIn()
97 ui->viewer->scale(1.2, 1.2);
100 void SkinViewer::zoomOut()
102 ui->viewer->scale(1/1.2, 1/1.2);
105 void SkinViewer::zoomEven()
107 ui->viewer->resetTransform();