]> git.sesse.net Git - kdenlive/blob - src/dvdwizardmenu.cpp
Try to fix dvd menu error:
[kdenlive] / src / dvdwizardmenu.cpp
1 /***************************************************************************
2  *   Copyright (C) 2009 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include "dvdwizardmenu.h"
21
22 #include <KDebug>
23
24
25 DvdWizardMenu::DvdWizardMenu(const QString &profile, QWidget *parent) :
26         QWizardPage(parent),
27         m_color(NULL),
28         m_safeRect(NULL)
29 {
30     m_view.setupUi(this);
31     m_view.play_text->setText(i18n("Play"));
32     m_scene = new DvdScene(this);
33     m_view.menu_preview->setScene(m_scene);
34
35     connect(m_view.create_menu, SIGNAL(toggled(bool)), m_view.menu_box, SLOT(setEnabled(bool)));
36     connect(m_view.create_menu, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
37
38     m_view.add_button->setIcon(KIcon("document-new"));
39     m_view.delete_button->setIcon(KIcon("trash-empty"));
40     m_view.zoom_button->setIcon(KIcon("zoom-in"));
41     m_view.unzoom_button->setIcon(KIcon("zoom-out"));
42
43     m_view.add_button->setToolTip(i18n("Add new button"));
44     m_view.delete_button->setToolTip(i18n("Delete current button"));
45
46     if (profile == "dv_ntsc" || profile == "dv_ntsc_wide") {
47         changeProfile(false);
48     } else changeProfile(true);
49
50
51
52     // Create color background
53     m_color = new QGraphicsRectItem(0, 0, m_width, m_height);
54     m_color->setBrush(m_view.background_color->color());
55     m_color->setZValue(2);
56     m_scene->addItem(m_color);
57
58
59     // create background image
60     m_background = new QGraphicsPixmapItem();
61     m_background->setZValue(3);
62     //m_scene->addItem(m_background);
63
64     // create safe zone rect
65     int safeW = m_width / 20;
66     int safeH = m_height / 20;
67     m_safeRect = new QGraphicsRectItem(safeW, safeH, m_width - 2 * safeW, m_height - 2 * safeH);
68     QPen pen(Qt::red);
69     pen.setStyle(Qt::DashLine);
70     pen.setWidth(3);
71     m_safeRect->setPen(pen);
72     m_safeRect->setZValue(5);
73     m_scene->addItem(m_safeRect);
74
75     checkBackgroundType(0);
76
77
78     // create menu button
79     DvdButton *button = new DvdButton(m_view.play_text->text());
80     QFont font = m_view.font_family->currentFont();
81     font.setPixelSize(m_view.font_size->value());
82     font.setStyleStrategy(QFont::NoAntialias);
83     button->setFont(font);
84     button->setDefaultTextColor(m_view.text_color->color());
85     button->setZValue(4);
86     button->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
87     QRectF r = button->sceneBoundingRect();
88     m_scene->addItem(button);
89     button->setPos((m_width - r.width()) / 2, (m_height - r.height()) / 2);
90     button->setSelected(true);
91
92
93     //m_view.menu_preview->resizefitInView(0, 0, m_width, m_height);
94
95     connect(m_view.play_text, SIGNAL(textChanged(const QString &)), this, SLOT(buildButton()));
96     connect(m_view.text_color, SIGNAL(changed(const QColor &)), this, SLOT(updateColor()));
97     connect(m_view.font_size, SIGNAL(valueChanged(int)), this, SLOT(buildButton()));
98     connect(m_view.font_family, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(buildButton()));
99     connect(m_view.background_image, SIGNAL(textChanged(const QString &)), this, SLOT(buildImage()));
100     connect(m_view.background_color, SIGNAL(changed(const QColor &)), this, SLOT(buildColor()));
101
102     connect(m_view.background_list, SIGNAL(activated(int)), this, SLOT(checkBackgroundType(int)));
103
104     connect(m_view.target_list, SIGNAL(activated(int)), this, SLOT(setButtonTarget(int)));
105     connect(m_view.back_to_menu, SIGNAL(toggled(bool)), this, SLOT(setBackToMenu(bool)));
106
107     connect(m_view.add_button, SIGNAL(pressed()), this, SLOT(addButton()));
108     connect(m_view.delete_button, SIGNAL(pressed()), this, SLOT(deleteButton()));
109     connect(m_view.zoom_button, SIGNAL(pressed()), this, SLOT(slotZoom()));
110     connect(m_view.unzoom_button, SIGNAL(pressed()), this, SLOT(slotUnZoom()));
111     connect(m_scene, SIGNAL(selectionChanged()), this, SLOT(buttonChanged()));
112     connect(m_scene, SIGNAL(changed(const QList<QRectF> &)), this, SIGNAL(completeChanged()));
113
114     m_view.menu_box->setEnabled(false);
115
116 }
117
118 DvdWizardMenu::~DvdWizardMenu()
119 {
120     delete m_color;
121     delete m_safeRect;
122     delete m_background;
123     delete m_scene;
124 }
125
126 // virtual
127
128 bool DvdWizardMenu::isComplete() const
129 {
130     if (!m_view.create_menu->isChecked()) return true;
131     QList <int> targets;
132     QList<QGraphicsItem *> list = m_scene->items();
133     int buttonCount = 0;
134     // check that the menu buttons don't collide
135     for (int i = 0; i < list.count(); i++) {
136         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
137             buttonCount++;
138             DvdButton *button = static_cast < DvdButton* >(list.at(i));
139             QList<QGraphicsItem *> collisions = button->collidingItems();
140             if (!collisions.isEmpty()) {
141                 for (int j = 0; j < collisions.count(); j++) {
142                     if (collisions.at(j)->type() == button->type()) return false;
143                 }
144             }
145             targets.append(button->target());
146         }
147     }
148     if (buttonCount == 0) {
149         // We need at least one button
150         return false;
151     }
152
153     if (!m_view.background_image->isHidden()) {
154         // Make sure user selected a valid image / video file
155         if (!QFile::exists(m_view.background_image->url().path())) return false;
156     }
157
158     // check that we have a "Play all" entry
159     if (targets.contains(0)) return true;
160     // ... or that each video file has a button
161     for (int i = m_view.target_list->count() - 1; i > 0; i--) {
162         // If there is a vob file entry and it has no button assigned, don't allow to go further
163         if (m_view.target_list->itemIcon(i).isNull() == false && !targets.contains(i)) return false;
164     }
165     return true;
166 }
167
168 void DvdWizardMenu::setButtonTarget(int ix)
169 {
170     QList<QGraphicsItem *> list = m_scene->selectedItems();
171     for (int i = 0; i < list.count(); i++) {
172         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
173             DvdButton *button = static_cast < DvdButton* >(list.at(i));
174             button->setTarget(ix, m_view.target_list->itemData(ix).toString());
175             break;
176         }
177     }
178     emit completeChanged();
179 }
180
181 void DvdWizardMenu::setBackToMenu(bool backToMenu)
182 {
183     QList<QGraphicsItem *> list = m_scene->selectedItems();
184     for (int i = 0; i < list.count(); i++) {
185         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
186             DvdButton *button = static_cast < DvdButton* >(list.at(i));
187             button->setBackMenu(backToMenu);
188             break;
189         }
190     }
191     emit completeChanged();
192 }
193
194 void DvdWizardMenu::buttonChanged()
195 {
196     QList<QGraphicsItem *> list = m_scene->selectedItems();
197     bool foundButton = false;
198     for (int i = 0; i < list.count(); i++) {
199         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
200             m_view.play_text->blockSignals(true);
201             m_view.font_size->blockSignals(true);
202             m_view.font_family->blockSignals(true);
203             m_view.target_list->blockSignals(true);
204             m_view.back_to_menu->blockSignals(true);
205             foundButton = true;
206             m_view.tabWidget->widget(0)->setEnabled(true);
207             DvdButton *button = static_cast < DvdButton* >(list.at(i));
208             m_view.target_list->setCurrentIndex(button->target());
209             m_view.play_text->setText(button->toPlainText());
210             m_view.back_to_menu->setChecked(button->backMenu());
211             QFont font = button->font();
212             m_view.font_size->setValue(font.pixelSize());
213             m_view.font_family->setCurrentFont(font);
214             m_view.play_text->blockSignals(false);
215             m_view.font_size->blockSignals(false);
216             m_view.font_family->blockSignals(false);
217             m_view.target_list->blockSignals(false);
218             m_view.back_to_menu->blockSignals(false);
219             break;
220         }
221     }
222     if (!foundButton) m_view.tabWidget->widget(0)->setEnabled(false);
223 }
224
225 void DvdWizardMenu::addButton()
226 {
227     m_scene->clearSelection();
228     DvdButton *button = new DvdButton(m_view.play_text->text());
229     QFont font = m_view.font_family->currentFont();
230     font.setPixelSize(m_view.font_size->value());
231     font.setStyleStrategy(QFont::NoAntialias);
232     button->setFont(font);
233     button->setDefaultTextColor(m_view.text_color->color());
234     button->setZValue(4);
235     button->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
236     QRectF r = button->sceneBoundingRect();
237     m_scene->addItem(button);
238     button->setPos((m_width - r.width()) / 2, (m_height - r.height()) / 2);
239     button->setSelected(true);
240 }
241
242 void DvdWizardMenu::deleteButton()
243 {
244     QList<QGraphicsItem *> list = m_scene->selectedItems();
245     for (int i = 0; i < list.count(); i++) {
246         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
247             delete list.at(i);
248             break;
249         }
250     }
251 }
252
253 void DvdWizardMenu::changeProfile(bool isPal)
254 {
255     m_isPal = isPal;
256     if (isPal == false) {
257         m_width = 720;
258         m_height = 480;
259         m_isPal = false;
260         updatePreview();
261     } else {
262         m_width = 720;
263         m_height = 576;
264         m_isPal = true;
265         updatePreview();
266     }
267 }
268
269 void DvdWizardMenu::updatePreview()
270 {
271     m_scene->setProfile(m_width, m_height);
272     QMatrix matrix;
273     matrix.scale(0.5, 0.5);
274     m_view.menu_preview->setMatrix(matrix);
275     m_view.menu_preview->setMinimumSize(m_width / 2 + 4, m_height / 2 + 8);
276
277     if (m_color) m_color->setRect(0, 0, m_width, m_height);
278
279     int safeW = m_width / 20;
280     int safeH = m_height / 20;
281     if (m_safeRect) m_safeRect->setRect(safeW, safeH, m_width - 2 * safeW, m_height - 2 * safeH);
282 }
283
284 void DvdWizardMenu::setTargets(QStringList list, QStringList targetlist)
285 {
286     m_view.target_list->clear();
287     m_view.target_list->addItem(i18n("Play All"), "title 1");
288     int movieCount = 0;
289     for (int i = 0; i < list.count(); i++) {
290         if (targetlist.at(i).contains("chapter"))
291             m_view.target_list->addItem(list.at(i), targetlist.at(i));
292         else {
293             m_view.target_list->addItem(KIcon("video-x-generic"), list.at(i), targetlist.at(i));
294             movieCount++;
295         }
296     }
297     m_view.back_to_menu->setHidden(movieCount == 1);
298 }
299
300 void DvdWizardMenu::checkBackgroundType(int ix)
301 {
302     if (ix == 0) {
303         m_view.background_color->setVisible(true);
304         m_view.background_image->setVisible(false);
305         if (m_background->scene() != 0) m_scene->removeItem(m_background);
306     } else {
307         m_view.background_color->setVisible(false);
308         m_view.background_image->setVisible(true);
309         if (ix == 1) {
310             m_view.background_image->setFilter("*");
311             m_scene->addItem(m_background);
312         } else {
313             if (m_background->scene() != 0) m_scene->removeItem(m_background);
314             m_view.background_image->setFilter("video/mpeg");
315         }
316     }
317 }
318
319 void DvdWizardMenu::buildColor()
320 {
321     m_color->setBrush(m_view.background_color->color());
322 }
323
324 void DvdWizardMenu::buildImage()
325 {
326     emit completeChanged();
327     if (m_view.background_image->url().isEmpty()) {
328         if (m_background->scene() != 0) m_scene->removeItem(m_background);
329         return;
330     }
331     QPixmap pix;
332     if (!pix.load(m_view.background_image->url().path())) {
333         if (m_background->scene() != 0) m_scene->removeItem(m_background);
334         return;
335     }
336     pix = pix.scaled(m_width, m_height);
337     m_background->setPixmap(pix);
338     if (m_view.background_list->currentIndex() == 1) m_scene->addItem(m_background);
339 }
340
341 void DvdWizardMenu::checkBackground()
342 {
343     if (m_view.background_list->currentIndex() != 1) {
344         if (m_background->scene() != 0) m_scene->removeItem(m_background);
345     } else {
346         m_scene->addItem(m_background);
347     }
348 }
349
350 void DvdWizardMenu::buildButton()
351 {
352     DvdButton *button = NULL;
353     QList<QGraphicsItem *> list = m_scene->selectedItems();
354     for (int i = 0; i < list.count(); i++) {
355         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
356             button = static_cast < DvdButton* >(list.at(i));
357             break;
358         }
359     }
360     if (button == NULL) return;
361     button->setPlainText(m_view.play_text->text());
362     QFont font = m_view.font_family->currentFont();
363     font.setPixelSize(m_view.font_size->value());
364     font.setStyleStrategy(QFont::NoAntialias);
365     button->setFont(font);
366     button->setDefaultTextColor(m_view.text_color->color());
367 }
368
369 void DvdWizardMenu::updateColor()
370 {
371     updateColor(m_view.text_color->color());
372     m_view.menu_preview->viewport()->update();
373 }
374
375 void DvdWizardMenu::updateColor(QColor c)
376 {
377     DvdButton *button = NULL;
378     QList<QGraphicsItem *> list = m_scene->items();
379     for (int i = 0; i < list.count(); i++) {
380         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
381             button = static_cast < DvdButton* >(list.at(i));
382             button->setDefaultTextColor(c);
383         }
384     }
385 }
386
387
388 void DvdWizardMenu::createButtonImages(const QString &img1, const QString &img2, const QString &img3)
389 {
390     if (m_view.create_menu->isChecked()) {
391         m_scene->clearSelection();
392         QImage img(m_width, m_height, QImage::Format_ARGB8555_Premultiplied);
393         QPainter p(&img);
394         p.setRenderHints(QPainter::Antialiasing, false);
395         p.setRenderHints(QPainter::TextAntialiasing, false);
396         if (m_safeRect->scene() != 0) m_scene->removeItem(m_safeRect);
397         if (m_color->scene() != 0) m_scene->removeItem(m_color);
398         if (m_background->scene() != 0) m_scene->removeItem(m_background);
399         m_scene->render(&p, QRectF(0, 0, m_width, m_height));
400         p.end();
401 #if QT_VERSION >= 0x040600
402         img.setColorCount(4);
403 #else
404         img.setNumColors(4);
405 #endif
406         img.save(img1);
407         /*QImage saved;
408         if (m_view.menu_profile->currentIndex() < 2)
409             saved = img.scaled(720, 576);
410         else saved = img.scaled(720, 480);
411         saved.setNumColors(4);
412         saved.save(img1);*/
413
414         updateColor(m_view.selected_color->color());
415         p.begin(&img);
416         p.setRenderHints(QPainter::Antialiasing, false);
417         p.setRenderHints(QPainter::TextAntialiasing, false);
418         m_scene->render(&p, QRectF(0, 0, m_width, m_height));
419         p.end();
420         /*        if (m_view.menu_profile->currentIndex() < 2)
421                     saved = img.scaled(720, 576);
422                 else saved = img.scaled(720, 480);
423                 saved.setNumColors(4);
424                 saved.save(img2);*/
425 #if QT_VERSION >= 0x040600
426         img.setColorCount(4);
427 #else
428         img.setNumColors(4);
429 #endif
430         img.save(img2);
431
432
433         updateColor(m_view.highlighted_color->color());
434         p.begin(&img);
435         p.setRenderHints(QPainter::Antialiasing, false);
436         p.setRenderHints(QPainter::TextAntialiasing, false);
437         m_scene->render(&p, QRectF(0, 0, m_width, m_height));
438         p.end();
439         /*if (m_view.menu_profile->currentIndex() < 2)
440             saved = img.scaled(720, 576);
441         else saved = img.scaled(720, 480);
442         saved.setNumColors(4);
443         saved.save(img3);*/
444 #if QT_VERSION >= 0x040600
445         img.setColorCount(4);
446 #else
447         img.setNumColors(4);
448 #endif
449         img.save(img3);
450
451         updateColor();
452
453         m_scene->addItem(m_safeRect);
454         m_scene->addItem(m_color);
455         if (m_view.background_list->currentIndex() == 1) m_scene->addItem(m_background);
456     }
457 }
458
459
460 void DvdWizardMenu::createBackgroundImage(const QString &img1)
461 {
462     QImage img;
463     if (m_view.background_list->currentIndex() == 0) {
464         // color background
465         if (m_isPal)
466             img = QImage(768, 576, QImage::Format_ARGB32);
467         else
468             img = QImage(720, 540, QImage::Format_ARGB32);
469         img.fill(m_view.background_color->color().rgb());
470     } else if (m_view.background_list->currentIndex() == 1) {
471         img.load(m_view.background_image->url().path());
472         if (m_isPal) {
473             if (img.width() != 768 || img.height() != 576)
474                 img = img.scaled(768, 576, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
475         } else {
476             if (img.width() != 720 || img.height() != 540)
477                 img = img.scaled(720, 540, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
478         }
479     } else return;
480     img.save(img1);
481 }
482
483 bool DvdWizardMenu::createMenu() const
484 {
485     return m_view.create_menu->isChecked();
486 }
487
488 bool DvdWizardMenu::menuMovie() const
489 {
490     return m_view.background_list->currentIndex() == 2;
491 }
492
493 QString DvdWizardMenu::menuMoviePath() const
494 {
495     return m_view.background_image->url().path();
496 }
497
498
499 QMap <QString, QRect> DvdWizardMenu::buttonsInfo()
500 {
501     QMap <QString, QRect> info;
502     QList<QGraphicsItem *> list = m_scene->items();
503     for (int i = 0; i < list.count(); i++) {
504         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
505             DvdButton *button = static_cast < DvdButton* >(list.at(i));
506             QRect r = list.at(i)->sceneBoundingRect().toRect();
507             // Make sure y1 is not odd (requested by spumux)
508             if (r.height() % 2 == 1) r.setHeight(r.height() + 1);
509             if (r.y() % 2 == 1) r.setY(r.y() - 1);
510             QString command = button->command();
511             if (button->backMenu()) command.prepend("g1 = 999;");
512             info.insertMulti(command, r);
513         }
514     }
515     return info;
516 }
517
518 bool DvdWizardMenu::isPalMenu() const
519 {
520     return m_isPal;
521 }
522
523 QDomElement DvdWizardMenu::toXml() const
524 {
525     QDomDocument doc;
526     QDomElement xml = doc.createElement("menu");
527     doc.appendChild(xml);
528     xml.setAttribute("enabled", m_view.create_menu->isChecked());
529     if (m_view.background_list->currentIndex() == 0) {
530         // Color bg
531         xml.setAttribute("background_color", m_view.background_color->color().name());
532     } else if (m_view.background_list->currentIndex() == 1) {
533         // Image bg
534         xml.setAttribute("background_image", m_view.background_image->url().path());
535     } else {
536         // Video bg
537         xml.setAttribute("background_video", m_view.background_image->url().path());
538     }
539     xml.setAttribute("text_color", m_view.text_color->color().name());
540     xml.setAttribute("selected_color", m_view.selected_color->color().name());
541     xml.setAttribute("highlighted_color", m_view.highlighted_color->color().name());
542
543     QList<QGraphicsItem *> list = m_scene->items();
544     int buttonCount = 0;
545
546     for (int i = 0; i < list.count(); i++) {
547         if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
548             buttonCount++;
549             DvdButton *button = static_cast < DvdButton* >(list.at(i));
550             QDomElement xmlbutton = doc.createElement("button");
551             xmlbutton.setAttribute("target", button->target());
552             xmlbutton.setAttribute("command", button->command());
553             xmlbutton.setAttribute("backtomenu", button->backMenu());
554             xmlbutton.setAttribute("posx", button->pos().x());
555             xmlbutton.setAttribute("posy", button->pos().y());
556             xmlbutton.setAttribute("text", button->toPlainText());
557             QFont font = button->font();
558             xmlbutton.setAttribute("font_size", font.pixelSize());
559             xmlbutton.setAttribute("font_family", font.family());
560             xml.appendChild(xmlbutton);
561         }
562     }
563     return doc.documentElement();
564 }
565
566
567 void DvdWizardMenu::loadXml(QDomElement xml)
568 {
569     kDebug() << "// LOADING MENU";
570     if (xml.isNull()) return;
571     kDebug() << "// LOADING MENU 1";
572     m_view.create_menu->setChecked(xml.attribute("enabled").toInt());
573     if (xml.hasAttribute("background_color")) {
574         m_view.background_list->setCurrentIndex(0);
575         m_view.background_color->setColor(xml.attribute("background_color"));
576     } else if (xml.hasAttribute("background_image")) {
577         m_view.background_list->setCurrentIndex(1);
578         m_view.background_image->setUrl(KUrl(xml.attribute("background_image")));
579     } else if (xml.hasAttribute("background_video")) {
580         m_view.background_list->setCurrentIndex(2);
581         m_view.background_image->setUrl(KUrl(xml.attribute("background_video")));
582     }
583
584     m_view.text_color->setColor(xml.attribute("text_color"));
585     m_view.selected_color->setColor(xml.attribute("selected_color"));
586     m_view.highlighted_color->setColor(xml.attribute("highlighted_color"));
587
588     QDomNodeList buttons = xml.elementsByTagName("button");
589     kDebug() << "// LOADING MENU 2" << buttons.count();
590
591     if (buttons.count() > 0) {
592         // Clear existing buttons
593         QList<QGraphicsItem *> list = m_scene->items();
594
595         for (int i = 0; i < list.count(); i++) {
596             if (list.at(i)->type() == QGraphicsItem::UserType + 1) {
597                 delete list.at(i);
598                 i--;
599             }
600         }
601     }
602
603     for (int i = 0; i < buttons.count(); i++) {
604         QDomElement e = buttons.at(i).toElement();
605         // create menu button
606         DvdButton *button = new DvdButton(e.attribute("text"));
607         QFont font(e.attribute("font_family"));
608         font.setPixelSize(e.attribute("font_size").toInt());
609         font.setStyleStrategy(QFont::NoAntialias);
610         button->setFont(font);
611         button->setTarget(e.attribute("target").toInt(), e.attribute("command"));
612         button->setBackMenu(e.attribute("backtomenu").toInt());
613         button->setDefaultTextColor(m_view.text_color->color());
614         button->setZValue(4);
615         button->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
616         QRectF r = button->sceneBoundingRect();
617         m_scene->addItem(button);
618         button->setPos(e.attribute("posx").toDouble(), e.attribute("posy").toDouble());
619
620     }
621 }
622
623 void DvdWizardMenu::slotZoom()
624 {
625     m_view.menu_preview->scale(2.0, 2.0);
626 }
627
628 void DvdWizardMenu::slotUnZoom()
629 {
630     m_view.menu_preview->scale(0.5, 0.5);
631 }
632