#include "doubleparameterwidget.h"
-#include <QHBoxLayout>
+#include <QGridLayout>
#include <QLabel>
#include <QSlider>
#include <QSpinBox>
DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, const QString suffix, QWidget *parent) :
QWidget(parent),
- m_default(defaultValue),
- m_comment(comment)
+ m_default(defaultValue)
{
- QHBoxLayout *layout = new QHBoxLayout(this);
+ QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
m_name = new QLabel(name, this);
- layout->addWidget(m_name);
+ layout->addWidget(m_name, 0, 0);
m_slider = new QSlider(Qt::Horizontal, this);
m_slider->setRange(min, max);
//m_slider->setPageStep((max - min) / 10);
- layout->addWidget(m_slider);
+ layout->addWidget(m_slider, 0, 1);
m_spinBox = new QSpinBox(this);
m_spinBox->setRange(min, max);
m_spinBox->setKeyboardTracking(false);
if (!suffix.isEmpty())
m_spinBox->setSuffix(suffix);
- layout->addWidget(m_spinBox);
+ layout->addWidget(m_spinBox, 0, 2);
QToolButton *reset = new QToolButton(this);
reset->setAutoRaise(true);
reset->setIcon(KIcon("edit-undo"));
reset->setToolTip(i18n("Reset to default value"));
- layout->addWidget(reset);
+ layout->addWidget(reset, 0, 3);
- if (m_comment != QString()) {
- QToolButton *showComment = new QToolButton(this);
- showComment->setAutoRaise(true);
- showComment->setIcon(KIcon("help-about"));
- layout->addWidget(showComment);
-
- connect(showComment, SIGNAL(clicked(bool)), this, SLOT(slotShowComment()));
- }
+ m_commentLabel = new QLabel(comment, this);
+ m_commentLabel->setWordWrap(true);
+ m_commentLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ m_commentLabel->setFrameShape(QFrame::StyledPanel);
+ m_commentLabel->setFrameShadow(QFrame::Raised);
+ m_commentLabel->setBackgroundRole(QPalette::AlternateBase);
+ m_commentLabel->setHidden(true);
+ layout->addWidget(m_commentLabel, 1, 0, 1, -1);
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
connect(m_spinBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
void DoubleParameterWidget::slotShowComment()
{
- emit showComment(m_comment);
+ if (m_commentLabel->text() != QString())
+ m_commentLabel->setHidden(!m_commentLabel->isHidden());
}
#include "doubleparameterwidget.moc"
void slotReset();
private slots:
- /** @brief Emits showComment with m_comment. */
+ /** @brief Shows/Hides the comment label. */
void slotShowComment();
private:
QLabel *m_name;
QSlider *m_slider;
QSpinBox *m_spinBox;
- QString m_comment;
+ QLabel *m_commentLabel;
signals:
void valueChanged(int);
- void showComment(const QString&);
};
#endif
m_vbox->addWidget(doubleparam);
m_valueItems[paramName] = doubleparam;
connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
- connect(doubleparam, SIGNAL(showComment(const QString&)), this, SIGNAL(showComment(const QString&)));
+ connect(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment()));
} else if (type == "list") {
Listval *lsval = new Listval;
lsval->setupUi(toFillin);
}
} else if (type == "keyframe" || type == "simplekeyframe") {
// keyframe editor widget
- kDebug() << "min: " << m_in << ", MAX: " << m_out;
if (m_keyframeEditor == NULL) {
KeyframeEdit *geo = new KeyframeEdit(pa, m_in, m_in + m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt());
m_vbox->addWidget(geo);
m_keyframeEditor = geo;
connect(geo, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
connect(geo, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
- connect(geo, SIGNAL(showComment(const QString&)), this, SIGNAL(showComment(const QString&)));
+ connect(this, SIGNAL(showComments()), geo, SIGNAL(showComments()));
} else {
// we already have a keyframe editor, so just add another column for the new param
m_keyframeEditor->addParameter(pa);
void displayMessage(const QString&, int);
void checkMonitorPosition(int);
void syncEffectsPos(int pos);
- void showComment(const QString&);
+ void showComments();
};
#endif
m_ui.buttonReset->setIcon(KIcon("view-refresh"));
m_ui.buttonReset->setToolTip(i18n("Reset effect"));
m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects"));
+ m_ui.buttonShowComments->setIcon(KIcon("help-about"));
+ m_ui.buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right
connect(m_ui.buttonSave, SIGNAL(clicked()), this, SLOT(slotSaveEffect()));
connect(m_ui.buttonReset, SIGNAL(clicked()), this, SLOT(slotResetEffect()));
connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
+ connect(m_ui.buttonShowComments, SIGNAL(clicked()), this, SIGNAL(showComments()));
connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement, const QDomElement)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement)));
connect(m_effectedit, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
connect(m_effectedit, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
connect(m_effectedit, SIGNAL(checkMonitorPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
- connect(m_effectedit, SIGNAL(showComment(const QString&)), this, SLOT(slotUpdateComment(const QString&)));
connect(monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
+ connect(this, SIGNAL(showComments()), m_effectedit, SIGNAL(showComments()));
m_effectLists["audio"] = &MainWindow::audioEffects;
m_effectLists["video"] = &MainWindow::videoEffects;
m_effectLists["custom"] = &MainWindow::customEffects;
m_ui.splitter->setStretchFactor(1, 10);
m_ui.splitter->setStretchFactor(0, 1);
- m_ui.labelComment->setHidden(true);
-
setEnabled(false);
}
m_trackMode = false;
m_currentEffectList = m_clipref->effectList();
setupListView(ix);
-
- slotUpdateComment();
}
void EffectStackView::slotTrackItemSelected(int ix, const TrackInfo info)
m_ui.checkAll->setText(i18n("Effects for track %1").arg(info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
m_trackindex = ix;
setupListView(0);
- slotUpdateComment();
}
void EffectStackView::slotItemChanged(QListWidgetItem *item)
m_ui.buttonUp->setEnabled(activeRow > 0);
m_ui.buttonDown->setEnabled((activeRow < m_ui.effectlist->count() - 1) && hasItem);
m_ui.frame->setEnabled(isChecked);
- slotUpdateComment();
+
+ if (m_ui.buttonShowComments->isChecked())
+ emit showComments();
}
void EffectStackView::slotItemUp()
emit updateEffect(m_clipref, -1, old, dom, activeRow);
}
}
+
+ if (m_ui.buttonShowComments->isChecked())
+ emit showComments();
}
return m_trackindex;
}
-void EffectStackView::slotUpdateComment(const QString& comment)
-{
- if (comment == m_ui.labelComment->text())
- m_ui.labelComment->setText(QString());
- else
- m_ui.labelComment->setText(comment);
-
- m_ui.labelComment->setHidden(m_ui.labelComment->text() == QString());
-}
-
#include "effectstackview.moc"
/** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
void slotRenderPos(int pos);
- /** @brief Sets the parameter explaining comment to @param comment. */
- void slotUpdateComment(const QString &comment = QString());
-
signals:
void removeEffect(ClipItem*, int, QDomElement);
/** Parameters for an effect changed, update the filter in playlist */
/** The region effect for current effect was changed */
void updateClipRegion(ClipItem*, int, QString);
void displayMessage(const QString&, int);
+ void showComments();
};
#endif
m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(),
m_params.at(columnId).attribute("default").toInt(), comment, m_params.at(columnId).attribute("suffix"), this);
connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
- connect(doubleparam, SIGNAL(showComment(const QString&)), this, SIGNAL(showComment(const QString&)));
+ connect(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment()));
m_slidersLayout->addWidget(doubleparam, columnId, 0);
QRadioButton *radio = new QRadioButton(this);
signals:
void parameterChanged();
void seekToPos(int);
- void showComment(const QString&);
+ void showComments();
};
#endif
<rect>
<x>0</x>
<y>0</y>
- <width>451</width>
- <height>251</height>
+ <width>458</width>
+ <height>255</height>
</rect>
</property>
<property name="sizePolicy">
</widget>
<widget class="QWidget" name="layoutWidget_2">
<layout class="QGridLayout" name="layoutEdit">
- <item row="0" column="0" colspan="3">
+ <item row="1" column="0" colspan="2">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <zorder>toolButton</zorder>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QLabel" name="labelComment">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <widget class="QToolButton" name="buttonShowComments">
<property name="text">
<string/>
</property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <property name="checkable">
+ <bool>true</bool>
</property>
- <property name="wordWrap">
+ <property name="autoRaise">
<bool>true</bool>
</property>
</widget>