]> git.sesse.net Git - kdenlive/blobdiff - src/colorplaneexport.cpp
Update year in the about dialog
[kdenlive] / src / colorplaneexport.cpp
index d773486d7ee470787c658fc0f24f4af5dc5479df..5f55e52d390bcb4cd4ba7f22d359489c9f7edc09 100644 (file)
@@ -25,10 +25,11 @@ ColorPlaneExport::ColorPlaneExport(QWidget *parent) :
     tResX->setText("800");
     tResY->setText("800");
 
-    cbColorspace->addItem(i18n("YUV UV plane"), QVariant(CPE_YUV));
-    cbColorspace->addItem(i18n("YUV Y plane"), QVariant(CPE_YUV_Y));
-    cbColorspace->addItem(i18n("Modified YUV (Chroma)"), QVariant(CPE_YUV_MOD));
-    cbColorspace->addItem(i18n("RGB plane, one component varying"), QVariant(CPE_RGB_CURVE));
+    cbColorspace->addItem(i18n("YUV UV plane"), QVariant(ColorPlaneExport::CPE_YUV));
+    cbColorspace->addItem(i18n("YUV Y plane"), QVariant(ColorPlaneExport::CPE_YUV_Y));
+    cbColorspace->addItem(i18n("Modified YUV (Chroma)"), QVariant(ColorPlaneExport::CPE_YUV_MOD));
+    cbColorspace->addItem(i18n("YCbCr CbCr plane"), QVariant(ColorPlaneExport::CPE_YPbPr));
+    cbColorspace->addItem(i18n("RGB plane, one component varying"), QVariant(ColorPlaneExport::CPE_RGB_CURVE));
 
     sliderColor->setSliderPosition(128);
 
@@ -47,7 +48,7 @@ ColorPlaneExport::ColorPlaneExport(QWidget *parent) :
     connect(sliderScaling, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateDisplays()));
     connect(cbColorspace, SIGNAL(currentIndexChanged(int)), this, SLOT(slotColormodeChanged()));
 
-    kurlrequester->setText("/tmp/yuv-plane.png");
+    kurlrequester->setUrl(KUrl("/tmp/yuv-plane.png"));
 
     slotColormodeChanged();
     slotValidate();
@@ -95,11 +96,18 @@ void ColorPlaneExport::slotUpdateDisplays()
 {
     m_scaling = 1 - (float)sliderScaling->value()/100;
 
-    lblScaleNr->setText("0..." + QString::number(m_scaling, 'f', 2));
+    switch(cbColorspace->itemData(cbColorspace->currentIndex()).toInt()){
+    case CPE_RGB_CURVE:
+        lblScaleNr->setText(QChar(0xb1) + QString::number(sliderScaling->value(), 'f', 2));;
+        break;
+    default:
+        lblScaleNr->setText("0..." + QString::number(m_scaling, 'f', 2));
+        break;
+    }
 
     switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
     case CPE_YUV_Y:
-        lblColNr->setText(i18n("%1 °", QString::number(sliderColor->value())));
+        lblColNr->setText(i18n("%1°", QString::number(sliderColor->value())));
         break;
     default:
         lblColNr->setText(QString::number(sliderColor->value()));
@@ -141,7 +149,7 @@ void ColorPlaneExport::slotExportPlane()
     qDebug() << "Lower: " << lower;
     if (!lower.endsWith(".png") && !lower.endsWith(".jpg") && !lower.endsWith(".tif") && !lower.endsWith(".tiff")) {
         if (KMessageBox::questionYesNo(this, i18n("File has no extension. Add extension (%1)?", EXTENSION_PNG)) == KMessageBox::Yes) {
-            kurlrequester->setText(kurlrequester->text() + ".png");
+            kurlrequester->setUrl(KUrl(kurlrequester->text() + ".png"));
         }
     }
     QImage img;
@@ -157,7 +165,11 @@ void ColorPlaneExport::slotExportPlane()
         img = m_colorTools->yuvColorWheel(size, sliderColor->value(), m_scaling, true, false);
         break;
     case CPE_RGB_CURVE:
-        img = m_colorTools->rgbCurvePlane(size, (ColorTools::ColorsRGB) (cbVariant->itemData(cbVariant->currentIndex()).toInt()));
+        img = m_colorTools->rgbCurvePlane(size, (ColorTools::ColorsRGB) (cbVariant->itemData(cbVariant->currentIndex()).toInt()),
+                                          (double)sliderScaling->value()/255);
+        break;
+    case CPE_YPbPr:
+        img = m_colorTools->yPbPrColorWheel(size, sliderColor->value(), m_scaling, false);
         break;
     }
     img.save(kurlrequester->text());
@@ -169,6 +181,7 @@ void ColorPlaneExport::slotColormodeChanged()
     switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
     case CPE_YUV:
     case CPE_YUV_MOD:
+    case CPE_YPbPr:
         enableSliderScaling(true);
         enableSliderColor(true);
         enableCbVariant(false);
@@ -189,7 +202,16 @@ void ColorPlaneExport::slotColormodeChanged()
         lblSliderName->setToolTip(i18n("Angle through the UV plane, with all possible Y values."));
         break;
     case CPE_RGB_CURVE:
-        // deliberately fall through
+        enableSliderScaling(true);
+        enableSliderColor(false);
+        enableCbVariant(true);
+        sliderScaling->setRange(1,255);
+        sliderScaling->setValue(255);
+        cbVariant->addItem(i18n("Red"), QVariant(ColorTools::COL_R));
+        cbVariant->addItem(i18n("Green"), QVariant(ColorTools::COL_G));
+        cbVariant->addItem(i18n("Blue"), QVariant(ColorTools::COL_B));
+        cbVariant->addItem(i18n("Luma"), QVariant(ColorTools::COL_Luma));
+        break;
     default:
         enableSliderScaling(false);
         enableSliderColor(false);
@@ -197,6 +219,7 @@ void ColorPlaneExport::slotColormodeChanged()
         cbVariant->addItem(i18n("Red"), QVariant(ColorTools::COL_R));
         cbVariant->addItem(i18n("Green"), QVariant(ColorTools::COL_G));
         cbVariant->addItem(i18n("Blue"), QVariant(ColorTools::COL_B));
+        cbVariant->addItem(i18n("Luma"), QVariant(ColorTools::COL_Luma));
         break;
     }
     this->update();