Change copyright and format the code using clang-format

This commit is contained in:
jfmcarreira committed 2017-01-28 19:43:48 +00:00
1 parent a69c32bfbf
commit 8a60bb2766
122 files changed
+12950 -12139

No files matched your search

+118 -110
View File
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2016 by Luis Lucas (luisfrlucas@gmail.com)
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,8 @@
#include <QtDebug>
#include "FramePropertiesDock.h"
FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch ) :
QWidget( parent ),
m_pbIsPlaying( pbMainPlaySwitch )
FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch )
: QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
{
// -------------- Variables definition --------------
m_pcFrame = NULL;
@@ -38,29 +37,31 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// Histogram area -----------------------------------------------------
QLabel *channelLabel = new QLabel( tr( "Channel:" ) );
QLabel* channelLabel = new QLabel( tr( "Channel:" ) );
channelLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
channelCB = new QComboBox;
channelCB->addItem( tr( "Luminance" ) );
channelCB->setItemIcon( 0, QIcon( ":/images/channel-luma.png" ) );
channelCB->setWhatsThis( tr( "<p>Select here the histogram channel to display:<p>"
"<b>Luminance</b>: Display luminance (perceived brightness).<p>"
"<b>Red</b>: Display the red image channel.<p>"
"<b>Green</b>: Display the green image channel.<p>"
"<b>Blue</b>: Display the blue image channel.<p>"
"<b>Alpha</b>: Display the alpha image channel. "
"This channel corresponds to the transparency value and "
"is supported by some image formats such as PNG or TIFF.<p>"
"<b>Colors</b>: Display all color channel values at "
"the same time." ) );
channelCB->setWhatsThis(
tr( "<p>Select here the histogram channel to display:<p>"
"<b>Luminance</b>: Display luminance (perceived brightness).<p>"
"<b>Red</b>: Display the red image channel.<p>"
"<b>Green</b>: Display the green image channel.<p>"
"<b>Blue</b>: Display the blue image channel.<p>"
"<b>Alpha</b>: Display the alpha image channel. "
"This channel corresponds to the transparency value and "
"is supported by some image formats such as PNG or TIFF.<p>"
"<b>Colors</b>: Display all color channel values at "
"the same time." ) );
QString scaleWhatsThis( tr( "<p>Select here the histogram scale.<p>"
"If the image's maximal values are small, you can use the "
"linear scale.<p>Logarithmic scale can be used when the maximal"
" values are big; if it is used, all values (small and large) "
"will be visible on the graph." ) );
QString scaleWhatsThis(
tr( "<p>Select here the histogram scale.<p>"
"If the image's maximal values are small, you can use the "
"linear scale.<p>Logarithmic scale can be used when the maximal"
" values are big; if it is used, all values (small and large) "
"will be visible on the graph." ) );
linHistoButton = new QPushButton;
linHistoButton->setToolTip( tr( "Linear" ) );
@@ -81,7 +82,7 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
scaleButtonGroup->addButton( linHistoButton, HistogramWidget::LinScaleHistogram );
scaleButtonGroup->addButton( logHistoButton, HistogramWidget::LogScaleHistogram );
QHBoxLayout *scaleLayout = new QHBoxLayout;
QHBoxLayout* scaleLayout = new QHBoxLayout;
scaleLayout->addWidget( linHistoButton );
scaleLayout->addWidget( logHistoButton );
@@ -92,10 +93,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
colorsCB->hide();
colorsLabel->hide();
QString regionWhatsThis( tr( "<p>Select here from which region the histogram will be computed:"
"<p><b>Full Image</b>: Compute histogram using the full image."
"<p><b>Selection</b>: Compute histogram using the current image "
"selection." ) );
QString regionWhatsThis(
tr( "<p>Select here from which region the histogram will be computed:"
"<p><b>Full Image</b>: Compute histogram using the full image."
"<p><b>Selection</b>: Compute histogram using the current image "
"selection." ) );
fullImageButton = new QPushButton;
fullImageButton->setToolTip( tr( "Full Image" ) );
@@ -116,11 +118,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
renderingButtonGroup->addButton( fullImageButton, HistogramWidget::FullImageHistogram );
renderingButtonGroup->addButton( selectionImageButton, HistogramWidget::ImageSelectionHistogram );
QHBoxLayout *regionLayout = new QHBoxLayout;
QHBoxLayout* regionLayout = new QHBoxLayout;
regionLayout->addWidget( fullImageButton );
regionLayout->addWidget( selectionImageButton );
QGridLayout *mainLayout = new QGridLayout;
QGridLayout* mainLayout = new QGridLayout;
mainLayout->addWidget( channelLabel, 1, 0 );
mainLayout->addWidget( channelCB, 1, 1 );
mainLayout->addLayout( scaleLayout, 1, 3 );
@@ -132,10 +134,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// -------------------------------------------------------------
histogramWidget = new HistogramWidget( 100, 100 );
histogramWidget->setWhatsThis( tr( "<p>This is the histogram drawing of "
"the selected image channel" ) );
histogramWidget->setWhatsThis(
tr( "<p>This is the histogram drawing of "
"the selected image channel" ) );
QVBoxLayout *histogramLayout = new QVBoxLayout;
QVBoxLayout* histogramLayout = new QVBoxLayout;
histogramLayout->setSpacing( 1 );
histogramLayout->addWidget( histogramWidget );
@@ -143,24 +146,26 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// -------------------------------------------------------------
QLabel *rangeSelectionLabel = new QLabel( tr( "Range:" ) );
QLabel* rangeSelectionLabel = new QLabel( tr( "Range:" ) );
rangeSelectionLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
minInterv = new QSpinBox;
minInterv->setRange( 0, 255 );
minInterv->setSingleStep( 1 );
minInterv->setValue( 0 );
minInterv->setWhatsThis( tr( "<p>Select here the minimal intensity "
"value of the histogram selection." ) );
minInterv->setWhatsThis(
tr( "<p>Select here the minimal intensity "
"value of the histogram selection." ) );
maxInterv = new QSpinBox;
maxInterv->setRange( 0, 255 );
maxInterv->setSingleStep( 1 );
maxInterv->setValue( 0 );
minInterv->setWhatsThis( tr( "<p>Select here the maximal intensity value"
" of the histogram selection." ) );
minInterv->setWhatsThis(
tr( "<p>Select here the maximal intensity value"
" of the histogram selection." ) );
QHBoxLayout *rangeLayout = new QHBoxLayout;
QHBoxLayout* rangeLayout = new QHBoxLayout;
rangeLayout->addWidget( rangeSelectionLabel );
rangeLayout->addWidget( minInterv );
rangeLayout->addWidget( maxInterv );
@@ -169,43 +174,43 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// ----------------- GUI definition -----------------
QLabel *pixelsLabel = new QLabel( tr( "Pixels:" ) );
QLabel* pixelsLabel = new QLabel( tr( "Pixels:" ) );
pixelsLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelPixelsValue = new QLabel;
labelPixelsValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *countLabel = new QLabel( tr( "Selected:" ) );
QLabel* countLabel = new QLabel( tr( "Selected:" ) );
countLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelCountValue = new QLabel;
labelCountValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *rangeLabel = new QLabel( tr( "Range:" ) );
QLabel* rangeLabel = new QLabel( tr( "Range:" ) );
rangeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelRangeValue = new QLabel;
labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *meanLabel = new QLabel( tr( "Mean:" ) );
QLabel* meanLabel = new QLabel( tr( "Mean:" ) );
meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelMeanValue = new QLabel;
labelMeanValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *stdDevLabel = new QLabel( tr( "Std. deviation:" ) );
QLabel* stdDevLabel = new QLabel( tr( "Std. deviation:" ) );
stdDevLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelStdDevValue = new QLabel;
labelStdDevValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *medianLabel = new QLabel( tr( "Median:" ) );
QLabel* medianLabel = new QLabel( tr( "Median:" ) );
medianLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelMedianValue = new QLabel;
labelMedianValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel *percentileLabel = new QLabel( tr( "Percentile:" ) );
QLabel* percentileLabel = new QLabel( tr( "Percentile:" ) );
percentileLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelPercentileValue = new QLabel;
labelPercentileValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
Int gridRow = 0;
QGridLayout *statisticsLayout = new QGridLayout;
QGridLayout* statisticsLayout = new QGridLayout;
statisticsLayout->addWidget( pixelsLabel, gridRow, 0 );
statisticsLayout->addWidget( labelPixelsValue, gridRow++, 1 );
statisticsLayout->addWidget( countLabel, gridRow, 0 );
@@ -218,14 +223,15 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
statisticsLayout->addWidget( medianLabel, gridRow, 0 );
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
// statisticsLayout->addWidget( percentileLabel, 5, 0 );
// statisticsLayout->addWidget( labelPercentileValue, 5, 1 );
// statisticsLayout->addWidget( percentileLabel, 5, 0 );
// statisticsLayout->addWidget( labelPercentileValue, 5, 1 );
QGroupBox *statisticsGroup = new QGroupBox( tr( "Statistics" ) );
QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
statisticsGroup->setLayout( statisticsLayout );
statisticsGroup->setWhatsThis( tr( "<p>Here you can see the statistical results calculated from the "
"selected histogram part. These values are available for all "
"channels." ) );
statisticsGroup->setWhatsThis(
tr( "<p>Here you can see the statistical results calculated from the "
"selected histogram part. These values are available for all "
"channels." ) );
mainLayout->addWidget( statisticsGroup, 5, 0, 1, 4 );
@@ -233,17 +239,17 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
setLayout( mainLayout );
setEnabled( false );
connect( channelCB, SIGNAL( activated(int) ), this, SLOT( slotChannelChanged(int) ) );
connect( scaleButtonGroup, SIGNAL( buttonClicked(int) ), this, SLOT( slotScaleChanged(int) ) );
connect( colorsCB, SIGNAL( activated(int) ), this, SLOT( slotColorsChanged(int) ) );
connect( renderingButtonGroup, SIGNAL( buttonClicked(int) ), this, SLOT( slotRenderingChanged(int) ) );
connect( histogramWidget, SIGNAL( signalIntervalChanged( int, int ) ), this, SLOT( slotUpdateInterval(int, int) ) );
connect( histogramWidget, SIGNAL( signalMaximumValueChanged(int) ), this, SLOT( slotUpdateIntervRange(int) ) );
connect( histogramWidget, SIGNAL( signalHistogramComputationDone(int) ), this, SLOT( slotRefreshOptions(int) ) );
connect( histogramWidget, SIGNAL( signalHistogramComputationFailed(void) ), this, SLOT( slotHistogramComputationFailed(void) ) );
connect( minInterv, SIGNAL( valueChanged (int) ), this, SLOT( slotMinValueChanged(int) ) );
connect( maxInterv, SIGNAL( valueChanged (int) ), this, SLOT( slotMaxValueChanged(int) ) );
connect( channelCB, SIGNAL( activated( int ) ), this, SLOT( slotChannelChanged( int ) ) );
connect( scaleButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotScaleChanged( int ) ) );
connect( colorsCB, SIGNAL( activated( int ) ), this, SLOT( slotColorsChanged( int ) ) );
connect( renderingButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotRenderingChanged( int ) ) );
connect( histogramWidget, SIGNAL( signalIntervalChanged( int, int ) ), this, SLOT( slotUpdateInterval( int, int ) ) );
connect( histogramWidget, SIGNAL( signalMaximumValueChanged( int ) ), this, SLOT( slotUpdateIntervRange( int ) ) );
connect( histogramWidget, SIGNAL( signalHistogramComputationDone( int ) ), this, SLOT( slotRefreshOptions( int ) ) );
connect( histogramWidget, SIGNAL( signalHistogramComputationFailed( void ) ), this,
SLOT( slotHistogramComputationFailed( void ) ) );
connect( minInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMinValueChanged( int ) ) );
connect( maxInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMaxValueChanged( int ) ) );
}
FramePropertiesDock::~FramePropertiesDock()
@@ -314,10 +320,11 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
colorsCB->addItem( "Green" );
colorsCB->addItem( "Blue" );
colorsCB->setEnabled( false );
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Red</b>: Draw the Red image channel in the foreground.<p>"
"<b>Green</b>: Draw the Green image channel in the foreground.<p>"
"<b>Blue</b>: Draw the Blue image channel in the foreground.<p>" ) );
colorsCB->setWhatsThis(
tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Red</b>: Draw the Red image channel in the foreground.<p>"
"<b>Green</b>: Draw the Green image channel in the foreground.<p>"
"<b>Blue</b>: Draw the Blue image channel in the foreground.<p>" ) );
colorsCB->show();
colorsLabel->show();
}
@@ -334,10 +341,11 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
colorsCB->addItem( "Chroma U" );
colorsCB->addItem( "Chroma V" );
colorsCB->setEnabled( false );
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Luminance</b>: DraupdateDataw the Luminance channel in the foreground.<p>"
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
"<b>Chroma V</b>: Draw the Chroma V channel in the foreground.<p>" ) );
colorsCB->setWhatsThis(
tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Luminance</b>: DraupdateDataw the Luminance channel in the foreground.<p>"
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
"<b>Chroma V</b>: Draw the Chroma V channel in the foreground.<p>" ) );
colorsCB->show();
colorsLabel->show();
}
@@ -358,7 +366,7 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
}
}
Void FramePropertiesDock::setSelection( const QRect &selectionArea )
Void FramePropertiesDock::setSelection( const QRect& selectionArea )
{
if( m_pcFrame )
{
@@ -378,7 +386,8 @@ Void FramePropertiesDock::setSelection( const QRect &selectionArea )
{
delete m_pcSelectedFrame;
}
m_pcSelectedFrame = new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(), selectionArea.height() );
m_pcSelectedFrame = new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
selectionArea.height() );
}
updateDataHistogram();
selectionImageButton->click();
@@ -445,21 +454,21 @@ Void FramePropertiesDock::updateStatistiques()
if( frame )
{
QString rangeText = "[" + QString::number( frame->getMin( channel ) ) + ":" + QString::number( frame->getMax( channel ) ) + "]";
QString rangeText =
"[" + QString::number( frame->getMin( channel ) ) + ":" + QString::number( frame->getMax( channel ) ) + "]";
labelRangeValue->setText( rangeText );
double mean = frame->getMean( channel, min, max );
labelMeanValue->setText( value.setNum( mean, 'f', 1 ) );
double pixels = frame->getPixels();
labelPixelsValue->setText( value.setNum( ( float )pixels, 'f', 0 ) );
labelPixelsValue->setText( value.setNum( (float)pixels, 'f', 0 ) );
double stddev = frame->getStdDev( channel, min, max );
labelStdDevValue->setText( value.setNum( stddev, 'f', 1 ) );
double counts = frame->getCount( channel, min, max );
labelCountValue->setText( value.setNum( ( float )counts, 'f', 0 ) );
labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) );
double median = frame->getMedian( channel, min, max );
labelMedianValue->setText( value.setNum( median, 'f', 1 ) );
@@ -515,31 +524,31 @@ Void FramePropertiesDock::slotChannelChanged( Int channel )
switch( channel )
{
case FirstChannel:
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
case SecondChannel:
histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram;
colorsCB->setEnabled( false );
break;
case ThirdChannel:
histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram;
colorsCB->setEnabled( false );
break;
case AlphaChannel:
histogramWidget->m_channelType = HistogramWidget::AlphaChannelHistogram;
colorsCB->setEnabled( false );
break;
case ColorChannels:
histogramWidget->m_channelType = HistogramWidget::ColorChannelsHistogram;
colorsCB->setEnabled( true );
break;
default: // Luminance.
//histogramWidget->m_channelType = HistogramWidget::LumaHistogram;
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
case FirstChannel:
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
case SecondChannel:
histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram;
colorsCB->setEnabled( false );
break;
case ThirdChannel:
histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram;
colorsCB->setEnabled( false );
break;
case AlphaChannel:
histogramWidget->m_channelType = HistogramWidget::AlphaChannelHistogram;
colorsCB->setEnabled( false );
break;
case ColorChannels:
histogramWidget->m_channelType = HistogramWidget::ColorChannelsHistogram;
colorsCB->setEnabled( true );
break;
default: // Luminance.
// histogramWidget->m_channelType = HistogramWidget::LumaHistogram;
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
}
histogramWidget->update();
updateStatistiques();
@@ -555,15 +564,15 @@ Void FramePropertiesDock::slotColorsChanged( Int color )
{
switch( color )
{
case AllColorsGreen:
histogramWidget->m_colorType = HistogramWidget::SecondChannelColor;
break;
case AllColorsBlue:
histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor;
break;
default: // Red.
histogramWidget->m_colorType = HistogramWidget::FirstChannelColor;
break;
case AllColorsGreen:
histogramWidget->m_colorType = HistogramWidget::SecondChannelColor;
break;
case AllColorsBlue:
histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor;
break;
default: // Red.
histogramWidget->m_colorType = HistogramWidget::FirstChannelColor;
break;
}
histogramWidget->update();
@@ -625,4 +634,3 @@ Void FramePropertiesDock::slotUpdateIntervRange( Int range )
maxInterv->setMaximum( range );
maxInterv->blockSignals( false );
}