]> git.sesse.net Git - kdenlive/commitdiff
Effect groups can now be renamed
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 28 Mar 2012 21:35:40 +0000 (23:35 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 28 Mar 2012 21:35:40 +0000 (23:35 +0200)
src/effectstack/collapsibleeffect.cpp
src/effectstack/collapsibleeffect.h
src/effectstack/collapsiblegroup.cpp
src/effectstack/collapsiblegroup.h
src/effectstack/effectstackview2.cpp
src/effectstack/effectstackview2.h
src/mainwindow.cpp
src/widgets/collapsiblegroup_ui.ui

index 8431bfa50056c37db43b5bc1b7bf0971de932756..2f089a694728b8f16cb4983b542f2a0a231c622c 100644 (file)
@@ -217,7 +217,7 @@ const QString CollapsibleEffect::getStyleSheet(QPalette p)
     KColorScheme scheme2(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
     QColor normal_bg2 = scheme2.background(KColorScheme::NormalBackground).color();
 
-    QString stylesheet(QString("QLineEdit#title { background-color: transparent;} QFrame#decoframe {border-radius:5px;border:0px solid %1;background:%6;} QFrame#decoframegroup {border-radius:5px;border:1px solid %1;background:%6;} QFrame:hover#decoframe {background:%7;} QFrame#decoframe[active=\"true\"] {background:%5;} QFrame#decoframegroup[active=\"true\"] {background:%5;} QFrame#frame[active=\"true\"] {background:%3;}  QProgressBar::chunk:horizontal {background: %6;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal#dragOnly {background: %5;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal:hover {background: %3;}\
+    QString stylesheet(QString("MyEditableLabel { background-color: transparent;} QFrame#decoframe {border-radius:5px;border:0px solid %1;background:%6;} QFrame#decoframegroup {border-radius:5px;border:1px solid %1;background:%6;} QFrame:hover#decoframe {background:%7;} QFrame#decoframe[active=\"true\"] {background:%5;} QFrame#decoframegroup[active=\"true\"] {background:%5;} QFrame#frame[active=\"true\"] {background:%3;}  QProgressBar::chunk:horizontal {background: %6;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal#dragOnly {background: %5;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal:hover {background: %3;}\
     QProgressBar:horizontal {border: 1px solid %1;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right:0px;background:%5;padding: 0px;text-align:left center}\
                                 QProgressBar:horizontal:disabled {border: 1px solid %6} QProgressBar:horizontal#dragOnly {background: %5}\
                                 QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %2;border-right: 0px;background: %4;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %2;}\
@@ -436,6 +436,10 @@ void CollapsibleEffect::setGroupIndex(int ix)
     m_info.groupIndex = ix;
 }
 
+void CollapsibleEffect::setGroupName(const QString &groupName)
+{
+    m_info.groupName = groupName;
+}
 
 QString CollapsibleEffect::infoString() const
 {
@@ -1299,5 +1303,3 @@ void ParameterContainer::slotStartFilterJobAction()
         }
     }
 }
-
-
index d5e54043d864c21adcd2dde4572b1e8bb24298a8..29682d39964494314a1b3335a0eb92c82789ae1f 100644 (file)
@@ -135,6 +135,7 @@ public:
     bool isGroup() const;
     int effectIndex() const;
     void setGroupIndex(int ix);
+    void setGroupName(const QString &groupName);
     void removeGroup(int ix, QVBoxLayout *layout);
     QString infoString() const;
     bool isActive() const;
index 11fb7493ed9048a289339588f18bd3499baba973..5fc3a5de7dce61fdb5a0a6484a539dd7a7e11f2e 100644 (file)
@@ -27,6 +27,7 @@
 #include <QDragEnterEvent>
 #include <QDropEvent>
 
+
 #include <KDebug>
 #include <KGlobalSettings>
 #include <KLocale>
 #include <KUrlRequester>
 #include <KColorScheme>
 
+MyEditableLabel::MyEditableLabel(QWidget * parent):
+    QLineEdit(parent)
+{
+    setFrame(false);
+    setReadOnly(true);
+}
+
+void MyEditableLabel::mouseDoubleClickEvent ( QMouseEvent * e )
+{
+    setReadOnly(false);
+    selectAll();
+}
 
-CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QWidget * parent) :
+
+CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QString groupName, QWidget * parent) :
         AbstractCollapsibleWidget(parent),
         m_index(ix)
 {
     setupUi(this);
     setFont(KGlobalSettings::smallestReadableFont());
-   
+    QHBoxLayout *l = static_cast <QHBoxLayout *>(frame->layout());
+    m_title = new MyEditableLabel(this);
+    l->insertWidget(4, m_title);
+    m_title->setText(groupName.isEmpty() ? i18n("Effect Group") : groupName);
+    connect(m_title, SIGNAL(editingFinished()), this, SLOT(slotRenameGroup()));
     buttonUp->setIcon(KIcon("kdenlive-up"));
     buttonUp->setToolTip(i18n("Move effect up"));
     buttonDown->setIcon(KIcon("kdenlive-down"));
@@ -57,7 +75,6 @@ CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QWid
     m_menu->addAction(KIcon("view-refresh"), i18n("Reset effect"), this, SLOT(slotResetEffect()));
     m_menu->addAction(KIcon("document-save"), i18n("Save effect"), this, SLOT(slotSaveEffect()));
     
-    title->setText(i18n("Effect Group"));
     effecticon->setPixmap(KIcon("folder").pixmap(16,16));
     m_menu->addAction(KIcon("list-remove"), i18n("Ungroup"), this, SLOT(slotUnGroup()));
     setAcceptDrops(true);
@@ -104,7 +121,7 @@ void CollapsibleGroup::mouseDoubleClickEvent ( QMouseEvent * event )
 
 void CollapsibleGroup::slotEnable(bool enable)
 {
-    title->setEnabled(enable);
+    m_title->setEnabled(enable);
     enabledBox->blockSignals(true);
     enabledBox->setChecked(enable);
     enabledBox->blockSignals(false);
@@ -296,3 +313,21 @@ void CollapsibleGroup::dropEvent(QDropEvent *event)
     event->accept();
 }
 
+void CollapsibleGroup::slotRenameGroup()
+{
+    m_title->setReadOnly(true);
+    if (m_title->text().isEmpty()) m_title->setText(i18n("Effect Group"));
+    QList <CollapsibleEffect*> effects = findChildren<CollapsibleEffect*>();
+    for (int j = 0; j < effects.count(); j++) {
+       effects.at(j)->setGroupName(m_title->text());
+    }
+    emit groupRenamed(this);
+}
+
+QList <CollapsibleEffect*> CollapsibleGroup::effects()
+{
+    QList <CollapsibleEffect*> result = findChildren<CollapsibleEffect*>();
+    return result;
+}
+
+
index a0972add3bcd91e955153febc5156cea9dfc4aa1..ee3b8f3dda1e89a6ed6d8063a0420f995ec37472 100644 (file)
 
 #include <QDomElement>
 #include <QToolButton>
+#include <QLineEdit>
 
 class QFrame;
 
+class MyEditableLabel : public QLineEdit
+{
+    Q_OBJECT
+
+public:
+    MyEditableLabel(QWidget * parent = 0);
+    
+protected:
+    virtual void mouseDoubleClickEvent( QMouseEvent *e);
+};
+
 
 /**)
  * @class CollapsibleEffect
@@ -46,7 +58,7 @@ class CollapsibleGroup : public AbstractCollapsibleWidget, public Ui::Collapsibl
     Q_OBJECT
 
 public:
-    CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QWidget * parent = 0);
+    CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QString groupName = QString(), QWidget * parent = 0);
     ~CollapsibleGroup();
     void updateTimecodeFormat();
     void setActive(bool activate);
@@ -56,6 +68,7 @@ public:
     bool isActive() const;
     void addGroupEffect(CollapsibleEffect *effect);
     void removeGroup(int ix, QVBoxLayout *layout);
+    QList <CollapsibleEffect*> effects();
 
 public slots:
     void slotEnable(bool enable);
@@ -69,6 +82,7 @@ private slots:
     void slotSaveEffect();
     void slotResetEffect();
     void slotUnGroup();
+    void slotRenameGroup();
 
 private:
     //QList <CollapsibleEffect *> m_subParamWidgets;
@@ -76,6 +90,7 @@ private:
     EffectInfo m_info;
     int m_index;
     void updateGroupIndex(int groupIndex);
+    MyEditableLabel *m_title;
     
 protected:
     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
@@ -92,6 +107,7 @@ signals:
     void moveEffect(int current_pos, int new_pos, int groupIndex);
     void addEffect(QDomElement e);
     void unGroup(CollapsibleGroup *);
+    void groupRenamed(CollapsibleGroup *);
 };
 
 
index 46b9afa5dfdb5fc519a2a6e8917f5ab8b78f6340..eb9a3b8f31e0c7219ac9acf61d8c60fab7f7829b 100644 (file)
@@ -2,8 +2,8 @@
                           effecstackview.cpp2  -  description
                              -------------------
     begin                : Feb 15 2008
-    copyright            : (C) 2008 by Marco Gittler
-    email                : g.marco@freenet.de
+    copyright            : (C) 2008 by Marco Gittler (g.marco@freenet.de)
+    copyright            : (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org)
  ***************************************************************************/
 
 /***************************************************************************
@@ -180,10 +180,10 @@ void EffectStackView2::setupListView(int ix)
            }
            
            if (group == NULL) {
-               group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == m_currentEffectList.count() - 1, m_ui.container->widget());
-               if (!effectInfo.groupName.isEmpty()) group->title->setText(effectInfo.groupName);
+               group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == m_currentEffectList.count() - 1, effectInfo.groupName, m_ui.container->widget());
                connect(group, SIGNAL(moveEffect(int,int,int)), this, SLOT(slotMoveEffect(int,int,int)));
                connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
+               connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this, SLOT(slotRenameGroup(CollapsibleGroup*)));
                vbox1->addWidget(group);
            }
            if (effectInfo.groupIndex >= m_groupIndex) m_groupIndex = effectInfo.groupIndex + 1;
@@ -596,10 +596,11 @@ void EffectStackView2::slotCreateGroup(int ix)
        }
     }
     
-    CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, m_ui.container->widget());
+    CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, QString(), m_ui.container->widget());
     m_groupIndex++;
     connect(group, SIGNAL(moveEffect(int,int,int)), this , SLOT(slotMoveEffect(int,int,int)));
     connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
+    connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this , SLOT(slotRenameGroup(CollapsibleGroup*)));
     l->insertWidget(groupPos, group);
     group->addGroupEffect(effectToMove);
 }
@@ -647,4 +648,19 @@ void EffectStackView2::slotUnGroup(CollapsibleGroup* group)
     group->deleteLater();
 }
 
+void EffectStackView2::slotRenameGroup(CollapsibleGroup *group)
+{
+    QList <CollapsibleEffect*> effects = group->effects();
+    for (int i = 0; i < effects.count(); i++) {
+       QDomElement origin = effects.at(i)->effect();
+       QDomElement changed = origin.cloneNode().toElement();
+       changed.setAttribute("kdenlive_info", effects.at(i)->infoString());
+       if (m_effectMetaInfo.trackMode) { 
+           emit updateEffect(NULL, m_trackindex, origin, changed, effects.at(i)->effectIndex());
+       } else {
+           emit updateEffect(m_clipref, -1, origin, changed, effects.at(i)->effectIndex());
+       }
+    }
+}
+
 #include "effectstackview2.moc"
index 431af94b69e978ec4b84fce8fb642367df689fef..a23a4001b1a8719269b98373dbbcebdf64b8d807 100644 (file)
@@ -2,8 +2,8 @@
                           effecstackview2.h  -  description
                              -------------------
     begin                : Feb 15 2008
-    copyright            : (C) 2008 by Marco Gittler
-    email                : g.marco@freenet.de
+    copyright            : (C) 2008 by Marco Gittler (g.marco@freenet.de)
+    copyright            : (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org) 
  ***************************************************************************/
 
 /***************************************************************************
@@ -174,6 +174,9 @@ private slots:
     
     /** @brief Display additionnal effect info */
     void slotShowComments();
+    
+    /** @brief An effect group was renamed, update effects info */
+    void slotRenameGroup(CollapsibleGroup *group);
 
 signals:
     void removeEffect(ClipItem*, int, QDomElement);
index 6e48f3db0486d4bb8c5bd75b228a2fcdfda086e9..7d55391ef76e70c576bd213d23898b751c2ee1bd 100644 (file)
@@ -35,7 +35,6 @@
 #include "trackview.h"
 #include "customtrackview.h"
 #include "effectslistview.h"
-#include "effectstackview.h"
 #include "effectstack/effectstackview2.h"
 #include "transitionsettings.h"
 #include "renderwidget.h"
index c3b74cd72f898ab34e2fa1a21eb040ca1591f4c1..7ab74bf9899612cabd91ac9c1bd81448ddf5f920 100644 (file)
            </property>
           </widget>
          </item>
-         <item>
-          <widget class="QLineEdit" name="title">
-           <property name="frame">
-            <bool>false</bool>
-           </property>
-           <property name="readOnly">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
          <item>
           <spacer name="horizontalSpacer">
            <property name="orientation">