class EffectInfo
{
public:
- EffectInfo() {isCollapsed = false; groupIndex = -1;}
+ EffectInfo() {isCollapsed = false; groupIndex = -1; groupIsCollapsed = false;}
bool isCollapsed;
+ bool groupIsCollapsed;
int groupIndex;
QString groupName;
QString toString() const {
QStringList data;
- data << QString::number(isCollapsed) << QString::number(groupIndex) << groupName;
+ // effect collapsed state: 0 = effect not collapsed, 1 = effect collapsed,
+ // 2 = group collapsed - effect not, 3 = group and effect collapsed
+ int collapsedState = (int) isCollapsed;
+ if (groupIsCollapsed) collapsedState += 2;
+ data << QString::number(collapsedState) << QString::number(groupIndex) << groupName;
return data.join("/");
}
void fromString(QString value) {
if (value.isEmpty()) return;
QStringList data = value.split("/");
- isCollapsed = data.at(0).toInt();
+ isCollapsed = data.at(0).toInt() == 1 || data.at(0).toInt() == 3;
+ groupIsCollapsed = data.at(0).toInt() == 3;
if (data.count() > 1) groupIndex = data.at(1).toInt();
if (data.count() > 2) groupName = data.at(2);
}
collapseButton->setArrowType(Qt::RightArrow);
m_info.isCollapsed = true;
}
- m_effect.setAttribute("kdenlive_info", m_info.toString());
- emit parameterChanged(m_original_effect, m_effect, effectIndex());
+ updateCollapsedState();
+}
+
+void CollapsibleEffect::groupStateChanged(bool collapsed)
+{
+ m_info.groupIsCollapsed = collapsed;
+ updateCollapsedState();
+}
+
+void CollapsibleEffect::updateCollapsedState()
+{
+ QString info = m_info.toString();
+ if (info != m_effect.attribute("kdenlive_info")) {
+ m_effect.setAttribute("kdenlive_info", info);
+ emit parameterChanged(m_original_effect, m_effect, effectIndex());
+ }
}
void CollapsibleEffect::setGroupIndex(int ix)
bool isActive() const;
/** @brief Should the wheel event be sent to parent widget for scrolling. */
bool filterWheelEvent;
-
/** @brief Return the stylesheet required for effect parameters. */
static const QString getStyleSheet();
+ /** @brief Parent group was collapsed, update. */
+ void groupStateChanged(bool collapsed);
public slots:
void slotSyncEffectsPos(int pos);
EffectInfo m_info;
/** @brief True if this is a region effect, which behaves in a special way, like a group. */
bool m_regionEffect;
+ /** @brief Check if collapsed state changed and inform MLT. */
+ void updateCollapsedState();
protected:
virtual void mouseDoubleClickEvent ( QMouseEvent * event );
}
-CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QString groupName, QWidget * parent) :
+CollapsibleGroup::CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, EffectInfo info, QWidget * parent) :
AbstractCollapsibleWidget(parent),
m_index(ix)
{
setupUi(this);
+
m_subWidgets = QList <CollapsibleEffect *> ();
setFont(KGlobalSettings::smallestReadableFont());
QHBoxLayout *l = static_cast <QHBoxLayout *>(framegroup->layout());
m_title = new MyEditableLabel(this);
l->insertWidget(3, m_title);
- m_title->setText(groupName.isEmpty() ? i18n("Effect Group") : groupName);
+ m_title->setText(info.groupName.isEmpty() ? i18n("Effect Group") : info.groupName);
connect(m_title, SIGNAL(editingFinished()), this, SLOT(slotRenameGroup()));
buttonUp->setIcon(KIcon("kdenlive-up"));
buttonUp->setToolTip(i18n("Move effect up"));
enabledButton->setChecked(false);
enabledButton->setIcon(KIcon("visible"));
+
+ if (info.groupIsCollapsed) {
+ slotShow(false);
+ }
connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
connect(enabledButton, SIGNAL(toggled(bool)), this, SLOT(slotEnable(bool)));
widgetFrame->setVisible(show);
if (show) {
collapseButton->setArrowType(Qt::DownArrow);
- m_info.isCollapsed = false;
+ m_info.groupIsCollapsed = false;
}
else {
collapseButton->setArrowType(Qt::RightArrow);
- m_info.isCollapsed = true;
+ m_info.groupIsCollapsed = true;
}
- //emit parameterChanged(m_original_effect, m_effect, effectIndex());
+ if (!m_subWidgets.isEmpty()) m_subWidgets.at(0)->groupStateChanged(m_info.groupIsCollapsed);
}
QWidget *CollapsibleGroup::title() const
Q_OBJECT
public:
- CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QString groupName = QString(), QWidget * parent = 0);
+ CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, EffectInfo info, QWidget * parent = 0);
~CollapsibleGroup();
void updateTimecodeFormat();
void setActive(bool activate);
}
if (group == NULL) {
- group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == m_currentEffectList.count() - 1, effectInfo.groupName, m_ui.container->widget());
+ group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == m_currentEffectList.count() - 1, effectInfo, m_ui.container->widget());
connect(group, SIGNAL(moveEffect(int,int,int,QString)), this, SLOT(slotMoveEffect(int,int,int,QString)));
connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this, SLOT(slotRenameGroup(CollapsibleGroup*)));
}
}
- CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, QString(), m_ui.container->widget());
+ CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, effectinfo, m_ui.container->widget());
m_groupIndex++;
connect(group, SIGNAL(moveEffect(int,int,int,QString)), this , SLOT(slotMoveEffect(int,int,int,QString)));
connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
effectinfo.groupIndex = groupIndex;
effectinfo.groupName = groupName;
neweffect.setAttribute("kdenlive_info", effectinfo.toString());
-
- ItemInfo info;
- if (m_effectMetaInfo.trackMode) {
- info.track = m_trackInfo.type;
- info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
- info.cropStart = GenTime(0);
- info.startPos = GenTime(-1);
- info.track = 0;
- emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->effectIndex(),false);
- } else {
- emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->effectIndex(),false);
+
+ if (oldeffect.attribute("kdenlive_info") != effectinfo.toString()) {
+ // effect's group info or collapsed state changed
+ ItemInfo info;
+ if (m_effectMetaInfo.trackMode) {
+ info.track = m_trackInfo.type;
+ info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps());
+ info.cropStart = GenTime(0);
+ info.startPos = GenTime(-1);
+ info.track = 0;
+ emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->effectIndex(),false);
+ } else {
+ emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->effectIndex(),false);
+ }
}
- //if (currentIndex == newIndex) return;
+
// Update effect index with new position
if (m_effectMetaInfo.trackMode) {
emit changeEffectPosition(NULL, m_trackindex, currentIndex, newIndex);
slotAddEffect(e);
return;
}
- for (int i = 0; i < effects.count(); i++) {
+ //
+ for (int i = effects.count() - 1; i >= 0; i--) {
//TODO: not working because wee need to move all effects in one go
- slotMoveEffect(effects.at(i).toElement().attribute("kdenlive_ix").toInt(), m_currentEffectList.count() + 1 + i, info.groupIndex, info.groupName);
+ slotMoveEffect(effects.at(i).toElement().attribute("kdenlive_ix").toInt(), m_currentEffectList.count(), info.groupIndex, info.groupName);
}
}
else if (ix == 0) {