1 /***************************************************************************
2 effecstackedit.h - description
5 copyright : (C) 2008 by Marco Gittler
6 email : g.marco@freenet.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
21 #include "transitionsettings.h"
22 #include "transition.h"
23 #include "effectslist.h"
24 #include "effectstackedit.h"
25 #include "mainwindow.h"
27 TransitionSettings::TransitionSettings(QWidget* parent): QWidget(parent) {
29 effectEdit = new EffectStackEdit(ui.frame, this);
31 ui.listWidget->addItems(MainWindow::transitions.effectNames());
32 kDebug() << MainWindow::transitions.effectNames().size();
33 ui.listWidget->setCurrentRow(0);
34 connect(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slotTransitionChanged()));
35 connect(this, SIGNAL(transferParamDesc(const QDomElement&, int , int)), effectEdit , SLOT(transferParamDesc(const QDomElement&, int , int)));
36 connect(effectEdit, SIGNAL(parameterChanged(const QDomElement&, const QDomElement&)), this , SLOT(slotUpdateEffectParams(const QDomElement&, const QDomElement&)));
37 ui.splitter->setStretchFactor(0, 1);
38 ui.splitter->setStretchFactor(1, 10);
42 void TransitionSettings::slotTransitionChanged(bool reinit) {
43 QDomElement e = m_usedTransition->toXML().cloneNode().toElement();
45 QDomElement newTransition = MainWindow::transitions.getEffectByName(ui.listWidget->currentItem()->text());
46 slotUpdateEffectParams(e, newTransition);
47 emit transferParamDesc(newTransition, 0, 0);
49 //slotUpdateEffectParams(e, e);
50 emit transferParamDesc(e, 0, 0);
54 void TransitionSettings::slotTransitionItemSelected(Transition* t) {
55 setEnabled(t != NULL);
56 if (t == m_usedTransition) {
60 if (m_usedTransition) {
61 QList<QListWidgetItem*> list = ui.listWidget->findItems(m_usedTransition->transitionName(), Qt::MatchExactly);
62 if (list.size() > 0) {
63 ui.listWidget->blockSignals(true);
64 ui.listWidget->setCurrentItem(list[0]);
65 slotTransitionChanged(false);
66 ui.listWidget->blockSignals(false);
72 void TransitionSettings::slotUpdateEffectParams(const QDomElement& oldparam, const QDomElement& param) {
73 if (m_usedTransition) {
74 m_usedTransition->setTransitionParameters(param);
75 m_usedTransition->update();
78 QTextStream str(&test);
79 oldparam.save(str, 2);
80 m_usedTransition->toXML().save(str, 2);*/
82 //oldparam must be also first given to Transition and then return the toXML()
83 emit transitionUpdated(m_usedTransition, oldparam);
86 void TransitionSettings::raiseWindow(QWidget* dock) {
87 if (dock && m_usedTransition)