]> git.sesse.net Git - kdenlive/blobdiff - src/effectstack/effectstackview2.cpp
Optimize monitor scene & fix issues with new effect stack
[kdenlive] / src / effectstack / effectstackview2.cpp
index 22b9f91c1e10f8f4fb5ae361d1ed7ed2bbac84d9..0df60fbed829b4e4bab673929c5fe4875cb434cc 100644 (file)
@@ -35,6 +35,7 @@
 #include <KStandardDirs>
 #include <KFileDialog>
 #include <KColorScheme>
+#include <KColorUtils>
 
 #include <QMenu>
 #include <QTextStream>
@@ -49,7 +50,8 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
         m_trackindex(-1),
         m_draggedEffect(NULL),
         m_draggedGroup(NULL),
-        m_groupIndex(0)
+        m_groupIndex(0),
+        m_monitorSceneWanted(false)
 {
     m_effectMetaInfo.trackMode = false;
     m_effectMetaInfo.monitor = monitor;
@@ -69,7 +71,7 @@ EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
     setEnabled(false);
 
     
-    setStyleSheet(CollapsibleEffect::getStyleSheet());
+    setStyleSheet(getStyleSheet());
 }
 
 EffectStackView2::~EffectStackView2()
@@ -78,12 +80,13 @@ EffectStackView2::~EffectStackView2()
 
 void EffectStackView2::updatePalette()
 {
-    setStyleSheet(CollapsibleEffect::getStyleSheet());
+    setStyleSheet(getStyleSheet());
 }
 
 void EffectStackView2::slotRenderPos(int pos)
 {
     if (m_effects.isEmpty()) return;
+    if (m_monitorSceneWanted) slotCheckMonitorPosition(pos);
     if (!m_effectMetaInfo.trackMode && m_clipref) pos = pos - m_clipref->startPos().frames(KdenliveSettings::project_fps());
 
     for (int i = 0; i< m_effects.count(); i++)
@@ -115,8 +118,11 @@ void EffectStackView2::slotClipItemSelected(ClipItem* c)
     }
     if (m_clipref == NULL) {
         //TODO: clear list, reset paramdesc and info
-        //ItemInfo info;
-        //m_effectedit->transferParamDesc(QDomElement(), info);
+        // If monitor scene is displayed, hide it
+        if (m_monitorSceneWanted) {
+           m_effectMetaInfo.monitor->slotShowEffectScene(false);
+       }
+        m_monitorSceneWanted = false;
        clear();
         return;
     }
@@ -143,6 +149,8 @@ void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo info)
 void EffectStackView2::setupListView()
 {
     blockSignals(true);
+    bool previousMonitorScene = m_monitorSceneWanted;
+    m_monitorSceneWanted = false;
     m_draggedEffect = NULL;
     m_draggedGroup = NULL;
     disconnect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
@@ -159,10 +167,15 @@ void EffectStackView2::setupListView()
     QVBoxLayout *vbox1 = new QVBoxLayout(view);
     vbox1->setContentsMargins(0, 0, 0, 0);
     vbox1->setSpacing(0);
-    
-    if (m_currentEffectList.isEmpty()) m_ui.labelComment->setHidden(true);
 
-    for (int i = 0; i < m_currentEffectList.count(); i++) {
+    int effectsCount = m_currentEffectList.count();
+    
+    // Make sure we always have one effect selected
+    int selectedEffect = m_clipref->selectedEffectIndex();
+    if (selectedEffect < 1 && effectsCount > 0) m_clipref->setSelectedEffect(1);
+    else if (selectedEffect > effectsCount) m_clipref->setSelectedEffect(effectsCount);
+    
+    for (int i = 0; i < effectsCount; i++) {
         QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
         if (d.isNull()) {
             kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
@@ -183,12 +196,8 @@ void EffectStackView2::setupListView()
            }
            
            if (group == NULL) {
-               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,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*)));
-                connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
-               connect(group, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
+               group = new CollapsibleGroup(effectInfo.groupIndex, i == 0, i == effectsCount - 1, effectInfo, m_ui.container->widget());
+               connectGroup(group);
                vbox1->addWidget(group);
                group->installEventFilter( this );
            }
@@ -212,14 +221,17 @@ void EffectStackView2::setupListView()
            info = m_clipref->info();
        }
 
-        CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, &m_effectMetaInfo, i == m_currentEffectList.count() - 1, view);
+        CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, &m_effectMetaInfo, i == effectsCount - 1, view);
        if (m_effectMetaInfo.trackMode) {
            isSelected = currentEffect->effectIndex() == 1;
        }
        else {
            isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
        }
-       if (isSelected) currentEffect->setActive(true);
+       if (isSelected) {
+           currentEffect->setActive(true);
+           if (currentEffect->needsMonitorEffectScene()) m_monitorSceneWanted = true;
+       }
         m_effects.append(currentEffect);
         if (group) {
            group->addGroupEffect(currentEffect);
@@ -228,9 +240,25 @@ void EffectStackView2::setupListView()
        }
        connectEffect(currentEffect);
     }
+    
+    if (m_currentEffectList.isEmpty()) {
+       m_ui.labelComment->setHidden(true);
+    }
+    else {
+       // Adjust group effects (up / down buttons)
+       QList<CollapsibleGroup *> allGroups = m_ui.container->widget()->findChildren<CollapsibleGroup *>();
+       for (int i = 0; i < allGroups.count(); i++) {
+           allGroups.at(i)->adjustEffects();
+       }
+       connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
+    }
+    
     vbox1->addStretch(10);
     slotUpdateCheckAllButton();
-    connect(m_effectMetaInfo.monitor, SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
+    if (previousMonitorScene && !m_monitorSceneWanted) {
+       // monitor scene was displayed, not wanted anymore
+       m_effectMetaInfo.monitor->slotShowEffectScene(false);
+    }
     
     // Wait a little bit for the new layout to be ready, then check if we have a scrollbar
     QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter()));
@@ -245,15 +273,15 @@ void EffectStackView2::connectEffect(CollapsibleEffect *currentEffect)
     connect(currentEffect, SIGNAL(deleteEffect(const QDomElement)), this , SLOT(slotDeleteEffect(const QDomElement)));
     connect(currentEffect, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
     connect(currentEffect, SIGNAL(resetEffect(int)), this , SLOT(slotResetEffect(int)));
-    connect(currentEffect, SIGNAL(changeEffectPosition(int,bool)), this , SLOT(slotMoveEffectUp(int , bool)));
+    connect(currentEffect, SIGNAL(changeEffectPosition(QList <int>,bool)), this , SLOT(slotMoveEffectUp(QList <int>,bool)));
     connect(currentEffect, SIGNAL(effectStateChanged(bool,int,bool)), this, SLOT(slotUpdateEffectState(bool,int,bool)));
     connect(currentEffect, SIGNAL(activateEffect(int)), this, SLOT(slotSetCurrentEffect(int)));
-    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,int,QString)), this , SLOT(slotMoveEffect(int,int,int,QString)));
+    connect(currentEffect, SIGNAL(moveEffect(QList<int>,int,int,QString)), this , SLOT(slotMoveEffect(QList<int>,int,int,QString)));
     connect(currentEffect, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement)));
     connect(currentEffect, SIGNAL(createRegion(int,KUrl)), this, SLOT(slotCreateRegion(int,KUrl)));
+    connect(currentEffect, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
 }
 
 void EffectStackView2::slotCheckWheelEventFilter()
@@ -296,7 +324,7 @@ bool EffectStackView2::eventFilter( QObject * o, QEvent * e )
        m_draggedGroup = qobject_cast<CollapsibleGroup*>(o);
        if (m_draggedGroup) {
            QMouseEvent *me = static_cast<QMouseEvent *>(e);
-           if (me->button() == Qt::LeftButton && (m_draggedGroup->framegroup->underMouse() || m_draggedGroup->title()->underMouse()))
+           if (me->button() == Qt::LeftButton && (m_draggedGroup->frame->underMouse() || m_draggedGroup->title()->underMouse()))
                m_clickPoint = me->globalPos();
            else {
                m_clickPoint = QPoint();
@@ -367,13 +395,21 @@ void EffectStackView2::startDrag()
 }
 
 
-void EffectStackView2::slotUpdateEffectState(bool disable, int index, bool updateMainStatus)
+void EffectStackView2::slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene)
 {
+    if (m_monitorSceneWanted && disable) {
+       m_effectMetaInfo.monitor->slotShowEffectScene(false);
+       m_monitorSceneWanted = false;
+    }
+    else if (!disable && !m_monitorSceneWanted && needsMonitorEffectScene) {
+       m_effectMetaInfo.monitor->slotShowEffectScene(true);
+       m_monitorSceneWanted = true;
+    }
     if (m_effectMetaInfo.trackMode)
-        emit changeEffectState(NULL, m_trackindex, index, disable);
+        emit changeEffectState(NULL, m_trackindex, QList <int>() << index, disable);
     else
-        emit changeEffectState(m_clipref, -1, index, disable);
-    if (updateMainStatus) slotUpdateCheckAllButton();
+        emit changeEffectState(m_clipref, -1, QList <int>() <<index, disable);
+    slotUpdateCheckAllButton();
 }
 
 
@@ -401,11 +437,17 @@ void EffectStackView2::slotSeekTimeline(int pos)
 
 void EffectStackView2::slotCheckMonitorPosition(int renderPos)
 {
-    if (m_effectMetaInfo.trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
-        if (!m_effectMetaInfo.monitor->getEffectEdit()->getScene()->views().at(0)->isVisible())
-            m_effectMetaInfo.monitor->slotEffectScene(true);
-    } else {
-        m_effectMetaInfo.monitor->slotEffectScene(false);
+    if (m_monitorSceneWanted) {
+       if (m_effectMetaInfo.trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
+           if (!m_effectMetaInfo.monitor->effectSceneDisplayed()) {
+               m_effectMetaInfo.monitor->slotShowEffectScene(true);
+           }
+       } else {
+           m_effectMetaInfo.monitor->slotShowEffectScene(false);
+       }
+    }
+    else {
+       m_effectMetaInfo.monitor->slotShowEffectScene(false);
     }
 }
 
@@ -418,6 +460,7 @@ int EffectStackView2::isTrackMode(bool *ok) const
 void EffectStackView2::clear()
 {
     m_effects.clear();
+    m_monitorSceneWanted = false;
     QWidget *view = m_ui.container->takeWidget();
     if (view) {
        delete view;
@@ -439,11 +482,22 @@ void EffectStackView2::slotCheckAll(int state)
     }
 
     bool disabled = state == Qt::Unchecked;
+    // Disable all effects
+    QList <int> indexes;
     for (int i = 0; i < m_effects.count(); i++) {
-       if (!m_effects.at(i)->isGroup()) {
-           m_effects.at(i)->slotEnable(disabled, false);
-       }
+       m_effects.at(i)->slotEnable(disabled, false);
+       indexes << m_effects.at(i)->effectIndex();
+    }
+    // Take care of groups
+    QList<CollapsibleGroup *> allGroups = m_ui.container->widget()->findChildren<CollapsibleGroup *>();
+    for (int i = 0; i < allGroups.count(); i++) {
+       allGroups.at(i)->slotEnable(disabled, false);
     }
+    
+    if (m_effectMetaInfo.trackMode)
+        emit changeEffectState(NULL, m_trackindex, indexes, disabled);
+    else
+        emit changeEffectState(m_clipref, -1, indexes, disabled);
 }
 
 void EffectStackView2::slotUpdateCheckAllButton()
@@ -516,7 +570,10 @@ void EffectStackView2::slotSetCurrentEffect(int ix)
         m_clipref->setSelectedEffect(ix);
        for (int i = 0; i < m_effects.count(); i++) {
            if (m_effects.at(i)->effectIndex() == ix) {
+               if (m_effects.at(i)->isActive()) return;
                m_effects.at(i)->setActive(true);
+               m_monitorSceneWanted = m_effects.at(i)->needsMonitorEffectScene();
+               slotCheckMonitorPosition(m_effectMetaInfo.monitor->render->seekFramePosition());
                m_ui.labelComment->setText(i18n(m_effects.at(i)->effect().firstChildElement("description").firstChildElement("full").text().toUtf8().data()));
                m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
            }
@@ -555,19 +612,19 @@ void EffectStackView2::slotAddEffect(QDomElement effect)
     emit addEffect(m_clipref, effect);
 }
 
-void EffectStackView2::slotMoveEffectUp(int index, bool up)
+void EffectStackView2::slotMoveEffectUp(QList <int> indexes, bool up)
 {
-    if (up && index <= 1) return;
-    if (!up && index >= m_currentEffectList.count()) return;
+    if (up && indexes.first() <= 1) return;
+    if (!up && indexes.last() >= m_currentEffectList.count()) return;
     int endPos;
     if (up) {
-        endPos = index - 1;
+        endPos = indexes.first() - 1;
     }
     else {
-        endPos =  index + 1;
+        endPos =  indexes.last() + 1;
     }
-    if (m_effectMetaInfo.trackMode) emit changeEffectPosition(NULL, m_trackindex, index, endPos);
-    else emit changeEffectPosition(m_clipref, -1, index, endPos);
+    if (m_effectMetaInfo.trackMode) emit changeEffectPosition(NULL, m_trackindex, indexes, endPos);
+    else emit changeEffectPosition(m_clipref, -1, indexes, endPos);
 }
 
 void EffectStackView2::slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties)
@@ -719,50 +776,62 @@ void EffectStackView2::slotCreateGroup(int ix)
        }
     }
     
-    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)));
+    connectGroup(group);
+    l->insertWidget(groupPos, group);
+    group->installEventFilter( this );
+    group->addGroupEffect(effectToMove);
+}
+
+void EffectStackView2::connectGroup(CollapsibleGroup *group)
+{
+    connect(group, SIGNAL(moveEffect(QList<int>,int,int,QString)), this , SLOT(slotMoveEffect(QList<int>,int,int,QString)));
+    connect(group, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement)));
     connect(group, SIGNAL(unGroup(CollapsibleGroup*)), this , SLOT(slotUnGroup(CollapsibleGroup*)));
     connect(group, SIGNAL(groupRenamed(CollapsibleGroup *)), this , SLOT(slotRenameGroup(CollapsibleGroup*)));
     connect(group, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
     connect(group, SIGNAL(deleteGroup(QDomDocument)), this , SLOT(slotDeleteGroup(QDomDocument)));
-    l->insertWidget(groupPos, group);
-    group->installEventFilter( this );
-    group->addGroupEffect(effectToMove);
+    connect(group, SIGNAL(changeEffectPosition(QList <int>,bool)), this , SLOT(slotMoveEffectUp(QList <int>,bool)));
 }
 
-void EffectStackView2::slotMoveEffect(int currentIndex, int newIndex, int groupIndex, QString groupName)
+void EffectStackView2::slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName)
 {
-    CollapsibleEffect *effectToMove = getEffectByIndex(currentIndex);
-    if (effectToMove == NULL) return;
+    if (currentIndexes.count() == 1) {
+       CollapsibleEffect *effectToMove = getEffectByIndex(currentIndexes.at(0));
+       if (effectToMove == NULL) return;
 
-    QDomElement oldeffect = effectToMove->effect();
-    QDomElement neweffect = oldeffect.cloneNode().toElement();
+       QDomElement oldeffect = effectToMove->effect();
+       QDomElement neweffect = oldeffect.cloneNode().toElement();
     
-    EffectInfo effectinfo;
-    effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
-    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);
+       EffectInfo effectinfo;
+       effectinfo.fromString(oldeffect.attribute("kdenlive_info"));
+       effectinfo.groupIndex = groupIndex;
+       effectinfo.groupName = groupName;
+       neweffect.setAttribute("kdenlive_info", effectinfo.toString());
+    
+       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);
+       emit changeEffectPosition(NULL, m_trackindex, currentIndexes, newIndex);
     }
     else {
-       emit changeEffectPosition(m_clipref, -1, currentIndex, newIndex);
+       emit changeEffectPosition(m_clipref, -1, currentIndexes, newIndex);
     }
 }
 
@@ -796,13 +865,8 @@ void EffectStackView2::dragEnterEvent(QDragEnterEvent *event)
     }
 }
 
-void EffectStackView2::dropEvent(QDropEvent *event)
+void EffectStackView2::processDroppedEffect(QDomElement e, QDropEvent *event)
 {
-    const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
-    //event->acceptProposedAction();
-    QDomDocument doc;
-    doc.setContent(effects, true);
-    QDomElement e = doc.documentElement();
     int ix = e.attribute("kdenlive_ix").toInt();
     if (e.tagName() == "effectgroup") {
        // We are dropping a group, all effects in group should be moved
@@ -814,16 +878,21 @@ void EffectStackView2::dropEvent(QDropEvent *event)
        EffectInfo info;
        info.fromString(effects.at(0).toElement().attribute("kdenlive_info"));
        if (info.groupIndex < 0) {
+           kDebug()<<"// ADDING EFFECT!!!";
            // Adding a new group effect to the stack
            event->setDropAction(Qt::CopyAction);
            event->accept();
            slotAddEffect(e);
            return;
        }
+       // Moving group: delete all effects and re-add them
+       QList <int> indexes;
        for (int i = 0; i < effects.count(); 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);
+           QDomElement effect = effects.at(i).cloneNode().toElement();
+           indexes << effect.attribute("kdenlive_ix").toInt();
        }
+       kDebug()<<"// Moving: "<<indexes<<" TO "<<m_currentEffectList.count();
+       slotMoveEffect(indexes, m_currentEffectList.count(), info.groupIndex, info.groupName);
     }
     else if (ix == 0) {
        // effect dropped from effects list, add it
@@ -835,10 +904,61 @@ void EffectStackView2::dropEvent(QDropEvent *event)
     }
     else {
        // User is moving an effect
-       slotMoveEffect(ix, m_currentEffectList.count() + 1, -1);
+       slotMoveEffect(QList<int> () << ix, m_currentEffectList.count() + 1, -1);
     }
     event->setDropAction(Qt::MoveAction);
     event->accept();
 }
 
+void EffectStackView2::dropEvent(QDropEvent *event)
+{
+    const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
+    //event->acceptProposedAction();
+    QDomDocument doc;
+    doc.setContent(effects, true);
+    processDroppedEffect(doc.documentElement(), event);
+}
+
+//static
+const QString EffectStackView2::getStyleSheet()
+{
+    KColorScheme scheme(QApplication::palette().currentColorGroup(), KColorScheme::View, KSharedConfig::openConfig(KdenliveSettings::colortheme()));
+    QColor selected_bg = scheme.decoration(KColorScheme::FocusColor).color();
+    QColor hgh = KColorUtils::mix(QApplication::palette().window().color(), selected_bg, 0.2);
+    QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color();
+    QColor light_bg = scheme.shade(KColorScheme::LightShade);
+    QColor alt_bg = scheme.background(KColorScheme::NormalBackground).color();
+    
+    QString stylesheet;
+    
+    // effect background
+    stylesheet.append(QString("QFrame#decoframe {border-top-left-radius:5px;border-top-right-radius:5px;border-bottom:2px solid palette(mid);border-top:1px solid palette(light);} QFrame#decoframe[active=\"true\"] {background: %1;}").arg(hgh.name()));
+    
+    // effect in group background
+    stylesheet.append(QString("QFrame#decoframesub {border-top:1px solid palette(light);}  QFrame#decoframesub[active=\"true\"] {background: %1;}").arg(hgh.name()));
+    
+    // group background
+    stylesheet.append(QString("QFrame#decoframegroup {border-top-left-radius:5px;border-top-right-radius:5px;border:2px solid palette(dark);margin:0px;margin-top:2px;} "));
+    
+    // effect title bar
+    stylesheet.append(QString("QFrame#frame {margin-bottom:2px;border-top-left-radius:5px;border-top-right-radius:5px;}  QFrame#frame[target=\"true\"] {background: palette(highlight);}"));
+
+    // group effect title bar
+    stylesheet.append(QString("QFrame#framegroup {border-top-left-radius:2px;border-top-right-radius:2px;background: palette(dark);}  QFrame#framegroup[target=\"true\"] {background: palette(highlight);} "));
+    
+    // draggable effect bar content
+    stylesheet.append(QString("QProgressBar::chunk:horizontal {background: palette(button);border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal#dragOnly {background: %1;border-top-left-radius: 4px;border-bottom-left-radius: 4px;} QProgressBar::chunk:horizontal:hover {background: %2;}").arg(alt_bg.name()).arg(selected_bg.name()));
+    
+    // draggable effect bar
+    stylesheet.append(QString("QProgressBar:horizontal {border: 1px solid palette(dark);border-top-left-radius: 4px;border-bottom-left-radius: 4px;border-right:0px;background:%3;padding: 0px;text-align:left center} QProgressBar:horizontal:disabled {border: 1px solid palette(button)} QProgressBar:horizontal#dragOnly {background: %3} QProgressBar:horizontal[inTimeline=\"true\"] { border: 1px solid %1;border-right: 0px;background: %2;padding: 0px;text-align:left center } QProgressBar::chunk:horizontal[inTimeline=\"true\"] {background: %1;}").arg(hover_bg.name()).arg(light_bg.name()).arg(alt_bg.name()));
+    
+    // spin box for draggable widget
+    stylesheet.append(QString("QAbstractSpinBox#dragBox {border: 1px solid palette(dark);border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QAbstractSpinBox::down-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox:disabled#dragBox {border: 1px solid palette(button);} QAbstractSpinBox::up-button#dragBox {width:0px;padding:0px;} QAbstractSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %1;} QAbstractSpinBox:hover#dragBox {border: 1px solid %2;} ").arg(hover_bg.name()).arg(selected_bg.name()));
+    
+    // group editable labels
+    stylesheet.append(QString("MyEditableLabel { background-color: transparent; color: palette(bright-text); border-radius: 2px;border: 1px solid transparent;} MyEditableLabel:hover {border: 1px solid palette(highlight);} "));
+    
+    return stylesheet;
+}
+
 #include "effectstackview2.moc"