Add progress bar to quality plots

This commit is contained in:
2015-03-13 19:48:17 +00:00
parent c22a33b162
commit 78279015d4
5 changed files with 121 additions and 5 deletions
+1
View File
@@ -69,6 +69,7 @@ set(plaYUVer_App_SRCS
AboutDialog.cpp
ConfigureFormatDialog.cpp
DialogSubWindowSelector.cpp
ProgressBar.cpp
# Widgets
HistogramWidget.cpp
WidgetFrameNumber.cpp
-4
View File
@@ -42,10 +42,6 @@ class QColor;
namespace plaYUVer
{
#define ADD_STANDARD_RESOLUTION( name, width, height) \
standardResolutionNames.push_back( QString( name ) ); \
standardResolutionSizesList.push_back( QSize( width, height ) )
/**
*
*/
+60
View File
@@ -0,0 +1,60 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 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 ProgressBar.cpp
* \brief Progress bar code
*/
#include "ProgressBar.h"
#include <QApplication>
#include <QLabel>
#include <QVBoxLayout>
#include <QProgressBar>
#include <QDesktopWidget>
namespace plaYUVer
{
ProgressBar::ProgressBar( QWidget *parent, UInt maxValue ) :
QWidget( parent ),
m_uiTotalProgress( maxValue ),
m_uiProgress( 0 )
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
m_pcProgressBar = new QProgressBar;
m_pcProgressBar->setMaximum( m_uiTotalProgress );
m_pcProgressBar->setAlignment( Qt::AlignCenter );
mainLayout->addWidget( m_pcProgressBar );
setLayout( mainLayout );
setWindowTitle( QStringLiteral( "Progress" ) );
QSize screenSize = QApplication::desktop()->availableGeometry().size();
QPoint screenCenter = QApplication::desktop()->availableGeometry().center();
resize( screenSize.width() / 4, screenSize.height() / 10 );
move( screenCenter.x() - screenSize.width() / 8, screenCenter.y() - screenSize.height() / 10 );
show();
}
Void ProgressBar::incrementProgress( UInt increment )
{
m_uiProgress += increment;
m_pcProgressBar->setValue( m_uiProgress );
}
} // NAMESPACE
+53
View File
@@ -0,0 +1,53 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 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 ProgressBar.h
* \brief Progress bar code
*/
#ifndef __PROGRESSBAR_H__
#define __PROGRESSBAR_H__
#include "PlaYUVerAppDefs.h"
#include <QWidget>
class QProgressBar;
namespace plaYUVer
{
class ProgressBar: public QWidget
{
Q_OBJECT
public:
ProgressBar( QWidget *parent, UInt maxValue );
Void incrementProgress( UInt );
private:
UInt m_uiTotalProgress;
UInt m_uiProgress;
QProgressBar* m_pcProgressBar;
};
} // NAMESPACE
#endif // __PROGRESSBAR_H__
+7 -1
View File
@@ -23,12 +23,13 @@
*/
#include <QtGui>
#include "lib/LibMemory.h"
#include "PlaYUVerSubWindowHandle.h"
#include "QualityHandle.h"
#include "VideoSubWindow.h"
#include "PlotSubWindow.h"
#include "DialogSubWindowSelector.h"
#include "lib/LibMemory.h"
#include "ProgressBar.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include "QtConcurrent/qtconcurrentrun.h"
#endif
@@ -169,6 +170,8 @@ Void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
}
pcReferenceWindow->stop();
ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames );
padQualityValues = new QVector<Double> [numberOfWindows + 1];
PlaYUVerFrame* pcReferenceFrame;
@@ -184,6 +187,7 @@ Void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
apcWindowList.at( i )->seekRelativeEvent( true );
}
pcReferenceWindow->seekRelativeEvent( true );
pcProgressBar->incrementProgress( 1 );
}
for( UInt i = 0; i < numberOfWindows; i++ )
{
@@ -216,6 +220,8 @@ Void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
m_pcMainWindowManager->addSubWindow( pcPlotWindow );
pcPlotWindow->show();
pcProgressBar->close();
}
Void QualityHandle::slotQualityMetricChanged( Int idx )