From 480f1a1466bc87a050a04dcb8ee5176ee9ec7747 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Sun, 26 Dec 2010 12:15:53 +0000 Subject: [PATCH] Show all parameter comments at once: http://kdenlive.org/mantis/view.php?id=1939 svn path=/trunk/kdenlive/; revision=5203 --- src/doubleparameterwidget.cpp | 34 +++++++++++++++++----------------- src/doubleparameterwidget.h | 5 ++--- src/effectstackedit.cpp | 5 ++--- src/effectstackedit.h | 2 +- src/effectstackview.cpp | 27 ++++++++++----------------- src/effectstackview.h | 4 +--- src/keyframeedit.cpp | 2 +- src/keyframeedit.h | 2 +- src/widgets/effectstack_ui.ui | 34 +++++++++++++++++++++------------- 9 files changed, 56 insertions(+), 59 deletions(-) diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index e258dbcb..a5a396c4 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -20,7 +20,7 @@ #include "doubleparameterwidget.h" -#include +#include #include #include #include @@ -32,41 +32,40 @@ 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))); @@ -106,7 +105,8 @@ void DoubleParameterWidget::slotReset() void DoubleParameterWidget::slotShowComment() { - emit showComment(m_comment); + if (m_commentLabel->text() != QString()) + m_commentLabel->setHidden(!m_commentLabel->isHidden()); } #include "doubleparameterwidget.moc" diff --git a/src/doubleparameterwidget.h b/src/doubleparameterwidget.h index 15fa4a0e..9a7681fc 100644 --- a/src/doubleparameterwidget.h +++ b/src/doubleparameterwidget.h @@ -64,7 +64,7 @@ public slots: void slotReset(); private slots: - /** @brief Emits showComment with m_comment. */ + /** @brief Shows/Hides the comment label. */ void slotShowComment(); private: @@ -72,11 +72,10 @@ 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 diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 56d54dd2..3bcfa52d 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -247,7 +247,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in 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); @@ -314,7 +314,6 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in } } 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); @@ -322,7 +321,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in 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); diff --git a/src/effectstackedit.h b/src/effectstackedit.h index 9a57416f..e6ef5557 100644 --- a/src/effectstackedit.h +++ b/src/effectstackedit.h @@ -99,7 +99,7 @@ signals: void displayMessage(const QString&, int); void checkMonitorPosition(int); void syncEffectsPos(int pos); - void showComment(const QString&); + void showComments(); }; #endif diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index e5d02ab6..50c1a4d9 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -69,6 +69,8 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : 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 @@ -82,20 +84,19 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : 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); } @@ -204,8 +205,6 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix) m_trackMode = false; m_currentEffectList = m_clipref->effectList(); setupListView(ix); - - slotUpdateComment(); } void EffectStackView::slotTrackItemSelected(int ix, const TrackInfo info) @@ -220,7 +219,6 @@ 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) @@ -327,7 +325,9 @@ void EffectStackView::slotItemSelectionChanged(bool update) 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() @@ -386,6 +386,9 @@ void EffectStackView::slotResetEffect() emit updateEffect(m_clipref, -1, old, dom, activeRow); } } + + if (m_ui.buttonShowComments->isChecked()) + emit showComments(); } @@ -495,14 +498,4 @@ int EffectStackView::isTrackMode(bool *ok) const 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" diff --git a/src/effectstackview.h b/src/effectstackview.h index c78c02db..1336cbfd 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -139,9 +139,6 @@ private slots: /** @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 */ @@ -160,6 +157,7 @@ signals: /** The region effect for current effect was changed */ void updateClipRegion(ClipItem*, int, QString); void displayMessage(const QString&, int); + void showComments(); }; #endif diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index 8266ae51..0af0c71a 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -116,7 +116,7 @@ void KeyframeEdit::addParameter(QDomElement e, int activeKeyframe) 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); diff --git a/src/keyframeedit.h b/src/keyframeedit.h index 6a2a7946..54f4e995 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -132,7 +132,7 @@ private slots: signals: void parameterChanged(); void seekToPos(int); - void showComment(const QString&); + void showComments(); }; #endif diff --git a/src/widgets/effectstack_ui.ui b/src/widgets/effectstack_ui.ui index f9909403..4f0ba621 100644 --- a/src/widgets/effectstack_ui.ui +++ b/src/widgets/effectstack_ui.ui @@ -6,8 +6,8 @@ 0 0 - 451 - 251 + 458 + 255 @@ -160,7 +160,7 @@ - + @@ -168,23 +168,31 @@ 0 + toolButton - - - - - 0 - 0 - + + + + Qt::Horizontal + + + 40 + 20 + + + + + + - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true - + true -- 2.39.2