Merge with features_quality_side_bar
This commit is contained in:
1 parent
28c09969ce
commit
0212913b5c
8 files changed
+435
-154
No files matched your search
@@ -0,0 +1,173 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file QualityMeasurementSidebar.cpp
|
||||
* \brief Definition of the quality measurement sidebar
|
||||
*/
|
||||
|
||||
#include "PlaYUVerDefs.h"
|
||||
#include <QtGui>
|
||||
#include "QualityMeasurementSidebar.h"
|
||||
#include "SubWindowHandle.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea *mdiArea ) :
|
||||
QWidget( parent ),
|
||||
m_pcMainWindowMdiArea( mdiArea ),
|
||||
m_pcCurrentSubWindow( NULL )
|
||||
{
|
||||
|
||||
// Side bar area -----------------------------------------------------
|
||||
|
||||
QLabel *RefLabel = new QLabel( tr( "Ref:" ) );
|
||||
RefLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
||||
|
||||
QLabel *RecLabel = new QLabel( tr( "Rec:" ) );
|
||||
RecLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
|
||||
|
||||
m_comboBoxRef = new QComboBox;
|
||||
|
||||
m_comboBoxRec = new QComboBox;
|
||||
|
||||
updateSubWindowList();
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget( RefLabel, 0, 0, Qt::AlignLeft );
|
||||
mainLayout->addWidget( m_comboBoxRef, 0, 1, Qt::AlignLeft );
|
||||
//mainLayout->addWidget( RecLabel, 1, 0, Qt::AlignLeft );
|
||||
//mainLayout->addWidget( m_comboBoxRec, 1, 1, Qt::AlignLeft );
|
||||
|
||||
m_ppcLabelQualityLabel[LUMA] = new QLabel( tr( "PSNR Y:" ) );
|
||||
m_ppcLabelQualityLabel[LUMA]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[LUMA] = new QLabel;
|
||||
m_ppcLabelQualityValue[LUMA]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CHROMA_U] = new QLabel( tr( "PSNR U:" ) );
|
||||
m_ppcLabelQualityLabel[CHROMA_U]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_U] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_U]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
m_ppcLabelQualityLabel[CHROMA_V] = new QLabel( tr( "PSNR V:" ) );
|
||||
m_ppcLabelQualityLabel[CHROMA_V]->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||
m_ppcLabelQualityValue[CHROMA_V] = new QLabel;
|
||||
m_ppcLabelQualityValue[CHROMA_V]->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||
|
||||
QGridLayout *qualityResultsLayout = new QGridLayout;
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[LUMA], 0, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[LUMA], 0, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CHROMA_U], 1, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CHROMA_U], 1, 1 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityLabel[CHROMA_V], 2, 0 );
|
||||
qualityResultsLayout->addWidget( m_ppcLabelQualityValue[CHROMA_V], 2, 1 );
|
||||
|
||||
QGroupBox *statisticsGroup = new QGroupBox( tr( "Quality" ) );
|
||||
statisticsGroup->setLayout( qualityResultsLayout );
|
||||
statisticsGroup->setWhatsThis( tr( "<p>Here you can see the quality results calculated for the "
|
||||
"selected windows." ) );
|
||||
|
||||
mainLayout->addWidget( statisticsGroup, 4, 0, 3, 3 );
|
||||
|
||||
mainLayout->setRowStretch( 8, 10 );
|
||||
setLayout( mainLayout );
|
||||
|
||||
connect( m_comboBoxRef, SIGNAL( activated(int) ), this, SLOT( slotReferenceChanged(int) ) );
|
||||
|
||||
}
|
||||
|
||||
QualityMeasurementSidebar::~QualityMeasurementSidebar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QSize QualityMeasurementSidebar::sizeHint() const
|
||||
{
|
||||
QSize currSize = size();
|
||||
QSize bestSize( 240, currSize.height() );
|
||||
if( currSize.width() < bestSize.width() )
|
||||
return bestSize;
|
||||
else
|
||||
return currSize;
|
||||
}
|
||||
|
||||
Void QualityMeasurementSidebar::updateSubWindowList()
|
||||
{
|
||||
SubWindowHandle *subWindow;
|
||||
QString currSubWindowName;
|
||||
m_pcWindowListNames.clear();
|
||||
for( Int i = 0; i < m_pcMainWindowMdiArea->subWindowList().size(); i++ )
|
||||
{
|
||||
subWindow = qobject_cast<SubWindowHandle *>( m_pcMainWindowMdiArea->subWindowList().at( i ) );
|
||||
currSubWindowName = subWindow->getWindowName();
|
||||
if( !m_pcSelectedWindowListNames.contains( currSubWindowName ) && !subWindow->getIsModule() )
|
||||
m_pcWindowListNames.append( currSubWindowName );
|
||||
}
|
||||
m_comboBoxRef->clear();
|
||||
m_comboBoxRef->insertItems( 0, m_pcWindowListNames );
|
||||
m_comboBoxRef->setCurrentIndex( -1 );
|
||||
}
|
||||
|
||||
Void QualityMeasurementSidebar::updateCurrentWindow( SubWindowHandle *subWindow )
|
||||
{
|
||||
m_pcCurrentSubWindow = subWindow;
|
||||
updateSidebarData();
|
||||
}
|
||||
|
||||
Void QualityMeasurementSidebar::updateSidebarData()
|
||||
{
|
||||
QString value( "0.00" );
|
||||
SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow();
|
||||
|
||||
if( refSubWindow )
|
||||
{
|
||||
PlaYUVerFrame* currFrame = m_pcCurrentSubWindow->getCurrFrame();
|
||||
PlaYUVerFrame* refFrame = refSubWindow->getCurrFrame();
|
||||
Double quality;
|
||||
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
quality = currFrame->getPSNR( refFrame, component );
|
||||
m_ppcLabelQualityLabel[component]->setText( value.setNum( quality, 'f', 2 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( Int component = 0; component < 3; component++ )
|
||||
{
|
||||
m_ppcLabelQualityLabel[component]->setText( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void QualityMeasurementSidebar::slotReferenceChanged( Int index )
|
||||
{
|
||||
SubWindowHandle *subWindow;
|
||||
if( index > -1 && m_pcCurrentSubWindow )
|
||||
{
|
||||
subWindow = qobject_cast<SubWindowHandle *>( m_pcMainWindowMdiArea->subWindowList().at( index ) );
|
||||
if( subWindow )
|
||||
m_pcCurrentSubWindow->setRefSubWindow( subWindow );
|
||||
}
|
||||
// updateSidebarData();
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
Reference in new issue
Block a user