Merge branch 'devel' into zoom-devel

This commit is contained in:
Luis Lucas committed 2015-04-18 20:11:19 +01:00
commit ddb51110bf
17 files changed
+421 -118

No files matched your search

+1
View File
@@ -71,6 +71,7 @@ set(plaYUVer_App_SRCS
ConfigureFormatDialog.cpp
DialogSubWindowSelector.cpp
ProgressBar.cpp
SeekStreamDialog.cpp
# Widgets
HistogramWidget.cpp
WidgetFrameNumber.cpp
+1 -2
View File
@@ -134,8 +134,7 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
// -------------------------------------------------------------
histogramWidget = new HistogramWidget( 256, 100 );
histogramWidget->setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel );
histogramWidget = new HistogramWidget( 100, 100 );
histogramWidget->setWhatsThis( tr( "<p>This is the histogram drawing of "
"the selected image channel" ) );
+15 -19
View File
@@ -177,7 +177,20 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget *parent ) :
setAttribute( Qt::WA_DeleteOnClose );
d = new HistogramWidgetPrivate;
setupWidget( width, height );
m_channelType = LumaHistogram;
m_scaleType = LogScaleHistogram;
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel );
setMouseTracking( true );
setMinimumSize( width, height );
d->blinkTimer = new QTimer( this );
connect( d->blinkTimer, SIGNAL( timeout() ), this, SLOT( slotBlinkTimerDone() ) );
m_imageHistogram = 0;
m_selectionHistogram = 0;
@@ -210,23 +223,6 @@ HistogramWidget::~HistogramWidget()
// Setup Functions
////////////////////////////////////////////////////////////////////////////////
Void HistogramWidget::setupWidget( Int width, Int height, HistogramOptions options )
{
m_channelType = LumaHistogram;
m_scaleType = LogScaleHistogram;
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
setOptions( options );
setMouseTracking( true );
setMinimumSize( width, height );
d->blinkTimer = new QTimer( this );
connect( d->blinkTimer, SIGNAL( timeout() ), this, SLOT( slotBlinkTimerDone() ) );
}
Void HistogramWidget::setOptions( HistogramOptions options )
{
d->statisticsVisible = ( bool )( options & ShowStatistics );
@@ -1037,7 +1033,7 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent * e )
{
if( d->selectMode == true && d->clearFlag == HistogramWidgetPrivate::HistogramCompleted )
{
setCursor( Qt::CrossCursor );
setCursor( Qt::SizeHorCursor );
if( d->inSelected )
{
-3
View File
@@ -109,9 +109,6 @@ public :
*/
HistogramWidget( Int width, Int height, QWidget *parent = 0 );
Void setupWidget( Int width, Int height,
HistogramOptions options = AllOptions );
~HistogramWidget();
/** Stop current histogram computations.*/
+27 -63
View File
@@ -291,7 +291,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
else
{
windowName.append( pcVideoSubWindow->getWindowName() );
videoSubWindowList.append( pcVideoSubWindow );
}
@@ -302,9 +301,8 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
return;
}
windowName.append( " <" );
windowName.append( QStringLiteral( "Module " ) );
windowName.append( pcCurrModuleIf->m_pcModule->m_pchModuleName );
windowName.append( ">" );
for( Int i = 0; i < videoSubWindowList.size(); i++ )
{
@@ -387,7 +385,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
}
applyModuleIf( pcCurrModuleIf, false );
applyModuleIf( pcCurrModuleIf, false, true );
QCoreApplication::processEvents();
if( pcModuleSubWindow )
@@ -402,40 +400,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
{
if( pcCurrModuleIf )
{
if( pcCurrModuleIf->m_pcModuleDock )
{
pcCurrModuleIf->m_pcModuleDock->close();
pcCurrModuleIf->m_pcModuleDock = NULL;
}
if( pcCurrModuleIf->m_pcDockWidget )
{
pcCurrModuleIf->m_pcDockWidget->close();
pcCurrModuleIf->m_pcDockWidget = NULL;
}
if( pcCurrModuleIf->m_pcDisplaySubWindow )
pcCurrModuleIf->m_pcDisplaySubWindow->closeSubWindow();
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
{
if( pcCurrModuleIf->m_pcSubWindow[i] )
{
pcCurrModuleIf->m_pcSubWindow[i]->disableModule( pcCurrModuleIf );
pcCurrModuleIf->m_pcSubWindow[i] = NULL;
}
}
if( pcCurrModuleIf->m_pcModuleStream )
{
pcCurrModuleIf->m_pcModuleStream->close();
delete pcCurrModuleIf->m_pcModuleStream;
pcCurrModuleIf->m_pcModuleStream = NULL;
}
if( pcCurrModuleIf->m_pcModule )
{
pcCurrModuleIf->m_pcModule->destroy();
pcCurrModuleIf->m_pcModule->Delete();
pcCurrModuleIf->m_pcModule = NULL;
}
pcCurrModuleIf->destroy();
}
}
@@ -460,14 +425,22 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isP
{
Bool bRet = false;
QApplication::setOverrideCursor( Qt::WaitCursor );
if( pcCurrModuleIf->m_pcDisplaySubWindow )
{
pcCurrModuleIf->m_pcDisplaySubWindow->setFillWindow( true );
}
else
{
pcCurrModuleIf->m_pcSubWindow[0]->setFillWindow( true );
}
if( !( isPlaying && ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
{
#ifdef PLAYUVER_THREADED_MODULES
if( !disableThreads )
pcCurrModuleIf->start();
pcCurrModuleIf->start();
else
#endif
pcCurrModuleIf->run();
pcCurrModuleIf->run();
if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
{
@@ -562,29 +535,28 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
}
}
Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame )
Void ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
{
Bool bRet = false;
//if( processedFrame )
switch( pcCurrModuleIf->m_pcModule->m_iModuleType )
{
case FRAME_PROCESSING_MODULE:
if( pcCurrModuleIf->m_pcDisplaySubWindow )
{
pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame );
bRet = true;
pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame );
pcCurrModuleIf->m_pcDisplaySubWindow->setFillWindow( false );
pcCurrModuleIf->m_pcDisplaySubWindow->clearWindowBusy();
}
else
{
pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame );
pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( pcCurrModuleIf->m_pcProcessedFrame );
pcCurrModuleIf->m_pcSubWindow[0]->setFillWindow( false );
pcCurrModuleIf->m_pcSubWindow[0]->clearWindowBusy();
}
break;
case FRAME_MEASUREMENT_MODULE:
pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( pcCurrModuleIf->m_dMeasurementResult );
break;
}
return bRet;
}
Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult )
{
Bool bRet = false;
pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( moduleResult );
return bRet;
}
Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
@@ -607,15 +579,7 @@ Void ModulesHandle::customEvent( QEvent *event )
PlaYUVerAppModuleIf::EventData *eventData = ( PlaYUVerAppModuleIf::EventData* )event;
if( eventData->m_bSuccess )
{
switch( eventData->m_pcModule->m_pcModule->m_iModuleType )
{
case FRAME_PROCESSING_MODULE:
showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_pcProcessedFrame );
break;
case FRAME_MEASUREMENT_MODULE:
showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_dMeasurementResult );
break;
}
showModuleIf( eventData->m_pcModule );
}
}
+1 -2
View File
@@ -65,8 +65,7 @@ public:
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying = false, Bool disableThreads = false );
static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame );
static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult );
static Void showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf );
private:
QWidget* m_pcParent;
-1
View File
@@ -70,7 +70,6 @@ ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget *parent, PlaYUVerAppModu
{
resize( 400, 10 );
setWindowTitle( "Select module parameters" );
setWindowIcon( QIcon( ":/images/configureformat.png" ) );
const Options::OptionsList& moduleOptions = m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
+53 -9
View File
@@ -30,6 +30,7 @@ namespace plaYUVer
{
PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module ) :
m_bIsRunning( false ),
m_pcModuleAction( action ),
m_pcModule( module ),
m_pcDisplaySubWindow( NULL ),
@@ -46,11 +47,11 @@ PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaY
}
}
void PlaYUVerAppModuleIf::run()
Void PlaYUVerAppModuleIf::run()
{
m_pcProcessedFrame = NULL;
m_dMeasurementResult = 0;
m_bIsRunning = true;
// m_pcProcessedFrame = NULL;
// m_dMeasurementResult = 0;
std::vector<PlaYUVerFrame*> apcFrameList;
for( UInt i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
@@ -84,15 +85,58 @@ void PlaYUVerAppModuleIf::run()
{
return;
}
postProgress( true );
m_bIsRunning = false;
EventData *eventData = new EventData( true, this );
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
return;
}
Void PlaYUVerAppModuleIf::postProgress( Bool success )
Void PlaYUVerAppModuleIf::destroy()
{
EventData *eventData = new EventData( success, this );
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
if( m_bIsRunning )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
while( m_bIsRunning )
{
}
QApplication::restoreOverrideCursor();
}
if( m_pcModuleDock )
{
m_pcModuleDock->close();
m_pcModuleDock = NULL;
}
if( m_pcDockWidget )
{
m_pcDockWidget->close();
m_pcDockWidget = NULL;
}
if( m_pcDisplaySubWindow )
m_pcDisplaySubWindow->closeSubWindow();
m_pcDisplaySubWindow = NULL;
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
{
if( m_pcSubWindow[i] )
{
m_pcSubWindow[i]->disableModule( this );
m_pcSubWindow[i] = NULL;
}
}
if( m_pcModuleStream )
{
m_pcModuleStream->close();
delete m_pcModuleStream;
m_pcModuleStream = NULL;
}
if( m_pcModule )
{
m_pcModule->destroy();
m_pcModule->Delete();
m_pcModule = NULL;
}
}
} // NAMESPACE
+16 -2
View File
@@ -29,6 +29,7 @@
#include "PlaYUVerAppDefs.h"
#include <iostream>
#include <cstdio>
#include <QVector>
#include "lib/PlaYUVerFrame.h"
#include "lib/PlaYUVerStream.h"
#include "ModuleHandleDock.h"
@@ -39,13 +40,15 @@ class QAction;
namespace plaYUVer
{
#define PLAYUVER_THREADED_MODULES
class VideoSubWindow;
class PlaYUVerAppModuleIf
#ifdef PLAYUVER_THREADED_MODULES
: public QThread
#else
: public QObject
: public QObject
#endif
{
friend class ModulesHandle;
@@ -54,6 +57,8 @@ class PlaYUVerAppModuleIf
private:
Bool m_bIsRunning;
QAction* m_pcModuleAction;
PlaYUVerModuleIf* m_pcModule;
@@ -68,7 +73,6 @@ private:
PlaYUVerFrame* m_pcProcessedFrame;
Double m_dMeasurementResult;
Void postProgress( Bool success );
public:
class EventData: public QEvent
{
@@ -88,6 +92,16 @@ public:
{
}
QList<VideoSubWindow*> getSubWindowList()
{
QList<VideoSubWindow*> arraySubWindows;
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
if( m_pcSubWindow[i] )
arraySubWindows.append( m_pcSubWindow[i] );
return arraySubWindows;
}
Void destroy();
protected:
virtual void run();
};
+2
View File
@@ -116,6 +116,7 @@ Void PlaYUVerSubWindowHandle::resetWindowMode()
m_apcMdiSubWindowList.clear();
if( m_pcMdiArea )
delete m_pcMdiArea;
m_pcMdiArea = NULL;
if( m_pcWindowManagerLayout )
delete m_pcWindowManagerLayout;
@@ -250,6 +251,7 @@ Void PlaYUVerSubWindowHandle::removeSubWindow( Int windowIdx )
PlaYUVerMdiSubWindow* mdiSubWindow = m_apcMdiSubWindowList.at( windowIdx );
m_apcMdiSubWindowList.removeAt( windowIdx );
m_pcMdiArea->removeSubWindow( m_apcSubWindowList.at( windowIdx ) );
m_apcSubWindowList.at( windowIdx )->close();
mdiSubWindow->close();
m_apcSubWindowList.removeAt( windowIdx );
}
+86
View File
@@ -0,0 +1,86 @@
/* 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 SeekStreamDialog.cpp
* \brief Dialog box to config modules opts
*/
#include "SeekStreamDialog.h"
#include "lib/PlaYUVerStream.h"
#include <QWidget>
#include <QLabel>
#include <QVector>
#include <QGridLayout>
#include <QSpinBox>
namespace plaYUVer
{
SeekStreamDialog::SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *parent ) :
QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ),
m_iSelectedFrameNum()
{
m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum();
setWindowModality( Qt::ApplicationModal );
setWindowTitle( "Seek Video" );
QFont labelFont;
labelFont.setStretch( 110 );
QLabel* pcLabel = new QLabel;
pcLabel->setText( QString( "Go to frame (0 - %1)" ).arg( pcCurrStream->getFrameNum() - 1 ) );
pcLabel->setFont( labelFont );
m_spinFrameNum = new QSpinBox;
m_spinFrameNum->setMinimumSize( 70, 5 );
m_spinFrameNum->setMaximumSize( 70, 30 );
m_spinFrameNum->setMinimum( 0 );
m_spinFrameNum->setMaximum( pcCurrStream->getFrameNum() - 1 );
m_spinFrameNum->setValue( m_iSelectedFrameNum );
QDialogButtonBox* dialogButtonOkCancel = new QDialogButtonBox();
dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) );
dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
dialogButtonOkCancel->setCenterButtons( false );
QGridLayout* mainLayout = new QGridLayout;
mainLayout->addWidget( pcLabel, 0, 0 );
mainLayout->addWidget( m_spinFrameNum, 0, 1 );
mainLayout->addWidget( dialogButtonOkCancel, 1, 0, 1, 2, Qt::AlignRight );
setLayout( mainLayout );
setFixedSize( 220, mainLayout->sizeHint().height() );
connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
}
Int SeekStreamDialog::runDialog()
{
if( exec() == QDialog::Rejected )
{
return -1;
}
m_iSelectedFrameNum = m_spinFrameNum->value();
return m_iSelectedFrameNum;
}
} // NAMESPACE
+54
View File
@@ -0,0 +1,54 @@
/* 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 SeekStreamDialog.h
* \brief Dialog box to config modules opts
*/
#ifndef __SEEKSTREAMDIALOG_H__
#define __SEEKSTREAMDIALOG_H__
#include "config.h"
#include "PlaYUVerAppDefs.h"
#include "PlaYUVerAppModuleIf.h"
#include <QDialog>
#include <QVector>
namespace plaYUVer
{
/**
*
*/
class SeekStreamDialog: public QDialog
{
Q_OBJECT
public:
SeekStreamDialog( PlaYUVerStream *pcCurrStream, QWidget *parent = 0 );
Int runDialog();
private:
QSpinBox* m_spinFrameNum;
Int m_iSelectedFrameNum;
};
} // NAMESPACE
#endif // __MODULEHANDLEOPTDIALOG_H__
+37 -3
View File
@@ -27,6 +27,7 @@
#include "VideoSubWindow.h"
#include "PlaYUVerSubWindowHandle.h"
#include "DialogSubWindowSelector.h"
#include "SeekStreamDialog.h"
#include "FramePropertiesDock.h"
#include "WidgetFrameNumber.h"
#include <QtGui>
@@ -90,15 +91,19 @@ Void VideoHandle::createActions()
connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) );
m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 );
m_arrayActions[VIDEO_GOTO_ACT] = new QAction( "Go to", this );
m_arrayActions[VIDEO_GOTO_ACT]->setShortcut( tr( "Ctrl+G" ) );
connect( m_arrayActions[VIDEO_GOTO_ACT], SIGNAL( triggered() ), this, SLOT( seekVideo() ) );
m_arrayActions[VIDEO_LOOP_ACT] = new QAction( "Repeat", this );
m_arrayActions[VIDEO_LOOP_ACT]->setCheckable( true );
m_arrayActions[VIDEO_LOOP_ACT]->setChecked( false );
m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Video Zoom Lock", this );
m_arrayActions[VIDEO_ZOOM_LOCK_ACT] = new QAction( "Zoom Lock", this );
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setCheckable( true );
m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked( false );
m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Video Lock Window Selection", this );
m_arrayActions[VIDEO_LOCK_SELECTION_ACT] = new QAction( "Playing Lock", this );
connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) );
m_pcFrameSlider = new QSlider;
@@ -117,6 +122,8 @@ QMenu* VideoHandle::createMenu()
m_pcMenuVideo->addAction( m_arrayActions[STOP_ACT] );
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] );
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_GOTO_ACT] );
m_pcMenuVideo->addSeparator();
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_LOOP_ACT] );
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_ZOOM_LOCK_ACT] );
m_pcMenuVideo->addAction( m_arrayActions[VIDEO_LOCK_SELECTION_ACT] );
@@ -331,7 +338,7 @@ Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center )
Void VideoHandle::moveAllScrollBars( const QPoint offset )
{
QPoint newOffset = offset;
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() )
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow )
{
VideoSubWindow *videoSubWindow;
QList<SubWindowAbstract*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
@@ -562,6 +569,33 @@ Void VideoHandle::seekEvent( Int direction )
}
}
Void VideoHandle::seekVideo()
{
if( m_pcCurrentVideoSubWindow )
{
if( m_pcCurrentVideoSubWindow->getInputStream() )
{
SeekStreamDialog* dialogSeekVideo = new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), this );
Int newFrameNum = dialogSeekVideo->runDialog();
if( newFrameNum >= 0 )
{
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
{
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
{
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )newFrameNum );
}
}
else
{
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( ( UInt )newFrameNum );
}
emit changed();
}
}
}
}
Void VideoHandle::seekSliderEvent( Int new_frame_num )
{
if( m_pcCurrentVideoSubWindow )
+2
View File
@@ -79,6 +79,7 @@ private:
STOP_ACT,
VIDEO_FORWARD_ACT,
VIDEO_BACKWARD_ACT,
VIDEO_GOTO_ACT,
VIDEO_LOOP_ACT,
VIDEO_ZOOM_LOCK_ACT,
VIDEO_LOCK_ACT,
@@ -129,6 +130,7 @@ private Q_SLOTS:
void playEvent();
void seekSliderEvent( int new_frame_num );
void seekEvent( int direction );
void seekVideo();
void videoSelectionButtonEvent();
};
+106 -8
View File
@@ -22,6 +22,7 @@
* \brief Video Sub windows handling
*/
#include <QStaticText>
#include "VideoSubWindow.h"
#include "ModulesHandle.h"
#include "ConfigureFormatDialog.h"
@@ -34,6 +35,10 @@
namespace plaYUVer
{
/**
* \brief Functions to control data stream from stream information
*/
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array )
{
PlaYUVerStreamInfo d;
@@ -78,14 +83,71 @@ Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename )
return -1;
}
/**
* \class VideoInformation
* \brief Shows information about video sub window
*/
class VideoInformation: public QWidget
{
private:
QList<QStaticText> m_cTopLeftTextList;
QFont m_cTopLeftTextFont;
QFont m_cCenterTextFont;
Bool m_bBusyWindow;
public:
VideoInformation( QWidget *parent ) :
QWidget( parent ),
m_bBusyWindow( false )
{
setPalette( Qt::transparent );
setAttribute( Qt::WA_TransparentForMouseEvents );
m_cTopLeftTextFont.setPointSize( 8 );
m_cCenterTextFont.setPointSize( 12 );
}
Void setInformationTopLeft( const QStringList& textLines )
{
m_cTopLeftTextList.clear();
for( Int i = 0; i < textLines.size(); i++ )
{
m_cTopLeftTextList.append( textLines.at( i ) );
}
}
Void setBusyWindow( Bool bFlag )
{
m_bBusyWindow = bFlag;
}
protected:
void paintEvent( QPaintEvent *event )
{
QPainter painter( this );
painter.setFont( m_cTopLeftTextFont );
if( !m_cTopLeftTextList.isEmpty() && size().width() > 300 )
{
QPoint topLeftCorner( 10, 10 );
for( Int i = 0; i < m_cTopLeftTextList.size(); i++ )
{
painter.drawStaticText( topLeftCorner, m_cTopLeftTextList.at( i ) );
topLeftCorner += QPoint( 0, 15 );
}
}
if( m_bBusyWindow )
{
painter.setFont( m_cCenterTextFont );
painter.drawText( rect(), Qt::AlignHCenter | Qt::AlignVCenter, QStringLiteral( "Refreshing..." ) );
painter.fillRect( rect(), QBrush( QColor::fromRgb( 255, 255, 255, 50 ), Qt::SolidPattern ) );
}
}
};
VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent ) :
SubWindowAbstract( parent, SubWindowAbstract::VIDEO_SUBWINDOW | category ),
m_bWindowBusy( false ),
m_pCurrStream( NULL ),
m_pcCurrFrame( NULL ),
m_pcCurrentDisplayModule( NULL ),
m_pcReferenceSubWindow( NULL ),
m_bIsPlaying( false ),
m_bIsModule( category == MODULE_SUBWINDOW )
m_bIsPlaying( false )
{
// Create a new scroll area inside the sub-window
@@ -108,8 +170,6 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget
m_pcScrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
// Define the cViewArea as the widget inside the scroll area
// m_cViewArea->setMinimumSize( size() );
m_pcScrollArea->setWidget( m_cViewArea );
m_pcScrollArea->setWidgetResizable( true );
@@ -119,6 +179,12 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget
m_apcCurrentModule.clear();
m_pcUpdateTimer = new QTimer();
m_pcUpdateTimer->setInterval( 800 );
connect( m_pcUpdateTimer, SIGNAL( timeout() ), this, SLOT( updateWindowOnTimeout() ) );
//! Add video information
m_pcVideoInfo = new VideoInformation( this );
}
VideoSubWindow::~VideoSubWindow()
@@ -154,6 +220,7 @@ Void VideoSubWindow::refreshSubWindow()
{
refreshFrame();
}
updateVideoWindowInfo();
}
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
@@ -244,6 +311,23 @@ Void VideoSubWindow::updateVideoWindowInfo()
if( m_pcCurrentDisplayModule )
{
m_cStreamInformation = "Module";
QList<VideoSubWindow*> arraySubWindows = m_pcCurrentDisplayModule->getSubWindowList();
QStringList sourceWindowList;
if( arraySubWindows.size() > 0 )
{
for( Int i = 0; i < arraySubWindows.size(); i++ )
{
if( arraySubWindows.at( i )->getWindowName() != getWindowName() )
{
sourceWindowList.append( QString( "Input %1 - " + arraySubWindows.at( i )->getWindowName() ).arg( i + 1 ) );
}
}
}
qDebug( ) << sourceWindowList;
if( sourceWindowList.size() > 0 )
{
m_pcVideoInfo->setInformationTopLeft( sourceWindowList );
}
}
else if( m_pCurrStream )
{
@@ -427,13 +511,16 @@ Void VideoSubWindow::associateModule( PlaYUVerAppModuleIf* pcModule )
m_apcCurrentModule.append( pcModule );
}
Void VideoSubWindow::setFillWindow( Bool bFlag )
{
m_pcVideoInfo->setBusyWindow( bFlag );
}
Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
{
// if( m_pcCurrFrame )
// if( m_pcCurrFrame )
{
m_pcCurrFrame = pcCurrFrame;
m_cViewArea->setImage( m_pcCurrFrame );
updateVideoWindowInfo();
}
}
@@ -447,6 +534,7 @@ Void VideoSubWindow::refreshFrameOperation()
}
if( m_pcCurrentDisplayModule )
{
m_bWindowBusy = true;
ModulesHandle::applyModuleIf( m_pcCurrentDisplayModule, m_bIsPlaying );
bSetFrame = false;
}
@@ -456,6 +544,7 @@ Void VideoSubWindow::refreshFrameOperation()
}
for( Int i = 0; i < m_apcCurrentModule.size(); i++ )
{
m_bWindowBusy = true;
ModulesHandle::applyModuleIf( m_apcCurrentModule.at( i ), m_bIsPlaying );
}
}
@@ -593,7 +682,7 @@ Void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
valueY = scrollBarV->minimum();
m_cCurrScroll.setY( valueY );
// Update window scroll
// Update window scroll
scrollBarH->setValue( m_cCurrScroll.x() );
scrollBarV->setValue( m_cCurrScroll.y() );
}
@@ -637,7 +726,7 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
m_cCurrScroll.setY( value );
}
// Update window scroll
// Update window scroll
scrollBarH->setValue( m_cCurrScroll.x() );
scrollBarV->setValue( m_cCurrScroll.y() );
@@ -804,6 +893,15 @@ QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const
return isize;
}
Void VideoSubWindow::updateWindowOnTimeout()
{
m_pcVideoInfo->update();
}
Void VideoSubWindow::resizeEvent( QResizeEvent* event )
{
m_pcVideoInfo->resize( event->size() );
}
//Void VideoSubWindow::closeEvent( QCloseEvent *event )
//{
// Bool bAccept = m_bIsPlaying ? false : true;
+19 -5
View File
@@ -41,6 +41,7 @@ class QScrollArea;
namespace plaYUVer
{
class VideoInformation;
class VideoSubWindow;
class PlaYUVerAppModuleIf;
@@ -66,12 +67,16 @@ Q_OBJECT
private:
Bool m_bWindowBusy;
QScrollArea* m_pcScrollArea;
QPoint m_cLastScroll;
QPoint m_cCurrScroll;
ViewArea* m_cViewArea;
VideoInformation* m_pcVideoInfo;
QString m_cFilename;
QString m_cStreamInformation;
PlaYUVerStreamInfo m_sStreamInfo;
@@ -89,8 +94,8 @@ private:
QString m_cCurrFileName;
Bool m_bIsPlaying;
Bool m_bIsModule;
QTimer* m_pcUpdateTimer;
/**
* Threads variables
* QtConcurrent
@@ -115,8 +120,8 @@ private:
public:
enum VideoSubWindowCategories
{
VIDEO_STREAM_SUBWINDOW = 2,
MODULE_SUBWINDOW = 4,
VIDEO_STREAM_SUBWINDOW = SubWindowAbstract::VIDEO_STREAM_SUBWINDOW,
MODULE_SUBWINDOW = SubWindowAbstract::MODULE_SUBWINDOW,
};
VideoSubWindow( enum VideoSubWindowCategories category, QWidget * parent = 0 );
~VideoSubWindow();
@@ -245,13 +250,22 @@ public:
Bool getIsModule()
{
return m_bIsModule;
return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW;
}
//protected:
Void clearWindowBusy()
{
m_bWindowBusy = false;
}
Void setFillWindow( Bool bFlag );
protected:
Void resizeEvent( QResizeEvent* event );
//void closeEvent( QCloseEvent *event );
public Q_SLOTS:
void updateWindowOnTimeout();
void adjustScrollBarByScale( double scale, QPoint center );
void adjustScrollBarByOffset( QPoint Offset );
void updateCurScrollValues();