]> git.sesse.net Git - kdenlive/blobdiff - src/effectstackedit.cpp
Continue work on slider widget, rewrote layout for geometry param (used in composite...
[kdenlive] / src / effectstackedit.cpp
index 7acae5dd662dc3e9f020a6b35b34b199c4dd4727..fe62a739fc22442e33af06d48da7464c87a0382e 100644 (file)
@@ -42,6 +42,7 @@
 #include <KDebug>
 #include <KLocale>
 #include <KFileDialog>
+#include <KColorScheme>
 
 #include <QVBoxLayout>
 #include <QLabel>
@@ -84,13 +85,23 @@ EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
     setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
     setFrameStyle(QFrame::NoFrame);
     setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
-
+    
+    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);
+    QColor mid_bg = scheme.shade(KColorScheme::DarkShade);
+    
+    QString stylesheet(QString("QProgressBar:horizontal {border: 1px solid %5;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: %5} QProgressBar:horizontal:hover#dragOnly {background: %3} QProgressBar:horizontal:hover {border: 1px solid %3;border-right: 0px;} QProgressBar::chunk:horizontal {background: %5;} 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;} QSpinBox#dragBox {border: 1px solid %1;border-top-right-radius: 4px;border-bottom-right-radius: 4px;padding-right:0px;} QSpinBox::down-button#dragBox {width:0px;padding:0px;} QSpinBox::up-button#dragBox {width:0px;padding:0px;} QSpinBox[inTimeline=\"true\"]#dragBox { border: 1px solid %2;} QSpinBox:hover#dragBox {border: 1px solid %3;} ").arg(dark_bg.name()).arg(selected_bg.name()).arg(hover_bg.name()).arg(light_bg.name()).arg(mid_bg.name()));
+    setStyleSheet(stylesheet);
+    
     setWidget(m_baseWidget);
     setWidgetResizable(true);
     m_vbox = new QVBoxLayout(m_baseWidget);
     m_vbox->setContentsMargins(0, 0, 0, 0);
-    m_vbox->setSpacing(0);
-    //wid->show();
+    m_vbox->setSpacing(2);
 }
 
 EffectStackEdit::~EffectStackEdit()
@@ -109,10 +120,17 @@ void EffectStackEdit::setFrameSize(QPoint p)
         QString type = pa.attributes().namedItem("type").nodeValue();
         QString paramName = i18n(na.toElement().text().toUtf8().data());
 
-        if (type == "geometry" && !KdenliveSettings::on_monitor_effects()) {
-            Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
-            geom->setFrameSize(m_frameSize);
-            break;
+        if (type == "geometry") {
+            if (!KdenliveSettings::on_monitor_effects()) {
+                Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
+                geom->setFrameSize(m_frameSize);
+                break;
+            }
+            else {
+                GeometryWidget *geom = ((GeometryWidget*)m_valueItems[paramName+"geometry"]);
+                geom->setFrameSize(m_frameSize);
+                break;
+            }
         }
     }
 }
@@ -257,7 +275,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 max = pa.attribute("max").toInt();
 
             DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max,
-                    pa.attribute("default").toInt(), comment, pa.attribute("suffix"), this);
+                    pa.attribute("default").toInt(), comment, -1, pa.attribute("suffix"), this);
             m_vbox->addWidget(doubleparam);
             m_valueItems[paramName] = doubleparam;
             connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
@@ -314,6 +332,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
         } else if (type == "geometry") {
             if (KdenliveSettings::on_monitor_effects()) {
                 GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
+                geometry->setFrameSize(m_frameSize);
                 geometry->slotShowScene(!disable);
                 // connect this before setupParam to make sure the monitor scene shows up at startup
                 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
@@ -516,6 +535,16 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
 
     if (m_keyframeEditor)
         m_keyframeEditor->checkVisibleParam();
+    
+    // Make sure all doubleparam spinboxes have the same width, looks much better
+    QList<DoubleParameterWidget *> allWidgets = findChildren<DoubleParameterWidget *>();
+    int minSize = 0;
+    for (int i = 0; i < allWidgets.count(); i++) {
+        if (minSize < allWidgets.at(i)->spinSize()) minSize = allWidgets.at(i)->spinSize();
+    }
+    for (int i = 0; i < allWidgets.count(); i++) {
+        allWidgets.at(i)->setSpinSize(minSize);
+    }
 }
 
 wipeInfo EffectStackEdit::getWipeInfo(QString value)