]> git.sesse.net Git - kdenlive/commitdiff
Show all parameter comments at once:
authorTill Theato <root@ttill.de>
Sun, 26 Dec 2010 12:15:53 +0000 (12:15 +0000)
committerTill Theato <root@ttill.de>
Sun, 26 Dec 2010 12:15:53 +0000 (12:15 +0000)
http://kdenlive.org/mantis/view.php?id=1939

svn path=/trunk/kdenlive/; revision=5203

src/doubleparameterwidget.cpp
src/doubleparameterwidget.h
src/effectstackedit.cpp
src/effectstackedit.h
src/effectstackview.cpp
src/effectstackview.h
src/keyframeedit.cpp
src/keyframeedit.h
src/widgets/effectstack_ui.ui

index e258dbcbe0ed06b8bf7a8f38566602b9e199663a..a5a396c46a3ab61c3c54f30f39f04e0aabf52a9c 100644 (file)
@@ -20,7 +20,7 @@
 
 #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)));
@@ -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"
index 15fa4a0ec43086c4b9b45c261585845aa937c6b5..9a7681fccb6df70916addd0b7b36ab496b5bf54f 100644 (file)
@@ -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
index 56d54dd22ce53d94587006f7940bf834fb23bad4..3bcfa52da7b0f9d61d7c31d513223efdfbf9f18e 100644 (file)
@@ -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);
index 9a57416ffa15f30b448bf5f49fbc9fac3048507a..e6ef5557eb70f0c52b7af842faa67cda1b4a20f4 100644 (file)
@@ -99,7 +99,7 @@ signals:
     void displayMessage(const QString&, int);
     void checkMonitorPosition(int);
     void syncEffectsPos(int pos);
-    void showComment(const QString&);
+    void showComments();
 };
 
 #endif
index e5d02ab61bccbe231c4d5753b503412e795bf04e..50c1a4d909cdd9129ac4c6e416709d4aa90256cc 100644 (file)
@@ -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"
index c78c02db164dae850c7c59b3c19c08c49e3af868..1336cbfda5a510c73459d533abe1fae36ef5a117 100644 (file)
@@ -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
index 8266ae5161d21f5b32b271956df7fa94977de98e..0af0c71afe8b0b2e4dc4ca09dfb0789a9b4f7227 100644 (file)
@@ -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);
index 6a2a79461319385652fb53446e18269886c4479c..54f4e99587d8eb16ef4e390d989154f4b8db9e01 100644 (file)
@@ -132,7 +132,7 @@ private slots:
 signals:
     void parameterChanged();
     void seekToPos(int);
-    void showComment(const QString&);
+    void showComments();
 };
 
 #endif
index f990940348db659922f565c1fff3eb960e45e777..4f0ba6210c122e924637486925a7f15249580957 100644 (file)
@@ -6,8 +6,8 @@
    <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>