]> git.sesse.net Git - kdenlive/blobdiff - src/colorplaneexport.cpp
Const'ref
[kdenlive] / src / colorplaneexport.cpp
index 37c1ee4f267feeb0bfba3fc29704b505b4ffcfbe..b4daaa54ccbc13557a15a6fe204481f521e86a80 100644 (file)
@@ -35,6 +35,7 @@ ColorPlaneExport::ColorPlaneExport(QWidget *parent) :
     cbColorspace->addItem(i18n("YCbCr CbCr plane"), QVariant(ColorPlaneExport::CPE_YPbPr));
     cbColorspace->addItem(i18n("RGB plane, one component varying"), QVariant(ColorPlaneExport::CPE_RGB_CURVE));
     cbColorspace->addItem(i18n("HSV Hue Shift"), QVariant(ColorPlaneExport::CPE_HSV_HUESHIFT));
+    cbColorspace->addItem(i18n("HSV Saturation"), QVariant(ColorPlaneExport::CPE_HSV_SATURATION));
 
     sliderColor->setSliderPosition(128);
 
@@ -68,21 +69,21 @@ ColorPlaneExport::~ColorPlaneExport()
 
 ///// Helper functions /////
 
-void ColorPlaneExport::enableSliderScaling(const bool &enable)
+void ColorPlaneExport::enableSliderScaling(bool enable)
 {
     sliderScaling->setEnabled(enable);
     lblScaling->setEnabled(enable);
     lblScaleNr->setEnabled(enable);
 }
 
-void ColorPlaneExport::enableSliderColor(const bool &enable)
+void ColorPlaneExport::enableSliderColor(bool enable)
 {
     sliderColor->setEnabled(enable);
     lblSliderName->setEnabled(enable);
     lblColNr->setEnabled(enable);
 }
 
-void ColorPlaneExport::enableCbVariant(const bool &enable)
+void ColorPlaneExport::enableCbVariant(bool enable)
 {
    cbVariant->setEnabled(enable);
    lblVariant->setEnabled(enable);
@@ -122,7 +123,7 @@ void ColorPlaneExport::slotUpdateDisplays()
         break;
     }
 
-    lblSize->setText(i18n("%1 px", QVariant(tResX->text()).toInt()*QVariant(tResY->text()).toInt()));
+    lblSize->setText(i18n("%1 px", tResX->text().toInt()*tResY->text().toInt()));
 }
 
 void ColorPlaneExport::slotValidate()
@@ -167,6 +168,7 @@ void ColorPlaneExport::slotExportPlane()
         }
     }
     QImage img;
+    QColor col;
     QSize size(QVariant(tResX->text()).toInt(), QVariant(tResY->text()).toInt());
     switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
     case CPE_YUV:
@@ -188,6 +190,12 @@ void ColorPlaneExport::slotExportPlane()
     case CPE_HSV_HUESHIFT:
         img = m_colorTools->hsvHueShiftPlane(size, sliderColor->value(), sliderScaling->value(), -180, 180);
         break;
+    case CPE_HSV_SATURATION:
+        col.setHsv(0, 0, sliderColor->value());
+        img = m_colorTools->hsvCurvePlane(size, col, ColorTools::COM_H, ColorTools::COM_S);
+        break;
+    default:
+        Q_ASSERT(false);
     }
     img.save(kurlrequester->text());
 }
@@ -247,6 +255,13 @@ void ColorPlaneExport::slotColormodeChanged()
         lblSliderName->setText(i18n("HSV Saturation"));
         lblScaling->setText(i18n("HSV Value"));
         break;
+    case CPE_HSV_SATURATION:
+        enableSliderScaling(false);
+        enableSliderColor(true);
+        sliderColor->setRange(0, 255);
+        sliderColor->setValue(200);
+        lblSliderName->setText(i18n("HSV Value"));
+        break;
     default:
         enableSliderScaling(false);
         enableSliderColor(false);
@@ -260,3 +275,5 @@ void ColorPlaneExport::slotColormodeChanged()
     this->update();
     slotUpdateDisplays();
 }
+
+#include "colorplaneexport.moc"