diff --git a/CMakeLists.txt b/CMakeLists.txt index b697fa3..9ab9c2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SRC_DIR}/ FILE( GLOB SOURCES_FILES ${SRC_DIR}/app/*.cpp ) FILE( GLOB FORMS_FILES ${UI_DIR}/*.ui ) -FILE( GLOB RESOURCES_FILES ${RSC_DIR}/*.qrc ${RSC_DIR}/*.rc ) +FILE( GLOB RESOURCES_FILES ${RSC_DIR}/*.qrc ) # must go before the project command SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) @@ -54,7 +54,7 @@ ADD_DEFINITIONS( "-DPLAYUVER" ) ###################################################################################### ADD_OPTION(PLAYUVER_LONGVERSIONNAME "Use long version name in deb" OFF ) ADD_OPTION(PLAYUVER_WERROR "Warnings as errors" OFF ) -ADD_OPTION(PLAYUVER_THREADED_MODULES "Warnings as errors" ON ) +ADD_OPTION(PLAYUVER_THREADED_MODULES "Use threads for modules" OFF ) ADD_OPTION(PLAYUVER_INSTALL_LIBS "Install PlaYUVer Lib" ON ) ADD_OPTION(USE_QT4 "Build with QT4" OFF ) ADD_OPTION(USE_OPENCV "Add OpenCV support" OFF ) @@ -78,6 +78,24 @@ INCLUDE( cmake/LibOpenCV.cmake ) INCLUDE( cmake/LibFFmpeg.cmake ) INCLUDE( cmake/LibPixfc.cmake ) + +# Windows application icon +if (WIN32) +set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj) +if (MSVC) +add_custom_command(OUTPUT ${WINDOWS_RES_FILE} +COMMAND rc.exe /fo ${WINDOWS_RES_FILE} playuver.rc +WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/resources +) +else() +add_custom_command(OUTPUT ${WINDOWS_RES_FILE} +COMMAND windres.exe playuver.rc ${WINDOWS_RES_FILE} +WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/resources +) +endif() +endif() + + ###################################################################################### # PlaYUVer modules build ###################################################################################### @@ -125,7 +143,7 @@ ENDIF() SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) -ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HEADERS_FILES} ${RESOURCES_RCC_FILES} ) +ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HEADERS_FILES} ${RESOURCES_RCC_FILES} ${WINDOWS_RES_FILE} ) TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib ${MODULES_LIBS} ${LINKER_LIBS} ) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 1520d1d..029dbc8 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -92,12 +92,7 @@ IF( PLAYUVER_LONGVERSIONNAME ) SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) ELSE() -# message(STATUS ${GIT_BRANCH} ) - SET( __version_name_deb ${GIT_BRANCH} ) - STRING(REPLACE "master" "stable" __version_name_deb ${__version_name_deb} ) - STRING(REPLACE "devel" "latest" __version_name_deb ${__version_name_deb} ) - message(STATUS ${GIT_BRANCH} ) - SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${__version_name_deb}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) + SET( CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACK_NAME}${APPEND_VERSION}-${OS}-${CPACK_PACKAGE_ARCHITECTURE}" ) SET( PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME} ) ENDIF() diff --git a/cmake/PlaYUVerVersion.cmake b/cmake/PlaYUVerVersion.cmake index 0d3bac4..ebc9278 100644 --- a/cmake/PlaYUVerVersion.cmake +++ b/cmake/PlaYUVerVersion.cmake @@ -16,18 +16,23 @@ SET( PLAYUVER_VERSION_MINOR ${__minor}) SET( PLAYUVER_VERSION_PATCH ${__patch}) SET( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLAYUVER_VERSION_PATCH}") -execute_process( - COMMAND git rev-parse --abbrev-ref HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_BRANCH - OUTPUT_STRIP_TRAILING_WHITESPACE -) -SET( __version_name_deb ${GIT_BRANCH} ) -STRING(REPLACE "master" "stable" __version_name_deb ${__version_name_deb} ) -STRING(REPLACE "devel" "latest" __version_name_deb ${__version_name_deb} ) - -SET( PACK_NAME ${__version_name_deb} ) +IF( NOT WIN32 ) + + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET( __version_name_deb ${GIT_BRANCH} ) + STRING(REPLACE "master" "latest" __version_name_deb ${__version_name_deb} ) + STRING(REPLACE "devel" "experimental" __version_name_deb ${__version_name_deb} ) + + SET( PACK_NAME ${__version_name_deb} ) +ELSE() + SET( PACK_NAME "latest" ) +ENDIF() unset(__version_name_deb) unset(__version_list) unset(__version) diff --git a/resources/icons/playuver.png b/resources/icons/playuver.png deleted file mode 100755 index 5475d4b..0000000 Binary files a/resources/icons/playuver.png and /dev/null differ diff --git a/resources/playuver.ico b/resources/playuver.ico new file mode 100644 index 0000000..fdff297 Binary files /dev/null and b/resources/playuver.ico differ diff --git a/resources/playuver.png b/resources/playuver.png index 5475d4b..ad3794b 100755 Binary files a/resources/playuver.png and b/resources/playuver.png differ diff --git a/resources/playuver.qrc b/resources/playuver.qrc index 5c16513..4e70ab1 100755 --- a/resources/playuver.qrc +++ b/resources/playuver.qrc @@ -1,6 +1,6 @@ - icons/playuver.png + playuver.png playuver-background-logo.png icons/open.png diff --git a/resources/playuver.rc b/resources/playuver.rc new file mode 100755 index 0000000..23ff060 --- /dev/null +++ b/resources/playuver.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "playuver.ico" \ No newline at end of file diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index ee857c0..4a5a838 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -172,6 +172,12 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf } } + // Disable existing Module + for( UInt i = 0; i < numberOfFrames; i++ ) + { + pcCurrModuleIf->m_pcSubWindow[i]->disableModule(); + } + // Create Module pcCurrModuleIf->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() ); @@ -256,7 +262,7 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) if( pcCurrModuleIf->m_pcModuleStream ) { UInt numberOfWindows = pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames; - UInt currFrames; + UInt64 currFrames = 0; UInt64 numberOfFrames = INT_MAX; for( UInt i = 0; i < numberOfWindows; i++ ) { @@ -266,10 +272,10 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcSubWindow[i]->stop(); } QApplication::setOverrideCursor( Qt::WaitCursor ); - for( UInt f = 0; f < numberOfFrames; f++ ) + for( UInt f = 1; f < numberOfFrames; f++ ) { applyModuleIf( pcCurrModuleIf, false, true ); - //QCoreApplication::processEvents(); + QCoreApplication::processEvents(); pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame ); for( UInt i = 0; i < numberOfWindows; i++ ) { @@ -277,6 +283,10 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcSubWindow[i]->playEvent(); } } + for( UInt i = 0; i < numberOfWindows; i++ ) + { + pcCurrModuleIf->m_pcSubWindow[i]->stop(); + } QApplication::restoreOverrideCursor(); } } @@ -334,14 +344,17 @@ Void ModulesHandle::openModuleIfStream( PlaYUVerModuleIf *pcCurrModuleIf ) Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFrame* processedFrame ) { Bool bRet = false; - if( pcCurrModuleIf->m_pcDisplaySubWindow ) + //if( processedFrame ) { - pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame ); - bRet = true; - } - else - { - pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame ); + if( pcCurrModuleIf->m_pcDisplaySubWindow ) + { + pcCurrModuleIf->m_pcDisplaySubWindow->setCurrFrame( processedFrame ); + bRet = true; + } + else + { + pcCurrModuleIf->m_pcSubWindow[0]->setCurrFrame( processedFrame ); + } } return bRet; } @@ -349,7 +362,7 @@ Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, PlaYUVerFram Bool ModulesHandle::showModuleIf( PlaYUVerModuleIf *pcCurrModuleIf, Double moduleResult ) { Bool bRet = false; - pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue(moduleResult); + pcCurrModuleIf->m_pcModuleDock->setModulueReturnValue( moduleResult ); return bRet; } diff --git a/source/app/PlaYUVerSettings.cpp b/source/app/PlaYUVerSettings.cpp index f396a79..34a5ece 100644 --- a/source/app/PlaYUVerSettings.cpp +++ b/source/app/PlaYUVerSettings.cpp @@ -65,7 +65,7 @@ Void PlaYUVerSettings::setLastOpenPath( const QString & path ) Int PlaYUVerSettings::getSelectedTool() { - return m_settings.value( "MainWindow/SelectedTool", NavigationTool ).toInt(); + return m_settings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt(); } Void PlaYUVerSettings::setSelectedTool( Int tool ) diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index 0fe5a3f..1344f87 100644 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -53,6 +53,12 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) : // ----------------- GUI definition ----------------- + QLabel *streamNameLabel = new QLabel( tr( "Name:" ) ); + streamNameLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); + labelNameValue = new QLabel; + labelNameValue->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + labelNameValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); + QLabel *formatLabel = new QLabel( tr( "File Format:" ) ); formatLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); labelFormatValue = new QLabel; @@ -83,6 +89,9 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) : QGridLayout *propertiesLayout = new QGridLayout; Int layout_line = 0; +// propertiesLayout->addWidget( streamNameLabel, layout_line, 0 ); +// propertiesLayout->addWidget( labelNameValue, layout_line, 1 ); +// layout_line++; propertiesLayout->addWidget( formatLabel, layout_line, 0 ); propertiesLayout->addWidget( labelFormatValue, layout_line, 1 ); layout_line++; @@ -126,6 +135,7 @@ QSize StreamPropertiesSideBar::sizeHint() const Void StreamPropertiesSideBar::setData( PlaYUVerStream* pcStream ) { // Clear information. + labelNameValue->clear(); labelFormatValue->clear(); labelCodecValue->clear(); labelDurationValueTime->clear(); @@ -143,11 +153,13 @@ Void StreamPropertiesSideBar::setData( PlaYUVerStream* pcStream ) m_pcStream = pcStream; setEnabled( true ); - QString value; + + labelNameValue->setText( QFileInfo( m_pcStream->getFileName() ).fileName() ); labelFormatValue->setText( m_pcStream->getFormatName() ); labelCodecValue->setText( m_pcStream->getCodecName() ); Int duration[3]; m_pcStream->getDuration( duration ); + QString value; value = QString( tr( "%1h:%2m:%3s" ) ).arg( duration[0] ).arg( duration[1] ).arg( duration[2] ); labelDurationValueTime->setText( value ); value = QString( tr( "%1 frms" ) ).arg( m_pcStream->getFrameNum() ); diff --git a/source/app/PropertiesSidebar.h b/source/app/PropertiesSidebar.h index 96bc195..7691df0 100644 --- a/source/app/PropertiesSidebar.h +++ b/source/app/PropertiesSidebar.h @@ -55,6 +55,7 @@ private: PlaYUVerStream* m_pcStream; Bool m_bIsVisible; + QLabel* labelNameValue; QLabel* labelFormatValue; QLabel* labelCodecValue; QLabel* labelDurationValueTime; diff --git a/source/app/QualityMeasurementSidebar.cpp b/source/app/QualityMeasurementSidebar.cpp index c1cadd7..d420ee8 100644 --- a/source/app/QualityMeasurementSidebar.cpp +++ b/source/app/QualityMeasurementSidebar.cpp @@ -48,13 +48,13 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea RecLabel->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); m_comboBoxMetric = new QComboBox; - m_comboBoxMetric->insertItems( 0, PlaYUVerFrame::supportedQualityMetricsList()); + m_comboBoxMetric->insertItems( 0, PlaYUVerFrame::supportedQualityMetricsList() ); m_comboBoxMetric->setSizeAdjustPolicy( QComboBox::AdjustToContents ); - m_comboBoxMetric->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed); + m_comboBoxMetric->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); m_comboBoxRef = new QComboBox; m_comboBoxRef->setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLength ); - m_comboBoxRef->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed); + m_comboBoxRef->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); updateSubWindowList(); QGridLayout *mainLayout = new QGridLayout; @@ -152,7 +152,16 @@ Void QualityMeasurementSidebar::updateSubWindowList() Void QualityMeasurementSidebar::updateCurrentWindow( SubWindowHandle *subWindow ) { m_pcCurrentSubWindow = subWindow; - updateSidebarData(); + if( m_pcCurrentSubWindow ) + { + Int index = -1; + if( SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow() ) + { + index = m_pcWindowListNames.indexOf( refSubWindow->getWindowName() ); + } + m_comboBoxRef->setCurrentIndex( index ); + updateSidebarData(); + } } Void QualityMeasurementSidebar::updateSidebarData() @@ -160,11 +169,9 @@ Void QualityMeasurementSidebar::updateSidebarData() QString value( "0.00" ); if( m_pcCurrentSubWindow ) { - if( SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow() ) + SubWindowHandle* refSubWindow = m_pcCurrentSubWindow->getRefSubWindow(); + if( refSubWindow ) { - Int index = m_pcWindowListNames.indexOf( refSubWindow->getWindowName() ); - m_comboBoxRef->setCurrentIndex( index ); - PlaYUVerFrame* currFrame = m_pcCurrentSubWindow->getCurrFrame(); PlaYUVerFrame* refFrame = refSubWindow->getCurrFrame(); Double quality; @@ -213,9 +220,9 @@ Void QualityMeasurementSidebar::slotReferenceChanged( Int index ) Void QualityMeasurementSidebar::slotQualityMetricChanged() { QString labelQuality = PlaYUVerFrame::supportedQualityMetricsList().at( m_comboBoxMetric->currentIndex() ); - m_ppcLabelQualityLabel[LUMA]->setText( labelQuality + " Y"); - m_ppcLabelQualityLabel[CHROMA_U]->setText( labelQuality + " U"); - m_ppcLabelQualityLabel[CHROMA_V]->setText( labelQuality + " V"); + m_ppcLabelQualityLabel[LUMA]->setText( labelQuality + " Y" ); + m_ppcLabelQualityLabel[CHROMA_U]->setText( labelQuality + " U" ); + m_ppcLabelQualityLabel[CHROMA_V]->setText( labelQuality + " V" ); updateSidebarData(); } } // NAMESPACE diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 6125d6d..87f91a4 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -303,8 +303,10 @@ Void SubWindowHandle::seekAbsoluteEvent( UInt new_frame_num ) { if( m_pCurrStream ) { - m_pCurrStream->seekInput( new_frame_num ); - refreshFrame(); + if( m_pCurrStream->seekInput( new_frame_num ) ) + { + refreshFrame(); + } } } @@ -312,8 +314,10 @@ Void SubWindowHandle::seekRelativeEvent( Bool bIsFoward ) { if( m_pCurrStream ) { - m_pCurrStream->seekInput( m_pCurrStream->getCurrFrameNum() + ( bIsFoward ? 1 : -1 ) ); - refreshFrame(); + if( m_pCurrStream->seekInput( m_pCurrStream->getCurrFrameNum() + ( bIsFoward ? 1 : -1 ) ) ) + { + refreshFrame(); + } } } diff --git a/source/app/ViewArea.h b/source/app/ViewArea.h index 4604589..1c0b0eb 100644 --- a/source/app/ViewArea.h +++ b/source/app/ViewArea.h @@ -53,6 +53,14 @@ public: { NormalMode, MaskMode, }; + typedef enum + { + NavigationTool, + NormalSelectionTool, + BlockSelectionTool, + MaskTool, + EraserTool + }eTool; ViewArea( QWidget *parent = 0 ); @@ -90,7 +98,7 @@ public: { return m_mode; } - enum eTool tool() const + eTool tool() const { return m_tool; } @@ -109,7 +117,7 @@ public: Void zoomChangeEvent(Double factor, QPoint center); - void setTool( enum eTool tool ); + void setTool( eTool tool ); // QSize sizeHint() const; @@ -161,7 +169,7 @@ private: QPoint m_lastWindowPos; GridManager m_grid; ViewMode m_mode; - enum eTool m_tool; + eTool m_tool; QColor m_maskColor; double m_zoomFactor; int m_xOffset; diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 35e9499..bab0367 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -53,6 +53,7 @@ plaYUVerApp::plaYUVerApp() setCentralWidget( mdiArea ); //mdiArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); //mdiArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded ); + mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder ); connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( chageSubWindowSelection() ) ); @@ -878,6 +879,7 @@ Void plaYUVerApp::chageSubWindowSelection() if( activeSubWindow() ) { m_pcCurrentSubWindow = new_window; + setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() ); if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentSubWindow->getRefSubWindow() ) ) { m_pcCurrentSubWindow->setRefSubWindow( NULL ); @@ -888,7 +890,7 @@ Void plaYUVerApp::chageSubWindowSelection() updateFrameProperties(); updateZoomFactorSBox(); - if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) ) + if( m_pcCurrentSubWindow->isPlaying() ) m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPause ) ); else m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) ); @@ -981,15 +983,9 @@ SubWindowHandle* plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const SubW return 0; } -Void plaYUVerApp::setNavigationTool() +Void plaYUVerApp::setTool( Int idxTool ) { - m_appTool = NavigationTool; - setAllSubWindowTool(); -} - -Void plaYUVerApp::setSelectionTool() -{ - m_appTool = NormalSelectionTool; + m_appTool = (ViewArea::eTool ) idxTool; setAllSubWindowTool(); } @@ -1271,19 +1267,25 @@ Void plaYUVerApp::createActions() actionGroupTools = new QActionGroup( this ); actionGroupTools->setExclusive( true ); - m_appTool = NavigationTool; + m_mapperTools = new QSignalMapper( this ); + connect( m_mapperTools, SIGNAL( mapped(int) ), this, SLOT( setTool(int) ) ); + + m_appTool = ViewArea::NavigationTool; m_arrayActions[NAVIGATION_TOOL_ACT] = new QAction( tr( "&Navigation Tool" ), this ); m_arrayActions[NAVIGATION_TOOL_ACT]->setCheckable( true ); m_arrayActions[NAVIGATION_TOOL_ACT]->setChecked( true ); actionGroupTools->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] ); - connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), this, SLOT( setNavigationTool() ) ); + connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) ); + m_mapperTools->setMapping( m_arrayActions[NAVIGATION_TOOL_ACT], ViewArea::NavigationTool ); m_arrayActions[SELECTION_TOOL_ACT] = new QAction( "&Selection Tool", this ); m_arrayActions[SELECTION_TOOL_ACT]->setCheckable( true ); m_arrayActions[SELECTION_TOOL_ACT]->setChecked( false ); actionGroupTools->addAction( m_arrayActions[SELECTION_TOOL_ACT] ); - connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), this, SLOT( setSelectionTool() ) ); + connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) ); + m_mapperTools->setMapping( m_arrayActions[SELECTION_TOOL_ACT], ViewArea::NormalSelectionTool ); + // ------------ Window ------------ @@ -1493,8 +1495,8 @@ Void plaYUVerApp::readSettings() move( pos ); resize( size ); m_cLastOpenPath = settings.lastOpenPath(); - m_appTool = ( enum eTool )settings.getSelectedTool(); - setAllSubWindowTool(); + //m_appTool = ( ViewArea::eTool )settings.getSelectedTool(); + //setAllSubWindowTool(); m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() ); m_arrayActions[VIDEO_LOCK_ACT]->setChecked( settings.getVideoLock() ); diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index bd2baa0..ec13b8f 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -113,8 +113,7 @@ private Q_SLOTS: void updateZoomFactorSBox(); void setAllSubWindowTool(); - void setNavigationTool(); - void setSelectionTool(); + void setTool( int idxTool ); private: @@ -295,9 +294,15 @@ private: // Tools Actions; QActionGroup *actionGroupTools; - QAction *actionNavigationTool; - QAction *actionSelectionTool; - enum eTool m_appTool; + enum APP_TOOLS_ACTION_LIST + { + NAVIGATION_TOOL, + SELECTION_TOOL, + TOTAL_TOOLS, + }; + QVector m_arrayTools; + QSignalMapper *m_mapperTools; + ViewArea::eTool m_appTool; PlaYUVerStreamInfoVector m_aRecentFileStreamInfo; diff --git a/source/lib/PlaYUVerDefs.h b/source/lib/PlaYUVerDefs.h index c5462e9..fb27988 100644 --- a/source/lib/PlaYUVerDefs.h +++ b/source/lib/PlaYUVerDefs.h @@ -146,11 +146,6 @@ typedef struct __pixel_definition }; }Pixel; -enum eTool -{ - NavigationTool, NormalSelectionTool, BlockSelectionTool, MaskTool, EraserTool -}; - } // NAMESPACE #endif // __TYPEDEF_H__ diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index 0a68b19..8d06d41 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -644,10 +644,10 @@ PlaYUVerFrame* PlaYUVerStream::getCurrFrame() return m_pcCurrFrame; } -Void PlaYUVerStream::seekInput( UInt64 new_frame_num ) +Bool PlaYUVerStream::seekInput( UInt64 new_frame_num ) { if( !m_bInit || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || ( Int64 )new_frame_num == m_iCurrFrameNum ) - return; + return false; m_iCurrFrameNum = new_frame_num - 1; @@ -656,7 +656,7 @@ Void PlaYUVerStream::seekInput( UInt64 new_frame_num ) m_uiFrameBufferIndex = new_frame_num; m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex]; setNextFrame(); - return; + return true; } #ifdef USE_FFMPEG if( m_cLibAvContext->getStatus() ) @@ -677,6 +677,7 @@ Void PlaYUVerStream::seekInput( UInt64 new_frame_num ) setNextFrame(); if( m_uiTotalFrameNum > 1 ) readFrame(); + return true; } Bool PlaYUVerStream::checkErrors( Int error_type ) diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index 072da79..60f2f2b 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -253,7 +253,7 @@ public: PlaYUVerFrame* getCurrFrame(); PlaYUVerFrame* getCurrFrame( PlaYUVerFrame * ); - Void seekInput( UInt64 new_frame_num ); + Bool seekInput( UInt64 new_frame_num ); Bool checkErrors( Int error_type );