From: Till Theato Date: Sat, 8 Jan 2011 22:52:58 +0000 (+0000) Subject: Allow adding comments to bool parameters X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4a657678757a8a9347a97b7d4019c1e025e1b3d3;p=kdenlive Allow adding comments to bool parameters svn path=/trunk/kdenlive/; revision=5309 --- diff --git a/src/doubleparameterwidget.cpp b/src/doubleparameterwidget.cpp index ed8e23f9..f9e8f5e1 100644 --- a/src/doubleparameterwidget.cpp +++ b/src/doubleparameterwidget.cpp @@ -105,16 +105,14 @@ void DoubleParameterWidget::slotReset() setValue(m_default); } -void DoubleParameterWidget::slotShowComment() +void DoubleParameterWidget::slotShowComment( bool show) { if (m_commentLabel->text() != QString()) { - if (m_commentLabel->isHidden()) { - m_commentLabel->setHidden(false); + m_commentLabel->setVisible(show); + if (show) layout()->setContentsMargins(0, 0, 0, 15); - } else { - m_commentLabel->setHidden(true); + else layout()->setContentsMargins(0, 0, 0, 0); - } } } diff --git a/src/doubleparameterwidget.h b/src/doubleparameterwidget.h index 9a7681fc..e677ad01 100644 --- a/src/doubleparameterwidget.h +++ b/src/doubleparameterwidget.h @@ -65,7 +65,7 @@ public slots: private slots: /** @brief Shows/Hides the comment label. */ - void slotShowComment(); + void slotShowComment(bool show); private: int m_default; diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 176052b4..37c17c75 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -242,7 +242,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(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment())); + connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool))); } else if (type == "list") { Listval *lsval = new Listval; lsval->setupUi(toFillin); @@ -275,8 +275,12 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in bval->setupUi(toFillin); bval->checkBox->setCheckState(value == "0" ? Qt::Unchecked : Qt::Checked); bval->name->setText(paramName); + bval->labelComment->setText(comment); + bval->labelComment->setHidden(true); m_valueItems[paramName] = bval; connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters())); + if (!comment.isEmpty()) + connect(this, SIGNAL(showComments(bool)), bval->labelComment, SLOT(setVisible(bool))); m_uiItems.append(bval); } else if (type == "complex") { ComplexParameter *pl = new ComplexParameter; @@ -331,7 +335,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(this, SIGNAL(showComments()), geo, SIGNAL(showComments())); + connect(this, SIGNAL(showComments(bool)), geo, SIGNAL(showComments(bool))); } 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 f1e9613b..012faf66 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 showComments(); + void showComments(bool show); void effectStateChanged(bool enabled); }; diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index cd9a6b4d..1c2fe12c 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -92,7 +92,7 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) : 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(monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int))); - connect(this, SIGNAL(showComments()), m_effectedit, SIGNAL(showComments())); + connect(this, SIGNAL(showComments(bool)), m_effectedit, SIGNAL(showComments(bool))); m_effectLists["audio"] = &MainWindow::audioEffects; m_effectLists["video"] = &MainWindow::videoEffects; m_effectLists["custom"] = &MainWindow::customEffects; @@ -334,8 +334,7 @@ void EffectStackView::slotItemSelectionChanged(bool update) m_ui.frame->setEnabled(isChecked); m_ui.buttonShowComments->setEnabled(hasItem); - if (m_ui.buttonShowComments->isChecked()) - emit showComments(); + emit showComments(m_ui.buttonShowComments->isChecked()); m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count() || !hasItem); } @@ -396,8 +395,7 @@ void EffectStackView::slotResetEffect() } } - if (m_ui.buttonShowComments->isChecked()) - emit showComments(); + emit showComments(m_ui.buttonShowComments->isChecked()); m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count()); } @@ -513,7 +511,7 @@ int EffectStackView::isTrackMode(bool *ok) const void EffectStackView::slotShowComments() { m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count()); - emit showComments(); + emit showComments(m_ui.buttonShowComments->isChecked()); } #include "effectstackview.moc" diff --git a/src/effectstackview.h b/src/effectstackview.h index 29ba056f..e87b8289 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -160,7 +160,7 @@ signals: /** The region effect for current effect was changed */ void updateClipRegion(ClipItem*, int, QString); void displayMessage(const QString&, int); - void showComments(); + void showComments(bool show); }; #endif diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index cc050c18..e3af8ab3 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -119,7 +119,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(this, SIGNAL(showComments()), doubleparam, SLOT(slotShowComment())); + connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool))); m_slidersLayout->addWidget(doubleparam, columnId, 0); QRadioButton *radio = new QRadioButton(this); diff --git a/src/keyframeedit.h b/src/keyframeedit.h index b6a0a681..4d1f1f5f 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -138,7 +138,7 @@ private slots: signals: void parameterChanged(); void seekToPos(int); - void showComments(); + void showComments(bool show); }; #endif diff --git a/src/widgets/boolval_ui.ui b/src/widgets/boolval_ui.ui index f2660805..6405d1ea 100644 --- a/src/widgets/boolval_ui.ui +++ b/src/widgets/boolval_ui.ui @@ -6,8 +6,8 @@ 0 0 - 326 - 30 + 329 + 43 @@ -31,6 +31,19 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + TextLabel + + +