Effect groups can now be renamed

parent 4f16ab37
......@@ -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()
}
}
}
......@@ -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;
......
......@@ -27,6 +27,7 @@
#include <QDragEnterEvent>
#include <QDropEvent>
#include <KDebug>
#include <KGlobalSettings>
#include <KLocale>
......@@ -36,14 +37,31 @@
#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;
}
......@@ -31,9 +31,21 @@
#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 *);
};
......
......@@ -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"
......@@ -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);
......
......@@ -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"
......
......@@ -102,16 +102,6 @@
</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">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment