diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 0b671bd..8f0a6f4 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -174,12 +174,14 @@ Void ModulesHandle::updateMenus() Void ModulesHandle::readSettings() { - + QSettings appSettings; + m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked( appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() ); } Void ModulesHandle::writeSettings() { - + QSettings appSettings; + appSettings.setValue( "ModulesHandle/UseNewWindow", m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() ); } Void ModulesHandle::processOpt( Int index ) @@ -301,7 +303,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { - pcModuleSubWindow = new VideoSubWindow( m_pcParent, true ); + pcModuleSubWindow = new VideoSubWindow( this , true ); pcModuleSubWindow->setWindowShortName( windowName ); pcModuleSubWindow->setWindowName( windowName ); @@ -310,7 +312,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow; pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf, true ); - m_pcMdiArea->addSubWindow( pcModuleSubWindow ); + //m_pcMdiArea->addSubWindow( pcModuleSubWindow ); } } else if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE ) @@ -340,7 +342,13 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) applyModuleIf( pcCurrModuleIf, false ); QCoreApplication::processEvents(); - //pcModuleSubWindow->show(); + + if( pcModuleSubWindow ) + { + QMdiSubWindow* window = m_pcMdiArea->addSubWindow( pcModuleSubWindow ); + window->show(); + } + return; } diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h index 3c362b0..a07c0f8 100644 --- a/app/ModulesHandle.h +++ b/app/ModulesHandle.h @@ -60,8 +60,6 @@ public: Void readSettings(); Void writeSettings(); - SubWindowHandle* processModuleHandlingOpt(); - static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf ); static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying = false, Bool disableThreads = false ); diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp index a42bfee..ba99ec1 100644 --- a/app/QualityHandle.cpp +++ b/app/QualityHandle.cpp @@ -86,6 +86,8 @@ QDockWidget* QualityHandle::createDock() connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged(int) ), this, SLOT( slotQualityMetricChanged(int) ) ); connect( m_mapperQualityMetric, SIGNAL( mapped(int) ), this, SLOT( slotQualityMetricChanged(int) ) ); + slotQualityMetricChanged( 0 ); + return m_pcQualityHandleDock; } @@ -96,12 +98,15 @@ Void QualityHandle::updateMenus() Void QualityHandle::readSettings() { - + QSettings appSettings; + Int metric = appSettings.value( "QualityHandle/Metric", 0 ).toInt(); + slotQualityMetricChanged( metric ); } Void QualityHandle::writeSettings() { - + QSettings appSettings; + appSettings.setValue( "QualityHandle/Metric", m_iQualityMetricIdx ); } Void QualityHandle::update( VideoSubWindow* currSubWindow ) @@ -114,6 +119,7 @@ Void QualityHandle::slotQualityMetricChanged( Int idx ) m_actionGroupQualityMetric->actions().at( idx )->setChecked( true ); m_pcQualityHandleSideBar->updateQualityMetric( idx ); m_pcQualityHandleDock->show(); + m_iQualityMetricIdx = idx; } Void QualityHandle::slotSelectReference() diff --git a/app/QualityHandle.h b/app/QualityHandle.h index 74fc297..d2f59c4 100644 --- a/app/QualityHandle.h +++ b/app/QualityHandle.h @@ -68,6 +68,7 @@ private: QVector m_arrayActions; QActionGroup* m_actionGroupQualityMetric; QSignalMapper* m_mapperQualityMetric; + Int m_iQualityMetricIdx; QMenu* m_pcMenuQuality; diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp index 3d60e5b..80ac936 100644 --- a/app/VideoHandle.cpp +++ b/app/VideoHandle.cpp @@ -140,7 +140,7 @@ QDockWidget* VideoHandle::createDock() QWidget* VideoHandle::createStatusBarMessage() { - QWidget* statusBarWidget = new QWidget; + QWidget* pcStatusBarWidget = new QWidget; QHBoxLayout* mainlayout = new QHBoxLayout; m_pcFormatCodeLabel = new QLabel; @@ -164,9 +164,9 @@ QWidget* VideoHandle::createStatusBarMessage() mainlayout->addWidget( m_pcFormatCodeLabel ); mainlayout->addWidget( m_pcResolutionLabel ); mainlayout->addWidget( m_pcColorSpace ); - statusBarWidget->setLayout( mainlayout ); + pcStatusBarWidget->setLayout( mainlayout ); - return statusBarWidget; + return pcStatusBarWidget; } Void VideoHandle::updateMenus() @@ -232,9 +232,10 @@ Void VideoHandle::update() } else { - //m_pcStreamProperties->setData( NULL ); m_pcFrameNumInfo->setCurrFrameNum( 0 ); - m_pcFormatCodeLabel->clear(); + m_pcFormatCodeLabel->setText( QString( "")); + if( m_pcCurrentVideoSubWindow->getIsModule() ) + m_pcFormatCodeLabel->setText( QString( "Module")); } if( pcFrame ) @@ -251,14 +252,13 @@ Void VideoHandle::update() 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 ); + else + { + m_pcFramePropertiesSideBar->setData( NULL, false ); + m_pcFrameSlider->setValue( 0 ); + m_pcFrameNumInfo->clear(); + } } Void VideoHandle::update( VideoSubWindow* currSubWindow ) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 4825102..7641cb5 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -169,7 +169,8 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) m_cFilename = cFilename; m_cWindowShortName = QFileInfo( cFilename ).fileName(); - setWindowName( m_pCurrStream->getStreamInformationString() ); + //setWindowName( m_pCurrStream->getStreamInformationString() ); + setWindowName( m_cWindowShortName ); return true; } @@ -195,7 +196,8 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo ) m_cFilename = streamInfo->m_cFilename; m_cWindowShortName = QFileInfo( streamInfo->m_cFilename ).fileName(); - setWindowName( m_pCurrStream->getStreamInformationString() ); + //setWindowName( m_pCurrStream->getStreamInformationString() ); + setWindowName( m_cWindowShortName ); return true; } @@ -246,12 +248,12 @@ Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame ) { m_pcCurrFrame = pcCurrFrame; m_cViewArea->setImage( m_pcCurrFrame ); - if( !isVisible() ) - { - show(); - resize( sizeHint() ); - zoomToFit(); - } +// if( !isVisible() ) +// { +// show(); +// resize( sizeHint() ); +// zoomToFit(); +// } } Void VideoSubWindow::refreshFrame() diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index c42330e..519adbe 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -45,7 +45,7 @@ plaYUVerApp::plaYUVerApp() m_pDBusAdaptor = new PlaYUVerAppAdaptor( this ); #endif - mdiArea = new PlaYUVerMdiArea; + mdiArea = new PlaYUVerMdiArea( this ); setCentralWidget( mdiArea ); //mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder ); @@ -448,56 +448,6 @@ Void plaYUVerApp::updateZoomFactorSBox() } } -Void plaYUVerApp::update() -{ - SubWindowHandle *new_window = activeSubWindow(); - QCoreApplication::processEvents(); - //if( activeSubWindow() != m_pcCurrentSubWindow ) - { - m_pcCurrentSubWindow = NULL; - m_pcCurrentVideoSubWindow = NULL; - if( activeSubWindow() ) - { - m_pcCurrentSubWindow = new_window; - - switch( m_pcCurrentSubWindow->getCategory() ) - { - case SubWindowHandle::VIDEO_SUBWINDOW: - m_pcCurrentVideoSubWindow = qobject_cast( m_pcCurrentSubWindow ); - break; - } - - setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() ); - - if( m_pcCurrentVideoSubWindow ) - { - if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentVideoSubWindow->getRefSubWindow() ) ) - { - m_pcCurrentVideoSubWindow->setRefSubWindow( NULL ); - } - } - updateZoomFactorSBox(); - } - } - m_appModuleVideo->update( m_pcCurrentVideoSubWindow ); - m_appModuleQuality->update( m_pcCurrentVideoSubWindow ); - updateMenus(); -} - -// ----------------------- Status bar Functions ----------------------- - -Void plaYUVerApp::updateStatusBar( const QString& statusBarString ) -{ - if( !statusBarString.isEmpty() ) - { - statusBar()->showMessage( statusBarString, 5000 ); - } - else - { - statusBar()->showMessage( " " ); - } -} - // ----------------------- Drag and drop functions ---------------------- Void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event ) @@ -519,7 +469,12 @@ Void plaYUVerApp::dropEvent( QDropEvent *event ) } } -// ----------------------- Gui Functions ----------------------- +// ----------------------- Sub Window Functions ----------------------- + +void plaYUVerApp::tileSubWindows() +{ + mdiArea->tileSubWindows(); +} SubWindowHandle *plaYUVerApp::activeSubWindow() { @@ -575,6 +530,56 @@ Void plaYUVerApp::setActiveSubWindow( QWidget *window ) mdiArea->setActiveSubWindow( qobject_cast( window ) ); } +// ----------------------- Update Functions ----------------------- + +Void plaYUVerApp::update() +{ + SubWindowHandle *new_window = activeSubWindow(); + QCoreApplication::processEvents(); + //if( activeSubWindow() != m_pcCurrentSubWindow ) + { + m_pcCurrentSubWindow = NULL; + m_pcCurrentVideoSubWindow = NULL; + if( activeSubWindow() ) + { + m_pcCurrentSubWindow = new_window; + + switch( m_pcCurrentSubWindow->getCategory() ) + { + case SubWindowHandle::VIDEO_SUBWINDOW: + m_pcCurrentVideoSubWindow = qobject_cast( m_pcCurrentSubWindow ); + break; + } + + setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() ); + + if( m_pcCurrentVideoSubWindow ) + { + if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentVideoSubWindow->getRefSubWindow() ) ) + { + m_pcCurrentVideoSubWindow->setRefSubWindow( NULL ); + } + } + updateZoomFactorSBox(); + } + } + m_appModuleVideo->update( m_pcCurrentVideoSubWindow ); + m_appModuleQuality->update( m_pcCurrentVideoSubWindow ); + updateMenus(); +} + +Void plaYUVerApp::updateStatusBar( const QString& statusBarString ) +{ + if( !statusBarString.isEmpty() ) + { + statusBar()->showMessage( statusBarString, 5000 ); + } + else + { + statusBar()->showMessage( " " ); + } +} + Void plaYUVerApp::updateMenus() { Bool hasSubWindow = ( activeSubWindow() != 0 ); @@ -658,7 +663,7 @@ Void plaYUVerApp::updateWindowMenu() } } - +// ----------------------- Create Functions ----------------------- Void plaYUVerApp::createActions() { @@ -787,7 +792,8 @@ Void plaYUVerApp::createActions() m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this ); m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) ); m_arrayActions[TILE_WINDOWS_ACT]->setStatusTip( tr( "Tile the windows" ) ); - connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) ); + //connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) ); + connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( tileSubWindows() ) ); m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this ); m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) ); @@ -942,10 +948,13 @@ Void plaYUVerApp::createDockWidgets() Void plaYUVerApp::createStatusBar() { - statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() ); + //! Warning: the following widget cannot change size too much + statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() ); statusBar()->showMessage( tr( "Ready" ) ); } + + Void plaYUVerApp::addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo ) { Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename ); @@ -994,11 +1003,13 @@ Void plaYUVerApp::readSettings() m_appTool = ( ViewArea::eTool )appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt(); setTool( m_appTool ); - QVariant value = appSettings.value("MainWindow/RecentFileList"); + QVariant value = appSettings.value( "MainWindow/RecentFileList" ); m_aRecentFileStreamInfo = value.value(); updateRecentFileActions(); m_appModuleVideo->readSettings(); + m_appModuleQuality->readSettings(); + m_appModuleExtensions->readSettings(); } Void plaYUVerApp::writeSettings() @@ -1012,9 +1023,11 @@ Void plaYUVerApp::writeSettings() QVariant var; var.setValue( m_aRecentFileStreamInfo ); - appSettings.setValue("MainWindow/RecentFileList", var ); + appSettings.setValue( "MainWindow/RecentFileList", var ); m_appModuleVideo->writeSettings(); + m_appModuleQuality->writeSettings(); + m_appModuleExtensions->writeSettings(); } } // NAMESPACE diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 3190271..9354cac 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -64,6 +64,8 @@ protected: private Q_SLOTS: + void about(); + /** * File functions slots */ @@ -90,18 +92,18 @@ private Q_SLOTS: void setTool( int idxTool ); + void dragEnterEvent( QDragEnterEvent *event ); + void dropEvent( QDropEvent *event ); + + void tileSubWindows(); + void setActiveSubWindow( QWidget *window ); + + void update(); void updateWindowMenu(); void updateZoomFactorSBox(); void updateStatusBar( const QString& ); - void about(); - - void dragEnterEvent( QDragEnterEvent *event ); - void dropEvent( QDropEvent *event ); - - void setActiveSubWindow( QWidget *window ); - private: class PlaYUVerMdiArea: public QMdiArea @@ -141,6 +143,13 @@ private: QString m_cLastOpenPath; + SubWindowHandle *activeSubWindow(); + template + T findSubWindow( const QMdiArea* mdiArea, const QString& name ); + template + T findSubWindow( const QMdiArea* mdiArea, const T subWindow ); + static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName ); + Void updateMenus(); Void createActions(); @@ -155,14 +164,6 @@ private: Void readSettings(); Void writeSettings(); - SubWindowHandle *activeSubWindow(); - - template - T findSubWindow( const QMdiArea* mdiArea, const QString& name ); - template - T findSubWindow( const QMdiArea* mdiArea, const T subWindow ); - - static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName ); QDoubleSpinBox *m_pcZoomFactorSBox;