-namespace plaYUVer
-{
-
-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;
@@ -41,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( "Select here the histogram channel to display:
"
- "Luminance: Display luminance (perceived brightness).
"
- "Red: Display the red image channel.
"
- "Green: Display the green image channel.
"
- "Blue: Display the blue image channel.
"
- "Alpha: Display the alpha image channel. "
- "This channel corresponds to the transparency value and "
- "is supported by some image formats such as PNG or TIFF.
"
- "Colors: Display all color channel values at "
- "the same time." ) );
+ channelCB->setWhatsThis(
+ tr( "
Select here the histogram channel to display:
"
+ "Luminance: Display luminance (perceived brightness).
"
+ "Red: Display the red image channel.
"
+ "Green: Display the green image channel.
"
+ "Blue: Display the blue image channel.
"
+ "Alpha: Display the alpha image channel. "
+ "This channel corresponds to the transparency value and "
+ "is supported by some image formats such as PNG or TIFF.
"
+ "Colors: Display all color channel values at "
+ "the same time." ) );
- QString scaleWhatsThis( tr( "
Select here the histogram scale.
"
- "If the image's maximal values are small, you can use the "
- "linear scale.
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( "
Select here the histogram scale.
"
+ "If the image's maximal values are small, you can use the "
+ "linear scale.
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" ) );
@@ -84,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 );
@@ -95,10 +93,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
colorsCB->hide();
colorsLabel->hide();
- QString regionWhatsThis( tr( "
Select here from which region the histogram will be computed:"
- "
Full Image: Compute histogram using the full image."
- "
Selection: Compute histogram using the current image "
- "selection." ) );
+ QString regionWhatsThis(
+ tr( "
Select here from which region the histogram will be computed:"
+ "
Full Image: Compute histogram using the full image."
+ "
Selection: Compute histogram using the current image "
+ "selection." ) );
fullImageButton = new QPushButton;
fullImageButton->setToolTip( tr( "Full Image" ) );
@@ -119,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 );
@@ -135,10 +134,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// -------------------------------------------------------------
histogramWidget = new HistogramWidget( 100, 100 );
- histogramWidget->setWhatsThis( tr( "
This is the histogram drawing of "
- "the selected image channel" ) );
+ histogramWidget->setWhatsThis(
+ tr( "
This is the histogram drawing of "
+ "the selected image channel" ) );
- QVBoxLayout *histogramLayout = new QVBoxLayout;
+ QVBoxLayout* histogramLayout = new QVBoxLayout;
histogramLayout->setSpacing( 1 );
histogramLayout->addWidget( histogramWidget );
@@ -146,25 +146,27 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// -------------------------------------------------------------
- QLabel *rangeLabel = new QLabel( tr( "Range:" ) );
- rangeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
+ 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( "
Select here the minimal intensity "
- "value of the histogram selection." ) );
+ minInterv->setWhatsThis(
+ tr( "
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( "
Select here the maximal intensity value"
- " of the histogram selection." ) );
+ minInterv->setWhatsThis(
+ tr( "
Select here the maximal intensity value"
+ " of the histogram selection." ) );
- QHBoxLayout *rangeLayout = new QHBoxLayout;
- rangeLayout->addWidget( rangeLabel );
+ QHBoxLayout* rangeLayout = new QHBoxLayout;
+ rangeLayout->addWidget( rangeSelectionLabel );
rangeLayout->addWidget( minInterv );
rangeLayout->addWidget( maxInterv );
@@ -172,55 +174,64 @@ 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 *meanLabel = new QLabel( tr( "Mean:" ) );
+ 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:" ) );
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 );
- QGridLayout *statisticsLayout = new QGridLayout;
- statisticsLayout->addWidget( pixelsLabel, 0, 0 );
- statisticsLayout->addWidget( labelPixelsValue, 0, 1 );
- statisticsLayout->addWidget( countLabel, 1, 0 );
- statisticsLayout->addWidget( labelCountValue, 1, 1 );
- statisticsLayout->addWidget( meanLabel, 2, 0 );
- statisticsLayout->addWidget( labelMeanValue, 2, 1 );
- statisticsLayout->addWidget( stdDevLabel, 3, 0 );
- statisticsLayout->addWidget( labelStdDevValue, 3, 1 );
- statisticsLayout->addWidget( medianLabel, 4, 0 );
- statisticsLayout->addWidget( labelMedianValue, 4, 1 );
-// statisticsLayout->addWidget( percentileLabel, 5, 0 );
-// statisticsLayout->addWidget( labelPercentileValue, 5, 1 );
+ Int gridRow = 0;
+ QGridLayout* statisticsLayout = new QGridLayout;
+ statisticsLayout->addWidget( pixelsLabel, gridRow, 0 );
+ statisticsLayout->addWidget( labelPixelsValue, gridRow++, 1 );
+ statisticsLayout->addWidget( countLabel, gridRow, 0 );
+ statisticsLayout->addWidget( labelCountValue, gridRow++, 1 );
+ statisticsLayout->addWidget( rangeLabel, gridRow, 0 );
+ statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 );
+ statisticsLayout->addWidget( meanLabel, gridRow, 0 );
+ statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 );
+ statisticsLayout->addWidget( stdDevLabel, gridRow, 0 );
+ 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 );
- QGroupBox *statisticsGroup = new QGroupBox( tr( "Statistics" ) );
+ QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
statisticsGroup->setLayout( statisticsLayout );
- statisticsGroup->setWhatsThis( tr( "
Here you can see the statistical results calculated from the "
- "selected histogram part. These values are available for all "
- "channels." ) );
+ statisticsGroup->setWhatsThis(
+ tr( "
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 );
@@ -228,17 +239,22 @@ 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()
@@ -309,10 +325,11 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
colorsCB->addItem( "Green" );
colorsCB->addItem( "Blue" );
colorsCB->setEnabled( false );
- colorsCB->setWhatsThis( tr( "
Select here the main color displayed with Colors Channel mode:"
- "
Red: Draw the Red image channel in the foreground.
"
- "Green: Draw the Green image channel in the foreground.
"
- "Blue: Draw the Blue image channel in the foreground.
" ) );
+ colorsCB->setWhatsThis(
+ tr( "
Select here the main color displayed with Colors Channel mode:"
+ "
Red: Draw the Red image channel in the foreground.
"
+ "Green: Draw the Green image channel in the foreground.
"
+ "Blue: Draw the Blue image channel in the foreground.
" ) );
colorsCB->show();
colorsLabel->show();
}
@@ -329,10 +346,12 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
colorsCB->addItem( "Chroma U" );
colorsCB->addItem( "Chroma V" );
colorsCB->setEnabled( false );
- colorsCB->setWhatsThis( tr( "
Select here the main color displayed with Colors Channel mode:"
- "
Luminance: DraupdateDataw the Luminance channel in the foreground.
"
- "Chroma U: Draw the Chroma U channel in the foreground.
"
- "Chroma V: Draw the Chroma V channel in the foreground.
" ) );
+ colorsCB->setWhatsThis(
+ tr( "
Select here the main color displayed with Colors Channel mode:"
+ "
Luminance: DraupdateDataw the Luminance channel in the "
+ "foreground.
"
+ "Chroma U: Draw the Chroma U channel in the foreground.
"
+ "Chroma V: Draw the Chroma V channel in the foreground.
" ) );
colorsCB->show();
colorsLabel->show();
}
@@ -353,7 +372,7 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
}
}
-Void FramePropertiesDock::setSelection( const QRect &selectionArea )
+Void FramePropertiesDock::setSelection( const QRect& selectionArea )
{
if( m_pcFrame )
{
@@ -373,7 +392,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();
@@ -427,10 +447,9 @@ Void FramePropertiesDock::updateStatistiques()
Int min = minInterv->value();
Int max = maxInterv->value();
Int channel = histogramWidget->m_channelType;
- //Int channel = channelCB->currentIndex();
if( channel == HistogramWidget::ColorChannelsHistogram )
- channel = colorsCB->currentIndex() + 1;
+ channel = colorsCB->currentIndex();
PlaYUVerFrame* frame;
@@ -441,17 +460,21 @@ Void FramePropertiesDock::updateStatistiques()
if( frame )
{
+ 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 ) );
@@ -507,30 +530,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;
- 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();
@@ -546,15 +570,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();
@@ -616,6 +640,3 @@ Void FramePropertiesDock::slotUpdateIntervRange( Int range )
maxInterv->setMaximum( range );
maxInterv->blockSignals( false );
}
-
-} // NAMESPACE
-
diff --git a/app/FramePropertiesDock.h b/app/FramePropertiesDock.h
index 605fd5e..1f69deb 100644
--- a/app/FramePropertiesDock.h
+++ b/app/FramePropertiesDock.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,36 +25,33 @@
#ifndef __FRAMEPROPERTIESDOCK_H__
#define __FRAMEPROPERTIESDOCK_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
+#include "config.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include
#elif( QT_VERSION_PLAYUVER == 4 )
-#include
#include
+#include
#endif
-#include "lib/PlaYUVerStream.h"
-#include "lib/PlaYUVerFrame.h"
#include "HistogramWidget.h"
+#include "lib/PlaYUVerFrame.h"
+#include "lib/PlaYUVerStream.h"
-namespace plaYUVer
+class FramePropertiesDock : public QWidget
{
-
-class FramePropertiesDock: public QWidget
-{
-Q_OBJECT
-public:
+ Q_OBJECT
+ public:
FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch );
~FramePropertiesDock();
QSize sizeHint() const;
Void setFrame( PlaYUVerFrame* m_pcFrame );
- Void setSelection( const QRect &selectionArea );
+ Void setSelection( const QRect& selectionArea );
Void reset();
Void stopHistogram();
-private:
+ private:
enum ColorChannel
{
LuminosityChannel = 0,
@@ -72,50 +69,45 @@ private:
AllColorsBlue
};
- PlaYUVerFrame *m_pcFrame;
- PlaYUVerFrame *m_pcSelectedFrame;
+ PlaYUVerFrame* m_pcFrame;
+ PlaYUVerFrame* m_pcSelectedFrame;
Int m_iLastFrameType;
Bool* m_pbIsPlaying;
+ QComboBox* channelCB;
+ QComboBox* colorsCB;
+ QComboBox* renderingCB;
- QComboBox *channelCB;
- QComboBox *colorsCB;
- QComboBox *renderingCB;
+ QPushButton* linHistoButton;
+ QPushButton* logHistoButton;
+ QPushButton* fullImageButton;
+ QPushButton* selectionImageButton;
- QPushButton *linHistoButton;
- QPushButton *logHistoButton;
- QPushButton *fullImageButton;
- QPushButton *selectionImageButton;
+ QButtonGroup* scaleButtonGroup;
+ QButtonGroup* renderingButtonGroup;
- QButtonGroup *scaleButtonGroup;
- QButtonGroup *renderingButtonGroup;
+ QSpinBox* minInterv;
+ QSpinBox* maxInterv;
- QSpinBox *minInterv;
- QSpinBox *maxInterv;
+ QLabel* labelPixelsValue;
+ QLabel* labelCountValue;
+ QLabel* labelRangeValue;
+ QLabel* labelMeanValue;
+ QLabel* labelStdDevValue;
+ QLabel* labelMedianValue;
+ QLabel* labelPercentileValue;
- QLabel *colorsLabel;
- QLabel *labelMeanValue;
- QLabel *labelPixelsValue;
- QLabel *labelStdDevValue;
- QLabel *labelCountValue;
- QLabel *labelMedianValue;
- QLabel *labelPercentileValue;
- QLabel *formatValueLabel;
- QLabel *sizeValueLabel;
- QLabel *colorSpaceValueLabel;
- QLabel *colorModeValueLabel;
- QLabel *depthValueLabel;
- QLabel *alphaValueLabel;
+ QLabel* colorsLabel;
QRect m_cSelectionArea;
- HistogramWidget *histogramWidget;
+ HistogramWidget* histogramWidget;
Void updateStatistiques();
Void updateDataHistogram();
-private Q_SLOTS:
+ private Q_SLOTS:
void slotRefreshOptions( int range );
void slotHistogramComputationFailed( void );
void slotChannelChanged( int channel );
@@ -127,9 +119,6 @@ private Q_SLOTS:
void slotUpdateInterval( int min, int max );
void slotUpdateIntervRange( int range );
-
};
-} // NAMESPACE
-
-#endif // __FRAMEPROPERTIESDOCK_H__
+#endif // __FRAMEPROPERTIESDOCK_H__
diff --git a/app/GridManager.cpp b/app/GridManager.cpp
index be677fa..d78e5f6 100644
--- a/app/GridManager.cpp
+++ b/app/GridManager.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -24,19 +24,16 @@
*/
#include
+#include
+#include
#include
+#include
+#include
#include
#include
-#include
-#include
-#include
-#include
#include "GridManager.h"
-namespace plaYUVer
-{
-
////////////////////////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////////////////////////
@@ -50,10 +47,10 @@ GridManager::GridManager()
////////////////////////////////////////////////////////////////////////////////
// Grid Drawer
////////////////////////////////////////////////////////////////////////////////
-void GridManager::drawGrid( QPixmap &image, const QRect& area, QPainter *painter )
+void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter )
{
- int offsetx = 0; // Grid offset doesn't applies to SCODE
- int offsety = 0; // project for now...
+ int offsetx = 0; // Grid offset doesn't applies to SCODE
+ int offsety = 0; // project for now...
int imageWidth = image.width();
int imageHeight = image.height();
@@ -68,76 +65,76 @@ void GridManager::drawGrid( QPixmap &image, const QRect& area, QPainter *painter
style = Solid;
switch( style )
{
- case IntersectionDot:
- case IntersectionCross:
- {
- painter->setPen( mainPen );
- // Draw crosses or dots on intersections
- for( int x = offsetx; x <= area.right(); x += hSpacing )
+ case IntersectionDot:
+ case IntersectionCross:
{
- if( x >= imageWidth )
- break;
+ painter->setPen( mainPen );
+ // Draw crosses or dots on intersections
+ for( int x = offsetx; x <= area.right(); x += hSpacing )
+ {
+ if( x >= imageWidth )
+ break;
+ for( int y = offsety; y <= area.bottom(); y += vSpacing )
+ {
+ if( y >= imageHeight )
+ break;
+
+ if( x >= area.x() && y >= area.y() )
+ {
+ if( style == IntersectionDot )
+ painter->drawPoint( x, y ); // Dot
+ else
+ { // Crosses:
+ painter->drawLine( x, y - 1, x, y + 1 ); // Ver.line
+ painter->drawLine( x - 1, y, x + 1, y ); // Hor.line
+ }
+ }
+ }
+ }
+ break;
+ }
+ case Dashed:
+ {
+ // Change pen to the dashed line
+ mainPen.setStyle( Qt::DashLine );
+ }
+ default: // Solid:
+ {
+ painter->setPen( mainPen );
+
+ // Draw vertical line
+ for( int x = offsetx; x <= area.right(); x += hSpacing )
+ {
+ if( x >= imageWidth )
+ break;
+
+ if( x >= area.x() )
+ {
+ // Always draw the full line otherwise the line stippling
+ // varies with the location of view area and we get glitchy
+ // patterns.
+ painter->drawLine( x, 0, x, imageHeight - 1 );
+ }
+ }
+ // Draw horizontal line
for( int y = offsety; y <= area.bottom(); y += vSpacing )
{
if( y >= imageHeight )
break;
- if( x >= area.x() && y >= area.y() )
+ if( y >= area.y() )
{
- if( style == IntersectionDot )
- painter->drawPoint( x, y ); // Dot
- else
- { // Crosses:
- painter->drawLine( x, y - 1, x, y + 1 ); // Ver.line
- painter->drawLine( x - 1, y, x + 1, y ); // Hor.line
- }
+ painter->drawLine( 0, y, imageWidth - 1, y );
}
}
+ break;
}
- break;
- }
- case Dashed:
- {
- // Change pen to the dashed line
- mainPen.setStyle( Qt::DashLine );
- }
- default: // Solid:
- {
- painter->setPen( mainPen );
-
- // Draw vertical line
- for( int x = offsetx; x <= area.right(); x += hSpacing )
- {
- if( x >= imageWidth )
- break;
-
- if( x >= area.x() )
- {
- // Always draw the full line otherwise the line stippling
- // varies with the location of view area and we get glitchy
- // patterns.
- painter->drawLine( x, 0, x, imageHeight - 1 );
- }
- }
- // Draw horizontal line
- for( int y = offsety; y <= area.bottom(); y += vSpacing )
- {
- if( y >= imageHeight )
- break;
-
- if( y >= area.y() )
- {
- painter->drawLine( 0, y, imageWidth - 1, y );
- }
- }
- break;
- }
}
}
////////////////////////////////////////////////////////////////////////////////
-QRect GridManager::rectContains( const QPoint &pos ) const
+QRect GridManager::rectContains( const QPoint& pos ) const
{
return rectContains( pos.x(), pos.y() );
}
@@ -222,8 +219,8 @@ bool GridManager::isNear( int x, int y )
return false;
}
- // We go to consider an area with ray equal 25% of the distance between
- // spaces of the gride. In this in case, we have one rectangle centered
+ // We go to consider an area with ray equal 25% of the distance between
+ // spaces of the gride. In this in case, we have one rectangle centered
// in 25% of this distance.
rectWidth = 2 * 0.25 * hSpacing;
@@ -245,8 +242,8 @@ bool GridManager::isNear( int x, int y )
{
for( int i = 0; i < 2; i++ )
{
- gx = ( int )( multiPosX * hSpacing + i * hSpacing );
- gy = ( int )( multiPosY * vSpacing + j * vSpacing );
+ gx = (int)( multiPosX * hSpacing + i * hSpacing );
+ gy = (int)( multiPosY * vSpacing + j * vSpacing );
gridPoint.setX( gx );
gridPoint.setY( gy );
rect.moveCenter( gridPoint );
@@ -262,9 +259,7 @@ bool GridManager::isNear( int x, int y )
return false;
}
-bool GridManager::isNear( const QPoint &pos )
+bool GridManager::isNear( const QPoint& pos )
{
return isNear( pos.x(), pos.y() );
}
-
-} // NameSpace plaYUVer
diff --git a/app/GridManager.h b/app/GridManager.h
index 27bf0fb..578aab3 100644
--- a/app/GridManager.h
+++ b/app/GridManager.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -26,34 +26,33 @@
#ifndef __GRIDMANAGER_H__
#define __GRIDMANAGER_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
-#include
+#include "config.h"
#include
#include
+#include
class QPoint;
class QBitmap;
class QPainter;
-namespace plaYUVer
-{
-
/**
*
*/
class GridManager
{
-public:
-
+ public:
enum Style
{
- IntersectionDot = 0, IntersectionCross, Dashed, Solid
+ IntersectionDot = 0,
+ IntersectionCross,
+ Dashed,
+ Solid
};
GridManager();
- void drawGrid( QPixmap &image, const QRect& area, QPainter *painter );
+ void drawGrid( QPixmap& image, const QRect& area, QPainter* painter );
/**
* @returns a QRect defined by the grid that contains the point (x, y).
@@ -64,7 +63,7 @@ public:
* This is an overloaded member function, provided for convenience.
* @returns a QRect defined by the grid that contains the QPoint pos.
*/
- QRect rectContains( const QPoint &pos ) const;
+ QRect rectContains( const QPoint& pos ) const;
/**
* @returns @c true if the point (x, y) is over a grid crossing, otherwise
@@ -84,7 +83,7 @@ public:
* returns @c false.
* @see @p nearPos()
*/
- bool isNear( const QPoint &pos );
+ bool isNear( const QPoint& pos );
/**
* @returns the grid crossing position that is near the point (x,y). If
@@ -93,8 +92,7 @@ public:
*/
QPoint nearPos( int x = -1, int y = -1 );
-private:
-
+ private:
UInt m_uiHSpace;
UInt m_uiVSpace;
QColor m_cGridColor;
@@ -102,6 +100,4 @@ private:
QPoint m_nearPos;
};
-} // NameSpace plaYUVer
-
-#endif // __GRIDMANAGER_H__
+#endif // __GRIDMANAGER_H__
diff --git a/app/HistogramWidget.cpp b/app/HistogramWidget.cpp
index cd398f0..6b404d5 100644
--- a/app/HistogramWidget.cpp
+++ b/app/HistogramWidget.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -23,25 +23,21 @@
* Based on the work of Ricardo N. Rocha Sardo in SCode project
*/
-//TODO:
-// - Optimizar paintEvent. Parece haver codigo redundante !!
-#include "config.h"
-#include
-#include
-#include
+// TODO:
+// - Optimizar paintEvent. Parece haver codigo redundante !!
#include "HistogramWidget.h"
+#include "config.h"
+#include
+#include
+#include
-namespace plaYUVer
+class HistogramWorker : public QThread
{
-
-class HistogramWorker: public QThread
-{
-private:
+ private:
QObject* m_parent;
PlaYUVerFrame* m_pcFrame;
-public:
-
+ public:
HistogramWorker( QObject* parent )
{
m_pcFrame = NULL;
@@ -57,16 +53,19 @@ public:
{
if( m_pcFrame && m_parent )
{
- EventData *eventData = new EventData();
-// eventDm_imageHistogramata->starting = true;
-// eventData->success = false;
-// eventData->histogram = m_histogram;
-// QCoreApplication::postEvent( m_parent, eventData );
+ EventData* eventData = new EventData();
+ // eventDm_imageHistogramata->starting = true;
+ // eventData->success = false;
+ // eventData->histogram = m_histogram;
+ // QCoreApplication::postEvent( m_parent, eventData );
+
+ eventData->starting = true;
m_pcFrame->calcHistogram();
eventData->starting = false;
- eventData->success = m_pcFrame->getHasHistogram();
+ // eventData->success = m_pcFrame->getHasHistogram();
+ eventData->success = true;
eventData->frame = m_pcFrame;
QCoreApplication::postEvent( m_parent, eventData );
}
@@ -75,13 +74,10 @@ public:
/**
* Custom Event
*/
- class EventData: public QEvent
+ class EventData : public QEvent
{
-
- public:
-
- EventData() :
- QEvent( QEvent::User )
+ public:
+ EventData() : QEvent( QEvent::User )
{
starting = false;
success = false;
@@ -90,36 +86,34 @@ public:
bool starting;
bool success;
- PlaYUVerFrame *frame;
+ PlaYUVerFrame* frame;
};
-
};
-const QBrush g_eColorPallet[][3] =
-{
- {
- Qt::darkGray, // Luma
- Qt::blue, // Cb
- Qt::red, // Cr
- },
- {
- Qt::red, // Channel Red
- Qt::green, // Channel Green
- Qt::blue, // Channel Blue
- }, };
+const QBrush g_eColorPallet[][3] = {
+ {
+ Qt::darkGray, // Luma
+ Qt::blue, // Cb
+ Qt::red, // Cr
+ },
+ {
+ Qt::red, // Channel Red
+ Qt::green, // Channel Green
+ Qt::blue, // Channel Blue
+ },
+};
class HistogramWidgetPrivate
{
-public:
-
+ public:
enum RepaintType
{
- HistogramNone = 0, // No current histogram values calculation.
- HistogramDataLoading, // The image is being loaded
- HistogramStarted, // Histogram values calculation started.
- HistogramCompleted, // Histogram values calculation completed.
- HistogramSkipped, // Skip histogram while playing
- HistogramFailed // Histogram values calculation failed.
+ HistogramNone = 0, // No current histogram values calculation.
+ HistogramDataLoading, // The image is being loaded
+ HistogramStarted, // Histogram values calculation started.
+ HistogramCompleted, // Histogram values calculation completed.
+ HistogramSkipped, // Skip histogram while playing
+ HistogramFailed // Histogram values calculation failed.
};
HistogramWidgetPrivate()
@@ -141,7 +135,7 @@ public:
double xminOrg;
double xmax;
Int range;
- Int clearFlag; // Clear drawing zone with message.
+ Int clearFlag; // Clear drawing zone with message.
// Image informations
Int imageChannels;
@@ -151,39 +145,40 @@ public:
bool guideVisible; // Display color guide.
bool statisticsVisible; // Display tooltip histogram statistics.
bool inSelected;
- bool selectMode; // If true, a part of the histogram can be
- // selected !
+ bool selectMode; // If true, a part of the histogram can be
+ // selected !
bool blinkFlag;
- bool blinkComputation; // If true, a message will be displayed during
- // histogram computation, else nothing (limit
- // flicker effect in widget especially for small
- // image/computation time).
- bool lumaChannel; // Compute luminance channel if true.
+ bool blinkComputation; // If true, a message will be displayed during
+ // histogram computation, else nothing (limit
+ // flicker effect in widget especially for small
+ // image/computation time).
+ bool lumaChannel; // Compute luminance channel if true.
bool inInitialRepaintWait;
- QTimer *blinkTimer;
+ QTimer* blinkTimer;
QColor colorGuide;
};
////////////////////////////////////////////////////////////////////////////////
-// Constructors
+// Constructors
////////////////////////////////////////////////////////////////////////////////
-//Constructor without image data
-HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) :
- QWidget( parent )
+// Constructor without image data
+HistogramWidget::HistogramWidget( Int width, Int height, QWidget* parent ) : QWidget( parent )
{
setAttribute( Qt::WA_DeleteOnClose );
d = new HistogramWidgetPrivate;
- m_channelType = LumaHistogram;
+ // m_channelType = LumaHistogram;
+ m_channelType = FirstChannelHistogram;
m_scaleType = LogScaleHistogram;
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
- setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel );
+ setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode |
+ HistogramWidget::ShowLumaChannel );
setMouseTracking( true );
setMinimumSize( width, height );
@@ -202,17 +197,17 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) :
}
////////////////////////////////////////////////////////////////////////////////
-// Destructor
+// Destructor
////////////////////////////////////////////////////////////////////////////////
HistogramWidget::~HistogramWidget()
{
d->blinkTimer->stop();
-// if( m_imageHistogram )
-// delete m_imageHistogram;
-//
-// if( m_selectionHistogram )
-// delete m_selectionHistogram;
+ // if( m_imageHistogram )
+ // delete m_imageHistogram;
+ //
+ // if( m_selectionHistogram )
+ // delete m_selectionHistogram;
delete m_imageWorker;
delete m_selectionWorker;
@@ -220,15 +215,15 @@ HistogramWidget::~HistogramWidget()
delete d;
}
////////////////////////////////////////////////////////////////////////////////
-// Setup Functions
+// Setup Functions
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::setOptions( HistogramOptions options )
{
- d->statisticsVisible = ( bool )( options & ShowStatistics );
- d->selectMode = ( bool )( options & SelectMode );
- d->blinkComputation = ( bool )( options & BlinkComputation );
- d->lumaChannel = ( bool )( options & ShowLumaChannel );
+ d->statisticsVisible = (bool)( options & ShowStatistics );
+ d->selectMode = (bool)( options & SelectMode );
+ d->blinkComputation = (bool)( options & BlinkComputation );
+ d->lumaChannel = (bool)( options & ShowLumaChannel );
}
Void HistogramWidget::setHistogramGuideByColor( QColor color )
@@ -249,17 +244,17 @@ Void HistogramWidget::reset()
}
////////////////////////////////////////////////////////////////////////////////
-// Custom Event Handler
+// Custom Event Handler
////////////////////////////////////////////////////////////////////////////////
-Void HistogramWidget::customEvent( QEvent *event )
+Void HistogramWidget::customEvent( QEvent* event )
{
if( !event )
{
return;
}
- HistogramWorker::EventData *ed = ( HistogramWorker::EventData* )event;
+ HistogramWorker::EventData* ed = (HistogramWorker::EventData*)event;
if( !ed )
{
@@ -324,24 +319,24 @@ Void HistogramWidget::customEvent( QEvent *event )
// Remove old histogram data from memory.
m_fullImage = NULL;
m_selectionImage = NULL;
-// if( m_imageHistogram )
-// {
-// delete m_imageHistogram;
-// m_imageHistogram = 0;
-// }
-// if( m_selectionHistogram )
-// {
-// delete m_selectionHistogram;
-// m_selectionHistogram = 0;
-// }
+ // if( m_imageHistogram )
+ // {
+ // delete m_imageHistogram;
+ // m_imageHistogram = 0;
+ // }
+ // if( m_selectionHistogram )
+ // {
+ // delete m_selectionHistogram;
+ // m_selectionHistogram = 0;
+ // }
emit signalHistogramComputationFailed();
}
}
- //delete ed;
+ // delete ed;
}
////////////////////////////////////////////////////////////////////////////////
-// Data Loading Functions
+// Data Loading Functions
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::setDataLoading()
@@ -380,23 +375,22 @@ Void HistogramWidget::setLoadingFailed()
Void HistogramWidget::stopHistogramComputation()
{
-// if( m_imageHistogram )
-// m_imageHistogram->setRunningFlag( false );
-//
-// if( m_selectionHistogram )
-// m_selectionHistogram->setRunningFlag( false );
+ // if( m_imageHistogram )
+ // m_imageHistogram->setRunningFlag( false );
+ //
+ // if( m_selectionHistogram )
+ // m_selectionHistogram->setRunningFlag( false );
d->blinkTimer->stop();
}
////////////////////////////////////////////////////////////////////////////////
-// Update Data Methods
+// Update Data Methods
////////////////////////////////////////////////////////////////////////////////
-Void HistogramWidget::updateData( PlaYUVerFrame *pcFrame, PlaYUVerFrame *pcFrameSelection )
+Void HistogramWidget::updateData( PlaYUVerFrame* pcFrame, PlaYUVerFrame* pcFrameSelection )
{
d->imageBits = pcFrame->getBitsPel();
- //d->imageColorSpace = image.getPelFormat();
d->imageColorSpace = pcFrame->getColorSpace();
d->imageChannels = pcFrame->getNumberChannels();
@@ -415,7 +409,6 @@ Void HistogramWidget::updateData( PlaYUVerFrame *pcFrame, PlaYUVerFrame *pcFrame
m_selectionImage = pcFrameSelection;
m_selectionWorker->setup( pcFrameSelection );
-
}
////////////////////////////////////////////////////////////////////////////////
@@ -429,10 +422,10 @@ Void HistogramWidget::slotBlinkTimerDone()
}
////////////////////////////////////////////////////////////////////////////////
-// Paint Event
+// Paint Event
////////////////////////////////////////////////////////////////////////////////
-Void HistogramWidget::paintEvent( QPaintEvent * )
+Void HistogramWidget::paintEvent( QPaintEvent* )
{
int maxX = size().width() - 1;
int maxY = size().height() - 1;
@@ -440,20 +433,23 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
// Widget is disabled, not initialized,
// or loading, but no message shall be drawn:
// Drawing grayed frame.
- if( !isEnabled() || d->clearFlag == HistogramWidgetPrivate::HistogramNone
- || ( !d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted || d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) ) )
+ if( !isEnabled() || d->clearFlag == HistogramWidgetPrivate::HistogramNone ||
+ ( !d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted ||
+ d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) ) )
{
QPainter p1( this );
p1.fillRect( 0, 0, maxX, maxY, palette().color( QPalette::Disabled, QPalette::Window ) );
- p1.setPen( QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
+ p1.setPen(
+ QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
p1.drawRect( 0, 0, maxX, maxY );
return;
}
// Image data is loading or histogram is being computed:
// Draw message.
- else if( d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted || d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) )
+ else if( d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted ||
+ d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) )
{
QPainter p1( this );
@@ -467,7 +463,8 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
if( d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading )
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Loading image..." ) );
else
- p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Histogram\ncalculation\nin progress..." ) );
+ p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter,
+ tr( "Histogram\ncalculation\nin progress..." ) );
return;
}
@@ -479,7 +476,7 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
p1.fillRect( 0, 0, maxX, maxY, Qt::white );
p1.setPen( Qt::darkGreen );
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Histogram\ncalculation\nskipped." ) );
- //bitBlt(this, 0, 0, &pm);
+ // bitBlt(this, 0, 0, &pm);
return;
}
// Histogram computation failed:
@@ -490,16 +487,16 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
p1.fillRect( 0, 0, maxX, maxY, Qt::white );
p1.setPen( Qt::red );
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Histogram\ncalculation\nfailed." ) );
- //bitBlt(this, 0, 0, &pm);
+ // bitBlt(this, 0, 0, &pm);
return;
}
int x, y;
- int yr, yg, yb; // For all color channels.
+ int yr, yg, yb; // For all color channels.
int wWidth = width() - 1;
int wHeight = height() - 1;
double max;
- PlaYUVerFrame *frame;
+ PlaYUVerFrame* frame;
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
frame = m_selectionImage;
@@ -518,38 +515,39 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
switch( m_channelType )
{
- case HistogramWidget::FirstChannelHistogram: // Y channel.
- max = frame->getMaximum( LUMA );
- break;
- case HistogramWidget::SecondChannelHistogram: // Cb channel.
- max = frame->getMaximum( CHROMA_U );
- break;
- case HistogramWidget::ThirdChannelHistogram: // Cr channel.
- max = frame->getMaximum( CHROMA_V );
- break;
- case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
- max = frame->getMaximum( COLOR_A );
- break;
+ case HistogramWidget::FirstChannelHistogram: // Y channel.
+ max = frame->getMaximum( LUMA );
+ break;
+ case HistogramWidget::SecondChannelHistogram: // Cb channel.
+ max = frame->getMaximum( CHROMA_U );
+ break;
+ case HistogramWidget::ThirdChannelHistogram: // Cr channel.
+ max = frame->getMaximum( CHROMA_V );
+ break;
+ case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
+ max = frame->getMaximum( COLOR_A );
+ break;
- case HistogramWidget::ColorChannelsHistogram: // All color channels.
- max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ), frame->getMaximum( CHROMA_V ) );
- break;
- case HistogramWidget::LumaHistogram: // Luminance.
- max = frame->getMaximum( LUMA );
- break;
+ case HistogramWidget::ColorChannelsHistogram: // All color channels.
+ max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ),
+ frame->getMaximum( CHROMA_V ) );
+ break;
+ // case HistogramWidget::LumaHistogram: // Luminance.
+ // max = frame->getMaximum( LUMA );
+ // break;
}
switch( m_scaleType )
{
- case HistogramWidget::LinScaleHistogram:
- break;
+ case HistogramWidget::LinScaleHistogram:
+ break;
- case HistogramWidget::LogScaleHistogram:
- if( max > 0.0 )
- max = log( max );
- else
- max = 1.0;
- break;
+ case HistogramWidget::LogScaleHistogram:
+ if( max > 0.0 )
+ max = log( max );
+ else
+ max = 1.0;
+ break;
}
// From Qt 4.0, QWidget automatically double-buffers its painting,
@@ -572,7 +570,7 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
do
{
double v;
- double vr, vg, vb; // For all color channels.
+ double vr, vg, vb; // For all color channels.
v = 0.0;
vr = 0.0;
@@ -581,27 +579,26 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
switch( m_channelType )
{
- case HistogramWidget::FirstChannelHistogram: // Y channel.
- v = frame->getHistogramValue( LUMA, i++ );
- break;
- case HistogramWidget::SecondChannelHistogram: // Cb channel.
- v = frame->getHistogramValue( CHROMA_U, i++ );
- break;
- case HistogramWidget::ThirdChannelHistogram: // Cr channel.
- v = frame->getHistogramValue( CHROMA_V, i++ );
- break;
- case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
- v = frame->getHistogramValue( COLOR_A, i++ );
- break;
- case HistogramWidget::ColorChannelsHistogram: // All color.
- vr = frame->getHistogramValue( LUMA, i );
- vg = frame->getHistogramValue( CHROMA_U, i );
- vb = frame->getHistogramValue( CHROMA_U, i++ );
- break;
- case HistogramWidget::LumaHistogram: // Luminance.
- v = frame->getHistogramValue( LUMA, i++ );
- break;
-
+ case HistogramWidget::FirstChannelHistogram: // Y channel.
+ v = frame->getHistogramValue( LUMA, i++ );
+ break;
+ case HistogramWidget::SecondChannelHistogram: // Cb channel.
+ v = frame->getHistogramValue( CHROMA_U, i++ );
+ break;
+ case HistogramWidget::ThirdChannelHistogram: // Cr channel.
+ v = frame->getHistogramValue( CHROMA_V, i++ );
+ break;
+ case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
+ v = frame->getHistogramValue( COLOR_A, i++ );
+ break;
+ case HistogramWidget::ColorChannelsHistogram: // All color.
+ vr = frame->getHistogramValue( LUMA, i );
+ vg = frame->getHistogramValue( CHROMA_U, i );
+ vb = frame->getHistogramValue( CHROMA_V, i++ );
+ break;
+ // case HistogramWidget::LumaHistogram: // Luminance.
+ // v = frame->getHistogramValue( LUMA, i++ );
+ // break;
}
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
@@ -618,55 +615,54 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
if( vb > value_b )
value_b = vb;
}
- }
- while( i < j );
+ } while( i < j );
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
{
switch( m_scaleType )
{
- case HistogramWidget::LinScaleHistogram:
- y = ( int )( ( wHeight * value ) / max );
- break;
+ case HistogramWidget::LinScaleHistogram:
+ y = (int)( ( wHeight * value ) / max );
+ break;
- case HistogramWidget::LogScaleHistogram:
- if( value <= 0.0 )
- value = 1.0;
- y = ( int )( ( wHeight * log( value ) ) / max );
- break;
+ case HistogramWidget::LogScaleHistogram:
+ if( value <= 0.0 )
+ value = 1.0;
+ y = (int)( ( wHeight * log( value ) ) / max );
+ break;
- default:
- y = 0;
- break;
+ default:
+ y = 0;
+ break;
}
}
else
{
switch( m_scaleType )
{
- case HistogramWidget::LinScaleHistogram:
- yr = ( int )( ( wHeight * value_r ) / max );
- yg = ( int )( ( wHeight * value_g ) / max );
- yb = ( int )( ( wHeight * value_b ) / max );
- break;
+ case HistogramWidget::LinScaleHistogram:
+ yr = (int)( ( wHeight * value_r ) / max );
+ yg = (int)( ( wHeight * value_g ) / max );
+ yb = (int)( ( wHeight * value_b ) / max );
+ break;
- case HistogramWidget::LogScaleHistogram:
- if( value_r <= 0.0 )
- value_r = 1.0;
- if( value_g <= 0.0 )
- value_g = 1.0;
- if( value_b <= 0.0 )
- value_b = 1.0;
- yr = ( int )( ( wHeight * log( value_r ) ) / max );
- yg = ( int )( ( wHeight * log( value_g ) ) / max );
- yb = ( int )( ( wHeight * log( value_b ) ) / max );
- break;
+ case HistogramWidget::LogScaleHistogram:
+ if( value_r <= 0.0 )
+ value_r = 1.0;
+ if( value_g <= 0.0 )
+ value_g = 1.0;
+ if( value_b <= 0.0 )
+ value_b = 1.0;
+ yr = (int)( ( wHeight * log( value_r ) ) / max );
+ yg = (int)( ( wHeight * log( value_g ) ) / max );
+ yb = (int)( ( wHeight * log( value_b ) ) / max );
+ break;
- default:
- yr = 0;
- yg = 0;
- yb = 0;
- break;
+ default:
+ yr = 0;
+ yg = 0;
+ yb = 0;
+ break;
}
}
@@ -674,9 +670,9 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
if( m_channelType != HistogramWidget::ColorChannelsHistogram )
{
- if( d->selectMode == true ) // Selection mode enable ?
+ if( d->selectMode == true ) // Selection mode enable ?
{
- if( x >= ( int )( d->xmin * wWidth ) && x <= ( int )( d->xmax * wWidth ) )
+ if( x >= (int)( d->xmin * wWidth ) && x <= (int)( d->xmax * wWidth ) )
{
p1.setPen( QPen( Qt::black, 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, 0 );
@@ -711,11 +707,11 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
}
}
}
- else // All colors channel
+ else // All colors channel
{
- if( d->selectMode == true ) // Histogram selection mode enable ?
+ if( d->selectMode == true ) // Histogram selection mode enable ?
{
- if( x >= ( int )( d->xmin * wWidth ) && x <= ( int )( d->xmax * wWidth ) )
+ if( x >= (int)( d->xmin * wWidth ) && x <= (int)( d->xmax * wWidth ) )
{
p1.setPen( QPen( Qt::black, 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, 0 );
@@ -725,17 +721,17 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
- case HistogramWidget::FirstChannelColor:
- p1.drawLine( x, wHeight, x, wHeight - yr );
- break;
+ case HistogramWidget::FirstChannelColor:
+ p1.drawLine( x, wHeight, x, wHeight - yr );
+ break;
- case HistogramWidget::SecondChannelColor:
- p1.drawLine( x, wHeight, x, wHeight - yg );
- break;
+ case HistogramWidget::SecondChannelColor:
+ p1.drawLine( x, wHeight, x, wHeight - yg );
+ break;
- default:
- p1.drawLine( x, wHeight, x, wHeight - yb );
- break;
+ default:
+ p1.drawLine( x, wHeight, x, wHeight - yb );
+ break;
}
}
else
@@ -744,56 +740,56 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
- case HistogramWidget::FirstChannelColor:
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
+ case HistogramWidget::FirstChannelColor:
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- break;
+ break;
- case HistogramWidget::SecondChannelColor:
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
+ case HistogramWidget::SecondChannelColor:
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- break;
+ break;
- default:
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
+ default:
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- break;
+ break;
}
if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 )
@@ -809,65 +805,65 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
- case HistogramWidget::FirstChannelColor:
- p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
+ case HistogramWidget::FirstChannelColor:
+ p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
+ p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
+ p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- break;
+ break;
- case HistogramWidget::SecondChannelColor:
- p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
+ case HistogramWidget::SecondChannelColor:
+ p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
+ p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
+ p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- break;
+ break;
- default:
- p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yr );
- p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yg );
- p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
- p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight, x, wHeight - yb );
+ default:
+ p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yr );
+ p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yg );
+ p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
+ p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight, x, wHeight - yb );
- p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
- p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
- p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
- p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
- p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
+ p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - qMax( qMax( yr, yg ), yb ), x, 0 );
+ p1.setPen( QPen( Qt::gray, 1, Qt::SolidLine ) );
+ p1.drawLine( x, wHeight - yr - 1, x, wHeight - yr );
+ p1.drawLine( x, wHeight - yg - 1, x, wHeight - yg );
+ p1.drawLine( x, wHeight - yb - 1, x, wHeight - yb );
- break;
+ break;
}
if( x == wWidth / 4 || x == wWidth / 2 || x == 3 * wWidth / 4 )
@@ -888,25 +884,26 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
{
switch( m_channelType )
{
- case HistogramWidget::FirstChannelHistogram:
- guidePos = d->colorGuide.red();
- break;
+ case HistogramWidget::FirstChannelHistogram:
+ guidePos = d->colorGuide.red();
+ break;
- case HistogramWidget::SecondChannelHistogram:
- guidePos = d->colorGuide.green();
- break;
+ case HistogramWidget::SecondChannelHistogram:
+ guidePos = d->colorGuide.green();
+ break;
- case HistogramWidget::ThirdChannelHistogram:
- guidePos = d->colorGuide.blue();
- break;
+ case HistogramWidget::ThirdChannelHistogram:
+ guidePos = d->colorGuide.blue();
+ break;
- case HistogramWidget::LumaHistogram:
- guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green() ), d->colorGuide.blue() );
- break;
+ // case HistogramWidget::LumaHistogram:
+ // guidePos = qMax( qMax( d->colorGuide.red(), d->colorGuide.green()
+ // ), d->colorGuide.blue() );
+ // break;
- default: // Alpha.
- guidePos = -1;
- break;
+ default: // Alpha.
+ guidePos = -1;
+ break;
}
if( guidePos != -1 )
@@ -953,7 +950,7 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
tipText += cellBeg + tr( "Pixels:" ) + cellMid;
double pixels = frame->getPixels();
- tipText += value.setNum( ( float )pixels, 'f', 0 ) + cellEnd;
+ tipText += value.setNum( (float)pixels, 'f', 0 ) + cellEnd;
tipText += cellBeg + tr( "Std dev.:" ) + cellMid;
double stddev = frame->getStdDev( m_channelType, 0, frame->getHistogramSegment() - 1 );
@@ -961,7 +958,7 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
tipText += cellBeg + tr( "Selected:" ) + cellMid;
double counts = frame->getCount( m_channelType, 0, frame->getHistogramSegment() - 1 );
- tipText += value.setNum( ( float )counts, 'f', 0 ) + cellEnd;
+ tipText += value.setNum( (float)counts, 'f', 0 ) + cellEnd;
tipText += cellBeg + tr( "Median:" ) + cellMid;
double median = frame->getMedian( m_channelType, 0, frame->getHistogramSegment() - 1 );
@@ -981,14 +978,14 @@ Void HistogramWidget::paintEvent( QPaintEvent * )
p1.setPen( QPen( Qt::black, 1, Qt::SolidLine ) );
p1.drawRect( 0, 0, maxX, maxY );
- //bitBlt(this, 0, 0, &pm);
+ // bitBlt(this, 0, 0, &pm);
}
////////////////////////////////////////////////////////////////////////////////
-// Mouse Events
+// Mouse Events
////////////////////////////////////////////////////////////////////////////////
-Void HistogramWidget::mousePressEvent( QMouseEvent * e )
+Void HistogramWidget::mousePressEvent( QMouseEvent* e )
{
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
{
@@ -998,15 +995,15 @@ Void HistogramWidget::mousePressEvent( QMouseEvent * e )
update();
}
- d->xmin = ( ( double )e->pos().x() ) / ( ( double )width() );
+ d->xmin = ( (double)e->pos().x() ) / ( (double)width() );
d->xminOrg = d->xmin;
notifyValuesChanged();
- //emit signalValuesChanged( (int)(d->xmin * d->range), );
+ // emit signalValuesChanged( (int)(d->xmin * d->range), );
d->xmax = 0.0;
}
}
-Void HistogramWidget::mouseReleaseEvent( QMouseEvent * )
+Void HistogramWidget::mouseReleaseEvent( QMouseEvent* )
{
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
@@ -1016,15 +1013,15 @@ Void HistogramWidget::mouseReleaseEvent( QMouseEvent * )
if( d->xmax == 0.0 )
{
d->xmin = 0.0;
- //emit signalMinValueChanged( 0 );
- //emit signalMaxValueChanged( d->range );
+ // emit signalMinValueChanged( 0 );
+ // emit signalMaxValueChanged( d->range );
notifyValuesChanged();
update();
}
}
}
-Void HistogramWidget::mouseMoveEvent( QMouseEvent * e )
+Void HistogramWidget::mouseMoveEvent( QMouseEvent* e )
{
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
{
@@ -1032,14 +1029,15 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent * e )
if( d->inSelected )
{
- double max = ( ( double )e->pos().x() ) / ( ( double )width() );
- //int max = (int)(e->pos().x()*((float)m_imageHistogram->getHistogramSegment()/(float)width()));
+ double max = ( (double)e->pos().x() ) / ( (double)width() );
+ // int max =
+ // (int)(e->pos().x()*((float)m_imageHistogram->getHistogramSegment()/(float)width()));
if( max < d->xminOrg )
{
d->xmax = d->xminOrg;
d->xmin = max;
- //emit signalMinValueChanged( (int)(d->xmin * d->range) );
+ // emit signalMinValueChanged( (int)(d->xmin * d->range) );
}
else
{
@@ -1048,7 +1046,8 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent * e )
}
notifyValuesChanged();
- //emit signalMaxValueChanged( d->xmax == 0.0 ? d->range : (int)(d->xmax * d->range) );
+ // emit signalMaxValueChanged( d->xmax == 0.0 ? d->range : (int)(d->xmax *
+ // d->range) );
update();
}
@@ -1059,7 +1058,8 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent * e )
Void HistogramWidget::notifyValuesChanged()
{
- emit signalIntervalChanged( ( int )( d->xmin * d->range ), d->xmax == 0.0 ? d->range : ( int )( d->xmax * d->range ) );
+ emit signalIntervalChanged( (int)( d->xmin * d->range ),
+ d->xmax == 0.0 ? d->range : (int)( d->xmax * d->range ) );
}
Void HistogramWidget::slotMinValueChanged( int min )
@@ -1074,7 +1074,7 @@ Void HistogramWidget::slotMinValueChanged( int min )
}
if( min >= 0 && min < d->range )
{
- d->xmin = ( ( double )min ) / d->range;
+ d->xmin = ( (double)min ) / d->range;
}
update();
}
@@ -1092,11 +1092,8 @@ Void HistogramWidget::slotMaxValueChanged( int max )
}
else if( max > 0 && max <= d->range )
{
- d->xmax = ( ( double )max ) / d->range;
+ d->xmax = ( (double)max ) / d->range;
}
update();
}
}
-
-} // NAMESPACE
-
diff --git a/app/HistogramWidget.h b/app/HistogramWidget.h
index dee1452..53ff76d 100644
--- a/app/HistogramWidget.h
+++ b/app/HistogramWidget.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -26,32 +26,28 @@
#ifndef __HISTOGRAMWIDGET_H__
#define __HISTOGRAMWIDGET_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
-#include
-#include
+#include "config.h"
#include "lib/PlaYUVerFrame.h"
+#include
+#include
class QEvent;
-namespace plaYUVer
-{
-
class HistogramWorker;
class HistogramWidgetPrivate;
-class HistogramWidget: public QWidget
+class HistogramWidget : public QWidget
{
-Q_OBJECT
-
-public:
+ Q_OBJECT
+ public:
enum HistogramChannel
{
/** Luminance */
- LumaHistogram = 0,
+ // LumaHistogram = 0,
/** Channels */
- FirstChannelHistogram,
+ FirstChannelHistogram = 0,
SecondChannelHistogram,
ThirdChannelHistogram,
/** Alpha channel */
@@ -96,10 +92,10 @@ public:
ShowLumaChannel = 0x8,
/** Set all the options */
AllOptions = BlinkComputation | ShowStatistics | SelectMode | ShowLumaChannel
- };Q_DECLARE_FLAGS( HistogramOptions, HistogramOption )
-
-public :
+ };
+ Q_DECLARE_FLAGS( HistogramOptions, HistogramOption )
+ public:
/**
* Constructor without image data. Needed to use @p updateData() method
* after to create instance.
@@ -107,7 +103,7 @@ public :
* @param height of the widget
* @param parent the histogram widget parent
*/
- HistogramWidget( Int width, Int height, QWidget *parent = 0 );
+ HistogramWidget( Int width, Int height, QWidget* parent = 0 );
~HistogramWidget();
@@ -115,7 +111,7 @@ public :
Void stopHistogramComputation();
/** Update full image histogram data. */
- Void updateData( PlaYUVerFrame *pcFrame, PlaYUVerFrame *pcFrameSelection );
+ Void updateData( PlaYUVerFrame* pcFrame, PlaYUVerFrame* pcFrameSelection );
/** @see @p HistogramOption */
Void setOptions( HistogramOptions options = AllOptions );
@@ -126,7 +122,7 @@ public :
Void reset();
-public:
+ public:
/** Channel type to draw */
Int m_channelType;
/** Scale to use for drawing */
@@ -138,43 +134,40 @@ public:
/** Full image */
HistogramWorker* m_imageWorker;
- //PlaYUVerFrameStats* m_imageHistogram;
+ // PlaYUVerFrameStats* m_imageHistogram;
PlaYUVerFrame* m_fullImage;
/** Histogram area selection */
HistogramWorker* m_selectionWorker;
- //PlaYUVerFrameStats* m_selectionHistogram;
+ // PlaYUVerFrameStats* m_selectionHistogram;
PlaYUVerFrame* m_selectionImage;
- Q_SIGNALS:
+ Q_SIGNALS:
void signalIntervalChanged( int min, int max );
void signalMaximumValueChanged( int );
void signalHistogramComputationDone( int );
void signalHistogramComputationFailed( void );
-public Q_SLOTS:
+ public Q_SLOTS:
void slotMinValueChanged( int min );
void slotMaxValueChanged( int max );
-protected slots:
+ protected slots:
void slotBlinkTimerDone( void );
-protected:
- Void paintEvent( QPaintEvent * );
- Void mousePressEvent( QMouseEvent * e );
- Void mouseReleaseEvent( QMouseEvent * e );
- Void mouseMoveEvent( QMouseEvent * e );
+ protected:
+ Void paintEvent( QPaintEvent* );
+ Void mousePressEvent( QMouseEvent* e );
+ Void mouseReleaseEvent( QMouseEvent* e );
+ Void mouseMoveEvent( QMouseEvent* e );
-private:
- Void customEvent( QEvent *event );
+ private:
+ Void customEvent( QEvent* event );
Void notifyValuesChanged();
-private:
+ private:
HistogramWidgetPrivate* d;
};
-}
- // NAMESPACE
+Q_DECLARE_OPERATORS_FOR_FLAGS( HistogramWidget::HistogramOptions )
-Q_DECLARE_OPERATORS_FOR_FLAGS( plaYUVer::HistogramWidget::HistogramOptions )
-
-#endif // __HISTOGRAMWIDGET_H__
+#endif // __HISTOGRAMWIDGET_H__
diff --git a/app/ModuleHandleDock.cpp b/app/ModuleHandleDock.cpp
index 59f1224..f96cda1 100644
--- a/app/ModuleHandleDock.cpp
+++ b/app/ModuleHandleDock.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,17 +22,13 @@
* \brief Module handle dock
*/
-#include
#include "ModuleHandleDock.h"
-#include "PlaYUVerAppModuleIf.h"
#include "ModulesHandle.h"
+#include "PlaYUVerAppModuleIf.h"
+#include
-namespace plaYUVer
-{
-
-ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf ) :
- QWidget( parent ),
- m_pcCurrModuleIf( moduleIf )
+ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf )
+ : QWidget( parent ), m_pcCurrModuleIf( moduleIf )
{
// ----------------- Dock definition -----------------
@@ -45,7 +41,7 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* module
labelModulueReturnValue = new QLabel;
labelModulueReturnValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
- QGridLayout *modulesPropertiesLayout = new QGridLayout;
+ QGridLayout* modulesPropertiesLayout = new QGridLayout;
Int layout_line = 0;
modulesPropertiesLayout->addWidget( labelModulueValueLabel, layout_line, 0 );
modulesPropertiesLayout->addWidget( labelModulueReturnValue, layout_line, 1 );
@@ -55,12 +51,10 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* module
setLayout( modulesPropertiesLayout );
setEnabled( true );
-
}
ModuleHandleDock::~ModuleHandleDock()
{
-
}
Void ModuleHandleDock::setModulueReturnValue( Double value )
@@ -89,6 +83,3 @@ QSize ModuleHandleDock::sizeHint() const
else
return currSize;
}
-
-} // NAMESPACE
-
diff --git a/app/ModuleHandleDock.h b/app/ModuleHandleDock.h
index 1166439..4ae5819 100644
--- a/app/ModuleHandleDock.h
+++ b/app/ModuleHandleDock.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,25 +25,21 @@
#ifndef __MODULEHANDLEDOCK_H__
#define __MODULEHANDLEDOCK_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
+#include "config.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include
#elif( QT_VERSION_PLAYUVER == 4 )
-#include
#include
+#include
#endif
-
-namespace plaYUVer
-{
-
class PlaYUVerAppModuleIf;
-class ModuleHandleDock: public QWidget
+class ModuleHandleDock : public QWidget
{
-Q_OBJECT
-public:
+ Q_OBJECT
+ public:
ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf );
~ModuleHandleDock();
@@ -51,19 +47,15 @@ public:
QSize sizeHint() const;
-private:
-
+ private:
PlaYUVerAppModuleIf* m_pcCurrModuleIf;
Bool m_bIsVisible;
QLabel* labelModulueValueLabel;
QLabel* labelModulueReturnValue;
-public Q_SLOTS:
+ public Q_SLOTS:
void visibilityChangedSlot( bool );
-
};
-} // NAMESPACE
-
-#endif // __MODULEHANDLEDOCK_H__
+#endif // __MODULEHANDLEDOCK_H__
diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp
index ab4c095..0c13f68 100644
--- a/app/ModulesHandle.cpp
+++ b/app/ModulesHandle.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,24 +22,23 @@
* \brief PlaYUVer modules handle
*/
-#include
-#include "PlaYUVerApp.h"
#include "ModulesHandle.h"
-#include "PlaYUVerSubWindowHandle.h"
-#include "VideoSubWindow.h"
-#include "VideoHandle.h"
#include "DialogSubWindowSelector.h"
#include "ModulesHandleOptDialog.h"
+#include "PlaYUVerApp.h"
+#include "PlaYUVerSubWindowHandle.h"
+#include "VideoHandle.h"
+#include "VideoSubWindow.h"
#include "modules/PlaYUVerModuleFactory.h"
+#include
-namespace plaYUVer
-{
-
-ModulesHandle::ModulesHandle( QWidget* parent, PlaYUVerSubWindowHandle *windowManager, VideoHandle *moduleVideo ) :
- QWidget( parent ),
- m_pcParent( parent ),
- m_pcMainWindowManager( windowManager ),
- m_appModuleVideo( moduleVideo )
+ModulesHandle::ModulesHandle( QWidget* parent,
+ PlaYUVerSubWindowHandle* windowManager,
+ VideoHandle* moduleVideo )
+ : QWidget( parent )
+ , m_pcParent( parent )
+ , m_pcMainWindowManager( windowManager )
+ , m_appModuleVideo( moduleVideo )
{
setParent( m_pcParent );
}
@@ -53,15 +52,18 @@ Void ModulesHandle::createActions()
m_arrayActions.resize( MODULES_TOTAL_ACT );
m_pcActionMapper = new QSignalMapper( this );
- connect( m_pcActionMapper, SIGNAL( mapped(int) ), this, SLOT( processOpt(int) ) );
+ connect( m_pcActionMapper, SIGNAL( mapped( int ) ), this, SLOT( processOpt( int ) ) );
- // m_arrayActions[FORCE_PLAYING_REFRESH_ACT] = new QAction( "Refresh while playing", parent() );
- // m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setStatusTip( "Force module refreshing while playing" );
+ // m_arrayActions[FORCE_PLAYING_REFRESH_ACT] = new QAction( "Refresh while
+ // playing", parent() );
+ // m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setStatusTip( "Force module
+ // refreshing while playing" );
// m_arrayActions[FORCE_PLAYING_REFRESH_ACT]->setCheckable( true );
m_arrayActions[LOAD_EXTERNAL_ACT] = new QAction( "Load external module", parent() );
m_arrayActions[LOAD_EXTERNAL_ACT]->setStatusTip( "Load an externally build module" );
- connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this, SLOT( loadExternalModule() ) );
+ connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this,
+ SLOT( loadExternalModule() ) );
m_arrayActions[APPLY_ALL_ACT] = new QAction( "Apply to All", parent() );
m_arrayActions[APPLY_ALL_ACT]->setStatusTip( "Apply module to all frames and save the result" );
@@ -70,19 +72,23 @@ Void ModulesHandle::createActions()
m_arrayActions[SWAP_FRAMES_ACT] = new QAction( "Swap frames", parent() );
m_arrayActions[SWAP_FRAMES_ACT]->setStatusTip( "Swap Sub Window order" );
- connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
+ connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper,
+ SLOT( map() ) );
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_ACT );
m_arrayActions[DISABLE_ACT] = new QAction( "Disable Modules", parent() );
- connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this, SLOT( destroyWindowModules() ) );
+ connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this,
+ SLOT( destroyWindowModules() ) );
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
- connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
+ connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this,
+ SLOT( destroyAllModulesIf() ) );
m_arrayActions[FORCE_NEW_WINDOW_ACT] = new QAction( "Use New Window", parent() );
- m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip( "Show module result in a new window. Some modules already force this feature" );
+ m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip(
+ "Show module result in a new window. Some modules already force this "
+ "feature" );
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setCheckable( true );
-
}
QMenu* ModulesHandle::createMenu()
@@ -119,7 +125,8 @@ Void ModulesHandle::buildMenu()
{
for( Int j = 0; j < m_pcModulesSubMenuList.size(); j++ )
{
- if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) )
+ if( m_pcModulesSubMenuList.at( j )->title() ==
+ QString( pcCurrModuleIf->m_pchModuleCategory ) )
{
currSubMenu = m_pcModulesSubMenuList.at( j );
break;
@@ -158,7 +165,8 @@ Void ModulesHandle::buildMenu()
Void ModulesHandle::updateMenus()
{
- VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow =
+ qobject_cast( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcSubWindow ? true : false;
QAction* currModuleAction;
@@ -201,18 +209,21 @@ Void ModulesHandle::updateMenus()
Void ModulesHandle::readSettings()
{
QSettings appSettings;
- m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked( appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
+ m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked(
+ appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
}
Void ModulesHandle::writeSettings()
{
QSettings appSettings;
- appSettings.setValue( "ModulesHandle/UseNewWindow", m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
+ appSettings.setValue( "ModulesHandle/UseNewWindow",
+ m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
}
Void ModulesHandle::processOpt( Int index )
{
- VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow =
+ qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcSubWindow )
{
PlaYUVerAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
@@ -221,16 +232,16 @@ Void ModulesHandle::processOpt( Int index )
PlaYUVerAppModuleIf* pcCurrModule = pcCurrentModule;
switch( index )
{
- case INVALID_OPT:
- break;
- case SWAP_FRAMES_ACT:
- swapModulesWindowsIf( pcCurrModule );
- break;
- case APPLY_ALL_ACT:
- applyAllModuleIf( pcCurrModule );
- break;
- default:
- Q_ASSERT( 0 );
+ case INVALID_OPT:
+ break;
+ case SWAP_FRAMES_ACT:
+ swapModulesWindowsIf( pcCurrModule );
+ break;
+ case APPLY_ALL_ACT:
+ applyAllModuleIf( pcCurrModule );
+ break;
+ default:
+ Q_ASSERT( 0 );
}
}
emit changed();
@@ -244,10 +255,9 @@ Void ModulesHandle::loadExternalModule()
QStringList formatsList;
formatsList << "Shared Libraries (*.so)";
QStringList filter;
- filter << supported
- << formatsList
- << tr( "All Files (*)" );
- QStringList fileNames = QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
+ filter << supported << formatsList << tr( "All Files (*)" );
+ QStringList fileNames = QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(),
+ filter.join( ";;" ) );
for( Int i = 0; i < fileNames.size(); i++ )
{
@@ -259,33 +269,47 @@ Void ModulesHandle::loadExternalModule()
Void ModulesHandle::activateModule()
{
- QAction *pcAction = qobject_cast( sender() );
+ QAction* pcAction = qobject_cast( sender() );
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
Bool bTmpForceNewWindow = false;
- VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcVideoSubWindow =
+ qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( !pcVideoSubWindow )
{
return;
}
- if( ( keyModifiers & Qt::ControlModifier ) || pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
+ if( ( keyModifiers & Qt::ControlModifier ) ||
+ pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
{
bTmpForceNewWindow = true;
}
QString ModuleIfName = pcAction->data().toString();
- PlaYUVerModuleIf* pcCurrModuleIf = PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
- PlaYUVerAppModuleIf* pcCurrAppModuleIf = new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
+ PlaYUVerModuleIf* pcCurrModuleIf =
+ PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
+ PlaYUVerAppModuleIf* pcCurrAppModuleIf =
+ new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
QList videoSubWindowList;
Int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows
{
- DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager, SubWindowAbstract::VIDEO_SUBWINDOW, numberOfFrames, numberOfFrames );
- QList windowsList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ Int minNumFrames = numberOfFrames;
+ Int maxNumFrames = numberOfFrames;
+ if( numberOfFrames == MODULE_REQUIRES_SEVERAL_FRAMES )
+ {
+ minNumFrames = 0;
+ maxNumFrames = 255;
+ }
+ DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager,
+ SubWindowAbstract::VIDEO_SUBWINDOW,
+ minNumFrames, maxNumFrames );
+ QList windowsList =
+ m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
- if( windowsList.size() <= numberOfFrames )
+ if( windowsList.size() == minNumFrames && windowsList.size() == maxNumFrames )
{
for( Int i = 0; i < windowsList.size(); i++ )
{
@@ -294,7 +318,7 @@ Void ModulesHandle::activateModule()
}
else
{
- if( windowsList.size() <= numberOfFrames )
+ if( windowsList.size() <= minNumFrames )
{
for( Int i = 0; i < windowsList.size(); i++ )
{
@@ -307,7 +331,7 @@ Void ModulesHandle::activateModule()
}
if( dialogWindowsSelection.exec() == QDialog::Accepted )
{
- VideoSubWindow *videoSubWindow;
+ VideoSubWindow* videoSubWindow;
QList subWindowList = dialogWindowsSelection.getSelectedWindows();
for( Int i = 0; i < subWindowList.size(); i++ )
{
@@ -321,10 +345,12 @@ Void ModulesHandle::activateModule()
// Check for same fmt in more than one frame modules
for( Int i = 1; i < videoSubWindowList.size(); i++ )
{
- if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) )
+ if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt(
+ videoSubWindowList.at( 0 )->getCurrFrame() ) )
{
videoSubWindowList.clear();
- qobject_cast( m_pcParent )->printMessage( "Error! Incompatible frames", LOG_ERROR );
+ qobject_cast( m_pcParent )
+ ->printMessage( "Error! Incompatible frames", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -338,7 +364,8 @@ Void ModulesHandle::activateModule()
if( videoSubWindowList.size() == 0 )
{
- qobject_cast( m_pcParent )->printMessage( "Error! There is no windows to apply the module", LOG_ERROR );
+ qobject_cast( m_pcParent )
+ ->printMessage( "Error! There is no windows to apply the module", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -353,29 +380,34 @@ Void ModulesHandle::activateModule()
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf );
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
{
- qobject_cast( m_pcParent )->printMessage( "Module canceled by user!", LOG_WARNINGS );
+ qobject_cast( m_pcParent )
+ ->printMessage( "Module canceled by user!", LOG_WARNINGS );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
}
- Bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
+ Bool bShowModulesNewWindow =
+ m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
QString windowName;
VideoSubWindow* pcModuleSubWindow = NULL;
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
{
- if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
+ if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) ||
+ bShowModulesNewWindow )
{
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
windowName.append( QStringLiteral( "Module " ) );
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
- connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
- connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo,
- SLOT( zoomToFactorAll( double, QPoint ) ) );
- connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
+ connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ),
+ m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
+ connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
+ m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
+ connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ),
+ m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
}
@@ -388,10 +420,13 @@ Void ModulesHandle::activateModule()
titleDockWidget.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
titleDockWidget.append( " Information" );
pcCurrAppModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent );
- pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
- pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
+ pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable |
+ QDockWidget::DockWidgetFloatable );
+ pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea );
pcCurrAppModuleIf->m_pcDockWidget->setWidget( pcCurrAppModuleIf->m_pcModuleDock );
- qobject_cast( m_pcParent )->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
+ qobject_cast( m_pcParent )
+ ->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
}
// Associate module with subwindows
@@ -403,7 +438,7 @@ Void ModulesHandle::activateModule()
{
if( pcCurrAppModuleIf->m_pcDisplaySubWindow )
pcCurrAppModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrAppModuleIf );
- for( Int i = 0; i < numberOfFrames; i++ )
+ for( Int i = 0; i < videoSubWindowList.size(); i++ )
{
pcCurrAppModuleIf->m_pcSubWindow[i]->associateModule( pcCurrAppModuleIf );
}
@@ -414,7 +449,7 @@ Void ModulesHandle::activateModule()
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_2 )
{
std::vector apcFrameList;
- for( UInt i = 0; i < pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames; i++ )
+ for( Int i = 0; i < videoSubWindowList.size(); i++ )
{
apcFrameList.push_back( pcCurrAppModuleIf->m_pcSubWindow[i]->getCurrFrame() );
}
@@ -428,7 +463,8 @@ Void ModulesHandle::activateModule()
if( !moduleCreated )
{
- qobject_cast( m_pcParent )->printMessage( "Error! Module cannot be created", LOG_ERROR );
+ qobject_cast( m_pcParent )
+ ->printMessage( "Error! Module cannot be created", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -455,7 +491,7 @@ Void ModulesHandle::activateModule()
emit changed();
}
-Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
+Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
{
if( pcCurrModuleIf )
{
@@ -465,7 +501,8 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
Void ModulesHandle::destroyWindowModules()
{
- VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcVideoSubWindow =
+ qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcVideoSubWindow )
{
pcVideoSubWindow->disableModule();
@@ -482,7 +519,9 @@ Void ModulesHandle::destroyAllModulesIf()
emit changed();
}
-Void ModulesHandle::applyModuleIf( QList pcCurrModuleIfList, Bool isPlaying, Bool disableThreads )
+Void ModulesHandle::applyModuleIf( QList pcCurrModuleIfList,
+ Bool isPlaying,
+ Bool disableThreads )
{
for( Int i = 0; i < pcCurrModuleIfList.size() && !isPlaying; i++ )
{
@@ -490,7 +529,7 @@ Void ModulesHandle::applyModuleIf( QList pcCurrModuleIfLis
}
}
-Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
+Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
{
if( pcCurrModuleIf )
{
@@ -517,11 +556,10 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
supported.append( " )" );
QStringList filter;
- filter << supported
- << formatsList
- << tr( "All Files (*)" );
+ filter << supported << formatsList << tr( "All Files (*)" );
- QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
+ QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(),
+ filter.join( ";;" ) );
Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth();
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
@@ -530,7 +568,9 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
FrameRate = pcCurrModuleIf->m_pcSubWindow[0]->getInputStream()->getFrameRate();
pcCurrModuleIf->m_pcModuleStream = new PlaYUVerStream;
- if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel, FrameRate, false ) )
+ if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height,
+ InputFormat, BitsPixel, PLAYUVER_LITTLE_ENDIAN,
+ FrameRate, false ) )
{
delete pcCurrModuleIf->m_pcModuleStream;
pcCurrModuleIf->m_pcModuleStream = NULL;
@@ -570,7 +610,7 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
}
-Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
+Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
{
if( pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES )
{
@@ -581,18 +621,15 @@ Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
}
-Void ModulesHandle::customEvent( QEvent *event )
+Void ModulesHandle::customEvent( QEvent* event )
{
if( !event )
{
return;
}
- PlaYUVerAppModuleIf::EventData *eventData = ( PlaYUVerAppModuleIf::EventData* )event;
+ PlaYUVerAppModuleIf::EventData* eventData = (PlaYUVerAppModuleIf::EventData*)event;
if( eventData->m_bSuccess )
{
eventData->m_pcModule->show();
}
}
-
-} // NAMESPACE
-
diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h
index cb06b57..12afbbf 100644
--- a/app/ModulesHandle.h
+++ b/app/ModulesHandle.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -26,8 +26,8 @@
#include "config.h"
-#include
#include
+#include
#include
#if( QT_VERSION_PLAYUVER == 5 )
@@ -35,28 +35,25 @@
#elif( QT_VERSION_PLAYUVER == 4 )
#include
#endif
-#include "PlaYUVerAppModuleIf.h"
#include "PlaYUVerAppDefs.h"
+#include "PlaYUVerAppModuleIf.h"
#include "lib/PlaYUVerFrame.h"
-namespace plaYUVer
-{
-
class VideoHandle;
class PlaYUVerSubWindowHandle;
class PlaYUVerAppModuleIf;
class SubWindowHandle;
-class ModulesHandle: public QWidget
+class ModulesHandle : public QWidget
{
-Q_OBJECT
-public:
+ Q_OBJECT
+ public:
ModulesHandle( QWidget*, PlaYUVerSubWindowHandle*, VideoHandle* );
~ModulesHandle();
Void createActions();
QMenu* createMenu();
- //QDockWidget* createDock();
+ // QDockWidget* createDock();
Void buildMenu();
Void updateMenus();
@@ -64,9 +61,11 @@ public:
Void writeSettings();
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
- static Void applyModuleIf( QList pcCurrModuleIfList, Bool isPlaying = false, Bool disableThreads = false );
+ static Void applyModuleIf( QList pcCurrModuleIfList,
+ Bool isPlaying = false,
+ Bool disableThreads = false );
-private:
+ private:
QWidget* m_pcParent;
PlaYUVerSubWindowHandle* m_pcMainWindowManager;
VideoHandle* m_appModuleVideo;
@@ -87,7 +86,7 @@ private:
enum MODULES_ACTION_LIST
{
LOAD_EXTERNAL_ACT,
- //FORCE_PLAYING_REFRESH_ACT,
+ // FORCE_PLAYING_REFRESH_ACT,
APPLY_ALL_ACT,
SWAP_FRAMES_ACT,
DISABLE_ACT,
@@ -100,23 +99,19 @@ private:
Void enableModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
Void applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
- Void swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf );
+ Void swapModulesWindowsIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
- Void customEvent( QEvent *event );
+ Void customEvent( QEvent* event );
-Q_SIGNALS:
+ Q_SIGNALS:
void changed();
-private Q_SLOTS:
+ private Q_SLOTS:
void loadExternalModule();
void activateModule();
void processOpt( int index );
void destroyWindowModules();
void destroyAllModulesIf();
-
};
-} // NAMESPACE
-
-#endif // __MODULESHANDLE_H__
-
+#endif // __MODULESHANDLE_H__
diff --git a/app/ModulesHandleOptDialog.cpp b/app/ModulesHandleOptDialog.cpp
index 5aa5a19..d316897 100644
--- a/app/ModulesHandleOptDialog.cpp
+++ b/app/ModulesHandleOptDialog.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -23,19 +23,18 @@
*/
#include "ModulesHandleOptDialog.h"
-#include "lib/PlaYUVerProgramOptions.h"
-#include
-#include
-#include
-#include
+
#include
+#include
+#include
+#include
+#include
-namespace plaYUVer
-{
+#include "lib/PlaYUVerOptions.h"
-class OpionConfiguration: public QWidget
+class OpionConfiguration : public QWidget
{
-public:
+ public:
OpionConfiguration( OptionBase* option )
{
m_pcChecked = NULL;
@@ -68,29 +67,28 @@ public:
}
return m_pcValue->text();
}
- const std::string& getName()
- {
- return m_cName;
- }
-private:
+ const String& getName() { return m_cName; }
+ private:
QLineEdit* m_pcValue;
QCheckBox* m_pcChecked;
QLabel* m_pcDescription;
- std::string m_cName;
+ String m_cName;
};
-ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget *parent, PlaYUVerAppModuleIf *pcCurrModuleIf ) :
- QDialog( parent ),
- m_pcCurrModuleIf( pcCurrModuleIf )
+ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent,
+ PlaYUVerAppModuleIf* pcCurrModuleIf )
+ : QDialog( parent ), m_pcCurrModuleIf( pcCurrModuleIf )
{
resize( 400, 10 );
setWindowTitle( "Select module parameters" );
- const Options::OptionsList& moduleOptions = m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
+ const PlaYUVerOptions::OptionsList& moduleOptions =
+ m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
QVBoxLayout* optionsLayout = new QVBoxLayout;
OpionConfiguration* pcOption;
- for( Options::OptionsList::const_iterator it = moduleOptions.begin(); it != moduleOptions.end(); ++it )
+ for( PlaYUVerOptions::OptionsList::const_iterator it = moduleOptions.begin();
+ it != moduleOptions.end(); ++it )
{
pcOption = new OpionConfiguration( ( *it )->opt );
m_apcOptionList.append( pcOption );
@@ -120,8 +118,8 @@ Int ModulesHandleOptDialog::runConfiguration()
return QDialog::Rejected;
}
- std::vector argsArray;
- std::string optionString;
+ std::vector argsArray;
+ String optionString;
QString valueString( "" );
for( Int i = 0; i < m_apcOptionList.size(); i++ )
@@ -142,9 +140,7 @@ Int ModulesHandleOptDialog::runConfiguration()
}
if( argsArray.size() > 0 )
{
- m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.scanArgs( argsArray );
+ m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.parse( argsArray );
}
return QDialog::Accepted;
}
-
-} // NAMESPACE
diff --git a/app/ModulesHandleOptDialog.h b/app/ModulesHandleOptDialog.h
index bb7eac2..2451121 100644
--- a/app/ModulesHandleOptDialog.h
+++ b/app/ModulesHandleOptDialog.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,32 +25,28 @@
#ifndef __MODULEHANDLEOPTDIALOG_H__
#define __MODULEHANDLEOPTDIALOG_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
#include "PlaYUVerAppModuleIf.h"
+#include "config.h"
#include
#include
-namespace plaYUVer
-{
-
class OpionConfiguration;
/**
*
*/
-class ModulesHandleOptDialog: public QDialog
+class ModulesHandleOptDialog : public QDialog
{
-Q_OBJECT
+ Q_OBJECT
-public:
- ModulesHandleOptDialog( QWidget *parent, PlaYUVerAppModuleIf *pcCurrModuleIf );
+ public:
+ ModulesHandleOptDialog( QWidget* parent, PlaYUVerAppModuleIf* pcCurrModuleIf );
Int runConfiguration();
-private:
- PlaYUVerAppModuleIf *m_pcCurrModuleIf;
+
+ private:
+ PlaYUVerAppModuleIf* m_pcCurrModuleIf;
QVector m_apcOptionList;
};
-} // NAMESPACE
-
-#endif // __MODULEHANDLEOPTDIALOG_H__
+#endif // __MODULEHANDLEOPTDIALOG_H__
diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp
index 0d40fab..c1ef172 100644
--- a/app/PlaYUVerApp.cpp
+++ b/app/PlaYUVerApp.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,43 +22,37 @@
* \brief Main definition of the PlaYUVerApp app
*/
-#include
+#include "PlaYUVerApp.h"
+#include
+#include
#include
+#include
#include
#include
-#include
-#include
-#include
#include
-#include "PlaYUVerApp.h"
+#include
#ifdef USE_FERVOR
#include "fvupdater.h"
#endif
-#include "lib/PlaYUVerCmdParser.h"
-#include "PlaYUVerSubWindowHandle.h"
#include "AboutDialog.h"
-#include "SubWindowAbstract.h"
-#include "VideoSubWindow.h"
-#include "VideoHandle.h"
-#include "QualityHandle.h"
-#include "ModulesHandle.h"
#include "DialogSubWindowSelector.h"
+#include "ModulesHandle.h"
+#include "PlaYUVerSubWindowHandle.h"
+#include "QualityHandle.h"
+#include "SubWindowAbstract.h"
+#include "VideoHandle.h"
+#include "VideoSubWindow.h"
+#include "lib/PlaYUVerOptions.h"
#define SYNCHRONISED_ZOON 1
-namespace plaYUVer
+PlaYUVerApp::PlaYUVerApp()
+ : m_pcCurrentSubWindow( NULL ), m_pcCurrentVideoSubWindow( NULL ), m_pcAboutDialog( NULL )
{
-
-PlaYUVerApp::PlaYUVerApp() :
- m_pcCurrentSubWindow( NULL ),
- m_pcCurrentVideoSubWindow( NULL ),
- m_pcAboutDialog( NULL )
-{
-
setWindowModality( Qt::ApplicationModal );
setWindowModality( Qt::NonModal );
- // DBus
+// DBus
#ifdef USE_QTDBUS
m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
#endif
@@ -90,44 +84,43 @@ PlaYUVerApp::PlaYUVerApp() :
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
-
}
-Bool PlaYUVerApp::parseArgs( Int argc, Char *argv[] )
+Bool PlaYUVerApp::parseArgs( Int argc, Char* argv[] )
{
Bool bRet = false;
- m_pcCmdParser = new PlaYUVerCmdParser();
- m_pcCmdParser->config( argc, argv );
+ PlaYUVerOptions pcCmdParser;
- std::vector m_apcInputs;
- std::string strResolution( "" );
- std::string strPelFmt( "" );
+ std::vector m_apcInputs;
+ String strResolution( "" );
+ String strPelFmt( "" );
- m_pcCmdParser->Opts().addOptions()/**/
- ( "input,i", m_apcInputs, "input file" ) /**/
- ( "size,s", strResolution, "size (WxH)" ) /**/
- ( "pel_fmt", strPelFmt, "pixel format" );
+ pcCmdParser.addOptions() /**/
+ ( "input,i", m_apcInputs, "input file" ) /**/
+ ( "size,s", strResolution, "size (WxH)" ) /**/
+ ( "pel_fmt", strPelFmt, "pixel format" );
- if( !m_pcCmdParser->parse() )
+ if( !pcCmdParser.parse( argc, argv ) )
{
bRet |= true;
}
- if( m_pcCmdParser->Opts()["help"]->count() )
+ if( pcCmdParser.hasOpt( "help" ) )
{
printf( "Usage: %s [options] input_file[s]\n", argv[0] );
- m_pcCmdParser->Opts().doHelp( std::cout );
+ pcCmdParser.doHelp( std::cout );
bRet |= true;
}
- if( m_pcCmdParser->Opts()["input"]->count() )
+ if( pcCmdParser.hasOpt( "input" ) )
{
for( UInt i = 1; i < m_apcInputs.size(); i++ )
{
loadFile( QString::fromStdString( m_apcInputs[i] ) );
}
}
- std::list& argv_unhandled = m_pcCmdParser->getNoArgs();
- for( std::list::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
+ std::list& argv_unhandled = pcCmdParser.getUnhandledArgs();
+ for( std::list::const_iterator it = argv_unhandled.begin();
+ it != argv_unhandled.end(); it++ )
{
loadFile( QString::fromStdString( *it ) );
}
@@ -143,7 +136,7 @@ Void PlaYUVerApp::about()
m_pcAboutDialog->exec();
}
-Void PlaYUVerApp::closeEvent( QCloseEvent *event )
+Void PlaYUVerApp::closeEvent( QCloseEvent* event )
{
Int mayCloseAll = true;
Int msgBoxCloseRet = QMessageBox::Yes;
@@ -151,35 +144,36 @@ Void PlaYUVerApp::closeEvent( QCloseEvent *event )
QList subWindowList = m_pcWindowHandle->findSubWindow();
if( subWindowList.size() >= 1 )
{
- QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!", QMessageBox::Yes | QMessageBox::No, this );
+ QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!",
+ QMessageBox::Yes | QMessageBox::No, this );
msgBoxClose.setDefaultButton( QMessageBox::No );
msgBoxClose.setInformativeText( "Close all?" );
msgBoxCloseRet = msgBoxClose.exec();
}
switch( msgBoxCloseRet )
{
- case QMessageBox::Yes:
- mayCloseAll = true;
- for( Int i = 0; i < subWindowList.size(); i++ )
- {
- mayCloseAll &= subWindowList.at( i )->mayClose();
- }
+ case QMessageBox::Yes:
+ mayCloseAll = true;
+ for( Int i = 0; i < subWindowList.size(); i++ )
+ {
+ mayCloseAll &= subWindowList.at( i )->mayClose();
+ }
- if( mayCloseAll )
- {
- //m_pcPlayingTimer->stop();
- closeAll();
- writeSettings();
- event->accept();
- }
- else
- {
+ if( mayCloseAll )
+ {
+ // m_pcPlayingTimer->stop();
+ closeAll();
+ writeSettings();
+ event->accept();
+ }
+ else
+ {
+ event->ignore();
+ }
+ break;
+ case QMessageBox::No:
+ default:
event->ignore();
- }
- break;
- case QMessageBox::No:
- default:
- event->ignore();
}
}
@@ -195,18 +189,20 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
printMessage( "File " + fileName + " do not exist!", LOG_ERROR );
return;
}
- VideoSubWindow *videoSubWindow = PlaYUVerApp::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
+ VideoSubWindow* videoSubWindow =
+ PlaYUVerApp::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
if( videoSubWindow )
{
m_pcWindowHandle->setActiveSubWindow( videoSubWindow );
return;
}
- videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); //createSubWindow();
- SubWindowAbstract *subWindow = videoSubWindow;
+ videoSubWindow =
+ new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
+ SubWindowAbstract* subWindow = videoSubWindow;
if( !pStreamInfo )
{
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
- pStreamInfo = ( PlaYUVerStreamInfo* )( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
+ pStreamInfo = (PlaYUVerStreamInfo*)( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
}
try
@@ -224,9 +220,12 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
m_pcWindowHandle->addSubWindow( videoSubWindow );
videoSubWindow->show();
- connect( subWindow, SIGNAL( aboutToClose( SubWindowAbstract* ) ), m_appModuleVideo, SLOT( closeSubWindow( SubWindowAbstract* ) ) );
- connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
- connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
+ connect( subWindow, SIGNAL( aboutToClose( SubWindowAbstract* ) ), m_appModuleVideo,
+ SLOT( closeSubWindow( SubWindowAbstract* ) ) );
+ connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
+ m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
+ connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
+ SLOT( moveAllScrollBars( const QPoint ) ) );
videoSubWindow->zoomToFit();
updateZoomFactorSBox();
@@ -243,10 +242,11 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
videoSubWindow->close();
}
}
- catch( const char *msg )
+ catch( PlaYUVerFailure& e )
{
videoSubWindow->close();
- QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + msg;
+ QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() +
+ " with the following error: \n" + e.what();
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
printMessage( warningMsg, LOG_ERROR );
}
@@ -274,11 +274,10 @@ Void PlaYUVerApp::open()
supported.append( " )" );
QStringList filter;
- filter << supported
- << formatsList
- << tr( "All Files (*)" );
+ filter << supported << formatsList << tr( "All Files (*)" );
- QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
+ QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ),
+ m_cLastOpenPath, filter.join( ";;" ) );
for( Int i = 0; i < fileNameList.size(); i++ )
{
@@ -289,9 +288,14 @@ Void PlaYUVerApp::open()
}
}
+// Void PlaYUVerApp::openDevice()
+//{
+// loadFile( "/dev/video0", NULL );
+//}
+
Void PlaYUVerApp::openRecent()
{
- QAction *action = qobject_cast( sender() );
+ QAction* action = qobject_cast( sender() );
PlaYUVerStreamInfo recentFile = action->data().value();
if( action )
loadFile( recentFile.m_cFilename, &recentFile );
@@ -301,11 +305,11 @@ Void PlaYUVerApp::save()
{
if( m_pcCurrentVideoSubWindow )
{
- VideoSubWindow *saveWindow = m_pcCurrentVideoSubWindow;
+ VideoSubWindow* saveWindow = m_pcCurrentVideoSubWindow;
QString supported = tr( "Supported Files (" );
QStringList formatsList;
- std::vector supportedFmts = PlaYUVerStream::supportedSaveFormats();
+ std::vector supportedFmts = PlaYUVerStream::supportedWriteFormats();
for( UInt i = 0; i < supportedFmts.size(); i++ )
{
QString currFmt;
@@ -320,19 +324,25 @@ Void PlaYUVerApp::save()
supported.append( " )" );
QStringList filter;
- filter << supported
- << formatsList
- << tr( "All Files (*)" );
+ filter << supported << formatsList << tr( "All Files (*)" );
- QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), QString(), filter.join( ";;" ) );
+ QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath,
+ filter.join( ";;" ) );
if( !fileName.isEmpty() )
{
m_cLastOpenPath = QFileInfo( fileName ).path();
- if( !saveWindow->save( fileName ) )
+ try
+ {
+ saveWindow->save( fileName );
+ }
+ catch( PlaYUVerFailure& e )
{
QApplication::restoreOverrideCursor();
- QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot save file %1" ).arg( fileName ) );
+ QString warningMsg = "Cannot save file " + QFileInfo( fileName ).fileName() +
+ " with the following error: \n" + e.what();
+ QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
+ printMessage( warningMsg, LOG_ERROR );
return;
}
}
@@ -351,12 +361,14 @@ Void PlaYUVerApp::format()
addStreamInfoToRecentList( pcVideoSubWindow->getStreamInfo() );
}
}
- catch( const char *msg )
+ catch( PlaYUVerFailure& e )
{
- QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + msg;
+ QString warningMsg = "Cannot change format of " +
+ QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() +
+ " with the following error: \n" + e.what();
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
printMessage( warningMsg, LOG_ERROR );
- qDebug( ) << warningMsg;
+ qDebug() << warningMsg;
m_pcCurrentSubWindow->close();
}
m_pcCurrentSubWindow = NULL;
@@ -376,15 +388,15 @@ Void PlaYUVerApp::reload()
Void PlaYUVerApp::reloadAll()
{
- UInt windowCategoryOrder[] =
- {
- SubWindowAbstract::VIDEO_STREAM_SUBWINDOW,
- SubWindowAbstract::MODULE_SUBWINDOW,
- SubWindowAbstract::MODULE_SUBWINDOW };
+ UInt windowCategoryOrder[] = {
+ SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, SubWindowAbstract::MODULE_SUBWINDOW,
+ SubWindowAbstract::MODULE_SUBWINDOW,
+ };
for( UInt c = 0; c < 3; c++ )
{
- QList subWindowList = m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
+ QList subWindowList =
+ m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindowList.at( i )->refreshSubWindow();
@@ -426,13 +438,13 @@ Void PlaYUVerApp::zoomToFit()
Void PlaYUVerApp::zoomToFitAll()
{
- VideoSubWindow *videoSubWindow;
- QList subWindowList = m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ VideoSubWindow* videoSubWindow;
+ QList subWindowList =
+ m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = qobject_cast( subWindowList.at( i ) );
videoSubWindow->zoomToFit();
-
}
if( m_pcCurrentSubWindow )
updateZoomFactorSBox();
@@ -449,7 +461,7 @@ Void PlaYUVerApp::scaleFrame( int ratio )
Void PlaYUVerApp::zoomFromSBox( double zoom )
{
- SubWindowAbstract *activeSubWindow = m_pcWindowHandle->activeSubWindow();
+ SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
Double factor = zoom / 100;
if( activeSubWindow )
{
@@ -469,16 +481,16 @@ Void PlaYUVerApp::updateZoomFactorSBox()
// ----------------------- Drag and drop functions ----------------------
-Void PlaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
+Void PlaYUVerApp::dragEnterEvent( QDragEnterEvent* event )
{
- //setText(tr(""));
- //mdiArea->setBackgroundRole( QPalette::Highlight );
+ // setText(tr(""));
+ // mdiArea->setBackgroundRole( QPalette::Highlight );
event->acceptProposedAction();
}
-Void PlaYUVerApp::dropEvent( QDropEvent *event )
+Void PlaYUVerApp::dropEvent( QDropEvent* event )
{
- const QMimeData *mimeData = event->mimeData();
+ const QMimeData* mimeData = event->mimeData();
QList urlList = mimeData->urls();
if( urlList.size() == 1 )
{
@@ -490,11 +502,13 @@ Void PlaYUVerApp::dropEvent( QDropEvent *event )
// ----------------------- Sub Window Functions -----------------------
-VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager, const QString& fileName )
+VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
+ const QString& fileName )
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
VideoSubWindow* pcSubWindow;
- QList subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList =
+ windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -508,9 +522,9 @@ VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHa
Void PlaYUVerApp::update()
{
- SubWindowAbstract *activeSubWindow = m_pcWindowHandle->activeSubWindow();
+ SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
QCoreApplication::processEvents();
-//if( activeSubWindow() != m_pcCurrentSubWindow )
+ // if( activeSubWindow() != m_pcCurrentSubWindow )
{
m_pcCurrentSubWindow = NULL;
m_pcCurrentVideoSubWindow = NULL;
@@ -601,6 +615,10 @@ Void PlaYUVerApp::createActions()
m_arrayActions[OPEN_ACT]->setStatusTip( tr( "Open stream" ) );
connect( m_arrayActions[OPEN_ACT], SIGNAL( triggered() ), this, SLOT( open() ) );
+ // m_arrayActions[OPEN_DEVICE_ACT] = new QAction( tr( "&Open Capture Device" ), this );
+ // m_arrayActions[OPEN_DEVICE_ACT]->setStatusTip( tr( "Open capture device (webcam)" ) );
+ // connect( m_arrayActions[OPEN_DEVICE_ACT], SIGNAL( triggered() ), this, SLOT( openDevice() ) );
+
m_arrayRecentFilesActions.resize( MAX_RECENT_FILES );
for( Int i = 0; i < MAX_RECENT_FILES; i++ )
{
@@ -616,7 +634,8 @@ Void PlaYUVerApp::createActions()
connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) );
m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this );
- m_arrayActions[FORMAT_ACT]->setIcon( QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
+ m_arrayActions[FORMAT_ACT]->setIcon(
+ QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
m_arrayActions[FORMAT_ACT]->setShortcut( Qt::CTRL + Qt::Key_F );
m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) );
connect( m_arrayActions[FORMAT_ACT], SIGNAL( triggered() ), this, SLOT( format() ) );
@@ -640,11 +659,13 @@ Void PlaYUVerApp::createActions()
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
- connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeActiveSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
+ SLOT( removeActiveSubWindow() ) );
m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
- connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) );
+ connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
+ SLOT( removeAllSubWindow() ) );
m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this );
m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit );
@@ -653,35 +674,41 @@ Void PlaYUVerApp::createActions()
// ------------ View ------------
mapperZoom = new QSignalMapper( this );
- connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) );
+ connect( mapperZoom, SIGNAL( mapped( int ) ), this, SLOT( scaleFrame( int ) ) );
m_arrayActions[ZOOM_IN_ACT] = new QAction( tr( "Zoom &In (+25%)" ), this );
- m_arrayActions[ZOOM_IN_ACT]->setIcon( QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
+ m_arrayActions[ZOOM_IN_ACT]->setIcon(
+ QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
m_arrayActions[ZOOM_IN_ACT]->setShortcut( tr( "Ctrl++" ) );
m_arrayActions[ZOOM_IN_ACT]->setStatusTip( tr( "Scale the image up by 25%" ) );
connect( m_arrayActions[ZOOM_IN_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
mapperZoom->setMapping( m_arrayActions[ZOOM_IN_ACT], 125 );
m_arrayActions[ZOOM_OUT_ACT] = new QAction( tr( "Zoom &Out (-25%)" ), this );
- m_arrayActions[ZOOM_OUT_ACT]->setIcon( QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
+ m_arrayActions[ZOOM_OUT_ACT]->setIcon(
+ QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
m_arrayActions[ZOOM_OUT_ACT]->setShortcut( tr( "Ctrl+-" ) );
m_arrayActions[ZOOM_OUT_ACT]->setStatusTip( tr( "Scale the image down by 25%" ) );
connect( m_arrayActions[ZOOM_OUT_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
mapperZoom->setMapping( m_arrayActions[ZOOM_OUT_ACT], 80 );
m_arrayActions[ZOOM_NORMAL_ACT] = new QAction( tr( "&Normal Size" ), this );
- m_arrayActions[ZOOM_NORMAL_ACT]->setIcon( QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
+ m_arrayActions[ZOOM_NORMAL_ACT]->setIcon(
+ QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
m_arrayActions[ZOOM_NORMAL_ACT]->setShortcut( tr( "Ctrl+N" ) );
m_arrayActions[ZOOM_NORMAL_ACT]->setStatusTip( tr( "Show the image at its original size" ) );
connect( m_arrayActions[ZOOM_NORMAL_ACT], SIGNAL( triggered() ), this, SLOT( normalSize() ) );
m_arrayActions[ZOOM_FIT_ACT] = new QAction( tr( "Zoom to &Fit" ), this );
- m_arrayActions[ZOOM_FIT_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
+ m_arrayActions[ZOOM_FIT_ACT]->setIcon(
+ QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) );
connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) );
m_arrayActions[ZOOM_FIT_ALL_ACT] = new QAction( tr( "Zoom to Fit All" ), this );
-//m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
+ // m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme(
+ // "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) )
+ // );
m_arrayActions[ZOOM_FIT_ALL_ACT]->setStatusTip( tr( "Apply zoom to fit to all windows" ) );
connect( m_arrayActions[ZOOM_FIT_ALL_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFitAll() ) );
@@ -695,7 +722,8 @@ Void PlaYUVerApp::createActions()
#ifdef USE_FERVOR
m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this );
m_arrayActions[UPDATE_ACT]->setStatusTip( tr( "Check for updates" ) );
- connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(), SLOT( CheckForUpdatesNotSilent() ) );
+ connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(),
+ SLOT( CheckForUpdatesNotSilent() ) );
#endif
m_arrayActions[ABOUT_ACT] = new QAction( tr( "&About" ), this );
@@ -714,6 +742,7 @@ Void PlaYUVerApp::createMenus()
m_arrayMenu[FILE_MENU] = menuBar()->addMenu( tr( "&File" ) );
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[OPEN_ACT] );
+ // m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[OPEN_DEVICE_ACT] );
m_arrayMenu[RECENT_MENU] = m_arrayMenu[FILE_MENU]->addMenu( tr( "Open Recent" ) );
for( Int i = 0; i < MAX_RECENT_FILES; ++i )
{
@@ -739,12 +768,12 @@ Void PlaYUVerApp::createMenus()
m_arrayMenu[VIEW_MENU]->addSeparator();
-// createPopupMenu() Returns a popup menu containing checkable entries for
-// the toolbars and dock widgets present in the main window.
+ // createPopupMenu() Returns a popup menu containing checkable entries for
+ // the toolbars and dock widgets present in the main window.
m_arrayMenu[DOCK_VIEW_MENU] = createPopupMenu();
if( m_arrayMenu[DOCK_VIEW_MENU] )
{
- QAction *actionPopupMenu = m_arrayMenu[VIEW_MENU]->addMenu( m_arrayMenu[DOCK_VIEW_MENU] );
+ QAction* actionPopupMenu = m_arrayMenu[VIEW_MENU]->addMenu( m_arrayMenu[DOCK_VIEW_MENU] );
actionPopupMenu->setText( tr( "&Toolbars/Docks" ) );
}
@@ -766,7 +795,6 @@ Void PlaYUVerApp::createMenus()
m_arrayMenu[ABOUT_MENU]->addSeparator();
m_arrayMenu[ABOUT_MENU]->addAction( m_arrayActions[ABOUT_ACT] );
m_arrayMenu[ABOUT_MENU]->addAction( m_arrayActions[ABOUTQT_ACT] );
-
}
Void PlaYUVerApp::createToolBars()
@@ -790,7 +818,8 @@ Void PlaYUVerApp::createToolBars()
m_pcZoomFactorSBox->setSingleStep( 10.0 );
m_pcZoomFactorSBox->setValue( 100.0 );
m_pcZoomFactorSBox->setSuffix( "%" );
- connect( m_pcZoomFactorSBox, SIGNAL( valueChanged(double) ), this, SLOT( zoomFromSBox(double) ) );
+ connect( m_pcZoomFactorSBox, SIGNAL( valueChanged( double ) ), this,
+ SLOT( zoomFromSBox( double ) ) );
m_arrayToolBars[VIEW_TOOLBAR]->addWidget( m_pcZoomFactorSBox );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_IN_ACT] );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
@@ -801,12 +830,11 @@ Void PlaYUVerApp::createToolBars()
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[VIEW_TOOLBAR] );
addToolBar( Qt::TopToolBarArea, m_appModuleVideo->createToolBar() );
-
}
Void PlaYUVerApp::createDockWidgets()
{
-// Properties Dock Window
+ // Properties Dock Window
m_arraySideBars.resize( TOTAL_DOCK );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() );
@@ -841,7 +869,8 @@ Void PlaYUVerApp::updateRecentFileActions()
m_arrayRecentFilesActions.at( actionIdx )->setText( QFileInfo( text ).fileName() );
m_arrayRecentFilesActions.at( actionIdx )->setToolTip( "Open File " + text );
m_arrayRecentFilesActions.at( actionIdx )->setStatusTip( "Open File " + text );
- m_arrayRecentFilesActions.at( actionIdx )->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) );
+ m_arrayRecentFilesActions.at( actionIdx )
+ ->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) );
m_arrayRecentFilesActions.at( actionIdx )->setVisible( true );
actionIdx++;
}
@@ -915,5 +944,3 @@ Void PlaYUVerApp::writeSettings()
m_appModuleExtensions->writeSettings();
m_pcWindowHandle->writeSettings();
}
-
-} // NAMESPACE
diff --git a/app/PlaYUVerApp.h b/app/PlaYUVerApp.h
index 7f26498..0e041b0 100644
--- a/app/PlaYUVerApp.h
+++ b/app/PlaYUVerApp.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -36,11 +36,11 @@
#ifndef __PLAYUVERAPP_H__
#define __PLAYUVERAPP_H__
+#include "PlaYUVerAppDefs.h"
#include "config.h"
#include
-#include
#include
-#include "PlaYUVerAppDefs.h"
+#include
#ifdef USE_QTDBUS
#include "PlaYUVerAppAdaptor.h"
#endif
@@ -54,10 +54,7 @@ class QActionGroup;
class QAction;
class QSignalMapper;
-namespace plaYUVer
-{
-
-class PlaYUVerCmdParser;
+class PlaYUVerOptions;
class PlaYUVerStream;
class PlaYUVerSubWindowHandle;
class VideoHandle;
@@ -68,23 +65,23 @@ class VideoSubWindow;
class SubWindowAbstract;
class AboutDialog;
-class PlaYUVerApp: public QMainWindow
+class PlaYUVerApp : public QMainWindow
{
-Q_OBJECT
+ Q_OBJECT
-public:
+ public:
PlaYUVerApp();
- Bool parseArgs( Int argc, Char *argv[] );
+ Bool parseArgs( Int argc, Char* argv[] );
Void loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo = NULL );
-public Q_SLOTS:
+ public Q_SLOTS:
void printMessage( const QString& msg );
void printMessage( const QString& msg, UInt logLevel );
-protected:
- Void closeEvent( QCloseEvent *event );
+ protected:
+ Void closeEvent( QCloseEvent* event );
-private Q_SLOTS:
+ private Q_SLOTS:
void about();
@@ -92,6 +89,7 @@ private Q_SLOTS:
* File functions slots
*/
void open();
+ // void openDevice();
void openRecent();
void save();
void format();
@@ -111,16 +109,15 @@ private Q_SLOTS:
void zoomToFit();
void zoomToFitAll();
- void dragEnterEvent( QDragEnterEvent *event );
- void dropEvent( QDropEvent *event );
+ void dragEnterEvent( QDragEnterEvent* event );
+ void dropEvent( QDropEvent* event );
void update();
void updateZoomFactorSBox();
-private:
-
+ private:
PlaYUVerAppAdaptor* m_pDBusAdaptor;
- PlaYUVerCmdParser* m_pcCmdParser;
+ PlaYUVerOptions* m_pcCmdParser;
/**
* Save the current subwindow for every category
*/
@@ -129,7 +126,8 @@ private:
QString m_cLastOpenPath;
- static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager, const QString& fileName );
+ static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
+ const QString& fileName );
Void updateMenus();
@@ -146,10 +144,10 @@ private:
Void readSettings();
Void writeSettings();
- QDoubleSpinBox *m_pcZoomFactorSBox;
+ QDoubleSpinBox* m_pcZoomFactorSBox;
- QSignalMapper *mapperZoom;
- QSignalMapper *mapperWindow;
+ QSignalMapper* mapperZoom;
+ QSignalMapper* mapperWindow;
/**
* App modules
@@ -159,7 +157,7 @@ private:
*/
VideoHandle* m_appModuleVideo;
QualityHandle* m_appModuleQuality;
- ModulesHandle *m_appModuleExtensions;
+ ModulesHandle* m_appModuleExtensions;
PlaYUVerSubWindowHandle* m_pcWindowHandle;
/**
@@ -210,6 +208,7 @@ private:
enum APP_ACTION_LIST
{
OPEN_ACT = 0,
+ OPEN_DEVICE_ACT,
SAVE_ACT,
FORMAT_ACT,
RELOAD_ACT,
@@ -237,7 +236,4 @@ private:
AboutDialog* m_pcAboutDialog;
};
-} // NAMESPACE
-
-#endif // __PLAYUVERAPP_H__
-
+#endif // __PLAYUVERAPP_H__
diff --git a/app/PlaYUVerAppAdaptor.cpp b/app/PlaYUVerAppAdaptor.cpp
index ff1d86d..bdddbbb 100644
--- a/app/PlaYUVerAppAdaptor.cpp
+++ b/app/PlaYUVerAppAdaptor.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,19 +22,16 @@
* \brief Define function to manage the interface in DBus
*/
-#include
#include "PlaYUVerAppAdaptor.h"
#include "PlaYUVerApp.h"
+#include
-namespace plaYUVer
-{
-
-PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp *app ) :
- QDBusAbstractAdaptor( app ),
- m_app( app )
+PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp* app )
+ : QDBusAbstractAdaptor( app ), m_app( app )
{
// application dbus interface
- QDBusConnection::sessionBus().registerObject( QStringLiteral( PLAYUVER_DBUS_PATH ), this, QDBusConnection::ExportAllSlots );
+ QDBusConnection::sessionBus().registerObject( QStringLiteral( PLAYUVER_DBUS_PATH ), this,
+ QDBusConnection::ExportAllSlots );
}
PlaYUVerAppAdaptor::~PlaYUVerAppAdaptor()
@@ -49,12 +46,11 @@ void PlaYUVerAppAdaptor::activate()
return;
}
m_app->raise();
-
}
QString PlaYUVerAppAdaptor::activeSession()
{
- //return m_app->sessionManager()->activeSession()->name();
+ // return m_app->sessionManager()->activeSession()->name();
return QString( "PlaYUVer" );
}
@@ -63,5 +59,3 @@ bool PlaYUVerAppAdaptor::loadFile( const QString& filename )
m_app->loadFile( filename );
return true;
}
-
-} // NAMESPACE
diff --git a/app/PlaYUVerAppAdaptor.h b/app/PlaYUVerAppAdaptor.h
index ae64e69..d57236a 100644
--- a/app/PlaYUVerAppAdaptor.h
+++ b/app/PlaYUVerAppAdaptor.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -29,31 +29,28 @@
#include
#include
#include
-#include
#include
-
-namespace plaYUVer
-{
+#include
#define PLAYUVER_DBUS_SESSION_NAME "org.pixlra.PlaYUVer.application"
#define PLAYUVER_DBUS_PATH "/MainApplication"
class PlaYUVerApp;
-class PlaYUVerAppAdaptor: public QDBusAbstractAdaptor
+class PlaYUVerAppAdaptor : public QDBusAbstractAdaptor
{
-Q_OBJECT
-Q_CLASSINFO("D-Bus Interface", "org.pixlra.PlaYUVer.application")
-Q_PROPERTY(QString activeSession READ activeSession)
-public:
- PlaYUVerAppAdaptor( PlaYUVerApp *app );
+ Q_OBJECT
+ Q_CLASSINFO( "D-Bus Interface", "org.pixlra.PlaYUVer.application" )
+ Q_PROPERTY( QString activeSession READ activeSession )
+ public:
+ PlaYUVerAppAdaptor( PlaYUVerApp* app );
~PlaYUVerAppAdaptor();
/**
* emit the exiting signal
*/
- //void emitExiting();
- //void emitDocumentClosed(const QString &token);
-public Q_SLOTS:
+ // void emitExiting();
+ // void emitDocumentClosed(const QString &token);
+ public Q_SLOTS:
/**
* open a file with given url and encoding
* will get view created
@@ -68,20 +65,19 @@ public Q_SLOTS:
*/
void activate();
-Q_SIGNALS:
+ Q_SIGNALS:
/**
* Notify the world that this kate instance is exiting.
- * All apps should stop using the dbus interface of this instance after this signal got emitted.
+ * All apps should stop using the dbus interface of this instance after this
+ * signal got emitted.
*/
- //void exiting();
- //void documentClosed(const QString &token);
-public:
+ // void exiting();
+ // void documentClosed(const QString &token);
+ public:
QString activeSession();
-private:
- PlaYUVerApp *m_app;
+
+ private:
+ PlaYUVerApp* m_app;
};
-} // NAMESPACE
-
-#endif // __PlaYUVerAppAdaptor_H__
-
+#endif // __PlaYUVerAppAdaptor_H__
diff --git a/app/PlaYUVerAppDefs.h b/app/PlaYUVerAppDefs.h
index 418a6e5..656ce56 100644
--- a/app/PlaYUVerAppDefs.h
+++ b/app/PlaYUVerAppDefs.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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,6 @@
#include "lib/PlaYUVerDefs.h"
-namespace plaYUVer
-{
-
// ====================================================================================================================
// Qt compatibility redefinition
// ====================================================================================================================
@@ -38,10 +35,7 @@ namespace plaYUVer
// fallback, return a temporary QString
// source code is assumed to be encoded in UTF-8
-# define QStringLiteral(str) QString::fromUtf8("" str "", sizeof(str) - 1)
+#define QStringLiteral( str ) QString::fromUtf8( "" str "", sizeof( str ) - 1 )
#endif
-
-} // NAMESPACE
-
-#endif // __PLAYUVERAPPDEFS_H__
+#endif // __PLAYUVERAPPDEFS_H__
diff --git a/app/PlaYUVerAppModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp
index e1ff8f0..9d5c38a 100644
--- a/app/PlaYUVerAppModuleIf.cpp
+++ b/app/PlaYUVerAppModuleIf.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -26,22 +26,21 @@
#include "VideoSubWindow.h"
#include "VideoSubWindow.h"
-namespace plaYUVer
-{
-
-PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module ) :
- m_bIsRunning( false ),
- m_pcModuleAction( action ),
- m_pcModule( module ),
- m_pcDisplaySubWindow( NULL ),
- m_pcDockWidget( NULL ),
- m_pcModuleDock( NULL ),
- m_pcModuleStream( NULL ),
- m_pcProcessedFrame( NULL ),
- m_dMeasurementResult( 0 )
+PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent,
+ QAction* action,
+ PlaYUVerModuleIf* module )
+ : m_bIsRunning( false )
+ , m_pcModuleAction( action )
+ , m_pcModule( module )
+ , m_pcDisplaySubWindow( NULL )
+ , m_pcDockWidget( NULL )
+ , m_pcModuleDock( NULL )
+ , m_pcModuleStream( NULL )
+ , m_pcProcessedFrame( NULL )
+ , m_dMeasurementResult( 0 )
{
setParent( parent );
- for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
+ for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
{
m_pcSubWindow[i] = NULL;
}
@@ -53,19 +52,27 @@ Void PlaYUVerAppModuleIf::update()
{
m_pcDisplaySubWindow->refreshFrame( true );
}
+ else
+ {
+ apply();
+ }
}
Bool PlaYUVerAppModuleIf::apply( Bool isPlaying, Bool disableThreads )
{
Bool bRet = false;
+
QApplication::setOverrideCursor( Qt::WaitCursor );
- if( m_pcDisplaySubWindow )
+ if( m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
{
- m_pcDisplaySubWindow->setFillWindow( true );
- }
- else
- {
- m_pcSubWindow[0]->setFillWindow( true );
+ if( m_pcDisplaySubWindow )
+ {
+ m_pcDisplaySubWindow->setFillWindow( true );
+ }
+ else
+ {
+ m_pcSubWindow[0]->setFillWindow( true );
+ }
}
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
{
@@ -98,7 +105,7 @@ Bool PlaYUVerAppModuleIf::apply( Bool isPlaying, Bool disableThreads )
Void PlaYUVerAppModuleIf::run()
{
m_bIsRunning = true;
-
+ m_bSuccess = false;
std::vector apcFrameList;
for( UInt i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
{
@@ -131,9 +138,10 @@ Void PlaYUVerAppModuleIf::run()
{
return;
}
+ m_bSuccess = true;
m_bIsRunning = false;
#ifdef PLAYUVER_THREADED_MODULES
- EventData *eventData = new EventData( true, this );
+ EventData* eventData = new EventData( m_bSuccess, this );
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
#endif
@@ -144,23 +152,23 @@ Void PlaYUVerAppModuleIf::show()
{
switch( m_pcModule->m_iModuleType )
{
- case FRAME_PROCESSING_MODULE:
- if( m_pcDisplaySubWindow )
- {
- m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame );
- m_pcDisplaySubWindow->setFillWindow( false );
- m_pcDisplaySubWindow->clearWindowBusy();
- }
- else
- {
- m_pcSubWindow[0]->setCurrFrame( m_pcProcessedFrame );
- m_pcSubWindow[0]->setFillWindow( false );
- m_pcSubWindow[0]->clearWindowBusy();
- }
- break;
- case FRAME_MEASUREMENT_MODULE:
- m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult );
- break;
+ case FRAME_PROCESSING_MODULE:
+ if( m_pcDisplaySubWindow )
+ {
+ m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame );
+ m_pcDisplaySubWindow->setFillWindow( false );
+ m_pcDisplaySubWindow->clearWindowBusy();
+ }
+ else
+ {
+ m_pcSubWindow[0]->setCurrFrame( m_pcProcessedFrame );
+ m_pcSubWindow[0]->setFillWindow( false );
+ m_pcSubWindow[0]->clearWindowBusy();
+ }
+ break;
+ case FRAME_MEASUREMENT_MODULE:
+ m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult );
+ break;
}
}
@@ -188,7 +196,7 @@ Void PlaYUVerAppModuleIf::destroy()
m_pcDisplaySubWindow->closeSubWindow();
m_pcDisplaySubWindow = NULL;
- for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
+ for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
{
if( m_pcSubWindow[i] )
{
@@ -208,8 +216,4 @@ Void PlaYUVerAppModuleIf::destroy()
m_pcModule->Delete();
m_pcModule = NULL;
}
-
}
-
-} // NAMESPACE
-
diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h
index 817055b..4483e27 100644
--- a/app/PlaYUVerAppModuleIf.h
+++ b/app/PlaYUVerAppModuleIf.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,21 +25,18 @@
#ifndef __PLAYUVERAPPMODULESIF_H__
#define __PLAYUVERAPPMODULESIF_H__
-#include "config.h"
-#include "PlaYUVerAppDefs.h"
-#include
-#include
-#include
-#include "lib/PlaYUVerFrame.h"
-#include "lib/PlaYUVerStream.h"
#include "ModuleHandleDock.h"
+#include "PlaYUVerAppDefs.h"
+#include "config.h"
+#include "lib/PlaYUVerFrame.h"
#include "lib/PlaYUVerModuleIf.h"
+#include "lib/PlaYUVerStream.h"
+#include
+#include
+#include
class QAction;
-namespace plaYUVer
-{
-
//#define PLAYUVER_THREADED_MODULES
class VideoSubWindow;
@@ -48,21 +45,21 @@ class PlaYUVerAppModuleIf
#ifdef PLAYUVER_THREADED_MODULES
: public QThread
#else
-: public QObject
+ : public QObject
#endif
{
friend class ModulesHandle;
friend class ModuleHandleDock;
friend class ModulesHandleOptDialog;
-private:
-
+ private:
Bool m_bIsRunning;
+ Bool m_bSuccess;
QAction* m_pcModuleAction;
PlaYUVerModuleIf* m_pcModule;
- VideoSubWindow* m_pcSubWindow[MAX_NUMBER_FRAMES];
+ VideoSubWindow* m_pcSubWindow[MODULE_REQUIRES_MAX_NUM_FRAMES];
VideoSubWindow* m_pcDisplaySubWindow;
@@ -73,12 +70,11 @@ private:
PlaYUVerFrame* m_pcProcessedFrame;
Double m_dMeasurementResult;
-public:
- class EventData: public QEvent
+ public:
+ class EventData : public QEvent
{
- public:
- EventData( bool success = false, PlaYUVerAppModuleIf* module = NULL ) :
- QEvent( QEvent::User )
+ public:
+ EventData( bool success, PlaYUVerAppModuleIf* module ) : QEvent( QEvent::User )
{
m_bSuccess = success;
m_pcModule = module;
@@ -88,38 +84,25 @@ public:
};
PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module );
- virtual ~PlaYUVerAppModuleIf()
- {
- }
-
+ virtual ~PlaYUVerAppModuleIf() {}
QList getSubWindowList()
{
QList arraySubWindows;
- for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
+ for( Int i = 0; i < MODULE_REQUIRES_MAX_NUM_FRAMES; i++ )
if( m_pcSubWindow[i] )
arraySubWindows.append( m_pcSubWindow[i] );
return arraySubWindows;
}
- PlaYUVerModuleIf* getModule()
- {
- return m_pcModule;
- }
-
- UInt getModuleRequirements()
- {
- return m_pcModule->m_uiModuleRequirements;
- }
-
+ PlaYUVerModuleIf* getModule() { return m_pcModule; }
+ UInt getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
Void update();
Bool apply( Bool isPlaying = false, Bool disableThreads = false );
Void show();
Void destroy();
-protected:
+
+ protected:
virtual void run();
};
-} // NAMESPACE
-
-#endif // __PLAYUVERAPPMODULESIF_H__
-
+#endif // __PLAYUVERAPPMODULESIF_H__
diff --git a/app/PlaYUVerMdiSubWindow.cpp b/app/PlaYUVerMdiSubWindow.cpp
index 7f407d6..230a2bb 100644
--- a/app/PlaYUVerMdiSubWindow.cpp
+++ b/app/PlaYUVerMdiSubWindow.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,15 +22,11 @@
* \brief Re-implementation QMdiSubWindow
*/
-#include
#include "PlaYUVerMdiSubWindow.h"
#include "SubWindowAbstract.h"
+#include
-namespace plaYUVer
-{
-
-PlaYUVerMdiSubWindow::PlaYUVerMdiSubWindow( QWidget *parent ) :
- QMdiSubWindow( parent )
+PlaYUVerMdiSubWindow::PlaYUVerMdiSubWindow( QWidget* parent ) : QMdiSubWindow( parent )
{
setAttribute( Qt::WA_DeleteOnClose );
setBackgroundRole( QPalette::Background );
@@ -45,10 +41,8 @@ QSize PlaYUVerMdiSubWindow::sizeHint() const
return sizeHint;
}
-Void PlaYUVerMdiSubWindow::closeEvent( QCloseEvent *event )
+Void PlaYUVerMdiSubWindow::closeEvent( QCloseEvent* event )
{
emit aboutToClose( this );
event->accept();
}
-
-} // NAMESPACE
diff --git a/app/PlaYUVerMdiSubWindow.h b/app/PlaYUVerMdiSubWindow.h
index 6982339..f622de7 100644
--- a/app/PlaYUVerMdiSubWindow.h
+++ b/app/PlaYUVerMdiSubWindow.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,30 +25,23 @@
#ifndef __PLAYUVERMDISUBWINDOW_H__
#define __PLAYUVERMDISUBWINDOW_H__
-#include "config.h"
#include "PlaYUVerAppDefs.h"
+#include "config.h"
#include
-
-namespace plaYUVer
+class PlaYUVerMdiSubWindow : public QMdiSubWindow
{
+ Q_OBJECT
-class PlaYUVerMdiSubWindow: public QMdiSubWindow
-{
-Q_OBJECT
+ public:
+ PlaYUVerMdiSubWindow( QWidget* parent = 0 );
-public:
- PlaYUVerMdiSubWindow( QWidget *parent = 0 );
-
-Q_SIGNALS:
+ Q_SIGNALS:
void aboutToClose( PlaYUVerMdiSubWindow* );
-protected:
+ protected:
QSize sizeHint() const;
- void closeEvent( QCloseEvent *event );
+ void closeEvent( QCloseEvent* event );
};
-} // NAMESPACE
-
-#endif // __PLAYUVERMDISUBWINDOW_H__
-
+#endif // __PLAYUVERMDISUBWINDOW_H__
diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp
index b2e1248..8132375 100644
--- a/app/PlaYUVerSubWindowHandle.cpp
+++ b/app/PlaYUVerSubWindowHandle.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,20 +22,29 @@
* \brief Handle multiple sub-windows
*/
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
#include "PlaYUVerSubWindowHandle.h"
+
#include "PlaYUVerApp.h"
#include "PlaYUVerMdiSubWindow.h"
#include "SubWindowAbstract.h"
-namespace plaYUVer
+class PlaYUVerMdiArea : public QMdiArea
{
-
-class PlaYUVerMdiArea: public QMdiArea
-{
-public:
- PlaYUVerMdiArea( QWidget *parent = 0 ) :
- QMdiArea( parent ),
- m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
+ public:
+ PlaYUVerMdiArea( QWidget* parent = 0 )
+ : QMdiArea( parent ), m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
{
setBackgroundRole( QPalette::Background );
}
@@ -47,8 +56,9 @@ public:
m_acLogMessages.remove( m_acLogMessages.size() - 1 );
update();
}
-protected:
- void paintEvent( QPaintEvent *event )
+
+ protected:
+ void paintEvent( QPaintEvent* event )
{
QMdiArea::paintEvent( event );
QPainter painter( viewport() );
@@ -58,19 +68,20 @@ protected:
int y = height() / 2 - pixFinalLogo.height() / 2;
painter.drawPixmap( x, y, pixFinalLogo );
-// for( Int i = 0; i < m_acLogMessages.size(); i++ )
-// {
-// painter.drawText( 5, height() - 5 - i * 15, m_acLogMessages.at( i ) );
-// }
-// QPoint bottomLeftCorner( 0, viewport()->height() );
+ // for( Int i = 0; i < m_acLogMessages.size(); i++ )
+ // {
+ // painter.drawText( 5, height() - 5 - i * 15, m_acLogMessages.at( i )
+ // );
+ // }
+ // QPoint bottomLeftCorner( 0, viewport()->height() );
}
-private:
+
+ private:
QVector m_acLogMessages;
QPixmap m_pixmapLogo;
};
-PlaYUVerSubWindowHandle::PlaYUVerSubWindowHandle( QWidget *parent ) :
- QWidget( parent )
+PlaYUVerSubWindowHandle::PlaYUVerSubWindowHandle( QWidget* parent ) : QWidget( parent )
{
m_iWindowMode = -1;
m_pcWindowManagerLayout = NULL;
@@ -80,7 +91,7 @@ PlaYUVerSubWindowHandle::PlaYUVerSubWindowHandle( QWidget *parent ) :
m_apcMdiSubWindowList.clear();
m_pcApp = qobject_cast( parentWidget() );
- //setWindowMode( DETACHEDSUBWINDOWMODE );
+ // setWindowMode( DETACHEDSUBWINDOWMODE );
setWindowMode( MDISUBWINDOWMODE );
}
@@ -98,7 +109,6 @@ Void PlaYUVerSubWindowHandle::resetWindowMode()
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
-
}
if( m_iWindowMode == MDISUBWINDOWMODE )
{
@@ -110,7 +120,8 @@ Void PlaYUVerSubWindowHandle::resetWindowMode()
}
for( Int i = 0; i < m_apcMdiSubWindowList.size(); i++ )
{
- disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
+ disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ),
+ this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
m_apcMdiSubWindowList.at( i )->close();
}
m_apcMdiSubWindowList.clear();
@@ -119,7 +130,6 @@ Void PlaYUVerSubWindowHandle::resetWindowMode()
m_pcMdiArea = NULL;
if( m_pcWindowManagerLayout )
delete m_pcWindowManagerLayout;
-
}
}
@@ -153,7 +163,8 @@ Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode )
setVisible( true );
m_pcMdiArea = new PlaYUVerMdiArea;
m_pcMdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
- connect( m_pcMdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( updateActiveSubWindow() ) );
+ connect( m_pcMdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), this,
+ SLOT( updateActiveSubWindow() ) );
m_pcWindowManagerLayout = new QHBoxLayout( this );
m_pcWindowManagerLayout->addWidget( m_pcMdiArea );
setLayout( m_pcWindowManagerLayout );
@@ -162,20 +173,21 @@ Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode )
addMdiSubWindow( m_apcSubWindowList.at( i ) );
m_apcSubWindowList.at( i )->resize( m_apcSubWindowList.at( i )->sizeHint() );
}
- //m_pcApp->move( m_cMdiModeWindowPosition );
- //m_pcApp->resize( m_cMdiModeWindowSize );
+ // m_pcApp->move( m_cMdiModeWindowPosition );
+ // m_pcApp->resize( m_cMdiModeWindowSize );
if( m_pcActiveWindow )
{
- m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
+ m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " +
+ m_pcActiveWindow->getWindowName() );
}
}
m_iWindowMode = iWindowMode;
- //tileSubWindows();
- //parentWidget()->update();
- //qApp->processEvents();
+ // tileSubWindows();
+ // parentWidget()->update();
+ // qApp->processEvents();
}
-Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract *window )
+Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
{
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
@@ -193,7 +205,8 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract *window )
if( mdiSubWindow )
{
QWidget* activeWidget = m_pcMdiArea->activeSubWindow()->widget();
- Int windowIdx = m_apcSubWindowList.indexOf( qobject_cast( activeWidget ) );
+ Int windowIdx =
+ m_apcSubWindowList.indexOf( qobject_cast( activeWidget ) );
if( windowIdx >= 0 )
{
m_pcActiveWindow = m_apcSubWindowList.at( windowIdx );
@@ -202,31 +215,37 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract *window )
}
if( m_pcActiveWindow )
{
- m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
+ m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " +
+ m_pcActiveWindow->getWindowName() );
}
}
}
-Void PlaYUVerSubWindowHandle::addMdiSubWindow( SubWindowAbstract *window )
+Void PlaYUVerSubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
{
PlaYUVerMdiSubWindow* mdiSubWindow = new PlaYUVerMdiSubWindow;
mdiSubWindow->setWidget( window );
m_pcMdiArea->addSubWindow( mdiSubWindow );
m_apcMdiSubWindowList.append( mdiSubWindow );
window->setSubWindow( mdiSubWindow );
- connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
+ connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this,
+ SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
}
-Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowAbstract *window, Qt::WindowFlags flags )
+Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
{
if( window )
{
- connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
- connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
+ connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp,
+ SLOT( printMessage( const QString& ) ) );
+ connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_pcApp,
+ SLOT( updateZoomFactorSBox() ) );
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
- connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this, SLOT( updateActiveSubWindow( SubWindowAbstract* ) ) );
- connect( window, SIGNAL( aboutToClose( SubWindowAbstract* ) ), this, SLOT( removeSubWindow( SubWindowAbstract* ) ) );
+ connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
+ SLOT( updateActiveSubWindow( SubWindowAbstract* ) ) );
+ connect( window, SIGNAL( aboutToClose( SubWindowAbstract* ) ), this,
+ SLOT( removeSubWindow( SubWindowAbstract* ) ) );
}
if( m_iWindowMode == MDISUBWINDOWMODE )
{
@@ -311,7 +330,8 @@ QList PlaYUVerSubWindowHandle::findSubWindow( const UInt uiC
return apcSubWindowList;
}
-QList PlaYUVerSubWindowHandle::findSubWindow( const QString &windowName, const UInt uiCategory ) const
+QList PlaYUVerSubWindowHandle::findSubWindow( const QString& windowName,
+ const UInt uiCategory ) const
{
QList subWindowList = findSubWindow( uiCategory );
QList apcSubWindowList;
@@ -326,7 +346,8 @@ QList PlaYUVerSubWindowHandle::findSubWindow( const QString
return apcSubWindowList;
}
-SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow( const SubWindowAbstract* subWindow ) const
+SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow(
+ const SubWindowAbstract* subWindow ) const
{
QList subWindowList = findSubWindow();
for( Int i = 0; i < subWindowList.size(); i++ )
@@ -337,12 +358,12 @@ SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow( const SubWindowAbstra
return 0;
}
-Void PlaYUVerSubWindowHandle::setActiveSubWindow( QWidget *window )
+Void PlaYUVerSubWindowHandle::setActiveSubWindow( QWidget* window )
{
if( !window )
return;
- m_pcActiveWindow = qobject_cast( window );
+ m_pcActiveWindow = qobject_cast( window );
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
@@ -374,7 +395,7 @@ Void PlaYUVerSubWindowHandle::tileSubWindows()
m_pcApp->resize( screenSize.width(), 5 );
QSize appSize = m_pcApp->size();
QPoint topLeftCornerWindow( 0, appSize.height() );
- //Select the arrangement based on the number of windows
+ // Select the arrangement based on the number of windows
if( numberOfWindows % 2 != 0 && numberOfWindows > minWindowsInRow )
{
@@ -405,7 +426,8 @@ Void PlaYUVerSubWindowHandle::tileSubWindows()
}
QSize totalWindowsSize( screenSize.width(), screenSize.height() - topLeftCornerWindow.y() );
- QSize windowsSize( totalWindowsSize.width() / numberTillingColumns, totalWindowsSize.height() / numberTillingRows );
+ QSize windowsSize( totalWindowsSize.width() / numberTillingColumns,
+ totalWindowsSize.height() / numberTillingRows );
QPoint windowRelativePos;
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
{
@@ -419,7 +441,6 @@ Void PlaYUVerSubWindowHandle::tileSubWindows()
{
m_pcMdiArea->tileSubWindows();
}
-
}
Void PlaYUVerSubWindowHandle::cascadeSubWindows()
@@ -433,7 +454,8 @@ Void PlaYUVerSubWindowHandle::cascadeSubWindows()
Void PlaYUVerSubWindowHandle::createActions()
{
m_mapperWindow = new QSignalMapper( this );
- connect( m_mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) );
+ connect( m_mapperWindow, SIGNAL( mapped( QWidget* ) ), this,
+ SLOT( setActiveSubWindow( QWidget* ) ) );
m_arrayActions.resize( TOTAL_ACT );
@@ -442,18 +464,21 @@ Void PlaYUVerSubWindowHandle::createActions()
m_actionGroupWindowMode->setExclusive( true );
m_mapperWindowMode = new QSignalMapper( this );
- connect( m_mapperWindowMode, SIGNAL( mapped(int) ), this, SLOT( setWindowMode(int) ) );
+ connect( m_mapperWindowMode, SIGNAL( mapped( int ) ), this, SLOT( setWindowMode( int ) ) );
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] = new QAction( tr( "&Detached SubWindows" ), this );
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT]->setCheckable( true );
m_actionGroupWindowMode->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] );
- connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
- m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], DETACHEDSUBWINDOWMODE );
+ connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
+ SLOT( map() ) );
+ m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT],
+ DETACHEDSUBWINDOWMODE );
m_arrayActions[MDI_SUBWINDOW_MODE_ACT] = new QAction( "&MDI SubWindows", this );
m_arrayActions[MDI_SUBWINDOW_MODE_ACT]->setCheckable( true );
m_actionGroupWindowMode->addAction( m_arrayActions[MDI_SUBWINDOW_MODE_ACT] );
- connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
+ connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
+ SLOT( map() ) );
m_mapperWindowMode->setMapping( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], MDISUBWINDOWMODE );
m_actionGroupWindowMode->actions().at( m_iWindowMode )->setChecked( true );
@@ -461,44 +486,54 @@ Void PlaYUVerSubWindowHandle::createActions()
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
- connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this,
+ SLOT( removeActiveSubWindow() ) );
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
- connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this,
+ SLOT( removeActiveSubWindow() ) );
m_arrayActions[CLOSE_ALL_ACT] = new QAction( tr( "Close &All" ), this );
m_arrayActions[CLOSE_ALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
- connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( removeAllSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this,
+ SLOT( removeAllSubWindow() ) );
m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this );
m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) );
m_arrayActions[TILE_WINDOWS_ACT]->setStatusTip( tr( "Tile the windows" ) );
m_arrayActions[TILE_WINDOWS_ACT]->setShortcut( tr( "Ctrl+T" ) );
-//connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) );
- connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( tileSubWindows() ) );
+ // connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea,
+ // SLOT( tileSubWindows() ) );
+ connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this,
+ SLOT( tileSubWindows() ) );
m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this );
m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) );
m_arrayActions[CASCADE_WINDOWS_ACT]->setStatusTip( tr( "Cascade the windows" ) );
- connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( cascadeSubWindows() ) );
+ connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this,
+ SLOT( cascadeSubWindows() ) );
m_arrayActions[NEXT_WINDOWS_ACT] = new QAction( tr( "Ne&xt" ), this );
m_arrayActions[NEXT_WINDOWS_ACT]->setShortcuts( QKeySequence::NextChild );
- m_arrayActions[NEXT_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
+ m_arrayActions[NEXT_WINDOWS_ACT]->setIcon(
+ QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
m_arrayActions[NEXT_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the next window" ) );
-// connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( activateNextSubWindow() ) );
+ // connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), this,
+ // SLOT( activateNextSubWindow() ) );
m_arrayActions[PREVIOUS_WINDOWS_ACT] = new QAction( tr( "Pre&vious" ), this );
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setShortcuts( QKeySequence::PreviousChild );
- m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
- m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the previous window" ) );
-// connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( activatePreviousSubWindow() ) );
+ m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon(
+ QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
+ m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip(
+ tr( "Move the focus to the previous window" ) );
+ // connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ),
+ // this, SLOT( activatePreviousSubWindow() ) );
m_arrayActions[SEPARATOR_ACT] = new QAction( this );
m_arrayActions[SEPARATOR_ACT]->setSeparator( true );
-
}
QMenu* PlaYUVerSubWindowHandle::createMenu()
@@ -521,9 +556,9 @@ Void PlaYUVerSubWindowHandle::updateMenu()
m_pcMenuWindow->addAction( m_arrayActions[TILE_WINDOWS_ACT] );
m_pcMenuWindow->addAction( m_arrayActions[CASCADE_WINDOWS_ACT] );
m_pcMenuWindow->addSeparator();
-// m_pcMenuWindow->addAction( m_arrayActions[NEXT_WINDOWS_ACT] );
-// m_pcMenuWindow->addAction( m_arrayActions[PREVIOUS_WINDOWS_ACT] );
-// m_pcMenuWindow->addSeparator();
+ // m_pcMenuWindow->addAction( m_arrayActions[NEXT_WINDOWS_ACT] );
+ // m_pcMenuWindow->addAction( m_arrayActions[PREVIOUS_WINDOWS_ACT] );
+ // m_pcMenuWindow->addSeparator();
Int number_windows = m_apcSubWindowList.size();
if( number_windows > 1 )
@@ -541,7 +576,7 @@ Void PlaYUVerSubWindowHandle::updateMenu()
for( Int i = 0; i < number_windows; ++i )
{
- SubWindowAbstract *subWindow = m_apcSubWindowList.at( i );
+ SubWindowAbstract* subWindow = m_apcSubWindowList.at( i );
QString text;
if( i < 9 )
@@ -552,7 +587,7 @@ Void PlaYUVerSubWindowHandle::updateMenu()
{
text = tr( "%1 %2" ).arg( i + 1 ).arg( subWindow->getWindowName() );
}
- QAction *action = m_pcMenuWindow->addAction( text );
+ QAction* action = m_pcMenuWindow->addAction( text );
action->setCheckable( true );
action->setChecked( subWindow == activeSubWindow() );
connect( action, SIGNAL( triggered() ), m_mapperWindow, SLOT( map() ) );
@@ -563,8 +598,10 @@ Void PlaYUVerSubWindowHandle::updateMenu()
Void PlaYUVerSubWindowHandle::readSettings()
{
QSettings appSettings;
- m_cMdiModeWindowPosition = appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
- m_cMdiModeWindowSize = appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
+ m_cMdiModeWindowPosition =
+ appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
+ m_cMdiModeWindowSize =
+ appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
Int iWindowMode = appSettings.value( "SubWindowManager/SubWindowMode", MDISUBWINDOWMODE ).toInt();
setWindowMode( iWindowMode );
m_actionGroupWindowMode->actions().at( iWindowMode )->setChecked( true );
@@ -577,5 +614,3 @@ Void PlaYUVerSubWindowHandle::writeSettings()
appSettings.setValue( "SubWindowManager/LastMdiSize", m_cMdiModeWindowSize );
appSettings.setValue( "SubWindowManager/SubWindowMode", m_iWindowMode );
}
-
-} // NAMESPACE
diff --git a/app/PlaYUVerSubWindowHandle.h b/app/PlaYUVerSubWindowHandle.h
index ad7412f..5865e02 100644
--- a/app/PlaYUVerSubWindowHandle.h
+++ b/app/PlaYUVerSubWindowHandle.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,37 +25,38 @@
#ifndef __PLAYUVERSUBWINDOWHANDLE_H__
#define __PLAYUVERSUBWINDOWHANDLE_H__
-#include "config.h"
-#include "PlaYUVerAppDefs.h"
-#if( QT_VERSION_PLAYUVER == 5 )
-#include
-#elif( QT_VERSION_PLAYUVER == 4 )
-#include
-#endif
+#include
+#include
+#include
-namespace plaYUVer
-{
+#include "PlaYUVerAppDefs.h"
+
+class QAction;
+class QActionGroup;
+class QHBoxLayout;
+class QMenu;
+class QSignalMapper;
class PlaYUVerApp;
class SubWindowAbstract;
class PlaYUVerMdiArea;
class PlaYUVerMdiSubWindow;
-class PlaYUVerSubWindowHandle: public QWidget
+class PlaYUVerSubWindowHandle : public QWidget
{
-Q_OBJECT
+ Q_OBJECT
-public:
- PlaYUVerSubWindowHandle( QWidget *parent );
+ public:
+ PlaYUVerSubWindowHandle( QWidget* parent );
Void processLogMsg( const QString& msg );
- Void addSubWindow( SubWindowAbstract *widget, Qt::WindowFlags flags = 0 );
+ Void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
- SubWindowAbstract *activeSubWindow() const;
+ SubWindowAbstract* activeSubWindow() const;
QList findSubWindow( const UInt uiCategory = 0 ) const;
- QList findSubWindow( const QString &aName, const UInt uiCategory = 0 ) const;
+ QList findSubWindow( const QString& aName, const UInt uiCategory = 0 ) const;
SubWindowAbstract* findSubWindow( const SubWindowAbstract* subWindow ) const;
Void createActions();
@@ -70,7 +71,7 @@ public:
MDISUBWINDOWMODE = 1,
};
-private:
+ private:
PlaYUVerApp* m_pcApp;
Int m_iWindowMode;
QList m_apcSubWindowList;
@@ -106,15 +107,15 @@ private:
/**
* Internal functions
*/
- Void addMdiSubWindow( SubWindowAbstract *window );
+ Void addMdiSubWindow( SubWindowAbstract* window );
Void resetWindowMode();
Void removeSubWindow( Int windowIdx );
-public Q_SLOTS:
+ public Q_SLOTS:
void setWindowMode( int iWindowMode );
- void updateActiveSubWindow( SubWindowAbstract *window = 0 );
- void setActiveSubWindow( QWidget *window );
- void removeSubWindow( SubWindowAbstract *window );
+ void updateActiveSubWindow( SubWindowAbstract* window = 0 );
+ void setActiveSubWindow( QWidget* window );
+ void removeSubWindow( SubWindowAbstract* window );
void removeMdiSubWindow( PlaYUVerMdiSubWindow* window );
void removeActiveSubWindow();
void removeAllSubWindow();
@@ -122,12 +123,9 @@ public Q_SLOTS:
void cascadeSubWindows();
void updateMenu();
-Q_SIGNALS:
+ Q_SIGNALS:
void changed();
void windowActivated();
-
};
-} // NAMESPACE
-
-#endif // __PLAYUVERSUBWINDOWHANDLE_H__
+#endif // __PLAYUVERSUBWINDOWHANDLE_H__
diff --git a/app/PlotSubWindow.cpp b/app/PlotSubWindow.cpp
index 9916e03..6d26720 100644
--- a/app/PlotSubWindow.cpp
+++ b/app/PlotSubWindow.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -25,9 +25,6 @@
#include "PlotSubWindow.h"
#include "qcustomplot.h"
-namespace plaYUVer
-{
-
Void PlotSubWindow::definePlotColors()
{
m_arrayColorList.append( Qt::blue );
@@ -47,10 +44,9 @@ Void PlotSubWindow::definePlotColors()
m_arrayColorList.append( Qt::darkYellow );
}
-PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget * parent ) :
- SubWindowAbstract( parent, SubWindowAbstract::PLOT_SUBWINDOW )
+PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
+ : SubWindowAbstract( parent, SubWindowAbstract::PLOT_SUBWINDOW )
{
-
definePlotColors();
m_iNumberPlots = 0;
m_dScaleFactor = 1;
@@ -96,19 +92,23 @@ PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget * parent ) :
m_cPlotArea->xAxis2->setTickLabels( false );
m_cPlotArea->yAxis2->setVisible( true );
m_cPlotArea->yAxis2->setTickLabels( false );
- // make left and bottom axes always transfer their ranges to right and top axes:
- connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged(QCPRange) ), m_cPlotArea->xAxis2, SLOT( setRange(QCPRange) ) );
- connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged(QCPRange) ), m_cPlotArea->yAxis2, SLOT( setRange(QCPRange) ) );
+ // make left and bottom axes always transfer their ranges to right and top
+ // axes:
+ connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->xAxis2,
+ SLOT( setRange( QCPRange ) ) );
+ connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->yAxis2,
+ SLOT( setRange( QCPRange ) ) );
- QFont legendFont = font(); // start out with MainWindow's font..
+ QFont legendFont = font(); // start out with MainWindow's font..
legendFont.setPointSize( 9 ); // and make a bit smaller for legend
m_cPlotArea->legend->setFont( legendFont );
m_cPlotArea->legend->setBrush( backgroundBrush );
m_cPlotArea->legend->setTextColor( palette().text().color() );
- m_cPlotArea->legend->setBorderPen( QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
+ m_cPlotArea->legend->setBorderPen(
+ QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
m_cPlotArea->legend->setVisible( false );
- m_cPlotArea->setInteractions( QCP::iRangeZoom | QCP::iRangeDrag ); //QCP::iSelectPlottables
+ m_cPlotArea->setInteractions( QCP::iRangeZoom | QCP::iRangeDrag ); // QCP::iSelectPlottables
m_cPlotPen.setStyle( Qt::SolidLine );
m_cPlotPen.setColor( Qt::black );
@@ -137,7 +137,6 @@ Void PlotSubWindow::zoomToFit()
Void PlotSubWindow::zoomToFactor( Double factor, QPoint center )
{
-
}
Void PlotSubWindow::scaleView( Double scale, QPoint center )
@@ -147,14 +146,16 @@ Void PlotSubWindow::scaleView( Double scale, QPoint center )
scale += 1;
m_dScaleFactor *= scale;
-//
-// UInt aNewAxisRange[2][2];
-// for( UInt axis = 0; axis < 2; axis++ )
-// for( UInt dim = 0; dim < 2; dim++ )
-// aNewAxisRange[axis][dim] = m_aAxisRange[axis][dim] / m_dScaleFactor;
-//
-// m_cPlotArea->xAxis->setRange( aNewAxisRange[HORIZONTAL][0], aNewAxisRange[HORIZONTAL][1] );
-// m_cPlotArea->yAxis->setRange( aNewAxisRange[VERTICAL][0], aNewAxisRange[VERTICAL][1] );
+ //
+ // UInt aNewAxisRange[2][2];
+ // for( UInt axis = 0; axis < 2; axis++ )
+ // for( UInt dim = 0; dim < 2; dim++ )
+ // aNewAxisRange[axis][dim] = m_aAxisRange[axis][dim] / m_dScaleFactor;
+ //
+ // m_cPlotArea->xAxis->setRange( aNewAxisRange[HORIZONTAL][0],
+ // aNewAxisRange[HORIZONTAL][1] );
+ // m_cPlotArea->yAxis->setRange( aNewAxisRange[VERTICAL][0],
+ // aNewAxisRange[VERTICAL][1] );
m_cPlotArea->xAxis->scaleRange( scale, 0 );
m_cPlotArea->yAxis->scaleRange( scale, 0 );
@@ -164,7 +165,7 @@ Void PlotSubWindow::scaleView( Double scale, QPoint center )
QSize PlotSubWindow::sizeHint() const
{
QSize maxSize;
- QWidget *p = parentWidget();
+ QWidget* p = parentWidget();
if( p )
{
maxSize = p->size();
@@ -176,7 +177,7 @@ QSize PlotSubWindow::sizeHint() const
return sizeHint( maxSize );
}
-QSize PlotSubWindow::sizeHint( const QSize & maxSize ) const
+QSize PlotSubWindow::sizeHint( const QSize& maxSize ) const
{
return maxSize * 2 / 3;
}
@@ -193,28 +194,32 @@ Void PlotSubWindow::setAxisRange( const QLine& axisLimits )
setAxisRange( VERTICAL, axisLimits.y1(), axisLimits.y2() );
}
-Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis, const Int& axisStart, const Int& axisEnd )
+Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis,
+ const Int& axisStart,
+ const Int& axisEnd )
{
if( eAxis == HORIZONTAL )
{
m_cPlotArea->xAxis->setRange( axisStart, axisEnd );
- //horizontalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
+ // horizontalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
m_aAxisRange[HORIZONTAL][0] = axisStart;
m_aAxisRange[HORIZONTAL][1] = axisEnd;
}
if( eAxis == VERTICAL )
{
m_cPlotArea->yAxis->setRange( axisStart, axisEnd );
- //verticalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
+ // verticalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
m_aAxisRange[VERTICAL][0] = axisStart;
m_aAxisRange[VERTICAL][1] = axisEnd;
}
m_cPlotArea->replot();
}
-Void PlotSubWindow::addPlot( const QVector &arrayX, const QVector &arrayY, const QString& key )
+Void PlotSubWindow::addPlot( const QVector& arrayX,
+ const QVector& arrayY,
+ const QString& key )
{
- QCPGraph *newPlot = m_cPlotArea->addGraph();
+ QCPGraph* newPlot = m_cPlotArea->addGraph();
QColor plotColor = m_arrayColorList.at( 0 );
if( m_iNumberPlots < m_arrayColorList.size() )
{
@@ -224,7 +229,8 @@ Void PlotSubWindow::addPlot( const QVector &arrayX, const QVectorsetPen( m_cPlotPen ); // line style
// pass data points to graphs:
newPlot->setData( arrayX, arrayY );
- // let the ranges scale themselves so graph 0 fits perfectly in the visible area:
+ // let the ranges scale themselves so graph 0 fits perfectly in the visible
+ // area:
newPlot->rescaleAxes( m_iNumberPlots > 1 ? true : false );
if( !key.isEmpty() )
@@ -240,5 +246,3 @@ Void PlotSubWindow::addPlot( const QVector &arrayX, const QVector
#elif( QT_VERSION_PLAYUVER == 4 )
@@ -36,14 +36,11 @@
class QCustomPlot;
-namespace plaYUVer
+class PlotSubWindow : public SubWindowAbstract
{
+ Q_OBJECT
-class PlotSubWindow: public SubWindowAbstract
-{
-Q_OBJECT
-
-private:
+ private:
QCustomPlot* m_cPlotArea;
QVector m_arrayColorList;
@@ -58,18 +55,13 @@ private:
Double m_dScaleFactor;
Int m_iNumberPlots;
-public:
-
- PlotSubWindow( const QString& windowTitle, QWidget * parent = NULL );
+ public:
+ PlotSubWindow( const QString& windowTitle, QWidget* parent = NULL );
~PlotSubWindow();
Void definePlotColors();
- Void refreshSubWindow()
- {
-
- }
-
+ Void refreshSubWindow() {}
/**
* Virtual functions from SubWindowAbstract
*/
@@ -78,16 +70,12 @@ public:
Void zoomToFactor( Double factor, QPoint center = QPoint() );
Void scaleView( Double scale, QPoint center = QPoint() );
- Double getScaleFactor()
- {
- return m_dScaleFactor;
- }
-
+ Double getScaleFactor() { return m_dScaleFactor; }
/**
* Size related functions
*/
QSize sizeHint() const;
- QSize sizeHint( const QSize & ) const;
+ QSize sizeHint( const QSize& ) const;
Void setAxisName( const QString& nameAxisX, const QString& nameAxisY );
@@ -96,11 +84,9 @@ public:
Void setKey( const QString& key );
- Void addPlot( const QVector &arrayX, const QVector &arrayY, const QString& key = QString() );
-
+ Void addPlot( const QVector& arrayX,
+ const QVector& arrayY,
+ const QString& key = QString() );
};
-} // NAMESPACE
-
-#endif // __PLOTWINDOWHANDLE_H__
-
+#endif // __PLOTWINDOWHANDLE_H__
diff --git a/app/ProgressBar.cpp b/app/ProgressBar.cpp
index 6f0104f..237e7c9 100644
--- a/app/ProgressBar.cpp
+++ b/app/ProgressBar.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -24,18 +24,13 @@
#include "ProgressBar.h"
#include
-#include
-#include
-#include
#include
+#include
+#include
+#include
-namespace plaYUVer
-{
-
-ProgressBar::ProgressBar( QWidget *parent, UInt maxValue ) :
- QWidget( parent ),
- m_uiTotalProgress( maxValue ),
- m_uiProgress( 0 )
+ProgressBar::ProgressBar( QWidget* parent, UInt maxValue )
+ : QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 )
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
m_pcProgressBar = new QProgressBar;
@@ -45,8 +40,8 @@ ProgressBar::ProgressBar( QWidget *parent, UInt maxValue ) :
setLayout( mainLayout );
setWindowTitle( QStringLiteral( "Progress" ) );
-// QSize appSize = QApplication::desktop()->availableGeometry().size();
-// QPoint appCenter = QApplication::desktop()->availableGeometry().center();
+ // QSize appSize = QApplication::desktop()->availableGeometry().size();
+ // QPoint appCenter = QApplication::desktop()->availableGeometry().center();
QSize appSize = parent->size();
QPoint appPos = parent->pos();
QPoint appCenter = QPoint( appPos.x() + appSize.width() / 2, appPos.y() + appSize.height() / 2 );
@@ -61,4 +56,3 @@ Void ProgressBar::incrementProgress( UInt increment )
m_pcProgressBar->setValue( m_uiProgress );
update();
}
-} // NAMESPACE
diff --git a/app/ProgressBar.h b/app/ProgressBar.h
index 8cba896..5a4079a 100644
--- a/app/ProgressBar.h
+++ b/app/ProgressBar.h
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -26,29 +26,24 @@
#define __PROGRESSBAR_H__
#include "PlaYUVerAppDefs.h"
-#include
#include
+#include
class QProgressBar;
-namespace plaYUVer
+class ProgressBar : public QWidget
{
+ Q_OBJECT
-class ProgressBar: public QWidget
-{
-Q_OBJECT
-
-public:
- ProgressBar( QWidget *parent, UInt maxValue );
+ public:
+ ProgressBar( QWidget* parent, UInt maxValue );
Void incrementProgress( UInt );
-private:
+ private:
UInt m_uiTotalProgress;
UInt m_uiProgress;
QProgressBar* m_pcProgressBar;
};
-} // NAMESPACE
-
-#endif // __PROGRESSBAR_H__
+#endif // __PROGRESSBAR_H__
diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp
index ab20471..976776c 100644
--- a/app/QualityHandle.cpp
+++ b/app/QualityHandle.cpp
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
- * Copyright (C) 2014-2015 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
@@ -22,31 +22,25 @@
* \brief Definition of the quality measurement sidebar
*/
-#include
-#include "lib/LibMemory.h"
-#include "PlaYUVerSubWindowHandle.h"
#include "QualityHandle.h"
-#include "VideoSubWindow.h"
-#include "PlotSubWindow.h"
#include "DialogSubWindowSelector.h"
+#include "PlaYUVerSubWindowHandle.h"
+#include "PlotSubWindow.h"
#include "ProgressBar.h"
+#include "VideoSubWindow.h"
+#include "lib/LibMemory.h"
+#include
#if( QT_VERSION_PLAYUVER == 5 )
#include "QtConcurrent/qtconcurrentrun.h"
#endif
-namespace plaYUVer
+QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
+ : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
{
-
-QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager ) :
- m_pcParet( parent ),
- m_pcMainWindowManager( windowManager )
-{
-
}
QualityHandle::~QualityHandle()
{
-
}
Void QualityHandle::createActions()
@@ -69,12 +63,15 @@ Void QualityHandle::createActions()
m_arrayActions.resize( TOTAL_ACT );
m_arrayActions[SELECT_CURR_REF_ACT] = new QAction( "Mark as Reference", this );
- connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this, SLOT( slotSelectCurrentAsReference() ) );
+ connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this,
+ SLOT( slotSelectCurrentAsReference() ) );
m_arrayActions[PLOT_QUALITY] = new QAction( "Plot Window's Quality", this );
- connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySingle() ) );
+ connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this,
+ SLOT( slotPlotQualitySingle() ) );
m_arrayActions[PLOT_SEVERAL_QUALITY] = new QAction( "Plot Several Quality", this );
- connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySeveral() ) );
+ connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this,
+ SLOT( slotPlotQualitySeveral() ) );
}
QMenu* QualityHandle::createMenu()
@@ -96,8 +93,10 @@ QDockWidget* QualityHandle::createDock()
m_pcQualityHandleDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
m_pcQualityHandleDock->setWidget( m_pcQualityHandleSideBar );
- connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged(int) ), this, SLOT( slotQualityMetricChanged(int) ) );
- connect( m_mapperQualityMetric, SIGNAL( mapped(int) ), this, SLOT( slotQualityMetricChanged(int) ) );
+ connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged( int ) ), this,
+ SLOT( slotQualityMetricChanged( int ) ) );
+ connect( m_mapperQualityMetric, SIGNAL( mapped( int ) ), this,
+ SLOT( slotQualityMetricChanged( int ) ) );
slotQualityMetricChanged( 0 );
@@ -106,7 +105,8 @@ QDockWidget* QualityHandle::createDock()
Void QualityHandle::updateMenus()
{
- VideoSubWindow* pcCurrentVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcCurrentVideoSubWindow =
+ qobject_cast( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcCurrentVideoSubWindow ? true : false;
Bool hasReference = false;
Bool isReference = false;
@@ -117,10 +117,11 @@ Void QualityHandle::updateMenus()
if( hasSubWindow && !hasReference )
{
VideoSubWindow* pcVideoSubWindow;
- QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList =
+ m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
- pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
+ pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
if( pcVideoSubWindow->getRefSubWindow() == pcCurrentVideoSubWindow )
{
isReference = true;
@@ -189,7 +190,7 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames );
- padQualityValues = new QVector [numberOfWindows + 1];
+ padQualityValues = new QVector[ numberOfWindows + 1 ];
PlaYUVerFrame* pcReferenceFrame;
PlaYUVerFrame* pcCurrFrame;
@@ -200,7 +201,8 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
for( UInt i = 0; i < numberOfWindows; i++ )
{
pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
- padQualityValues[i + 1].append( pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, LUMA ) );
+ padQualityValues[i + 1].append(
+ pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, LUMA ) );
apcWindowList.at( i )->seekRelativeEvent( true );
}
pcReferenceWindow->seekRelativeEvent( true );
@@ -218,7 +220,9 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
plotWindowTitle += " - " + apcWindowList.at( 0 )->getWindowName();
}
PlotSubWindow* pcPlotWindow = new PlotSubWindow( plotWindowTitle );
- pcPlotWindow->setAxisName( "Frame Number", QString::fromStdString( PlaYUVerFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
+ pcPlotWindow->setAxisName(
+ "Frame Number",
+ QString::fromStdString( PlaYUVerFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
if( apcWindowList.size() > 1 )
{
@@ -238,7 +242,6 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
pcPlotWindow->show();
pcProgressBar->close();
-
}
Void QualityHandle::slotQualityMetricChanged( Int idx )
@@ -251,11 +254,13 @@ Void QualityHandle::slotQualityMetricChanged( Int idx )
Void QualityHandle::slotSelectCurrentAsReference()
{
- VideoSubWindow* pcRefSubWindow = qobject_cast