diff --git a/app/SubWindowHandle.cpp b/app/SubWindowHandle.cpp index 7d9149c..28dbe0f 100644 --- a/app/SubWindowHandle.cpp +++ b/app/SubWindowHandle.cpp @@ -39,14 +39,16 @@ SubWindowHandle::~SubWindowHandle() } Void SubWindowHandle::setWindowName( QString name ) - { - m_cWindowName = name; - setWindowTitle( m_cWindowName ); - } - QString SubWindowHandle::getWindowName() - { - return m_cWindowName; - } +{ + m_cWindowName = name; + setWindowTitle( m_cWindowName ); +} + +QString SubWindowHandle::getWindowName() +{ + return m_cWindowName; +} + Bool SubWindowHandle::mayClose() { return true; diff --git a/app/SubWindowHandle.h b/app/SubWindowHandle.h index 3a7050a..015c829 100644 --- a/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -82,6 +82,9 @@ public: return m_uiCategory; } +protected: + virtual void closeEvent( QCloseEvent *event ) = 0; + Q_SIGNALS: void zoomChanged(); void updateStatusBar( const QString& ); diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 4773db1..f8fdaf5 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -267,6 +267,14 @@ Void VideoHandle::update( VideoSubWindow* currSubWindow ) update(); } +Void VideoHandle::updateSelectionArea( QRect area ) +{ + if( m_pcCurrentVideoSubWindow ) + { + m_pcFramePropertiesSideBar->setSelection( area ); + } +} + Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow ) { if( m_acPlayingSubWindows.contains( currSubWindow ) ) @@ -274,6 +282,10 @@ Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow ) Int pos = m_acPlayingSubWindows.indexOf( currSubWindow ); m_acPlayingSubWindows.at( pos )->stop(); m_acPlayingSubWindows.remove( pos ); + if( m_acPlayingSubWindows.size() < 2 ) + { + m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false ); + } } } diff --git a/app/VideoHandle.h b/app/VideoHandle.h index ecba095..edb3d90 100644 --- a/app/VideoHandle.h +++ b/app/VideoHandle.h @@ -107,6 +107,7 @@ Q_SIGNALS: private Q_SLOTS: void update(); + void updateSelectionArea( QRect area ); void play(); void stop(); void playEvent(); diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 1f270e5..ba7eaaf 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -528,10 +528,9 @@ QSize VideoSubWindow::sizeHint() const return maxSize; } -void VideoSubWindow::closeEvent( QCloseEvent *event ) +Void VideoSubWindow::closeEvent( QCloseEvent *event ) { - Bool bAccept = mayClose(); - bAccept = m_bIsPlaying ? false : bAccept; + Bool bAccept = m_bIsPlaying ? false : true; if( bAccept ) { event->accept(); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 2bd8154..179317b 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -145,6 +145,18 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event ) } } +Void plaYUVerApp::closeActiveWindow() +{ + SubWindowHandle *currSubWindow = activeSubWindow(); + m_appModuleVideo->closeSubWindow( qobject_cast( currSubWindow ) ); + mdiArea->closeActiveSubWindow(); +} + +Void plaYUVerApp::closeAll() +{ + mdiArea->closeAllSubWindows(); +} + Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) { if( !QFileInfo( fileName ).exists() ) @@ -181,7 +193,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) mdiArea->addSubWindow( videoSubWindow ); videoSubWindow->show(); - connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) ); + connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) ); connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) ); connect( subWindow, SIGNAL( zoomChanged() ), this, SLOT( updateZoomFactorSBox() ) ); @@ -367,11 +379,6 @@ Void plaYUVerApp::setTool( Int idxTool ) { m_appTool = ( ViewArea::eTool )idxTool; actionGroupTools->actions().at( m_appTool )->setChecked( true ); - setAllSubWindowTool(); -} - -Void plaYUVerApp::setAllSubWindowTool() -{ QList videoSubWindowList = mdiArea->findChildren(); for( Int i = 0; i < videoSubWindowList.size(); i++ ) { @@ -379,72 +386,6 @@ Void plaYUVerApp::setAllSubWindowTool() } } -Void plaYUVerApp::closeActiveWindow() -{ - SubWindowHandle *currSubWindow = activeSubWindow(); - m_appModuleVideo->closeSubWindow( qobject_cast( currSubWindow ) ); - mdiArea->closeActiveSubWindow(); -} - -Void plaYUVerApp::closeAll() -{ - mdiArea->closeAllSubWindows(); -} -// -//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 ); -// } -} - // ----------------------- Zoom Functions ----------------------- Void plaYUVerApp::normalSize() diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 62adef0..76b43db 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -88,11 +88,12 @@ private Q_SLOTS: void normalSize(); void zoomToFit(); + void setTool( int idxTool ); + void update(); void updateWindowMenu(); void updateZoomFactorSBox(); void updateStatusBar( const QString& ); - void updatePropertiesSelectedArea( QRect area ); void about(); @@ -101,9 +102,6 @@ private Q_SLOTS: void setActiveSubWindow( QWidget *window ); - void setAllSubWindowTool(); - void setTool( int idxTool ); - private: class PlaYUVerMdiArea: public QMdiArea @@ -138,7 +136,7 @@ private: /** * Save the current subwindow for every category */ - SubWindowHandle* m_pcCurrentSubWindow; //!< General always set + SubWindowHandle* m_pcCurrentSubWindow; //!< General always set VideoSubWindow* m_pcCurrentVideoSubWindow; QString m_cLastOpenPath; @@ -175,6 +173,17 @@ private: QSignalMapper *mapperZoom; QSignalMapper *mapperWindow; + // Tools Actions; + QActionGroup *actionGroupTools; + enum APP_TOOLS_ACTION_LIST + { + NAVIGATION_TOOL, + SELECTION_TOOL, + TOTAL_TOOLS, + }; + QSignalMapper *m_mapperTools; + ViewArea::eTool m_appTool; + /** * App modules * Video @@ -185,7 +194,6 @@ private: QualityHandle* m_appModuleQuality; ModulesHandle *m_appModuleExtensions; - /** * Array of menus for the main app * @param position description: @@ -260,26 +268,11 @@ private: }; QVector m_arrayActions; -#define MAX_RECENT_FILES 10 +#define MAX_RECENT_FILES 20 QVector m_arrayRecentFilesActions; - //QAction *actionPopupMenu; - - // Tools Actions; - QActionGroup *actionGroupTools; - enum APP_TOOLS_ACTION_LIST - { - NAVIGATION_TOOL, - SELECTION_TOOL, - TOTAL_TOOLS, - }; - QVector m_arrayTools; - QSignalMapper *m_mapperTools; - ViewArea::eTool m_appTool; - PlaYUVerStreamInfoVector m_aRecentFileStreamInfo; AboutDialog* m_pcAboutDialog; - }; } // NAMESPACE