X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Feffectstack%2Feffectstackview2.cpp;h=46b9afa5dfdb5fc519a2a6e8917f5ab8b78f6340;hb=4f16ab3780bd444f7c85bc70e0df18bffcc8cba4;hp=5c37aa3619f5c6ebe68c61f592ce5ffe118095c7;hpb=6b948d90cca8267476a239c5663176cabcf60539;p=kdenlive diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index 5c37aa36..46b9afa5 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -26,6 +26,8 @@ #include "monitoreditwidget.h" #include "monitorscene.h" #include "kdenlivesettings.h" +#include "collapsibleeffect.h" +#include "collapsiblegroup.h" #include #include @@ -64,21 +66,8 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) : setEnabled(false); - QPalette p = palette(); - KColorScheme scheme(p.currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme())); - QColor dark_bg = scheme.shade(KColorScheme::DarkShade); - QColor selected_bg = scheme.decoration(KColorScheme::FocusColor).color(); - QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color(); - QColor light_bg = scheme.shade(KColorScheme::LightShade); - QString stylesheet(QString("QProgressBar:horizontal {border: 1px solid %1;border-radius:0px;border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right: 0px;background:%4;padding: 0px;text-align:left center}\ - QProgressBar:horizontal#dragOnly {background: %1} QProgressBar:horizontal:hover#dragOnly {background: %3} QProgressBar:horizontal:hover {border: 1px solid %3;border-right: 0px;}\ - QProgressBar::chunk:horizontal {background: %1;} QProgressBar::chunk:horizontal:hover {background: %3;}\ - 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;}\ - QAbstractSpinBox#dragBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QAbstractSpinBox::down-button#dragBox {width:0px;padding:0px;}\ - QAbstractSpinBox::up-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %2;} QAbstractSpinBox:hover#dragBox {border: 1px solid %3;} ") - .arg(dark_bg.name()).arg(selected_bg.name()).arg(hover_bg.name()).arg(light_bg.name())); - setStyleSheet(stylesheet); + setStyleSheet(CollapsibleEffect::getStyleSheet(palette())); } EffectStackView2::~EffectStackView2() @@ -176,13 +165,14 @@ void EffectStackView2::setupListView(int ix) continue; } - CollapsibleEffect *group = NULL; + CollapsibleGroup *group = NULL; EffectInfo effectInfo; effectInfo.fromString(d.attribute("kdenlive_info")); if (effectInfo.groupIndex >= 0) { // effect is in a group - for (int i = 0; i < vbox1->count(); i++) { - CollapsibleEffect *eff = static_cast(vbox1->itemAt(i)->widget()); + + for (int j = 0; j < vbox1->count(); j++) { + CollapsibleGroup *eff = static_cast(vbox1->itemAt(j)->widget()); if (eff->isGroup() && eff->groupIndex() == effectInfo.groupIndex) { group = eff; break; @@ -190,10 +180,10 @@ void EffectStackView2::setupListView(int ix) } if (group == NULL) { - group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), effectInfo.groupIndex, &m_effectMetaInfo, false, true, m_ui.container->widget()); + 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); - connect(group, SIGNAL(moveEffect(int,int,CollapsibleEffect*)), this, SLOT(slotMoveEffect(int,int,CollapsibleEffect*))); - connect(group, SIGNAL(unGroup(CollapsibleEffect*)), this , SLOT(slotUnGroup(CollapsibleEffect*))); + connect(group, SIGNAL(moveEffect(int,int,int)), this, SLOT(slotMoveEffect(int,int,int))); + connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*))); vbox1->addWidget(group); } if (effectInfo.groupIndex >= m_groupIndex) m_groupIndex = effectInfo.groupIndex + 1; @@ -213,7 +203,7 @@ void EffectStackView2::setupListView(int ix) } else info = m_clipref->info(); - CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, i, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, false, view); + CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, view); m_effects.append(currentEffect); if (group) { group->addGroupEffect(currentEffect); @@ -236,7 +226,7 @@ void EffectStackView2::setupListView(int ix) connect(currentEffect, SIGNAL(checkMonitorPosition(int)), this, SLOT(slotCheckMonitorPosition(int))); connect(currentEffect, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int))); connect(currentEffect, SIGNAL(createGroup(int)), this , SLOT(slotCreateGroup(int))); - connect(currentEffect, SIGNAL(moveEffect(int,int,CollapsibleEffect*)), this , SLOT(slotMoveEffect(int,int,CollapsibleEffect*))); + connect(currentEffect, SIGNAL(moveEffect(int,int,int)), this , SLOT(slotMoveEffect(int,int,int))); connect(currentEffect, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement))); //ui.title->setPixmap(icon.pixmap(QSize(12, 12))); @@ -553,11 +543,11 @@ void EffectStackView2::slotResetEffect(int ix) info.cropStart = GenTime(0); info.startPos = GenTime(-1); info.track = 0; - m_effects.at(ix)->updateWidget(info, ix, dom, &m_effectMetaInfo); + m_effects.at(ix)->updateWidget(info, dom, &m_effectMetaInfo); emit updateEffect(NULL, m_trackindex, old, dom, ix); } else { m_clipref->initEffect(dom); - m_effects.at(ix)->updateWidget(m_clipref->info(), ix, dom, &m_effectMetaInfo); + m_effects.at(ix)->updateWidget(m_clipref->info(), dom, &m_effectMetaInfo); //m_ui.region_url->setUrl(KUrl(dom.attribute("region"))); emit updateEffect(m_clipref, -1, old, dom, ix); } @@ -606,15 +596,15 @@ void EffectStackView2::slotCreateGroup(int ix) } } - CollapsibleEffect *group = new CollapsibleEffect(QDomElement(), QDomElement(), ItemInfo(), m_groupIndex, &m_effectMetaInfo, false, true, m_ui.container->widget()); + CollapsibleGroup *group = new CollapsibleGroup(m_groupIndex, ix == 1, ix == m_currentEffectList.count() - 2, m_ui.container->widget()); m_groupIndex++; - connect(group, SIGNAL(moveEffect(int,int,CollapsibleEffect*)), this , SLOT(slotMoveEffect(int,int,CollapsibleEffect*))); - connect(group, SIGNAL(unGroup(CollapsibleEffect*)), this , SLOT(slotUnGroup(CollapsibleEffect*))); + connect(group, SIGNAL(moveEffect(int,int,int)), this , SLOT(slotMoveEffect(int,int,int))); + connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*))); l->insertWidget(groupPos, group); group->addGroupEffect(effectToMove); } -void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, CollapsibleEffect* target) +void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, int groupIndex) { CollapsibleEffect *effectToMove = getEffectByIndex(currentIndex); if (effectToMove == NULL) return; @@ -624,7 +614,7 @@ void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, Collapsibl EffectInfo effectinfo; effectinfo.fromString(oldeffect.attribute("kdenlive_info")); - effectinfo.groupIndex = target->groupIndex(); + effectinfo.groupIndex = groupIndex; neweffect.setAttribute("kdenlive_info", effectinfo.toString()); ItemInfo info; @@ -634,9 +624,9 @@ void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, Collapsibl info.cropStart = GenTime(0); info.startPos = GenTime(-1); info.track = 0; - emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->index()); + emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->effectIndex()); } else { - emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->index()); + emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->effectIndex()); } //if (currentIndex == newIndex) return; @@ -649,7 +639,7 @@ void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, Collapsibl } } -void EffectStackView2::slotUnGroup(CollapsibleEffect* group) +void EffectStackView2::slotUnGroup(CollapsibleGroup* group) { QVBoxLayout *l = static_cast(m_ui.container->widget()->layout()); int ix = l->indexOf(group);