Add PlotSubwindow and plot support for the QualityModule

This commit is contained in:
jfmcarreira committed 2015-01-19 01:11:34 +00:00
1 parent d5cfd4b0cb
commit 00d9102345
12 files changed
+25140 -25

No files matched your search

+2 -2
View File
@@ -65,11 +65,11 @@ IF( NOT USE_QT4 )
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" )
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets )
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
FIND_PACKAGE( Qt5DBus )
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets )
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport )
LIST(APPEND QT_MODULES Core Gui Widgets )
IF( ${Qt5DBus_FOUND} )
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
+3 -1
View File
@@ -3,7 +3,7 @@
###
# This is hard way - please fix
INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/modules ${CMAKE_BINARY_DIR}/modules )
INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/external ${CMAKE_SOURCE_DIR}/modules ${CMAKE_BINARY_DIR}/modules )
set(plaYUver_App_SRCS
# Main
@@ -19,6 +19,8 @@ set(plaYUver_App_SRCS
# Module Quality
QualityHandle.cpp
QualityMeasurementSidebar.cpp
PlotSubWindow.cpp
external/qcustomplot.cpp
# Module Plugins
ModulesHandle.cpp
ModuleHandleDock.cpp
+127
View File
@@ -0,0 +1,127 @@
/* 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 PlotWindowHandle.cpp
* \brief Window to handle plots
*/
#include "PlotSubWindow.h"
namespace plaYUVer
{
PlotSubWindow::PlotSubWindow( QWidget * parent ) :
SubWindowHandle( parent, SubWindowHandle::PLOT_SUBWINDOW )
{
setParent( parent );
setAttribute( Qt::WA_DeleteOnClose );
setBackgroundRole( QPalette::Light );
setVisible( false );
m_cPlotArea = new QCustomPlot( this );
setWidget( m_cPlotArea );
Example();
}
Void PlotSubWindow::Example()
{
// add two new graphs and set their look:
m_cPlotArea->addGraph();
m_cPlotArea->graph( 0 )->setPen( QPen( Qt::blue ) ); // line color blue for first graph
m_cPlotArea->graph( 0 )->setBrush( QBrush( QColor( 0, 0, 255, 20 ) ) ); // first graph will be filled with translucent blue
m_cPlotArea->addGraph();
m_cPlotArea->graph( 1 )->setPen( QPen( Qt::red ) ); // line color red for second graph
// generate some points of data (y0 for first, y1 for second graph):
QVector<double> x( 250 ), y0( 250 ), y1( 250 );
for( int i = 0; i < 250; ++i )
{
x[i] = i;
y0[i] = exp( -i / 150.0 ) * cos( i / 10.0 ); // exponentially decaying cosine
y1[i] = exp( -i / 150.0 ); // exponential envelope
}
// configure right and top axis to show ticks but no labels:
// (see QCPAxisRect::setupFullAxesBox for a quicker method to do this)
m_cPlotArea->xAxis2->setVisible( true );
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) ) );
// pass data points to graphs:
m_cPlotArea->graph( 0 )->setData( x, y0 );
m_cPlotArea->graph( 1 )->setData( x, y1 );
// let the ranges scale themselves so graph 0 fits perfectly in the visible area:
m_cPlotArea->graph( 0 )->rescaleAxes();
// same thing for graph 1, but only enlarge ranges (in case graph 1 is smaller than graph 0):
m_cPlotArea->graph( 1 )->rescaleAxes( true );
// Note: we could have also just called m_cPlotArea->rescaleAxes(); instead
// Allow user to drag axis ranges with mouse, zoom with mouse wheel and select graphs by clicking:
m_cPlotArea->setInteractions( QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables );
}
PlotSubWindow::~PlotSubWindow()
{
delete m_cPlotArea;
}
Void PlotSubWindow::normalSize()
{
}
Void PlotSubWindow::zoomToFit()
{
}
Void PlotSubWindow::zoomToFactor( Double factor, QPoint center )
{
}
Void PlotSubWindow::scaleView( Double scale, QPoint center )
{
}
//QSize PlotSubWindow::sizeHint() const
//{
//
//}
Void PlotSubWindow::closeEvent( QCloseEvent *event )
{
Bool bAccept = true;
if( bAccept )
{
event->accept();
}
else
{
event->ignore();
}
}
} // NAMESPACE
+75
View File
@@ -0,0 +1,75 @@
/* 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 PlotSubWindow.h
* \brief Window to handle plots
*/
#ifndef __PLOTWINDOWHANDLE_H__
#define __PLOTWINDOWHANDLE_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include <QtWidgets>
#elif( QT_VERSION_PLAYUVER == 4 )
#include <QtGui>
#endif
#include "SubWindowHandle.h"
#include "qcustomplot.h"
namespace plaYUVer
{
class PlotSubWindow: public SubWindowHandle
{
Q_OBJECT
private:
QCustomPlot* m_cPlotArea;
Void Example();
public:
PlotSubWindow( QWidget * parent = 0 );
~PlotSubWindow();
/**
* Virtual functions from SubWindowHandle
*/
Void normalSize();
Void zoomToFit();
Void zoomToFactor( Double factor, QPoint center = QPoint() );
Void scaleView( Double scale, QPoint center = QPoint() );
Double getScaleFactor()
{
return 0;
}
//QSize sizeHint() const;
protected:
void closeEvent( QCloseEvent *event );
};
} // NAMESPACE
#endif // __PLOTWINDOWHANDLE_H__
+14 -1
View File
@@ -22,9 +22,10 @@
* \brief Definition of the quality measurement sidebar
*/
#include "lib/PlaYUVerDefs.h"
#include <QtGui>
#include "QualityHandle.h"
#include "VideoSubWindow.h"
#include "PlotSubWindow.h"
#include "DialogSubWindowSelector.h"
namespace plaYUVer
@@ -63,6 +64,8 @@ Void QualityHandle::createActions()
m_arrayActions.resize( TOTAL_ACT );
m_arrayActions[SELECT_REF_ACT] = new QAction( "Select Reference", this );
connect( m_arrayActions[SELECT_REF_ACT], SIGNAL( triggered() ), this, SLOT( slotSelectReference() ) );
m_arrayActions[CREATE_PLOT] = new QAction( "CREATE_PLOT", this );
connect( m_arrayActions[CREATE_PLOT], SIGNAL( triggered() ), this, SLOT( slotCreatePlot() ) );
}
QMenu* QualityHandle::createMenu()
@@ -73,6 +76,7 @@ QMenu* QualityHandle::createMenu()
//m_pcMenuQuality->addActions( m_actionGroupQualityMetric->actions() );
//m_pcMenuQuality->addSeparator();
m_pcMenuQuality->addAction( m_arrayActions[SELECT_REF_ACT] );
m_pcMenuQuality->addAction( m_arrayActions[CREATE_PLOT] );
return m_pcMenuQuality;
}
@@ -150,5 +154,14 @@ Void QualityHandle::slotSelectReference()
}
}
Void QualityHandle::slotCreatePlot()
{
PlotSubWindow* pcPlotWindow = new PlotSubWindow( m_pcParet );
m_pcMainWindowMdiArea->addSubWindow( pcPlotWindow );
pcPlotWindow->show();
}
} // NAMESPACE
+3 -2
View File
@@ -26,13 +26,13 @@
#define __QUALITYMEASUREMENT_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#include <QtCore>
#if( QT_VERSION_PLAYUVER == 5 )
#include <QtWidgets>
#elif( QT_VERSION_PLAYUVER == 4 )
#include <QtGui>
#endif
#include "VideoSubWindow.h"
#include "QualityMeasurementSidebar.h"
namespace plaYUVer
@@ -63,6 +63,7 @@ private:
enum
{
SELECT_REF_ACT,
CREATE_PLOT,
TOTAL_ACT,
};
QVector<QAction*> m_arrayActions;
@@ -81,7 +82,7 @@ Q_SIGNALS:
private Q_SLOTS:
void slotQualityMetricChanged( int );
void slotSelectReference();
void slotCreatePlot();
};
} // NAMESPACE
+1 -1
View File
@@ -23,9 +23,9 @@
*/
#include "VideoSubWindow.h"
#include "ModulesHandle.h"
#include "SubWindowHandle.h"
#include "ConfigureFormatDialog.h"
#include "ViewArea.h"
namespace plaYUVer
{
+2 -2
View File
@@ -33,14 +33,14 @@
#include <QtGui>
#endif
#include "lib/PlaYUVerStream.h"
#include "ViewArea.h"
#include "ModulesHandle.h"
#include "SubWindowHandle.h"
#include "ViewArea.h"
namespace plaYUVer
{
class VideoSubWindow;
class PlaYUVerAppModuleIf;
typedef struct
{
+21370
View File
File diff suppressed because it is too large. Load diff
+3529
View File
File diff suppressed because it is too large. Load diff
+10 -11
View File
@@ -28,7 +28,7 @@
#endif
#include "plaYUVerApp.h"
#include "DialogSubWindowSelector.h"
#include "WidgetFrameNumber.h"
#define SYNCHRONISED_ZOON 1
@@ -54,6 +54,7 @@ plaYUVerApp::plaYUVerApp()
m_appModuleVideo = new VideoHandle( this, mdiArea );
m_appModuleQuality = new QualityHandle( this, mdiArea );
m_appModuleExtensions = new ModulesHandle( this, mdiArea );
createActions();
@@ -200,7 +201,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
videoSubWindow->zoomToFit();
videoSubWindow->getViewArea()->setTool( m_appTool );
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool ) m_uiViewTool );
updateZoomFactorSBox();
addStreamInfoToRecentList( videoSubWindow->getStreamInfo() );
@@ -312,8 +313,6 @@ Void plaYUVerApp::save()
}
}
Void plaYUVerApp::format()
{
if( m_pcCurrentVideoSubWindow )
@@ -377,12 +376,12 @@ Void plaYUVerApp::loadAll()
Void plaYUVerApp::setTool( Int idxTool )
{
m_appTool = ( ViewArea::eTool )idxTool;
actionGroupTools->actions().at( m_appTool )->setChecked( true );
m_uiViewTool = idxTool;
actionGroupTools->actions().at( m_uiViewTool )->setChecked( true );
QList<VideoSubWindow*> videoSubWindowList = mdiArea->findChildren<VideoSubWindow*>();
for( Int i = 0; i < videoSubWindowList.size(); i++ )
{
videoSubWindowList.at( i )->getViewArea()->setTool( m_appTool );
videoSubWindowList.at( i )->getViewArea()->setTool( ( ViewArea::eTool ) m_uiViewTool );
}
}
@@ -799,7 +798,7 @@ Void plaYUVerApp::createActions()
m_mapperTools = new QSignalMapper( this );
connect( m_mapperTools, SIGNAL( mapped(int) ), this, SLOT( setTool(int) ) );
m_appTool = ViewArea::NavigationTool;
m_uiViewTool = ViewArea::NavigationTool;
m_arrayActions[NAVIGATION_TOOL_ACT] = new QAction( tr( "&Navigation Tool" ), this );
m_arrayActions[NAVIGATION_TOOL_ACT]->setCheckable( true );
@@ -1032,8 +1031,8 @@ Void plaYUVerApp::readSettings()
m_cLastOpenPath = appSettings.value( "MainWindow/LastOpenPath", QDir::homePath() ).toString();
m_appTool = ( ViewArea::eTool )appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt();
setTool( m_appTool );
m_uiViewTool = appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toUInt();
setTool( ( ViewArea::eTool ) m_uiViewTool );
QVariant value = appSettings.value( "MainWindow/RecentFileList" );
m_aRecentFileStreamInfo = value.value<PlaYUVerStreamInfoVector>();
@@ -1051,7 +1050,7 @@ Void plaYUVerApp::writeSettings()
appSettings.setValue( "MainWindow/Position", pos() );
appSettings.setValue( "MainWindow/Size", size() );
appSettings.setValue( "MainWindow/LastOpenPath", m_cLastOpenPath );
appSettings.setValue( "MainWindow/SelectedTool", ( Int )m_appTool );
appSettings.setValue( "MainWindow/SelectedTool", m_uiViewTool );
QVariant var;
var.setValue<PlaYUVerStreamInfoVector>( m_aRecentFileStreamInfo );
+4 -5
View File
@@ -26,6 +26,7 @@
#define __PLAYUVERAPP_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include <QtWidgets>
#elif( QT_VERSION_PLAYUVER == 4 )
@@ -35,14 +36,12 @@
#include "PlaYUVerAppAdaptor.h"
#endif
#include <QMainWindow>
#include "lib/PlaYUVerDefs.h"
#include "SubWindowHandle.h"
#include "VideoSubWindow.h"
#include "VideoHandle.h"
#include "QualityHandle.h"
#include "ModulesHandle.h"
#include "SubWindowHandle.h"
#include "AboutDialog.h"
#include "WidgetFrameNumber.h"
#include "VideoSubWindow.h"
namespace plaYUVer
{
@@ -182,7 +181,7 @@ private:
TOTAL_TOOLS,
};
QSignalMapper *m_mapperTools;
ViewArea::eTool m_appTool;
UInt m_uiViewTool;
/**
* App modules