Merge devel into master

This commit is contained in:
jfmcarreira committed 2014-06-15 13:07:15 +01:00
1 parent 7a5a965a29
commit b02072c585
13 files changed
+310 -87

No files matched your search

+8 -7
View File
@@ -32,7 +32,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SRC_DIR}/
FILE( GLOB SOURCES_FILES ${SRC_DIR}/app/*.cpp ${SRC_DIR}/lib/*.cpp )
FILE( GLOB FORMS_FILES ${UI_DIR}/*.ui )
FILE( GLOB RESOURCES_FILES ${RSC_DIR}/*.qrc )
FILE( GLOB RESOURCES_FILES ${RSC_DIR}/*.qrc ${RSC_DIR}/*.rc )
# must go before the project command
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
@@ -45,11 +45,12 @@ SET( CMAKE_CXX_FLAGS "" )
######################################################################################
# Variables
######################################################################################
ADD_OPTION(USE_WERROR "Warnings as errors" OFF )
ADD_OPTION(USE_QT4 "Build with QT4" OFF )
ADD_OPTION(USE_OPENCV "Add OpenCV support" OFF )
ADD_OPTION(USE_PIXFC "Add PIXFC support" OFF )
ADD_OPTION(USE_FFMPEG "Add FFMPEG support" OFF )
ADD_OPTION(PLAYUVER_WERROR "Warnings as errors" OFF )
ADD_OPTION(PLAYUVER_THREADED_MODULES "Warnings as errors" ON )
ADD_OPTION(USE_QT4 "Build with QT4" OFF )
ADD_OPTION(USE_OPENCV "Add OpenCV support" OFF )
ADD_OPTION(USE_PIXFC "Add PIXFC support" OFF )
ADD_OPTION(USE_FFMPEG "Add FFMPEG support" OFF )
######################################################################################
# Dependencies
@@ -103,7 +104,7 @@ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3" )
IF( USE_WERROR )
IF( PLAYUVER_WERROR )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
ENDIF()
+2
View File
@@ -36,6 +36,8 @@
#define QT_VERSION_PLAYUVER 4
#endif
#cmakedefine PLAYUVER_THREADED_MODULES
/* OpenCV */
#cmakedefine USE_OPENCV
+2 -2
View File
@@ -101,12 +101,12 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
resolutionLabel->setText( "Resolution chosen" );
QLabel* widthLabel = new QLabel( "Width" );
m_spinBoxWidth = new QSpinBox();
m_spinBoxWidth->setRange( 0, 7240 );
m_spinBoxWidth->setRange( 0, 8192 );
m_spinBoxWidth->setValue( 0 );
QLabel* heightLabel = new QLabel( "Height" );
m_spinBoxheight = new QSpinBox();
m_spinBoxheight->setRange( 0, 5432 );
m_spinBoxheight->setRange( 0, 4608 );
m_spinBoxheight->setValue( 0 );
QLabel* pixelsLabel = new QLabel();
+7
View File
@@ -75,9 +75,16 @@ private:
{
ADD_STANDARD_RESOLUTION( "CIF (352x288)", 352, 288 );
ADD_STANDARD_RESOLUTION( "VGA (640x480)", 640, 480 );
ADD_STANDARD_RESOLUTION( "WVGA (832x480)", 832, 480 );
ADD_STANDARD_RESOLUTION( "XVGA (1024x768)", 1024, 768 );
ADD_STANDARD_RESOLUTION( "HD (1280x720)", 1280, 720 );
ADD_STANDARD_RESOLUTION( "SXGA- (1280x900)", 1280, 900 );
ADD_STANDARD_RESOLUTION( "SXGA (1280x1024)", 1280, 1024 );
ADD_STANDARD_RESOLUTION( "WSXGA (1440x900)", 1440, 900 );
ADD_STANDARD_RESOLUTION( "Full HD (1920x1080)", 1920, 1080 );
ADD_STANDARD_RESOLUTION( "WQXGA (2560x1600)", 2560, 1600 );
ADD_STANDARD_RESOLUTION( "Ultra HD (3840x2160)", 3840, 2160 );
ADD_STANDARD_RESOLUTION( "8K", 8192, 4608 );
}
};
+66 -5
View File
@@ -41,6 +41,7 @@ namespace plaYUVer
InputStream::InputStream()
{
m_bInit = false;
m_bLoadAll = false;
m_iErrorStatus = 0;
m_pFile = NULL;
@@ -58,6 +59,7 @@ InputStream::InputStream()
m_pcNextFrame = NULL;
m_ppcFrameBuffer = NULL;
m_uiFrameBufferSize = 2;
m_uiFrameBufferIndex = 0;
m_uiAveragePlayInterval = 0;
}
@@ -145,6 +147,7 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
return m_bInit;
}
m_uiFrameBufferSize = 2;
getMem1D<PlaYUVerFrame*>( &m_ppcFrameBuffer, m_uiFrameBufferSize );
for( UInt i = 0; i < m_uiFrameBufferSize; i++ )
{
@@ -193,6 +196,7 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
m_iCurrFrameNum = -1;
seekInput( 0 );
//loadAll();
m_cTimer.start();
m_uiAveragePlayInterval = 0;
@@ -229,6 +233,7 @@ Void InputStream::close()
<< QString::number( 1000 / ( m_uiAveragePlayInterval + 1 ) )
<< " fps";
m_bLoadAll = false;
m_bInit = false;
}
@@ -293,6 +298,45 @@ Bool InputStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, In
return bRet;
}
Void InputStream::loadAll()
{
if( m_bLoadAll )
return;
if( m_ppcFrameBuffer )
{
for( UInt i = 0; i < m_uiFrameBufferSize; i++ )
{
if( m_ppcFrameBuffer[i] )
delete m_ppcFrameBuffer[i];
m_ppcFrameBuffer[i] = NULL;
}
freeMem1D<PlaYUVerFrame*>( m_ppcFrameBuffer );
m_ppcFrameBuffer = NULL;
}
m_uiFrameBufferSize = m_uiTotalFrameNum;
getMem1D<PlaYUVerFrame*>( &m_ppcFrameBuffer, m_uiFrameBufferSize );
for( UInt i = 0; i < m_uiFrameBufferSize; i++ )
{
m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_uiWidth, m_uiHeight, m_iPixelFormat );
if( !m_ppcFrameBuffer[i] )
{
close();
}
}
m_uiFrameBufferIndex = 0;
m_pcCurrFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
m_iCurrFrameNum = -1;
seekInput( 0 );
for( UInt i = 0; i < m_uiFrameBufferSize-1; i++ )
{
readNextFrame();
setNextFrame();
}
m_bLoadAll = true;
seekInput( 0 );
}
Void InputStream::getDuration( Int* duration_array )
{
Int hours, mins, secs;
@@ -327,6 +371,11 @@ Void InputStream::readNextFrame()
return;
}
if( m_bLoadAll )
{
return;
}
#ifdef USE_FFMPEG
if( m_cLibAvContext.getStatus() )
{
@@ -365,8 +414,12 @@ Void InputStream::setNextFrame()
{
m_pcCurrFrame = m_pcNextFrame;
m_iCurrFrameNum++;
m_pcNextFrame = m_ppcFrameBuffer[!m_uiFrameBufferIndex];
m_uiFrameBufferIndex = !m_uiFrameBufferIndex;
m_uiFrameBufferIndex++;
if( m_uiFrameBufferIndex == m_uiFrameBufferSize )
{
m_uiFrameBufferIndex = 0;
}
m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
}
else
{
@@ -391,10 +444,18 @@ PlaYUVerFrame* InputStream::getCurrFrame()
Void InputStream::seekInput( UInt64 new_frame_num )
{
if( !m_pFile )
if( !m_pFile || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || (Int64)new_frame_num == m_iCurrFrameNum )
return;
if( new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || (Int64)new_frame_num == m_iCurrFrameNum )
m_iCurrFrameNum = new_frame_num - 1;
if( m_bLoadAll )
{
m_uiFrameBufferIndex = new_frame_num;
m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
setNextFrame();
return;
}
#ifdef USE_FFMPEG
if( m_cLibAvContext.getStatus() )
{
@@ -409,7 +470,7 @@ Void InputStream::seekInput( UInt64 new_frame_num )
}
m_uiFrameBufferIndex = 0;
m_pcCurrFrame = m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
m_iCurrFrameNum = new_frame_num - 1;
readNextFrame();
setNextFrame();
if( m_uiTotalFrameNum > 1 )
+3
View File
@@ -48,6 +48,7 @@ class InputStream
private:
Bool m_bInit;
Bool m_bLoadAll;
Int m_iErrorStatus;
#ifdef USE_FFMPEG
@@ -109,6 +110,8 @@ public:
Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate );
Void getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate );
Void loadAll();
Void readNextFrame();
Bool writeFrame( const QString& filename );
+36 -20
View File
@@ -74,7 +74,6 @@ SubWindowHandle* ModulesHandle::processModuleHandlingOpt()
else
{
destroyModuleIf( pcCurrModuleIf );
return NULL;
}
}
else
@@ -154,6 +153,8 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf
{
pcCurrModuleIf->m_pcSubWindow[i]->enableModule( pcCurrModuleIf );
}
applyModuleIf( pcCurrModuleIf, false );
return interfaceChild;
}
@@ -185,32 +186,18 @@ Void ModulesHandle::destroyAllModulesIf()
Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlaying )
{
PlaYUVerFrame* processedFrame = NULL;
Bool bRet = false;
if( !isPlaying || ( isPlaying && pcCurrModuleIf->m_cModuleDef.m_bApplyWhilePlaying ) )
{
switch( pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames )
{
case MODULE_REQUIRES_ONE_FRAME:
processedFrame = pcCurrModuleIf->process( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
break;
case MODULE_REQUIRES_TWO_FRAMES:
processedFrame = pcCurrModuleIf->process( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame(), pcCurrModuleIf->m_pcSubWindow[1]->getCurrFrame() );
break;
case MODULE_REQUIRES_THREE_FRAMES:
processedFrame = pcCurrModuleIf->process( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame(), pcCurrModuleIf->m_pcSubWindow[1]->getCurrFrame(),
pcCurrModuleIf->m_pcSubWindow[2]->getCurrFrame() );
break;
}
#ifdef PLAYUVER_THREADED_MODULES
pcCurrModuleIf->start();
#else
pcCurrModuleIf->run();
#endif
if( pcCurrModuleIf->m_pcDisplaySubWindow )
{
pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame );
bRet = true;
}
else
{
pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame );
}
}
else
{
@@ -219,6 +206,21 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Bool isPlay
return bRet;
}
Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame )
{
Bool bRet = false;
if( pcCurrModuleIf->m_pcDisplaySubWindow )
{
pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame );
bRet = true;
}
else
{
pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame );
}
return bRet;
}
Void ModulesHandle::swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf )
{
if( pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES )
@@ -229,6 +231,19 @@ Void ModulesHandle::swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf )
}
}
Void ModulesHandle::customEvent( QEvent *event )
{
if( !event )
{
return;
}
PlaYUVerModuleIf::EventData *eventData = ( PlaYUVerModuleIf::EventData* )event;
if( eventData->m_bSuccess )
{
showModuleIf( eventData->m_pcModule, eventData->m_pcProcessedFrame );
}
}
QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
{
PlaYUVerModuleIf* pcCurrModuleIf;
@@ -245,6 +260,7 @@ QMenu* ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
for( Int i = 0; i < m_pcPlaYUVerModules.size(); i++ )
{
pcCurrModuleIf = m_pcPlaYUVerModules.at( i );
pcCurrModuleIf->setParent( this );
currSubMenu = NULL;
if( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory )
+2
View File
@@ -58,6 +58,7 @@ public:
static Void destroyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf );
static Bool applyModuleIf( PlaYUVerModuleIf* pcCurrModuleIf, Bool isPlaying = false );
static Void swapModulesWindowsIf( PlaYUVerModuleIf *pcCurrModuleIf );
static Bool showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame );
private:
QWidget *m_pcParent;
@@ -89,6 +90,7 @@ private:
Void appendModule( PlaYUVerModuleIf* pcCurrModuleIf );
SubWindowHandle* enableModuleIf( PlaYUVerModuleIf* pcCurrModuleIf );
Void customEvent( QEvent *event );
private Q_SLOTS:
void selectModule( int index );
+70
View File
@@ -0,0 +1,70 @@
/* 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 PlaYUVerModuleIf.cpp
* \brief PlaYUVer modules interface
*/
#include "PlaYUVerModuleIf.h"
#include "SubWindowHandle.h"
namespace plaYUVer
{
PlaYUVerModuleIf::PlaYUVerModuleIf() :
m_pcAction( NULL ),
m_pcDisplaySubWindow( NULL )
{
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
{
m_pcSubWindow[i] = NULL;
}
}
void PlaYUVerModuleIf::run()
{
PlaYUVerFrame* pcProcessedFrame = NULL;
switch( m_cModuleDef.m_uiNumberOfFrames )
{
case MODULE_REQUIRES_ONE_FRAME:
pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() );
break;
case MODULE_REQUIRES_TWO_FRAMES:
pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() );
break;
case MODULE_REQUIRES_THREE_FRAMES:
pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() );
break;
}
postProgress( true, pcProcessedFrame );
}
Void PlaYUVerModuleIf::postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame )
{
EventData *eventData = new EventData();
eventData->m_bSuccess = success;
eventData->m_pcProcessedFrame = pcProcessedFrame;
eventData->m_pcModule = this;
if( parent() )
QCoreApplication::postEvent( parent(), eventData );
}
} // NAMESPACE
+40 -22
View File
@@ -31,13 +31,12 @@
#include <cstdio>
#include "PlaYUVerFrame.h"
class QImage;
class QAction;
namespace plaYUVer
{
enum __PlaYUVerModuleTypes
enum // Module type
{
FRAME_LEVEL_MODULE,
VIDEO_LEVEL_MODULE,
@@ -46,17 +45,15 @@ enum __PlaYUVerModuleTypes
#define APPLY_WHILE_PLAYING true
#define MAX_NUMBER_FRAMES 3
enum __PlaYUVerModuleNumberOfFrames
enum // Number of frames
{
// Number of frames
MODULE_REQUIRES_ONE_FRAME = 1,
MODULE_REQUIRES_TWO_FRAMES = 2,
MODULE_REQUIRES_THREE_FRAMES = 3,
};
enum __PlaYUVerModuleRequirements
enum // Requirements
{
// Requirements
MODULE_REQUIRES_NOTHING = 0,
MODULE_REQUIRES_NEW_WINDOW = 2,
MODULE_REQUIRES_SIDEBAR = 4,
@@ -72,7 +69,7 @@ enum __PlaYUVerModuleRequirements
} \
}
typedef struct __PlaYUVerModuleDefinition
typedef struct
{
Int m_iModuleType;
const Char* m_pchModuleCategory;
@@ -86,36 +83,57 @@ typedef struct __PlaYUVerModuleDefinition
class SubWindowHandle;
class PlaYUVerModuleIf
#ifdef PLAYUVER_THREADED_MODULES
: public QThread
#else
: public QObject
#endif
{
friend class ModulesHandle;
private:
QAction* m_pcAction;
SubWindowHandle* m_pcSubWindow[MAX_NUMBER_FRAMES];
SubWindowHandle* m_pcDisplaySubWindow;
PlaYUVerModuleDefinition m_cModuleDef;
Void postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame );
public:
PlaYUVerModuleIf() :
m_pcAction( NULL ),
m_pcDisplaySubWindow( NULL )
class EventData: public QEvent
{
for( Int i = 0; i < MAX_NUMBER_FRAMES; i++ )
public:
EventData() :
QEvent( QEvent::User )
{
m_pcSubWindow[i] = NULL;
m_bSuccess = false;
m_pcProcessedFrame = NULL;
m_pcModule = NULL;
}
}
virtual ~PlaYUVerModuleIf() { }
Bool m_bSuccess;
PlaYUVerFrame* m_pcProcessedFrame;
PlaYUVerModuleIf* m_pcModule;
};
virtual Void create() { }
virtual Void create( PlaYUVerFrame* ) { }
PlaYUVerModuleIf();
virtual ~PlaYUVerModuleIf() {}
virtual Void process() { }
virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; }
virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; }
virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; }
virtual Void destroy(){ }
virtual Void create() {}
virtual Void create( PlaYUVerFrame* ) {}
Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; }
virtual Void process() {}
virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; }
virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; }
virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; }
virtual Void destroy() { }
//PlaYUVerFrame* getProcessedFrame() { return m_pcProcessedFrame; }
Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; }
protected:
virtual void run();
};
} // NAMESPACE
+11 -2
View File
@@ -37,6 +37,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
setAttribute( Qt::WA_DeleteOnClose );
setBackgroundRole( QPalette::Light );
setVisible( false );
// Create a new scroll area inside the sub-window
m_cScrollArea = new QScrollArea( this );
@@ -122,7 +123,7 @@ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module )
disableModule();
}
m_pcCurrentModule = select_module;
refreshFrame();
// refreshFrame();
}
Void SubWindowHandle::disableModule()
@@ -149,6 +150,13 @@ Void SubWindowHandle::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
{
m_pcCurrFrame = pcCurrFrame;
m_cViewArea->setImage( m_pcCurrFrame );
if( !isVisible() )
{
show();
resize( sizeHint() );
zoomToFit();
}
}
Void SubWindowHandle::refreshFrame()
@@ -391,7 +399,8 @@ QSize SubWindowHandle::sizeHint() const
if( m_pcCurrFrame )
isize = QSize( m_pcCurrFrame->getWidth() + 50, m_pcCurrFrame->getHeight() + 50 );
else
isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
if( m_pCurrStream )
isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
// If the SubWindowHandle needs more space that the avaiable, we'll give
// to the subwindow a reasonable size preserving the image aspect ratio.
+53 -26
View File
@@ -164,8 +164,8 @@ Void plaYUVerApp::loadFile( QString fileName )
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
statusBar()->showMessage( tr( "Loading file..." ) );
mdiArea->addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) );
@@ -173,6 +173,7 @@ Void plaYUVerApp::loadFile( QString fileName )
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
}
else
{
@@ -216,6 +217,16 @@ Void plaYUVerApp::format()
m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->currentFile(), true );
}
Void plaYUVerApp::loadAll()
{
if( m_pcCurrentSubWindow )
{
statusBar()->showMessage( tr( "Loading file into memory ..." ) );
m_pcCurrentSubWindow->getInputStream()->loadAll();
statusBar()->showMessage( tr( "File loaded" ), 2000 );
}
}
Void plaYUVerApp::closeActiveWindow()
{
SubWindowHandle *currSubWindow = activeSubWindow();
@@ -245,8 +256,7 @@ Void plaYUVerApp::ModuleHandling( QAction *curr_action )
if( interfaceChild )
{
mdiArea->addSubWindow( interfaceChild );
interfaceChild->show();
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
}
if( activeSubWindow() )
@@ -679,7 +689,7 @@ Void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame*
sPixelValue = curFrame->getPixelValue( pos, PlaYUVerFrame::COLOR_YUV );
strPixel = QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Luma ).arg( sPixelValue.ChromaU ).arg( sPixelValue.ChromaV );
strStatus.append( strPixel );
statusBar()->showMessage( strStatus, 0 );
statusBar()->showMessage( strStatus, 3000 );
}
else
{
@@ -860,6 +870,11 @@ Void plaYUVerApp::createActions()
m_arrayActions[SAVE_ACT]->setStatusTip( tr( "Save current frame" ) );
connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) );
m_arrayActions[LOAD_ALL_ACT] = new QAction( tr( "&Load All" ), this );
//m_arrayActions[LOAD_ALL_ACT]->setIcon( QIcon( ":/images/configuredialog.png" ) );
m_arrayActions[LOAD_ALL_ACT]->setStatusTip( tr( "Load sequence into memory (caution)" ) );
connect( m_arrayActions[LOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( loadAll() ) );
m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this );
m_arrayActions[FORMAT_ACT]->setIcon( QIcon( ":/images/configuredialog.png" ) );
m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) );
@@ -954,7 +969,7 @@ Void plaYUVerApp::createActions()
m_pcFrameSlider = new QSlider;
m_pcFrameSlider->setOrientation( Qt::Horizontal );
m_pcFrameSlider->setMaximumWidth( 100 );
m_pcFrameSlider->setMaximumWidth( 300 );
m_pcFrameSlider->setMaximumWidth( /* 300 */ 2000 );
m_pcFrameSlider->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
m_pcFrameSlider->setEnabled( false );
connect( m_pcFrameSlider, SIGNAL( sliderMoved(int) ), this, SLOT( seekSliderEvent(int) ) );
@@ -1023,7 +1038,9 @@ 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[SAVE_ACT] );
m_arrayMenu[FILE_MENU]->addSeparator();
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[FORMAT_ACT] );
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[LOAD_ALL_ACT] );
m_arrayMenu[FILE_MENU]->addSeparator();
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[CLOSE_ACT] );
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[EXIT_ACT] );
@@ -1075,36 +1092,46 @@ Void plaYUVerApp::createMenus()
Void plaYUVerApp::createToolBars()
{
toolbarFile = addToolBar( tr( "File" ) );
toolbarFile->addAction( m_arrayActions[OPEN_ACT] );
toolbarFile->addAction( m_arrayActions[SAVE_ACT] );
toolbarFile->addAction( m_arrayActions[FORMAT_ACT] );
toolbarFile->addAction( m_arrayActions[CLOSE_ACT] );
m_arrayToolBars.resize( TOTAL_TOOLBAR );
toolbarView = addToolBar( tr( "Zoom" ) );
toolbarView->addAction( m_arrayActions[ZOOM_IN_ACT] );
toolbarView->addAction( m_arrayActions[ZOOM_OUT_ACT] );
toolbarView->addAction( m_arrayActions[ZOOM_NORMAL_ACT] );
toolbarView->addAction( m_arrayActions[ZOOM_FIT_ACT] );
m_arrayToolBars[FILE_TOOLBAR] = new QToolBar( tr( "File" ) );
m_arrayToolBars[FILE_TOOLBAR]->addAction( m_arrayActions[OPEN_ACT] );
m_arrayToolBars[FILE_TOOLBAR]->addAction( m_arrayActions[SAVE_ACT] );
m_arrayToolBars[FILE_TOOLBAR]->addAction( m_arrayActions[FORMAT_ACT] );
m_arrayToolBars[FILE_TOOLBAR]->addAction( m_arrayActions[CLOSE_ACT] );
toolbarVideo = addToolBar( tr( "Video" ) );
toolbarVideo->addAction( m_arrayActions[PLAY_ACT] );
toolbarVideo->addAction( m_arrayActions[PAUSE_ACT] );
toolbarVideo->addAction( m_arrayActions[STOP_ACT] );
toolbarVideo->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] );
toolbarVideo->addWidget( m_pcFrameSlider );
toolbarVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
m_arrayToolBars[FILE_TOOLBAR]->setMovable( false );
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[FILE_TOOLBAR] );
toolbarVideo->addWidget( new QLabel );
m_arrayToolBars[VIEW_TOOLBAR] = new QToolBar( tr( "View" ) );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_IN_ACT] );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_NORMAL_ACT] );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_FIT_ACT] );
m_arrayToolBars[FILE_TOOLBAR]->setMovable( false );
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[VIEW_TOOLBAR] );
m_arrayToolBars[VIDEO_TOOLBAR] = new QToolBar( tr( "Video" ) );
m_arrayToolBars[VIDEO_TOOLBAR]->setAllowedAreas( Qt::BottomToolBarArea );
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[PLAY_ACT] );
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[PAUSE_ACT] );
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[STOP_ACT] );
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] );
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcFrameSlider );
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( new QLabel );
m_pcCurrFrameNumLabel = new QLabel;
m_pcCurrFrameNumLabel->setText( "-" );
toolbarVideo->addWidget( m_pcCurrFrameNumLabel );
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcCurrFrameNumLabel );
QLabel *forwardslash = new QLabel;
forwardslash->setText( "/" );
toolbarVideo->addWidget( forwardslash );
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( forwardslash );
m_pcTotalFrameNumLabel = new QLabel;
m_pcTotalFrameNumLabel->setText( "-" );
toolbarVideo->addWidget( m_pcTotalFrameNumLabel );
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcTotalFrameNumLabel );
addToolBar( Qt::BottomToolBarArea, m_arrayToolBars[VIDEO_TOOLBAR] );
}
Void plaYUVerApp::createDockWidgets()
+10 -3
View File
@@ -59,6 +59,7 @@ private Q_SLOTS:
void open();
void save();
void format();
void loadAll();
void closeActiveWindow();
void closeAll();
@@ -183,15 +184,21 @@ private:
StreamPropertiesSideBar* m_pcStreamProperties;
FramePropertiesSideBar* m_pcFrameProperties;
QToolBar *toolbarFile;
QToolBar *toolbarView;
QToolBar *toolbarVideo;
enum TOOLBAR_LIST
{
FILE_TOOLBAR = 0,
VIEW_TOOLBAR,
VIDEO_TOOLBAR,
TOTAL_TOOLBAR,
};
QVector<QToolBar*> m_arrayToolBars;
enum APP_ACTION_LIST
{
OPEN_ACT = 0,
SAVE_ACT,
FORMAT_ACT,
LOAD_ALL_ACT,
CLOSE_ACT,
CLOSEALL_ACT,
EXIT_ACT,