From edc58414a732e7b37866df8d9de49039f2959b3a Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 29 Dec 2014 22:07:18 +0000 Subject: [PATCH] Add a VideoHandle module to control playing and video functions --- app/CMakeLists.txt | 1 + app/VideoHandle.cpp | 457 ++++++++++++++++++++++++++++++++++++++++++ app/VideoHandle.h | 111 ++++++++++ app/plaYUVerApp.cpp | 478 ++++++-------------------------------------- app/plaYUVerApp.h | 38 +--- 5 files changed, 635 insertions(+), 450 deletions(-) create mode 100644 app/VideoHandle.cpp create mode 100644 app/VideoHandle.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 94069d4..b337a76 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -9,6 +9,7 @@ set(plaYUver_App_SRCS # Main main.cpp plaYUVerApp.cpp + VideoHandle.cpp QualityHandle.cpp ModulesHandle.cpp PlaYUVerAppModuleIf.cpp diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp new file mode 100644 index 0000000..f07ea5e --- /dev/null +++ b/app/VideoHandle.cpp @@ -0,0 +1,457 @@ +/* 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 VideoHandle.h + * \brief Class to handle video playback + */ + +#include "lib/PlaYUVerDefs.h" +#include +#include "VideoHandle.h" +#include "DialogSubWindowSelector.h" + +namespace plaYUVer +{ + +VideoHandle::VideoHandle( QWidget* parent, QMdiArea* mdiArea ) : + m_pcParet( parent ), + m_pcMainWindowMdiArea( mdiArea ) +{ + m_pcCurrentVideoSubWindow = NULL; + m_bIsPlaying = false; + m_pcPlayingTimer = new QTimer; +#if( QT_VERSION_PLAYUVER == 5 ) + m_pcPlayingTimer->setTimerType( Qt::CoarseTimer ); +#endif + connect( m_pcPlayingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) ); + m_acPlayingSubWindows.clear(); +} + +VideoHandle::~VideoHandle() +{ + +} + +Void VideoHandle::createActions() +{ + + m_arrayActions.resize( TOTAL_ACT ); + m_arrayActions[PLAY_ACT] = new QAction( "Play", this ); + m_arrayActions[PLAY_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ) ); + m_arrayActions[PLAY_ACT]->setShortcut( Qt::Key_Space ); + connect( m_arrayActions[PLAY_ACT], SIGNAL( triggered() ), this, SLOT( play() ) ); + + m_arrayActions[STOP_ACT] = new QAction( "Stop", this ); + m_arrayActions[STOP_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaStop ) ) ); + connect( m_arrayActions[STOP_ACT], SIGNAL( triggered() ), this, SLOT( stop() ) ); + + m_mapperVideoSeek = new QSignalMapper( this ); + connect( m_mapperVideoSeek, SIGNAL( mapped(int) ), this, SLOT( seekEvent(int) ) ); + + m_arrayActions[VIDEO_BACKWARD_ACT] = new QAction( "Video Backward", this ); + m_arrayActions[VIDEO_BACKWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) ); + m_arrayActions[VIDEO_BACKWARD_ACT]->setShortcut( Qt::Key_Left ); + connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) ); + m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_BACKWARD_ACT], 0 ); + + m_arrayActions[VIDEO_FORWARD_ACT] = new QAction( "Video Forward", this ); + m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) ); + m_arrayActions[VIDEO_FORWARD_ACT]->setShortcut( Qt::Key_Right ); + connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) ); + m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 ); + + 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_LOCK_SELECTION_ACT] = new QAction( "Video Lock Window Selection", this ); + m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) ); + connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) ); + + m_pcFrameSlider = new QSlider; + m_pcFrameSlider->setOrientation( Qt::Horizontal ); + m_pcFrameSlider->setMaximumWidth( 100 ); + 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) ) ); +} + +QMenu* VideoHandle::createMenu() +{ + m_pcMenuVideo = new QMenu( "Video1", this ); + m_pcMenuVideo->addAction( m_arrayActions[PLAY_ACT] ); + 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_LOOP_ACT] ); + m_pcMenuVideo->addAction( m_arrayActions[VIDEO_LOCK_SELECTION_ACT] ); + return m_pcMenuVideo; +} + +QToolBar* VideoHandle::createToolBar() +{ + m_toolbarVideo = new QToolBar( tr( "Video" ) ); + m_toolbarVideo->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea ); + m_toolbarVideo->addAction( m_arrayActions[PLAY_ACT] ); + m_toolbarVideo->addAction( m_arrayActions[STOP_ACT] ); + + QLabel* pcLockLabel = new QLabel( "PlayingLock", this ); + m_arrayActions[VIDEO_LOCK_ACT] = m_toolbarVideo->addWidget( pcLockLabel ); + m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); + + m_toolbarVideo->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] ); + m_toolbarVideo->addWidget( m_pcFrameSlider ); + m_toolbarVideo->addAction( m_arrayActions[VIDEO_FORWARD_ACT] ); + m_toolbarVideo->addWidget( new QLabel ); + m_pcFrameNumInfo = new WidgetFrameNumber; + m_toolbarVideo->addWidget( m_pcFrameNumInfo ); + + return m_toolbarVideo; +} + +QDockWidget* VideoHandle::createDock() +{ + m_pcFramePropertiesSideBar = new FramePropertiesSideBar( this, &m_bIsPlaying ); + m_pcFramePropertiesDock = new QDockWidget( tr( "Frame Information" ), this ); + m_pcFramePropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + m_pcFramePropertiesDock->setWidget( m_pcFramePropertiesSideBar ); + connect( m_pcFramePropertiesDock, SIGNAL( visibilityChanged(bool) ), this, SLOT( update() ) ); + + return m_pcFramePropertiesDock; +} + +Void VideoHandle::updateMenus() +{ + VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowMdiArea->activeSubWindow() ); + Bool hasSubWindow = pcSubWindow ? true : false; + + m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow ); + //m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[STOP_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[VIDEO_BACKWARD_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[VIDEO_FORWARD_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[VIDEO_LOOP_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setEnabled( hasSubWindow ); + m_pcFrameSlider->setEnabled( hasSubWindow ); + if( !hasSubWindow ) + { + m_pcFrameSlider->setValue( 0 ); + m_pcFrameNumInfo->clear(); + } +} + +Void VideoHandle::update() +{ + if( m_pcCurrentVideoSubWindow ) + { + Int frame_num = 0; + UInt64 total_frame_num = 1; + if( m_pcCurrentVideoSubWindow->getInputStream() ) + { + frame_num = m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum(); + m_pcFrameNumInfo->setCurrFrameNum( frame_num ); + total_frame_num = getMaxFrameNumber(); + //m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() ); + } + else + { + //m_pcStreamProperties->setData( NULL ); + m_pcFrameNumInfo->setCurrFrameNum( 0 ); + } + + m_pcFramePropertiesSideBar->setData( m_pcCurrentVideoSubWindow->getCurrFrame(), m_pcCurrentVideoSubWindow->isPlaying() ); + + m_pcFrameSlider->setValue( frame_num ); + m_pcFrameSlider->setMaximum( total_frame_num - 1 ); + m_pcFrameNumInfo->setTotalFrameNum( total_frame_num ); + + if( m_pcCurrentVideoSubWindow->isPlaying() ) + m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPause ) ); + else + m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ); + + //m_appModuleQuality->update( m_pcCurrentVideoSubWindow ); + return; + } + //m_pcStreamProperties->setData( NULL ); + m_pcFramePropertiesSideBar->setData( NULL, false ); + m_pcFrameSlider->setValue( 0 ); + m_pcFrameNumInfo->setCurrFrameNum( 0 ); + m_pcFrameNumInfo->setTotalFrameNum( 0 ); +} + +Void VideoHandle::update( VideoSubWindow* currSubWindow ) +{ + m_pcCurrentVideoSubWindow = currSubWindow; + update(); +} + +Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow ) +{ + if( m_acPlayingSubWindows.contains( currSubWindow ) ) + { + Int pos = m_acPlayingSubWindows.indexOf( currSubWindow ); + m_acPlayingSubWindows.at( pos )->stop(); + m_acPlayingSubWindows.remove( pos ); + } +} + +UInt64 VideoHandle::getMaxFrameNumber() +{ + UInt currFrames; + UInt64 maxFrames = INT_MAX; + if( m_pcCurrentVideoSubWindow ) + { + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + currFrames = m_acPlayingSubWindows.at( i )->getInputStream()->getFrameNum(); + if( currFrames < maxFrames ) + maxFrames = currFrames; + } + } + else + { + maxFrames = m_pcCurrentVideoSubWindow->getInputStream()->getFrameNum(); + } + } + return maxFrames; +} + +Void VideoHandle::setTimerStatus() +{ + Bool status = false; + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + status |= m_acPlayingSubWindows.at( i )->isPlaying(); + } + if( m_pcCurrentVideoSubWindow ) + { + status |= m_pcCurrentVideoSubWindow->isPlaying(); + } + if( status ) + { + if( !m_bIsPlaying ) + { + m_pcPlayingTimer->start(); + m_bIsPlaying = true; + } + } + else + { + m_pcPlayingTimer->stop(); + m_bIsPlaying = false; + } +} + +Void VideoHandle::play() +{ + if( !m_pcCurrentVideoSubWindow ) + return; + + if( !m_pcCurrentVideoSubWindow->getInputStream() ) + return; + + if( !m_pcCurrentVideoSubWindow->isPlaying() ) // Not playing + { + UInt frameRate; + UInt timeInterval; + if( m_acPlayingSubWindows.size() < 2 ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->pause(); + } + m_acPlayingSubWindows.clear(); + m_acPlayingSubWindows.append( m_pcCurrentVideoSubWindow ); + } + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->play(); + } + frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); + timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); + m_pcPlayingTimer->setInterval( timeInterval ); + } + } + else + { + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->pause(); + } + } + else + { + m_pcCurrentVideoSubWindow->pause(); + } + } + setTimerStatus(); + update(); +} + +Void VideoHandle::stop() +{ + if( m_acPlayingSubWindows.size() > 0 ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->stop(); + } + m_acPlayingSubWindows.clear(); + setTimerStatus(); + } + else + { + if( m_pcCurrentVideoSubWindow ) + { + m_pcCurrentVideoSubWindow->stop(); + } + } + update(); + m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); +} + +Void VideoHandle::playEvent() +{ + Bool bEndOfSequence = false; + try + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent(); + } + if( bEndOfSequence && !m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ) + { + stop(); + } + } + catch( const char *msg ) + { + QString warningMsg = "Error while playing " + QFileInfo( m_pcCurrentVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + + msg; + QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); + //statusBar()->showMessage( warningMsg, 2000 ); + qDebug( ) << warningMsg; + stop(); + m_pcCurrentVideoSubWindow->close(); + } + update(); +} + +Void VideoHandle::seekEvent( Int direction ) +{ + if( m_pcCurrentVideoSubWindow ) + { + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + if( !( ( UInt )( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() && direction > 0 ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false ); + } + } + } + else + { + m_pcCurrentVideoSubWindow->seekRelativeEvent( direction > 0 ? true : false ); + } + update(); + } +} + +Void VideoHandle::seekSliderEvent( Int new_frame_num ) +{ + if( m_pcCurrentVideoSubWindow ) + { + if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )new_frame_num ); + } + } + else + { + m_pcCurrentVideoSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num ); + } + update(); + } +} + +Void VideoHandle::videoSelectionButtonEvent() +{ + DialogSubWindowSelector dialogWindowsSelection( this, m_pcMainWindowMdiArea ); + QStringList cWindowListNames; + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + cWindowListNames.append( m_acPlayingSubWindows.at( i )->getWindowName() ); + dialogWindowsSelection.setSubWindowList( cWindowListNames ); + } + if( dialogWindowsSelection.exec() == QDialog::Accepted ) + { + QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows(); + m_acPlayingSubWindows.clear(); + SubWindowHandle *subWindow; + QString windowName; + QList subWindowList = m_pcMainWindowMdiArea->findChildren(); + for( Int i = 0; i < subWindowList.size(); i++ ) + { + subWindow = subWindowList.at( i ); + windowName = subWindow->getWindowName(); + if( selectedWindows.contains( windowName ) ) + { + VideoSubWindow* pcVideoSubWinodw = qobject_cast( subWindow ); + m_acPlayingSubWindows.append( pcVideoSubWinodw ); + pcVideoSubWinodw->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); + } + } + if( m_acPlayingSubWindows.size() > 0 ) + { + m_acPlayingSubWindows.at( 0 )->activateWindow(); + if( m_acPlayingSubWindows.size() > 1 ) + { + m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true ); + } + if( m_bIsPlaying ) + { + for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) + { + m_acPlayingSubWindows.at( i )->play(); + } + } + } + else + { + stop(); + } + return; + } +} + +} // NAMESPACE + diff --git a/app/VideoHandle.h b/app/VideoHandle.h new file mode 100644 index 0000000..ed772ac --- /dev/null +++ b/app/VideoHandle.h @@ -0,0 +1,111 @@ +/* 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 VideoHandle.h + * \brief Class to handle video playback + */ + +#ifndef __VIDEOHANDLE_H__ +#define __VIDEOHANDLE_H__ + +#include "config.h" +#include +#if( QT_VERSION_PLAYUVER == 5 ) +#include +#elif( QT_VERSION_PLAYUVER == 4 ) +#include +#endif +#include "VideoSubWindow.h" +#include "WidgetFrameNumber.h" +#include "PropertiesSidebar.h" + +namespace plaYUVer +{ + +class VideoSubWindow; + +class VideoHandle: public QWidget +{ +Q_OBJECT +public: + VideoHandle( QWidget*, QMdiArea * ); + ~VideoHandle(); + + Void createActions(); + QMenu* createMenu(); + QToolBar* createToolBar(); + QDockWidget* createDock(); + Void updateMenus(); + + Void update( VideoSubWindow* currSubWindow ); + + Bool* getIsPlayingPtr() { return &m_bIsPlaying; } + Void closeSubWindow( VideoSubWindow* currSubWindow ); + +private: + QWidget* m_pcParet; + QMdiArea* m_pcMainWindowMdiArea; + enum + { + PLAY_ACT, + STOP_ACT, + VIDEO_FORWARD_ACT, + VIDEO_BACKWARD_ACT, + VIDEO_LOOP_ACT, + VIDEO_LOCK_ACT, + VIDEO_LOCK_SELECTION_ACT, + TOTAL_ACT, + }; + QVector m_arrayActions; + QSignalMapper* m_mapperVideoSeek; + + QSlider* m_pcFrameSlider; + WidgetFrameNumber* m_pcFrameNumInfo; + + QMenu* m_pcMenuVideo; + QToolBar* m_toolbarVideo; + + QDockWidget* m_pcFramePropertiesDock; + FramePropertiesSideBar* m_pcFramePropertiesSideBar; + + VideoSubWindow* m_pcCurrentVideoSubWindow; + QVector m_acPlayingSubWindows; + + QTimer *m_pcPlayingTimer; + Bool m_bIsPlaying; + + + UInt64 getMaxFrameNumber(); + Void setTimerStatus(); + +private Q_SLOTS: + void update(); + void play(); + void stop(); + void playEvent(); + void seekSliderEvent( int new_frame_num ); + void seekEvent( int direction ); + void videoSelectionButtonEvent(); + +}; + +} // NAMESPACE + +#endif // __VIDEOHANDLE_H__ diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 1055b09..899b908 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -55,6 +55,7 @@ plaYUVerApp::plaYUVerApp() mapperWindow = new QSignalMapper( this ); connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) ); + m_appModuleVideo = new VideoHandle( this, mdiArea ); m_appModuleQuality = new QualityMeasurement( this, mdiArea ); m_appModuleExtensions = new ModulesHandle( this, mdiArea ); @@ -71,14 +72,6 @@ plaYUVerApp::plaYUVerApp() setWindowIcon( QIcon( ":/images/playuver.png" ) ); setUnifiedTitleAndToolBarOnMac( true ); - m_bIsPlaying = false; - m_pcPlayingTimer = new QTimer; -#if( QT_VERSION_PLAYUVER == 5 ) - m_pcPlayingTimer->setTimerType( Qt::CoarseTimer ); -#endif - connect( m_pcPlayingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) ); - m_acPlayingSubWindows.clear(); - setAcceptDrops( true ); mdiArea->setAcceptDrops( true ); @@ -105,13 +98,6 @@ Void plaYUVerApp::about() if( !m_pcAboutDialog ) m_pcAboutDialog = new AboutDialog( this ); m_pcAboutDialog->exec(); -// QString about_message; -// about_message.append( "The plaYUVer is an open-source raw video player! " ); -// about_message.append( "Developed by " ); -// about_message.append( "João Carreira " ); -// about_message.append( "and " ); -// about_message.append( "Luís Lucas" ); -// QMessageBox::about( this, "About plaYUVer", about_message ); } Void plaYUVerApp::closeEvent( QCloseEvent *event ) @@ -140,7 +126,7 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event ) if( mayCloseAll ) { - m_pcPlayingTimer->stop(); + //m_pcPlayingTimer->stop(); closeAll(); writeSettings(); event->accept(); @@ -393,16 +379,7 @@ Void plaYUVerApp::setAllSubWindowTool() Void plaYUVerApp::closeActiveWindow() { SubWindowHandle *currSubWindow = activeSubWindow(); - if( currSubWindow->getCategory() == SubWindowHandle::VIDEO_SUBWINDOW ) - { - VideoSubWindow* pcVideoSubWindow = qobject_cast( currSubWindow ); - if( m_acPlayingSubWindows.contains( pcVideoSubWindow ) ) - { - Int pos = m_acPlayingSubWindows.indexOf( pcVideoSubWindow ); - m_acPlayingSubWindows.at( pos )->stop(); - m_acPlayingSubWindows.remove( pos ); - } - } + m_appModuleVideo->closeSubWindow( qobject_cast( currSubWindow ) ); mdiArea->closeActiveSubWindow(); } @@ -410,302 +387,59 @@ Void plaYUVerApp::closeAll() { mdiArea->closeAllSubWindows(); } - -// ----------------------- Update Properties -------------------- - -UInt64 plaYUVerApp::getMaxFrameNumber() -{ - UInt currFrames; - UInt64 maxFrames = INT_MAX; - if( m_pcCurrentVideoSubWindow ) - { - if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - currFrames = m_acPlayingSubWindows.at( i )->getInputStream()->getFrameNum(); - if( currFrames < maxFrames ) - maxFrames = currFrames; - } - } - else - { - maxFrames = m_pcCurrentVideoSubWindow->getInputStream()->getFrameNum(); - } - } - return maxFrames; -} - -Void plaYUVerApp::updateStreamProperties() -{ - if( m_pcCurrentVideoSubWindow ) - { - Int frame_num = 0; - UInt64 total_frame_num = 1; - if( m_pcCurrentVideoSubWindow->getInputStream() ) - { - frame_num = m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum(); - m_pcFrameNumInfo->setCurrFrameNum( frame_num ); - total_frame_num = getMaxFrameNumber(); - m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() ); - } - else - { - m_pcStreamProperties->setData( NULL ); - m_pcFrameNumInfo->setCurrFrameNum( 0 ); - } - - m_pcFrameProperties->setData( m_pcCurrentVideoSubWindow->getCurrFrame(), m_pcCurrentVideoSubWindow->isPlaying() ); - - m_pcFrameSlider->setValue( frame_num ); - m_pcFrameSlider->setMaximum( total_frame_num - 1 ); - m_pcFrameNumInfo->setTotalFrameNum( total_frame_num ); - - if( m_pcCurrentVideoSubWindow->isPlaying() ) - m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPause ) ); - else - m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ); - - m_appModuleQuality->update( m_pcCurrentVideoSubWindow ); - return; - } - m_pcStreamProperties->setData( NULL ); - m_pcFrameProperties->setData( NULL, false ); - m_pcFrameNumInfo->setCurrFrameNum( 0 ); - m_pcFrameNumInfo->setTotalFrameNum( 0 ); - m_pcZoomFactorSBox->setValue( 0.0 ); -} +// +//Void plaYUVerApp::updateStreamProperties() +//{ +// if( m_pcCurrentVideoSubWindow ) +// { +// Int frame_num = 0; +// UInt64 total_frame_num = 1; +// if( m_pcCurrentVideoSubWindow->getInputStream() ) +// { +// frame_num = m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum(); +// m_pcFrameNumInfo->setCurrFrameNum( frame_num ); +// total_frame_num = getMaxFrameNumber(); +// m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() ); +// } +// else +// { +// m_pcStreamProperties->setData( NULL ); +// m_pcFrameNumInfo->setCurrFrameNum( 0 ); +// } +// +// m_pcFrameProperties->setData( m_pcCurrentVideoSubWindow->getCurrFrame(), m_pcCurrentVideoSubWindow->isPlaying() ); +// +// m_pcFrameSlider->setValue( frame_num ); +// m_pcFrameSlider->setMaximum( total_frame_num - 1 ); +// m_pcFrameNumInfo->setTotalFrameNum( total_frame_num ); +// +// if( m_pcCurrentVideoSubWindow->isPlaying() ) +// m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPause ) ); +// else +// m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ); +// +// return; +// } +// m_pcStreamProperties->setData( NULL ); +// m_pcFrameProperties->setData( NULL, false ); +// m_pcFrameNumInfo->setCurrFrameNum( 0 ); +// m_pcFrameNumInfo->setTotalFrameNum( 0 ); +// m_pcZoomFactorSBox->setValue( 0.0 ); +//} Void plaYUVerApp::updatePropertiesSelectedArea( QRect area ) { - if( m_pcCurrentSubWindow ) - { - if( area.isValid() ) - { - m_pcFrameProperties->setSelection( area ); - } - } - else - { - m_pcFrameProperties->setData( NULL, false ); - } -} - -// ----------------------- Playing Functions -------------------- - -Void plaYUVerApp::setTimerStatus() -{ - Bool status = false; - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - status |= m_acPlayingSubWindows.at( i )->isPlaying(); - } - if( m_pcCurrentVideoSubWindow ) - { - status |= m_pcCurrentVideoSubWindow->isPlaying(); - } - if( status ) - { - if( !m_bIsPlaying ) - { - m_pcPlayingTimer->start(); - m_bIsPlaying = true; - } - } - else - { - m_pcPlayingTimer->stop(); - m_bIsPlaying = false; - } -} - -Void plaYUVerApp::play() -{ - if( !m_pcCurrentVideoSubWindow ) - return; - - if( !m_pcCurrentVideoSubWindow->getInputStream() ) - return; - - if( !m_pcCurrentVideoSubWindow->isPlaying() ) // Not playing - { - UInt frameRate; - UInt timeInterval; - if( m_acPlayingSubWindows.size() < 2 ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->pause(); - } - m_acPlayingSubWindows.clear(); - m_acPlayingSubWindows.append( m_pcCurrentVideoSubWindow ); - } - if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->play(); - } - frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate(); - timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 ); - m_pcPlayingTimer->setInterval( timeInterval ); - } - } - else - { - if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->pause(); - } - } - else - { - m_pcCurrentVideoSubWindow->pause(); - } - } - setTimerStatus(); - updateStreamProperties(); -} - -Void plaYUVerApp::stop() -{ - if( m_acPlayingSubWindows.size() > 0 ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->stop(); - } - m_acPlayingSubWindows.clear(); - setTimerStatus(); - } - else - { - if( m_pcCurrentVideoSubWindow ) - { - m_pcCurrentVideoSubWindow->stop(); - } - } - updateStreamProperties(); - m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); -} - -Void plaYUVerApp::playEvent() -{ - Bool bEndOfSequence = false; - try - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent(); - } - if( bEndOfSequence && !m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ) - { - stop(); - } - } - catch( const char *msg ) - { - QString warningMsg = "Error while playing " + QFileInfo( m_pcCurrentVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" - + msg; - QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); - statusBar()->showMessage( warningMsg, 2000 ); - qDebug( ) << warningMsg; - stop(); - m_pcCurrentVideoSubWindow->close(); - } - updateStreamProperties(); -} - -Void plaYUVerApp::seekEvent( Int direction ) -{ - if( m_pcCurrentVideoSubWindow ) - { - if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) - { - if( !( ( UInt )( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() && direction > 0 ) ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false ); - } - } - } - else - { - m_pcCurrentVideoSubWindow->seekRelativeEvent( direction > 0 ? true : false ); - } - updateStreamProperties(); - } -} - -Void plaYUVerApp::seekSliderEvent( Int new_frame_num ) -{ - if( m_pcCurrentVideoSubWindow ) - { - if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( ( UInt )new_frame_num ); - } - } - else - { - m_pcCurrentVideoSubWindow->seekAbsoluteEvent( ( UInt )new_frame_num ); - } - updateStreamProperties(); - } -} - -Void plaYUVerApp::videoSelectionButtonEvent() -{ - DialogSubWindowSelector dialogWindowsSelection( this, mdiArea ); - QStringList cWindowListNames; - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - cWindowListNames.append( m_acPlayingSubWindows.at( i )->getWindowName() ); - dialogWindowsSelection.setSubWindowList( cWindowListNames ); - } - if( dialogWindowsSelection.exec() == QDialog::Accepted ) - { - QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows(); - m_acPlayingSubWindows.clear(); - SubWindowHandle *subWindow; - QString windowName; - for( Int i = 0; i < mdiArea->subWindowList().size(); i++ ) - { - subWindow = qobject_cast( mdiArea->subWindowList().at( i ) ); - windowName = subWindow->getWindowName(); - if( selectedWindows.contains( windowName ) ) - { - VideoSubWindow* pcVideoSubWinodw = qobject_cast( subWindow ); - m_acPlayingSubWindows.append( pcVideoSubWinodw ); - pcVideoSubWinodw->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() ); - } - } - if( m_acPlayingSubWindows.size() > 0 ) - { - m_acPlayingSubWindows.at( 0 )->activateWindow(); - if( m_acPlayingSubWindows.size() > 1 ) - { - m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true ); - } - if( m_bIsPlaying ) - { - for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ ) - { - m_acPlayingSubWindows.at( i )->play(); - } - } - } - else - { - stop(); - } - return; - } +// if( m_pcCurrentSubWindow ) +// { +// if( area.isValid() ) +// { +// m_pcFrameProperties->setSelection( area ); +// } +// } +// else +// { +// m_pcFrameProperties->setData( NULL, false ); +// } } // ----------------------- Zoom Functions ----------------------- @@ -802,7 +536,7 @@ Void plaYUVerApp::chageSubWindowSelection() updateZoomFactorSBox(); } } - updateStreamProperties(); + m_appModuleVideo->update( m_pcCurrentVideoSubWindow ); m_appModuleQuality->update( m_pcCurrentVideoSubWindow ); updateMenus(); } @@ -921,22 +655,10 @@ Void plaYUVerApp::updateMenus() m_arrayActions[ZOOM_FIT_ACT]->setEnabled( hasSubWindow ); m_pcZoomFactorSBox->setEnabled( hasSubWindow ); - m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow ); -//m_arrayActions[PAUSE_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[STOP_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[VIDEO_BACKWARD_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[VIDEO_FORWARD_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[VIDEO_LOOP_ACT]->setEnabled( hasSubWindow ); - m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setEnabled( hasSubWindow ); - m_pcFrameSlider->setEnabled( hasSubWindow ); - if( !hasSubWindow ) - { - m_pcFrameSlider->setValue( 0 ); - m_pcFrameNumInfo->clear(); - } m_arrayActions[NAVIGATION_TOOL_ACT]->setEnabled( hasSubWindow ); m_arrayActions[SELECTION_TOOL_ACT]->setEnabled( hasSubWindow ); + m_appModuleVideo->updateMenus(); m_appModuleQuality->updateMenus(); m_appModuleExtensions->updateMenus(); } @@ -1105,48 +827,6 @@ Void plaYUVerApp::createActions() m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) ); connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) ); -// ------------ Playing ------------ - - m_arrayActions[PLAY_ACT] = new QAction( "Play", this ); - m_arrayActions[PLAY_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ) ); - m_arrayActions[PLAY_ACT]->setShortcut( Qt::Key_Space ); - connect( m_arrayActions[PLAY_ACT], SIGNAL( triggered() ), this, SLOT( play() ) ); - - m_arrayActions[STOP_ACT] = new QAction( "Stop", this ); - m_arrayActions[STOP_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaStop ) ) ); - connect( m_arrayActions[STOP_ACT], SIGNAL( triggered() ), this, SLOT( stop() ) ); - - mapperSeekVideo = new QSignalMapper( this ); - connect( mapperSeekVideo, SIGNAL( mapped(int) ), this, SLOT( seekEvent(int) ) ); - - m_arrayActions[VIDEO_BACKWARD_ACT] = new QAction( "Video Backward", this ); - m_arrayActions[VIDEO_BACKWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) ); - m_arrayActions[VIDEO_BACKWARD_ACT]->setShortcut( Qt::Key_Left ); - connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), mapperSeekVideo, SLOT( map() ) ); - mapperSeekVideo->setMapping( m_arrayActions[VIDEO_BACKWARD_ACT], 0 ); - - m_arrayActions[VIDEO_FORWARD_ACT] = new QAction( "Video Forward", this ); - m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) ); - m_arrayActions[VIDEO_FORWARD_ACT]->setShortcut( Qt::Key_Right ); - connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), mapperSeekVideo, SLOT( map() ) ); - mapperSeekVideo->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 ); - - 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_LOCK_SELECTION_ACT] = new QAction( "Video Lock Window Selection", this ); - m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) ); - connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) ); - - m_pcFrameSlider = new QSlider; - m_pcFrameSlider->setOrientation( Qt::Horizontal ); - m_pcFrameSlider->setMaximumWidth( 100 ); - 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) ) ); - // ------------ Tools ------------ actionGroupTools = new QActionGroup( this ); actionGroupTools->setExclusive( true ); @@ -1170,6 +850,7 @@ Void plaYUVerApp::createActions() connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) ); m_mapperTools->setMapping( m_arrayActions[SELECTION_TOOL_ACT], ViewArea::NormalSelectionTool ); + m_appModuleVideo->createActions(); m_appModuleQuality->createActions(); m_appModuleExtensions->createActions(); @@ -1264,15 +945,8 @@ Void plaYUVerApp::createMenus() // m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] ); // m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[SELECTION_TOOL_ACT] ); - m_arrayMenu[VIDEO_MENU] = menuBar()->addMenu( tr( "Video" ) ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[PLAY_ACT] ); -//m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[PAUSE_ACT] ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[STOP_ACT] ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[VIDEO_FORWARD_ACT] ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[VIDEO_LOOP_ACT] ); - m_arrayMenu[VIDEO_MENU]->addAction( m_arrayActions[VIDEO_LOCK_SELECTION_ACT] ); - + QMenu* VideoMenu = m_appModuleVideo->createMenu(); + menuBar()->addMenu( VideoMenu ); QMenu* QualityMenu = m_appModuleQuality->createMenu(); menuBar()->addMenu( QualityMenu ); QMenu* ModuleMenu = m_appModuleExtensions->createMenu(); @@ -1325,23 +999,8 @@ Void plaYUVerApp::createToolBars() 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::TopToolBarArea | Qt::BottomToolBarArea ); - m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[PLAY_ACT] ); - m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[STOP_ACT] ); + addToolBar( Qt::TopToolBarArea, m_appModuleVideo->createToolBar() ); - m_pcLockLabel = new QLabel( "PlayingLock", this ); - m_arrayActions[VIDEO_LOCK_ACT] = m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcLockLabel ); - - 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_pcFrameNumInfo = new WidgetFrameNumber; - m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcFrameNumInfo ); - - addToolBar( Qt::TopToolBarArea, m_arrayToolBars[VIDEO_TOOLBAR] ); - m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); } Void plaYUVerApp::createDockWidgets() @@ -1356,17 +1015,8 @@ Void plaYUVerApp::createDockWidgets() addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[STREAM_DOCK] ); connect( m_arraySideBars[STREAM_DOCK], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateStreamProperties() ) ); - m_pcFrameProperties = new FramePropertiesSideBar( this, &m_bIsPlaying ); - m_arraySideBars[FRAME_DOCK] = new QDockWidget( tr( "Frame Information" ), this ); - m_arraySideBars[FRAME_DOCK]->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - m_arraySideBars[FRAME_DOCK]->setWidget( m_pcFrameProperties ); - addDockWidget( Qt::RightDockWidgetArea, m_arraySideBars[FRAME_DOCK] ); - connect( m_arraySideBars[FRAME_DOCK], SIGNAL( visibilityChanged(bool) ), this, SLOT( updateStreamProperties() ) ); - - QMainWindow::tabifyDockWidget( m_arraySideBars[FRAME_DOCK], m_arraySideBars[STREAM_DOCK] ); -//QMainWindow::setTabPosition(Qt::RightDockWidgetArea, QTabWidget::North); - - addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() ); + addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() ); + addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() ); } Void plaYUVerApp::createStatusBar() @@ -1384,7 +1034,7 @@ Void plaYUVerApp::readSettings() m_cLastOpenPath = settings.lastOpenPath(); m_appTool = ( ViewArea::eTool )settings.getSelectedTool(); setTool( m_appTool ); - m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() ); + //m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() ); m_aRecentFileStreamInfo = settings.getRecentFileList(); updateRecentFileActions(); @@ -1408,8 +1058,8 @@ Void plaYUVerApp::writeSettings() settings.setLastOpenPath( m_cLastOpenPath ); settings.setSelectedTool( ( Int )m_appTool ); settings.setRecentFileList( m_aRecentFileStreamInfo ); - settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible(), true ); - settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ); + //settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible(), true ); + //settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked() ); } } // NAMESPACE diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 2a45a5a..df02cba 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -38,6 +38,7 @@ #include "lib/PlaYUVerDefs.h" #include "SubWindowHandle.h" #include "VideoSubWindow.h" +#include "VideoHandle.h" #include "QualityHandle.h" #include "ModulesHandle.h" #include "PropertiesSidebar.h" @@ -77,17 +78,6 @@ private Q_SLOTS: void closeActiveWindow(); void closeAll(); - /** - * Playing functions slots - */ - void play(); - void stop(); - void playEvent(); - void seekSliderEvent( int new_frame_num ); - void seekEvent( int direction ); - - void videoSelectionButtonEvent(); - /** * Scale the image by a given factor * @param factor factor of scale. Ex: 120 scale the image up by 20% and @@ -101,7 +91,6 @@ private Q_SLOTS: void chageSubWindowSelection(); void updateWindowMenu(); void updateZoomFactorSBox(); - void updateStreamProperties(); void about(); @@ -155,21 +144,12 @@ private: VideoSubWindow* m_pcCurrentVideoSubWindow; QString m_cLastOpenPath; - QTimer *m_pcPlayingTimer; - Bool m_bIsPlaying; Void readRecentFileList(); Void writeRecentFileList(); Void zoomToFitAll(); - /** - * Playing functions - */ - UInt64 getMaxFrameNumber(); - Void setTimerStatus(); - - Void updateMenus(); Void updateRecentFileActions(); @@ -192,15 +172,9 @@ private: static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName ); - QVector m_acPlayingSubWindows; - - QLabel* m_pcLockLabel; - QSlider* m_pcFrameSlider; - WidgetFrameNumber* m_pcFrameNumInfo; QDoubleSpinBox *m_pcZoomFactorSBox; QSignalMapper *mapperZoom; - QSignalMapper *mapperSeekVideo; QSignalMapper *mapperWindow; /** @@ -209,6 +183,7 @@ private: * Quality * Modules */ + VideoHandle* m_appModuleVideo; QualityMeasurement* m_appModuleQuality; ModulesHandle *m_appModuleExtensions; @@ -247,7 +222,6 @@ private: QVector m_arraySideBars; StreamPropertiesSideBar* m_pcStreamProperties; - FramePropertiesSideBar* m_pcFrameProperties; /** * Array of tool bars for the main app @@ -279,14 +253,6 @@ private: ZOOM_OUT_ACT, ZOOM_FIT_ACT, ZOOM_NORMAL_ACT, - PLAY_ACT, - /*PAUSE_ACT,*/ - STOP_ACT, - VIDEO_FORWARD_ACT, - VIDEO_BACKWARD_ACT, - VIDEO_LOOP_ACT, - VIDEO_LOCK_ACT, - VIDEO_LOCK_SELECTION_ACT, NAVIGATION_TOOL_ACT, SELECTION_TOOL_ACT, TILE_WINDOWS_ACT,