#include <KStandardDirs>
#include <KFileDialog>
#include <KColorScheme>
+#include <KColorUtils>
#include <QMenu>
#include <QTextStream>
setEnabled(false);
- setStyleSheet(CollapsibleEffect::getStyleSheet());
+ setStyleSheet(getStyleSheet());
}
EffectStackView2::~EffectStackView2()
void EffectStackView2::updatePalette()
{
- setStyleSheet(CollapsibleEffect::getStyleSheet());
+ setStyleSheet(getStyleSheet());
}
void EffectStackView2::slotRenderPos(int pos)
{
if (m_effects.isEmpty()) return;
+ 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++)
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++) {
QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
}
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)));
// Wait a little bit for the new layout to be ready, then check if we have a scrollbar
QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter()));
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(QList<int>,int,int,QString)), this , SLOT(slotMoveEffect(QList<int>,int,int,QString)));
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();
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);
+ CollapsibleEffect *current = currentEffect();
+ if (current && current->needsMonitorEffectScene()) {
+ 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);
}
}
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);
+ 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());
}
}
}
+CollapsibleEffect *EffectStackView2::currentEffect() const
+{
+ for (int i = 0; i < m_effects.count(); i++) {
+ if (m_effects.at(i)->isActive()) return m_effects.at(i);
+ }
+ return NULL;
+}
+
void EffectStackView2::slotDeleteGroup(QDomDocument doc)
{
QDomNodeList effects = doc.elementsByTagName("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, QList <int>() <<index, endPos);
- else emit changeEffectPosition(m_clipref, -1, QList <int>() <<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)
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)));
+ connect(group, SIGNAL(changeEffectPosition(QList <int>,bool)), this , SLOT(slotMoveEffectUp(QList <int>,bool)));
}
void EffectStackView2::slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName)
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"