]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackview.cpp
Allow to select between timecode (hh:mm:ss:ff) and frame count overlay when rendering
[kdenlive] / src / effectstackview.cpp
index cd9a6b4de1012f2964967907c4e2b11d2460854f..02f26b87ae90b5df82517e89783005cea80f113e 100644 (file)
@@ -23,6 +23,7 @@
 #include "docclipbase.h"
 #include "projectlist.h"
 #include "kthumb.h"
+#include "monitoreditwidget.h"
 #include "monitorscene.h"
 #include "kdenlivesettings.h"
 
@@ -48,9 +49,11 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
     m_ui.setupUi(this);
     QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
     m_effectedit = new EffectStackEdit(monitor, m_ui.frame);
-    vbox1->setContentsMargins(0, 0, 0, 0);
+    vbox1->setContentsMargins(2, 0, 2, 0);
     vbox1->setSpacing(0);
     vbox1->addWidget(m_effectedit);
+    m_ui.splitter->setStretchFactor(0, 0);
+    m_ui.splitter->setStretchFactor(1, 200);
 
     //m_ui.region_url->fileDialog()->setFilter(ProjectList::getExtensions());
     //m_ui.effectlist->horizontalHeader()->setVisible(false);
@@ -92,7 +95,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;
@@ -176,9 +179,9 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
         m_clipref = c;
         if (c) {
             QString cname = m_clipref->clipName();
-            if (cname.length() > 20) {
+            if (cname.length() > 30) {
                 m_ui.checkAll->setToolTip(i18n("Effects for %1").arg(cname));
-                cname.truncate(17);
+                cname.truncate(27);
                 m_ui.checkAll->setText(i18n("Effects for %1").arg(cname) + "...");
             } else {
                 m_ui.checkAll->setToolTip(QString());
@@ -229,7 +232,6 @@ void EffectStackView::slotItemChanged(QListWidgetItem *item)
 {
     bool disable = true;
     if (item->checkState() == Qt::Checked) disable = false;
-    m_ui.frame->setEnabled(!disable);
     m_ui.buttonReset->setEnabled(!disable);
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow >= 0) {
@@ -294,8 +296,7 @@ void EffectStackView::setupListView(int ix)
         m_ui.buttonShowComments->setEnabled(false);
         m_ui.labelComment->setHidden(true);
     } else {
-        qMin(ix, 0);
-        qMax(ix, m_ui.effectlist->count() - 1);
+        ix = qBound(0, ix, m_ui.effectlist->count() - 1);
         m_ui.effectlist->setCurrentRow(ix);
         m_ui.checkAll->setEnabled(true);
     }
@@ -313,8 +314,9 @@ void EffectStackView::slotItemSelectionChanged(bool update)
     int activeRow = m_ui.effectlist->currentRow();
     bool isChecked = false;
     if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
+    QDomElement eff;
     if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
-        QDomElement eff = m_currentEffectList.at(activeRow);
+        eff = m_currentEffectList.at(activeRow);
         if (m_trackMode) {
             // showing track effects
             m_effectedit->transferParamDesc(eff, 0, 0, m_trackInfo.duration);
@@ -334,9 +336,8 @@ void EffectStackView::slotItemSelectionChanged(bool update)
     m_ui.frame->setEnabled(isChecked);
     m_ui.buttonShowComments->setEnabled(hasItem);
 
-    if (m_ui.buttonShowComments->isChecked())
-        emit showComments();
-    m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || !m_ui.labelComment->text().count() || !hasItem);
+    emit showComments(m_ui.buttonShowComments->isChecked());
+    m_ui.labelComment->setVisible(hasItem && m_ui.labelComment->text().count() && (m_ui.buttonShowComments->isChecked() || !eff.elementsByTagName("parameter").count()));
 }
 
 void EffectStackView::slotItemUp()
@@ -396,8 +397,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());
 }
 
@@ -485,8 +485,8 @@ void EffectStackView::slotCheckAll(int state)
 
 void EffectStackView::slotCheckMonitorPosition(int renderPos)
 {
-    if (m_trackMode || (renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
-        if (!m_monitor->getEffectScene()->views().at(0)->isVisible())
+    if (m_trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
+        if (!m_monitor->getEffectEdit()->getScene()->views().at(0)->isVisible())
             m_monitor->slotEffectScene(true);
     } else {
         m_monitor->slotEffectScene(false);
@@ -513,7 +513,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"