Commit f705c75c authored by Simon Eugster's avatar Simon Eugster

Renamed Levels to Histogram (Levels = the Levels effect)

svn path=/trunk/kdenlive/; revision=4636
parent e6d13a7c
......@@ -94,7 +94,7 @@ kde4_add_ui_files(kdenlive_UI
widgets/colorplaneexport_ui.ui
widgets/waveform_ui.ui
widgets/rgbparade_ui.ui
widgets/levels_ui.ui
widgets/histogram_ui.ui
)
set(kdenlive_SRCS
......@@ -198,13 +198,13 @@ set(kdenlive_SRCS
configtrackscommand.cpp
abstractscopewidget.cpp
rebuildgroupcommand.cpp
levels.cpp
histogram.cpp
rgbparade.cpp
vectorscope.cpp
waveform.cpp
colorplaneexport.cpp
colortools.cpp
colorcorrection/levelsgenerator.cpp
colorcorrection/histogramgenerator.cpp
colorcorrection/rgbparadegenerator.cpp
colorcorrection/vectorscopegenerator.cpp
colorcorrection/waveformgenerator.cpp
......
......@@ -13,24 +13,24 @@
#include <QDebug>
#include <QImage>
#include <QPainter>
#include "levelsgenerator.h"
#include "histogramgenerator.h"
LevelsGenerator::LevelsGenerator()
HistogramGenerator::HistogramGenerator()
{
}
QImage LevelsGenerator::calculateLevels(const QSize &paradeSize, const QImage &image, const int &components,
QImage HistogramGenerator::calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components,
const bool &unscaled, const uint &accelFactor) const
{
qDebug() << "Levels rect size is: " << paradeSize.width() << "/" << paradeSize.height();
qDebug() << "Histogram rect size is: " << paradeSize.width() << "/" << paradeSize.height();
if (paradeSize.height() <= 0 || paradeSize.width() <= 0) {
return QImage();
}
bool drawY = (components & LevelsGenerator::ComponentY) != 0;
bool drawR = (components & LevelsGenerator::ComponentR) != 0;
bool drawG = (components & LevelsGenerator::ComponentG) != 0;
bool drawB = (components & LevelsGenerator::ComponentB) != 0;
bool drawY = (components & HistogramGenerator::ComponentY) != 0;
bool drawR = (components & HistogramGenerator::ComponentR) != 0;
bool drawG = (components & HistogramGenerator::ComponentG) != 0;
bool drawB = (components & HistogramGenerator::ComponentB) != 0;
int r[256], g[256], b[256], y[256];
// Initialize the values to zero
......@@ -76,10 +76,10 @@ QImage LevelsGenerator::calculateLevels(const QSize &paradeSize, const QImage &i
int wy = 0; // Drawing position
QImage levels(paradeSize, QImage::Format_ARGB32);
QPainter davinci(&levels);
QImage histogram(paradeSize, QImage::Format_ARGB32);
QPainter davinci(&histogram);
davinci.setPen(QColor(220, 220, 220, 255));
levels.fill(qRgba(0, 0, 0, 0));
histogram.fill(qRgba(0, 0, 0, 0));
if (drawY) {
qDebug() << "Drawing Y at " << wy << " with height " << partH;
......@@ -108,10 +108,10 @@ QImage LevelsGenerator::calculateLevels(const QSize &paradeSize, const QImage &i
wy += partH + d;
}
return levels;
return histogram;
}
QImage LevelsGenerator::drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled) const
QImage HistogramGenerator::drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled) const
{
QImage component(256, size.height(), QImage::Format_ARGB32);
component.fill(qRgba(0, 0, 0, 0));
......@@ -138,7 +138,7 @@ QImage LevelsGenerator::drawComponent(const int *y, const QSize &size, const flo
}
}
void LevelsGenerator::drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
void HistogramGenerator::drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
const QColor &color, const int &textSpace, const bool &unscaled) const
{
QImage component = drawComponent(y, rect.size() - QSize(0, textSpace), scaling, color, unscaled);
......
......@@ -8,8 +8,8 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef LEVELSGENERATOR_H
#define LEVELSGENERATOR_H
#ifndef HISTOGRAMGENERATOR_H
#define HISTOGRAMGENERATOR_H
#include <QObject>
......@@ -19,16 +19,16 @@ class QPainter;
class QRect;
class QSize;
class LevelsGenerator : public QObject
class HistogramGenerator : public QObject
{
public:
LevelsGenerator();
HistogramGenerator();
/**
Calculates a levels display from the input image.
components are OR-ed LevelsGenerator::Components flags and decide with components (Y, R, G, B) to paint.
Calculates a histogram display from the input image.
components are OR-ed HistogramGenerator::Components flags and decide with components (Y, R, G, B) to paint.
unscaled = true leaves the width at 256 if the widget is wider (to avoid scaling). */
QImage calculateLevels(const QSize &paradeSize, const QImage &image, const int &components, const bool &unscaled,
QImage calculateHistogram(const QSize &paradeSize, const QImage &image, const int &components, const bool &unscaled,
const uint &accelFactor = 1) const;
QImage drawComponent(const int *y, const QSize &size, const float &scaling, const QColor &color, const bool &unscaled) const;
......@@ -40,4 +40,4 @@ public:
};
#endif // LEVELSGENERATOR_H
#endif // HISTOGRAMGENERATOR_H
......@@ -10,14 +10,14 @@
#include <QMenu>
#include <QTime>
#include "levelsgenerator.h"
#include "levels.h"
#include "histogramgenerator.h"
#include "histogram.h"
#include "renderer.h"
Levels::Levels(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent) :
Histogram::Histogram(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent) :
AbstractScopeWidget(projMonitor, clipMonitor, parent)
{
ui = new Ui::Levels_UI();
ui = new Ui::Histogram_UI();
ui->setupUi(this);
ui->cbY->setChecked(true);
......@@ -41,47 +41,47 @@ Levels::Levels(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent) :
}
Levels::~Levels()
Histogram::~Histogram()
{
delete ui;
delete m_aUnscaled;
}
QString Levels::widgetName() const { return QString("Levels"); }
QString Histogram::widgetName() const { return QString("Histogram"); }
bool Levels::isHUDDependingOnInput() const { return false; }
bool Levels::isScopeDependingOnInput() const { return true; }
bool Levels::isBackgroundDependingOnInput() const { return false; }
bool Histogram::isHUDDependingOnInput() const { return false; }
bool Histogram::isScopeDependingOnInput() const { return true; }
bool Histogram::isBackgroundDependingOnInput() const { return false; }
QRect Levels::scopeRect()
QRect Histogram::scopeRect()
{
qDebug() << "According to the spacer, the top left point is " << ui->verticalSpacer->geometry().x() << "/" << ui->verticalSpacer->geometry().y();
QPoint topleft(offset, offset+ ui->verticalSpacer->geometry().y());
return QRect(topleft, this->rect().size() - QSize(topleft.x() + offset, topleft.y() + offset));
}
QImage Levels::renderHUD(uint)
QImage Histogram::renderHUD(uint)
{
emit signalHUDRenderingFinished(0, 1);
return QImage();
}
QImage Levels::renderScope(uint accelFactor)
QImage Histogram::renderScope(uint accelFactor)
{
QTime start = QTime::currentTime();
start.start();
const int componentFlags = (ui->cbY->isChecked() ? 1 : 0) * LevelsGenerator::ComponentY
| (ui->cbR->isChecked() ? 1 : 0) * LevelsGenerator::ComponentR
| (ui->cbG->isChecked() ? 1 : 0) * LevelsGenerator::ComponentG
| (ui->cbB->isChecked() ? 1 : 0) * LevelsGenerator::ComponentB;
const int componentFlags = (ui->cbY->isChecked() ? 1 : 0) * HistogramGenerator::ComponentY
| (ui->cbR->isChecked() ? 1 : 0) * HistogramGenerator::ComponentR
| (ui->cbG->isChecked() ? 1 : 0) * HistogramGenerator::ComponentG
| (ui->cbB->isChecked() ? 1 : 0) * HistogramGenerator::ComponentB;
QImage levels = m_levelsGenerator->calculateLevels(m_scopeRect.size(), m_activeRender->extractFrame(m_activeRender->seekFramePosition()),
QImage histogram = m_histogramGenerator->calculateHistogram(m_scopeRect.size(), m_activeRender->extractFrame(m_activeRender->seekFramePosition()),
componentFlags, m_aUnscaled->isChecked(), accelFactor);
emit signalScopeRenderingFinished(start.elapsed(), accelFactor);
return levels;
return histogram;
}
QImage Levels::renderBackground(uint)
QImage Histogram::renderBackground(uint)
{
emit signalBackgroundRenderingFinished(0, 1);
return QImage();
......
......@@ -8,25 +8,25 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef LEVELS_H
#define LEVELS_H
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
#include "abstractscopewidget.h"
#include "ui_levels_ui.h"
#include "ui_histogram_ui.h"
class LevelsGenerator;
class HistogramGenerator;
class Levels : public AbstractScopeWidget {
class Histogram : public AbstractScopeWidget {
Q_OBJECT
public:
Levels(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
~Levels();
Histogram(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent = 0);
~Histogram();
QString widgetName() const;
private:
LevelsGenerator *m_levelsGenerator;
HistogramGenerator *m_histogramGenerator;
QAction *m_aUnscaled;
QRect scopeRect();
......@@ -36,8 +36,8 @@ private:
QImage renderHUD(uint accelerationFactor);
QImage renderScope(uint accelerationFactor);
QImage renderBackground(uint accelerationFactor);
Ui::Levels_UI *ui;
Ui::Histogram_UI *ui;
};
#endif // LEVELS_H
#endif // HISTOGRAM_H
......@@ -55,7 +55,7 @@
#include "vectorscope.h"
#include "waveform.h"
#include "rgbparade.h"
#include "levels.h"
#include "histogram.h"
#include <KApplication>
#include <KAction>
......@@ -229,16 +229,16 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
addDockWidget(Qt::TopDockWidgetArea, m_waveformDock);
m_RGBParade = new RGBParade(m_projectMonitor, m_clipMonitor, this);
m_RGBParadeDock = new QDockWidget("RGB Parade", this);
m_RGBParadeDock = new QDockWidget(i18n("RGB Parade"), this);
m_RGBParadeDock->setObjectName(m_RGBParade->widgetName());
m_RGBParadeDock->setWidget(m_RGBParade);
addDockWidget(Qt::TopDockWidgetArea, m_RGBParadeDock);
m_levels = new Levels(m_projectMonitor, m_clipMonitor, this);
m_levelsDock = new QDockWidget("Levels", this);
m_levelsDock->setObjectName(m_levels->widgetName());
m_levelsDock->setWidget(m_levels);
addDockWidget(Qt::TopDockWidgetArea, m_levelsDock);
m_histogram = new Histogram(m_projectMonitor, m_clipMonitor, this);
m_histogramDock = new QDockWidget(i18n("Histogram"), this);
m_histogramDock->setObjectName(m_histogram->widgetName());
m_histogramDock->setWidget(m_histogram);
addDockWidget(Qt::TopDockWidgetArea, m_histogramDock);
m_undoViewDock = new QDockWidget(i18n("Undo History"), this);
......@@ -271,7 +271,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
tabifyDockWidget(m_vectorscopeDock, m_waveformDock);
tabifyDockWidget(m_vectorscopeDock, m_RGBParadeDock);
tabifyDockWidget(m_vectorscopeDock, m_levelsDock);
tabifyDockWidget(m_vectorscopeDock, m_histogramDock);
tabifyDockWidget(m_vectorscopeDock, m_undoViewDock);
tabifyDockWidget(m_vectorscopeDock, m_effectListDock);
......@@ -433,7 +433,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_vectorscope, SLOT(slotActiveMonitorChanged(bool)));
connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_waveform, SLOT(slotActiveMonitorChanged(bool)));
connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_RGBParade, SLOT(slotActiveMonitorChanged(bool)));
connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_levels, SLOT(slotActiveMonitorChanged(bool)));
connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), m_histogram, SLOT(slotActiveMonitorChanged(bool)));
connect(m_effectList, SIGNAL(addEffect(const QDomElement)), this, SLOT(slotAddEffect(const QDomElement)));
connect(m_effectList, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
......@@ -3622,7 +3622,7 @@ void MainWindow::slotShowTitleBars(bool show)
m_vectorscopeDock->setTitleBarWidget(0);
m_waveformDock->setTitleBarWidget(0);
m_RGBParadeDock->setTitleBarWidget(0);
m_levelsDock->setTitleBarWidget(0);
m_histogramDock->setTitleBarWidget(0);
} else {
if (!m_effectStackDock->isFloating()) { m_effectStackDock->setTitleBarWidget(new QWidget(this)); }
if (!m_clipMonitorDock->isFloating()) { m_clipMonitorDock->setTitleBarWidget(new QWidget(this)); }
......@@ -3637,7 +3637,7 @@ void MainWindow::slotShowTitleBars(bool show)
if (!m_vectorscopeDock->isFloating()) { m_vectorscopeDock->setTitleBarWidget(new QWidget(this)); }
if (!m_waveformDock->isFloating()) { m_waveformDock->setTitleBarWidget(new QWidget(this)); }
if (!m_RGBParadeDock->isFloating()) { m_RGBParadeDock->setTitleBarWidget(new QWidget(this)); }
if (!m_levelsDock->isFloating()) { m_levelsDock->setTitleBarWidget(new QWidget(this)); }
if (!m_histogramDock->isFloating()) { m_histogramDock->setTitleBarWidget(new QWidget(this)); }
}
KdenliveSettings::setShowtitlebars(show);
}
......
......@@ -61,7 +61,7 @@ class JogShuttle;
class DocClipBase;
class Render;
class Transition;
class Levels;
class Histogram;
class Vectorscope;
class Waveform;
class RGBParade;
......@@ -163,8 +163,8 @@ private:
QDockWidget *m_RGBParadeDock;
RGBParade *m_RGBParade;
QDockWidget *m_levelsDock;
Levels *m_levels;
QDockWidget *m_histogramDock;
Histogram *m_histogram;
QDockWidget *m_undoViewDock;
QUndoView *m_undoView;
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Levels_UI</class>
<widget class="QWidget" name="Levels_UI">
<class>Histogram_UI</class>
<widget class="QWidget" name="Histogram_UI">
<property name="geometry">
<rect>
<x>0</x>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment