From: Simon A. Eugster Date: Mon, 16 Aug 2010 09:49:12 +0000 (+0000) Subject: Histogram: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2104f909dd1bd678f12147b021ee5d2a4a4bddd3;p=kdenlive Histogram: * Remember configuration (which components were activated) * Removed debug output svn path=/trunk/kdenlive/; revision=4728 --- diff --git a/src/colorcorrection/histogramgenerator.cpp b/src/colorcorrection/histogramgenerator.cpp index 75f2d4a6..53d54c76 100644 --- a/src/colorcorrection/histogramgenerator.cpp +++ b/src/colorcorrection/histogramgenerator.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include #include "histogramgenerator.h" @@ -22,7 +21,7 @@ HistogramGenerator::HistogramGenerator() QImage HistogramGenerator::calculateHistogram(const QSize ¶deSize, const QImage &image, const int &components, const bool &unscaled, const uint &accelFactor) const { - qDebug() << "Histogram rect size is: " << paradeSize.width() << "/" << paradeSize.height(); +// qDebug() << "Histogram rect size is: " << paradeSize.width() << "/" << paradeSize.height(); if (paradeSize.height() <= 0 || paradeSize.width() <= 0 || image.width() <= 0 || image.height() <= 0) { return QImage(); } @@ -82,27 +81,27 @@ QImage HistogramGenerator::calculateHistogram(const QSize ¶deSize, const QIm histogram.fill(qRgba(0, 0, 0, 0)); if (drawY) { - qDebug() << "Drawing Y at " << wy << " with height " << partH; +// qDebug() << "Drawing Y at " << wy << " with height " << partH; drawComponentFull(&davinci, y, scaling, QRect(0, wy, ww, partH + dist), QColor(220, 220, 210, 255), dist, unscaled); wy += partH + d; } if (drawR) { - qDebug() << "Drawing R at " << wy << " with height " << partH; +// qDebug() << "Drawing R at " << wy << " with height " << partH; drawComponentFull(&davinci, r, scaling, QRect(0, wy, ww, partH + dist), QColor(255, 128, 0, 255), dist, unscaled); wy += partH + d; } if (drawG) { - qDebug() << "Drawing G at " << wy << " with height " << partH; +// qDebug() << "Drawing G at " << wy << " with height " << partH; drawComponentFull(&davinci, g, scaling, QRect(0, wy, ww, partH + dist), QColor(128, 255, 0, 255), dist, unscaled); wy += partH + d; } if (drawB) { - qDebug() << "Drawing B at " << wy << " with height " << partH; +// qDebug() << "Drawing B at " << wy << " with height " << partH; drawComponentFull(&davinci, b, scaling, QRect(0, wy, ww, partH + dist), QColor(0, 128, 255, 255), dist, unscaled); wy += partH + d; diff --git a/src/histogram.cpp b/src/histogram.cpp index b4903f8b..a02cc46d 100644 --- a/src/histogram.cpp +++ b/src/histogram.cpp @@ -19,7 +19,6 @@ Histogram::Histogram(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent { ui = new Ui::Histogram_UI(); ui->setupUi(this); - init(); ui->cbY->setChecked(true); ui->cbR->setChecked(true); @@ -40,14 +39,40 @@ Histogram::Histogram(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent b &= connect(m_aUnscaled, SIGNAL(toggled(bool)), this, SLOT(forceUpdateScope())); Q_ASSERT(b); + init(); } Histogram::~Histogram() { + writeConfig(); + delete ui; delete m_aUnscaled; } +void Histogram::readConfig() +{ + AbstractScopeWidget::readConfig(); + + KSharedConfigPtr config = KGlobal::config(); + KConfigGroup scopeConfig(config, configName()); + ui->cbY->setChecked(scopeConfig.readEntry("yEnabled", true)); + ui->cbR->setChecked(scopeConfig.readEntry("rEnabled", true)); + ui->cbG->setChecked(scopeConfig.readEntry("gEnabled", true)); + ui->cbB->setChecked(scopeConfig.readEntry("bEnabled", true)); +} + +void Histogram::writeConfig() +{ + KSharedConfigPtr config = KGlobal::config(); + KConfigGroup scopeConfig(config, configName()); + scopeConfig.writeEntry("yEnabled", ui->cbY->isChecked()); + scopeConfig.writeEntry("rEnabled", ui->cbR->isChecked()); + scopeConfig.writeEntry("gEnabled", ui->cbG->isChecked()); + scopeConfig.writeEntry("bEnabled", ui->cbB->isChecked()); + scopeConfig.sync(); +} + QString Histogram::widgetName() const { return QString("Histogram"); } bool Histogram::isHUDDependingOnInput() const { return false; } diff --git a/src/histogram.h b/src/histogram.h index 2b1f1eb9..554f9401 100644 --- a/src/histogram.h +++ b/src/histogram.h @@ -24,6 +24,9 @@ public: ~Histogram(); QString widgetName() const; +protected: + virtual void readConfig(); + void writeConfig(); private: HistogramGenerator *m_histogramGenerator;