complexparameter.cpp 5.08 KB
Newer Older
1
/***************************************************************************
Vincent Pinon's avatar
Vincent Pinon committed
2
                          complexparameter.cpp  -  description
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
                             -------------------
    begin                : Feb 15 2008
    copyright            : (C) 2008 by Marco Gittler
    email                : g.marco@freenet.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

Vincent Pinon's avatar
Vincent Pinon committed
18
#include "complexparameter.h"
19
#include "utils/KoIconUtils.h"
20

Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
21
#include <QDebug>
22
#include <klocalizedstring.h>
23

24

25 26
#include <QHeaderView>

27 28
ComplexParameter::ComplexParameter(QWidget *parent) :
        QWidget(parent)
29
{
30 31 32 33 34
    m_ui.setupUi(this);
    //m_ui.effectlist->horizontalHeader()->setVisible(false);
    //m_ui.effectlist->verticalHeader()->setVisible(false);


35
    m_ui.buttonLeftRight->setIcon(KoIconUtils::themedIcon("go-next"));//better icons needed
36
    m_ui.buttonLeftRight->setToolTip(i18n("Allow horizontal moves"));
37
    m_ui.buttonUpDown->setIcon(KoIconUtils::themedIcon("go-up"));
38
    m_ui.buttonUpDown->setToolTip(i18n("Allow vertical moves"));
39
    m_ui.buttonShowInTimeline->setIcon(KoIconUtils::themedIcon("draw-line"));
40
    m_ui.buttonShowInTimeline->setToolTip(i18n("Show keyframes in timeline"));
41
    m_ui.buttonHelp->setIcon(KoIconUtils::themedIcon("help-about"));
42
    m_ui.buttonHelp->setToolTip(i18n("Parameter info"));
43
    m_ui.buttonNewPoints->setIcon(KoIconUtils::themedIcon("document-new"));
44 45 46 47 48 49 50
    m_ui.buttonNewPoints->setToolTip(i18n("Add keyframe"));

    connect(m_ui.buttonLeftRight, SIGNAL(clicked()), this , SLOT(slotSetMoveX()));
    connect(m_ui.buttonUpDown, SIGNAL(clicked()), this , SLOT(slotSetMoveY()));
    connect(m_ui.buttonShowInTimeline, SIGNAL(clicked()), this , SLOT(slotShowInTimeline()));
    connect(m_ui.buttonNewPoints, SIGNAL(clicked()), this , SLOT(slotSetNew()));
    connect(m_ui.buttonHelp, SIGNAL(clicked()), this , SLOT(slotSetHelp()));
Laurent Montel's avatar
Laurent Montel committed
51
    connect(m_ui.parameterList, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotParameterChanged(QString)));
52 53
    connect(m_ui.kplotwidget, SIGNAL(parameterChanged(QDomElement)), this , SLOT(slotUpdateEffectParams(QDomElement)));
    connect(m_ui.kplotwidget, SIGNAL(parameterList(QStringList)), this , SLOT(slotUpdateParameterList(QStringList)));
54 55 56 57
    /*ÜeffectLists["audio"]=audioEffectList;
    effectLists["video"]=videoEffectList;
    effectLists["custom"]=customEffectList;*/
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
58
    m_ui.infoBox->hide();
59
    updateButtonStatus();
60 61
}

62 63
void ComplexParameter::slotSetMoveX()
{
64
    m_ui.kplotwidget->setMoveX(!m_ui.kplotwidget->isMoveX());
65
    updateButtonStatus();
66 67
}

68 69
void ComplexParameter::slotSetMoveY()
{
70
    m_ui.kplotwidget->setMoveY(!m_ui.kplotwidget->isMoveY());
71
    updateButtonStatus();
72 73
}

74 75
void ComplexParameter::slotSetNew()
{
76
    m_ui.kplotwidget->setNewPoints(!m_ui.kplotwidget->isNewPoints());
77
    updateButtonStatus();
78 79
}

80 81
void ComplexParameter::slotSetHelp()
{
82 83
    m_ui.infoBox->setVisible(!m_ui.infoBox->isVisible());
    m_ui.buttonHelp->setDown(m_ui.infoBox->isVisible());
84 85
}

86 87
void ComplexParameter::slotShowInTimeline()
{
88

89
    m_ui.kplotwidget->setMoveTimeLine(!m_ui.kplotwidget->isMoveTimeline());
90
    updateButtonStatus();
91 92
}

93 94
void ComplexParameter::updateButtonStatus()
{
95 96
    m_ui.buttonLeftRight->setDown(m_ui.kplotwidget->isMoveX());
    m_ui.buttonUpDown->setDown(m_ui.kplotwidget->isMoveY());
97

98 99
    m_ui.buttonShowInTimeline->setEnabled(m_ui.kplotwidget->isMoveX() || m_ui.kplotwidget->isMoveY());
    m_ui.buttonShowInTimeline->setDown(m_ui.kplotwidget->isMoveTimeline());
100

101 102
    m_ui.buttonNewPoints->setEnabled(m_ui.parameterList->currentText() != "all");
    m_ui.buttonNewPoints->setDown(m_ui.kplotwidget->isNewPoints());
103 104
}

105 106
void ComplexParameter::slotParameterChanged(const QString& text)
{
107 108
    //m_ui.buttonNewPoints->setEnabled(text!="all");
    m_ui.kplotwidget->replot(text);
109
    updateButtonStatus();
110 111
}

112
void ComplexParameter::setupParam(const QDomElement &d, const QString& paramName, int from, int to)
113
{
114 115
    m_param = d;
    m_ui.kplotwidget->setPointLists(d, paramName, from, to);
Marco Gittler's avatar
Marco Gittler committed
116
}
117

118 119
void ComplexParameter::itemSelectionChanged()
{
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
120
    ////qDebug() << "drop";
121
}
122

123
void ComplexParameter::slotUpdateEffectParams(const QDomElement &e)
124
{
125
    m_param = e;
126
    emit parameterChanged();
127 128
}

129
QDomElement ComplexParameter::getParamDesc() const
130
{
131
    return m_param;
132 133
}

134
void ComplexParameter::slotUpdateParameterList(const QStringList &l)
135
{
Jean-Baptiste Mardelle's avatar
Jean-Baptiste Mardelle committed
136
    //qDebug() << l ;
137 138 139
    m_ui.parameterList->clear();
    m_ui.parameterList->addItem("all");
    m_ui.parameterList->addItems(l);
140 141
}

142

Vincent Pinon's avatar
Vincent Pinon committed
143