From: Till Theato Date: Sat, 25 Dec 2010 00:24:45 +0000 (+0000) Subject: Use label at the bottom of the effect stack instead of tooltips for showing parameter... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2b77390fdc4a38d58407cc483430b07b7570f222;p=kdenlive Use label at the bottom of the effect stack instead of tooltips for showing parameter comments: http://kdenlive.org/mantis/view.php?id=1939 svn path=/trunk/kdenlive/; revision=5197 --- diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index efc28e0b..e258dbcb 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -32,10 +32,9 @@ 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_default(defaultValue), + m_comment(comment) { - setToolTip(comment); - QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -60,6 +59,15 @@ DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int reset->setToolTip(i18n("Reset to default value")); layout->addWidget(reset); + 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())); + } + connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); connect(m_spinBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); connect(reset, SIGNAL(clicked(bool)), this, SLOT(slotReset())); @@ -96,4 +104,9 @@ void DoubleParameterWidget::slotReset() setValue(m_default); } +void DoubleParameterWidget::slotShowComment() +{ + emit showComment(m_comment); +} + #include "doubleparameterwidget.moc" diff --git a/src/doubleparameterwidget.h b/src/doubleparameterwidget.h index 0a914a40..15fa4a0e 100644 --- a/src/doubleparameterwidget.h +++ b/src/doubleparameterwidget.h @@ -49,8 +49,10 @@ public: * @param suffix (optional) Suffix to display in spinbox * @param parent (optional) Parent Widget */ DoubleParameterWidget(const QString &name, int value, int min, int max, int defaultValue, const QString &comment, const QString suffix = QString(), QWidget* parent = 0); + /** @brief Updates the label to display @param name. */ void setName(const QString &name); + /** @brief Gets the parameter's value. */ int getValue(); @@ -61,14 +63,20 @@ public slots: /** @brief Sets value to m_default. */ void slotReset(); +private slots: + /** @brief Emits showComment with m_comment. */ + void slotShowComment(); + private: int m_default; QLabel *m_name; QSlider *m_slider; QSpinBox *m_spinBox; + QString m_comment; signals: void valueChanged(int); + void showComment(const QString&); }; #endif diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 3e3f2d07..56d54dd2 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -247,6 +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&))); } else if (type == "list") { Listval *lsval = new Listval; lsval->setupUi(toFillin); @@ -321,6 +322,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&))); } 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 d58a97d7..9a57416f 100644 --- a/src/effectstackedit.h +++ b/src/effectstackedit.h @@ -84,10 +84,12 @@ private: public slots: /** @brief Called when an effect is selected, builds the UI for this effect. */ void transferParamDesc(const QDomElement d, int pos, int in, int out, bool isEffect = true); + /** @brief Called whenever(?) some parameter is changed in the gui. * * Transfers all Dynamic gui parameter settings into m_params(??) */ void collectAllParameters(); + /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */ void slotSyncEffectsPos(int pos); @@ -97,6 +99,7 @@ signals: void displayMessage(const QString&, int); void checkMonitorPosition(int); void syncEffectsPos(int pos); + void showComment(const QString&); }; #endif diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index 212a698c..e5d02ab6 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -51,7 +51,7 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : vbox1->setContentsMargins(0, 0, 0, 0); vbox1->setSpacing(0); vbox1->addWidget(m_effectedit); - m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); + //m_ui.region_url->fileDialog()->setFilter(ProjectList::getExtensions()); //m_ui.effectlist->horizontalHeader()->setVisible(false); //m_ui.effectlist->verticalHeader()->setVisible(false); @@ -70,7 +70,6 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : m_ui.buttonReset->setToolTip(i18n("Reset effect")); m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects")); - m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right //connect(m_ui.region_url, SIGNAL(urlSelected(const KUrl &)), this , SLOT(slotRegionChanged())); @@ -87,12 +86,16 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : 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))); 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); } @@ -201,6 +204,8 @@ 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) @@ -215,13 +220,14 @@ 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) { bool disable = true; if (item->checkState() == Qt::Checked) disable = false; - m_ui.frame_layout->setEnabled(!disable); + m_ui.frame->setEnabled(!disable); m_ui.buttonReset->setEnabled(!disable); int activeRow = m_ui.effectlist->currentRow(); if (activeRow >= 0) { @@ -320,7 +326,8 @@ void EffectStackView::slotItemSelectionChanged(bool update) m_ui.buttonReset->setEnabled(hasItem && isChecked); m_ui.buttonUp->setEnabled(activeRow > 0); m_ui.buttonDown->setEnabled((activeRow < m_ui.effectlist->count() - 1) && hasItem); - m_ui.frame_layout->setEnabled(isChecked); + m_ui.frame->setEnabled(isChecked); + slotUpdateComment(); } void EffectStackView::slotItemUp() @@ -343,8 +350,10 @@ void EffectStackView::slotItemDel() { int activeRow = m_ui.effectlist->currentRow(); if (activeRow >= 0) { - if (m_trackMode) emit removeEffect(NULL, m_trackindex, m_currentEffectList.at(activeRow).cloneNode().toElement()); - else emit removeEffect(m_clipref, -1, m_clipref->effectAt(activeRow)); + if (m_trackMode) + emit removeEffect(NULL, m_trackindex, m_currentEffectList.at(activeRow).cloneNode().toElement()); + else + emit removeEffect(m_clipref, -1, m_clipref->effectAt(activeRow)); slotUpdateCheckAllButton(); } } @@ -486,4 +495,14 @@ 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 1c7cb830..c78c02db 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -139,6 +139,9 @@ 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 */ diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index 39c512e0..b68d82a7 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -116,6 +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&))); m_slidersLayout->addWidget(doubleparam, columnId, 0); QRadioButton *radio = new QRadioButton(this); diff --git a/src/keyframeedit.h b/src/keyframeedit.h index b804da41..6a2a7946 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -132,6 +132,7 @@ private slots: signals: void parameterChanged(); void seekToPos(int); + void showComment(const QString&); }; #endif diff --git a/src/widgets/effectstack_ui.ui b/src/widgets/effectstack_ui.ui index 875614e1..f9909403 100644 --- a/src/widgets/effectstack_ui.ui +++ b/src/widgets/effectstack_ui.ui @@ -6,8 +6,8 @@ 0 0 - 448 - 248 + 451 + 251 @@ -159,17 +159,36 @@ - - + + - + 0 0 + + + + + 0 + 0 + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + +