From bf2b2a31653f92c8e4687621ea78461ac1854fc6 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 13 Jan 2015 13:31:17 +0000 Subject: [PATCH 1/5] Merge master with devel with few fixes in settings handle --- app/Settings.cpp | 57 +----------------- app/Settings.h | 17 ------ app/plaYUVerApp.cpp | 142 +++++++++++++++++++++++++------------------- app/plaYUVerApp.h | 8 +-- 4 files changed, 85 insertions(+), 139 deletions(-) diff --git a/app/Settings.cpp b/app/Settings.cpp index 32d509f..5888106 100644 --- a/app/Settings.cpp +++ b/app/Settings.cpp @@ -27,64 +27,9 @@ namespace plaYUVer { -Settings::Settings() : - m_settings( "pixLRA", "plaYUVer" ) +Settings::Settings() { } -// - - - - - - - - - - - - Main Window Settings - - - - - - - - - - - - - - - - - -QPoint Settings::mainWindowPos() -{ - return m_settings.value( "MainWindow/pos", QPoint( 200, 200 ) ).toPoint(); -} - -Void Settings::setMainWindowPos( const QPoint & pos ) -{ - m_settings.setValue( "MainWindow/pos", pos ); -} - -QSize Settings::mainWindowSize() -{ - return m_settings.value( "MainWindow/size", QSize( 500, 400 ) ).toSize(); -} - -Void Settings::setMainWindowSize( const QSize & size ) -{ - m_settings.setValue( "MainWindow/size", size ); -} - -QString Settings::lastOpenPath() -{ - return m_settings.value( "MainWindow/lastOpenPath", QDir::homePath() ).toString(); -} - -Void Settings::setLastOpenPath( const QString & path ) -{ - m_settings.setValue( "MainWindow/lastOpenPath", path ); -} - -Int Settings::getSelectedTool() -{ - return m_settings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt(); -} - -Void Settings::setSelectedTool( Int tool ) -{ - m_settings.setValue( "MainWindow/SelectedTool", tool ); -} - -Void Settings::setRecentFileList( PlaYUVerStreamInfoVector recentFileList ) -{ - QVariant var; - var.setValue( recentFileList ); - m_settings.setValue("MainWindow/RecentFileList", var ); -} - -QVector Settings::getRecentFileList() -{ - QVariant value = m_settings.value("MainWindow/RecentFileList"); - return value.value(); -} // - - - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - - - - diff --git a/app/Settings.h b/app/Settings.h index 7bea562..8ea674f 100644 --- a/app/Settings.h +++ b/app/Settings.h @@ -40,23 +40,6 @@ class Settings public: Settings(); - // - - - - - - - - - - Main Window Settings - - - - - - - - - - - - - - QPoint mainWindowPos(); - Void setMainWindowPos( const QPoint &v ); - - QSize mainWindowSize(); - Void setMainWindowSize( const QSize &v ); - - QString lastOpenPath(); - Void setLastOpenPath( const QString &v ); - - Int getSelectedTool(); - Void setSelectedTool( Int); - - // - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - - - Void setRecentFileList( PlaYUVerStreamInfoVector recentFileList ); - PlaYUVerStreamInfoVector getRecentFileList(); - // - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - GridManager::Style gridStyle(); Void setGridStyle( GridManager::Style v ); diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 3e678d3..d03a536 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -29,7 +29,6 @@ #include "plaYUVerApp.h" #include "DialogSubWindowSelector.h" #include "WidgetFrameNumber.h" -#include "Settings.h" #define SYNCHRONISED_ZOON 1 @@ -202,14 +201,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo ) videoSubWindow->getViewArea()->setTool( m_appTool ); updateZoomFactorSBox(); - Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName ); - if( idx >= 0 ) - m_aRecentFileStreamInfo.remove( idx ); - PlaYUVerStreamInfo streamInfo = videoSubWindow->getStreamInfo(); - m_aRecentFileStreamInfo.prepend( streamInfo ); - while( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES ) - m_aRecentFileStreamInfo.remove( m_aRecentFileStreamInfo.size() - 1 ); - updateRecentFileActions(); + addStreamInfoToRecentList( videoSubWindow->getStreamInfo() ); statusBar()->showMessage( tr( "File loaded" ), 2000 ); m_cLastOpenPath = QFileInfo( fileName ).path(); @@ -253,8 +245,8 @@ Void plaYUVerApp::open() QStringList filter; filter << supported - << formatsList - << tr( "All Files (*)" ); + << formatsList + << tr( "All Files (*)" ); QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) ); @@ -300,8 +292,8 @@ Void plaYUVerApp::save() QStringList filter; filter << supported - << formatsList - << tr( "All Files (*)" ); + << formatsList + << tr( "All Files (*)" ); QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), QString(), filter.join( ";;" ) ); @@ -318,6 +310,8 @@ Void plaYUVerApp::save() } } + + Void plaYUVerApp::format() { if( m_pcCurrentVideoSubWindow ) @@ -325,7 +319,10 @@ Void plaYUVerApp::format() VideoSubWindow* pcVideoSubWindow = m_pcCurrentVideoSubWindow; try { - pcVideoSubWindow->loadFile( pcVideoSubWindow->getCurrentFileName(), true ); + if( pcVideoSubWindow->loadFile( pcVideoSubWindow->getCurrentFileName(), true ) ) + { + addStreamInfoToRecentList( pcVideoSubWindow->getStreamInfo() ); + } } catch( const char *msg ) { @@ -505,7 +502,7 @@ Void plaYUVerApp::updateStatusBar( const QString& statusBarString ) Void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event ) { -//setText(tr("")); + //setText(tr("")); mdiArea->setBackgroundRole( QPalette::Highlight ); event->acceptProposedAction(); } @@ -660,34 +657,13 @@ Void plaYUVerApp::updateWindowMenu() } } -Void plaYUVerApp::updateRecentFileActions() -{ - Int numRecentFiles = m_aRecentFileStreamInfo.size(); - numRecentFiles = qMin( numRecentFiles, MAX_RECENT_FILES ); - Int actionIdx = 0; - while( actionIdx < numRecentFiles ) - { - QString text = m_aRecentFileStreamInfo.at( actionIdx ).m_cFilename; - m_arrayRecentFilesActions.at( actionIdx )->setText( QFileInfo( text ).fileName() ); - m_arrayRecentFilesActions.at( actionIdx )->setToolTip( "Open File " + text ); - m_arrayRecentFilesActions.at( actionIdx )->setStatusTip( "Open File " + text ); - m_arrayRecentFilesActions.at( actionIdx )->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) ); - m_arrayRecentFilesActions.at( actionIdx )->setVisible( true ); - actionIdx++; - } - while( actionIdx < MAX_RECENT_FILES ) - { - m_arrayRecentFilesActions.at( actionIdx )->setVisible( false ); - actionIdx++; - } - m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false ); -} + Void plaYUVerApp::createActions() { m_arrayActions.resize( TOTAL_ACT ); -// ------------ File ------------ + // ------------ File ------------ m_arrayActions[OPEN_ACT] = new QAction( QIcon( ":/images/open.png" ), tr( "&Open" ), this ); m_arrayActions[OPEN_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogOpenButton ) ); m_arrayActions[OPEN_ACT]->setShortcuts( QKeySequence::Open ); @@ -744,7 +720,7 @@ Void plaYUVerApp::createActions() m_arrayActions[EXIT_ACT]->setStatusTip( tr( "Exit the application" ) ); connect( m_arrayActions[EXIT_ACT], SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ) ); -// ------------ View ------------ + // ------------ View ------------ mapperZoom = new QSignalMapper( this ); connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) ); @@ -773,7 +749,8 @@ 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() ) ); -// ------------ Tools ------------ + + // ------------ Tools ------------ actionGroupTools = new QActionGroup( this ); actionGroupTools->setExclusive( true ); @@ -800,7 +777,7 @@ Void plaYUVerApp::createActions() m_appModuleQuality->createActions(); m_appModuleExtensions->createActions(); -// ------------ Window ------------ + // ------------ Window ------------ m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this ); m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) ); @@ -827,7 +804,7 @@ Void plaYUVerApp::createActions() m_arrayActions[SEPARATOR_ACT] = new QAction( this ); m_arrayActions[SEPARATOR_ACT]->setSeparator( true ); -// ------------ About ------------ + // ------------ About ------------ #ifdef USE_FERVOR m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this ); @@ -878,8 +855,8 @@ Void plaYUVerApp::createMenus() m_arrayMenu[VIEW_MENU]->addSeparator(); -// createPopupMenu() Returns a popup menu containing checkable entries for -// the toolbars and dock widgets present in the main window. + // createPopupMenu() Returns a popup menu containing checkable entries for + // the toolbars and dock widgets present in the main window. m_arrayMenu[DOCK_VIEW_MENU] = createPopupMenu(); if( m_arrayMenu[DOCK_VIEW_MENU] ) { @@ -887,9 +864,9 @@ Void plaYUVerApp::createMenus() actionPopupMenu->setText( tr( "&Toolbars/Docks" ) ); } -// m_arrayMenu[TOOLS_MENU] = menuBar()->addMenu( tr( "Tools" ) ); -// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] ); -// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[SELECTION_TOOL_ACT] ); + // m_arrayMenu[TOOLS_MENU] = menuBar()->addMenu( tr( "Tools" ) ); + // m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] ); + // m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[SELECTION_TOOL_ACT] ); QMenu* VideoMenu = m_appModuleVideo->createMenu(); menuBar()->addMenu( VideoMenu ); @@ -951,9 +928,8 @@ Void plaYUVerApp::createToolBars() Void plaYUVerApp::createDockWidgets() { -// Properties Dock Window + // Properties Dock Window m_arraySideBars.resize( TOTAL_DOCK ); - addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() ); addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() ); } @@ -964,32 +940,74 @@ Void plaYUVerApp::createStatusBar() statusBar()->showMessage( tr( "Ready" ) ); } + +Void plaYUVerApp::addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo ) +{ + Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename ); + if( idx >= 0 ) + m_aRecentFileStreamInfo.remove( idx ); + m_aRecentFileStreamInfo.prepend( streamInfo ); + while( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES ) + m_aRecentFileStreamInfo.remove( m_aRecentFileStreamInfo.size() - 1 ); + updateRecentFileActions(); +} + +Void plaYUVerApp::updateRecentFileActions() +{ + Int numRecentFiles = m_aRecentFileStreamInfo.size(); + numRecentFiles = qMin( numRecentFiles, MAX_RECENT_FILES ); + Int actionIdx = 0; + while( actionIdx < numRecentFiles ) + { + QString text = m_aRecentFileStreamInfo.at( actionIdx ).m_cFilename; + m_arrayRecentFilesActions.at( actionIdx )->setText( QFileInfo( text ).fileName() ); + m_arrayRecentFilesActions.at( actionIdx )->setToolTip( "Open File " + text ); + m_arrayRecentFilesActions.at( actionIdx )->setStatusTip( "Open File " + text ); + m_arrayRecentFilesActions.at( actionIdx )->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) ); + m_arrayRecentFilesActions.at( actionIdx )->setVisible( true ); + actionIdx++; + } + while( actionIdx < MAX_RECENT_FILES ) + { + m_arrayRecentFilesActions.at( actionIdx )->setVisible( false ); + actionIdx++; + } + m_arrayMenu[RECENT_MENU]->setEnabled( m_aRecentFileStreamInfo.size() > 0 ? true : false ); +} + Void plaYUVerApp::readSettings() { - Settings settings; - QPoint pos = settings.mainWindowPos(); - QSize size = settings.mainWindowSize(); + QSettings appSettings; + + QPoint pos = appSettings.value( "MainWindow/Position", QPoint( 200, 200 ) ).toPoint(); + QSize size = appSettings.value( "MainWindow/Size", QSize( 500, 400 ) ).toSize(); move( pos ); resize( size ); - m_cLastOpenPath = settings.lastOpenPath(); - m_appTool = ( ViewArea::eTool )settings.getSelectedTool(); + + m_cLastOpenPath = appSettings.value( "MainWindow/LastOpenPath", QDir::homePath() ).toString(); + + m_appTool = ( ViewArea::eTool )appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt(); setTool( m_appTool ); - m_aRecentFileStreamInfo = settings.getRecentFileList(); + QVariant value = appSettings.value("MainWindow/RecentFileList"); + m_aRecentFileStreamInfo = value.value(); updateRecentFileActions(); m_appModuleVideo->readSettings(); - } Void plaYUVerApp::writeSettings() { - Settings settings; - settings.setMainWindowPos( pos() ); - settings.setMainWindowSize( size() ); - settings.setLastOpenPath( m_cLastOpenPath ); - settings.setSelectedTool( ( Int )m_appTool ); - settings.setRecentFileList( m_aRecentFileStreamInfo ); + QSettings appSettings; + + appSettings.setValue( "MainWindow/Position", pos() ); + appSettings.setValue( "MainWindow/Size", size() ); + appSettings.setValue( "MainWindow/LastOpenPath", m_cLastOpenPath ); + appSettings.setValue( "MainWindow/SelectedTool", ( Int )m_appTool ); + + QVariant var; + var.setValue( m_aRecentFileStreamInfo ); + appSettings.setValue("MainWindow/RecentFileList", var ); m_appModuleVideo->writeSettings(); } diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 76b43db..5da5a66 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -141,14 +141,11 @@ private: QString m_cLastOpenPath; - Void readRecentFileList(); - Void writeRecentFileList(); - Void zoomToFitAll(); Void updateMenus(); - Void updateRecentFileActions(); + Void createActions(); Void createMenus(); @@ -156,6 +153,9 @@ private: Void createDockWidgets(); Void createStatusBar(); + Void addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo ); + Void updateRecentFileActions(); + Void readSettings(); Void writeSettings(); From d492870273d8901781318486a05d7788c7f14e7f Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 13 Jan 2015 13:37:08 +0000 Subject: [PATCH 2/5] Merge master with devel --- app/plaYUVerApp.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index d03a536..e3418b4 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -940,7 +940,6 @@ Void plaYUVerApp::createStatusBar() statusBar()->showMessage( tr( "Ready" ) ); } - Void plaYUVerApp::addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo ) { Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename ); From 3624c5477b1d62567e4b76c01b0a613f0b389cc6 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 13 Jan 2015 13:41:26 +0000 Subject: [PATCH 3/5] Merge master with devel --- app/plaYUVerApp.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index e3418b4..46abac2 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -749,7 +749,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() ) ); - // ------------ Tools ------------ actionGroupTools = new QActionGroup( this ); actionGroupTools->setExclusive( true ); @@ -930,8 +929,6 @@ Void plaYUVerApp::createDockWidgets() { // Properties Dock Window m_arraySideBars.resize( TOTAL_DOCK ); - addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() ); - addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() ); } Void plaYUVerApp::createStatusBar() From e23e6ac27415f60c553f72c13a59b01601b293f6 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 13 Jan 2015 13:51:59 +0000 Subject: [PATCH 4/5] Fix wrong merge --- app/plaYUVerApp.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 46abac2..de1b6c1 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -929,6 +929,8 @@ Void plaYUVerApp::createDockWidgets() { // Properties Dock Window m_arraySideBars.resize( TOTAL_DOCK ); + addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() ); + addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() ); } Void plaYUVerApp::createStatusBar() From d9403404dc9968f6830cc33f4092ec019f425131 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 13 Jan 2015 19:33:44 +0000 Subject: [PATCH 5/5] Add zoom to fit all --- app/plaYUVerApp.cpp | 7 +++++++ app/plaYUVerApp.h | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index de1b6c1..3865f0d 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -596,6 +596,7 @@ Void plaYUVerApp::updateMenus() m_arrayActions[ZOOM_OUT_ACT]->setEnabled( hasSubWindow ); m_arrayActions[ZOOM_NORMAL_ACT]->setEnabled( hasSubWindow ); m_arrayActions[ZOOM_FIT_ACT]->setEnabled( hasSubWindow ); + m_arrayActions[ZOOM_FIT_ALL_ACT]->setEnabled( hasSubWindow ); m_pcZoomFactorSBox->setEnabled( hasSubWindow ); m_arrayActions[NAVIGATION_TOOL_ACT]->setEnabled( hasSubWindow ); @@ -749,6 +750,11 @@ 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() ) ); + m_arrayActions[ZOOM_FIT_ALL_ACT] = new QAction( tr( "Zoom to Fit All" ), this ); + //m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) ); + m_arrayActions[ZOOM_FIT_ALL_ACT]->setStatusTip( tr( "Apply zoom to fit to all windows" ) ); + connect( m_arrayActions[ZOOM_FIT_ALL_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFitAll() ) ); + // ------------ Tools ------------ actionGroupTools = new QActionGroup( this ); actionGroupTools->setExclusive( true ); @@ -851,6 +857,7 @@ Void plaYUVerApp::createMenus() m_arrayMenu[VIEW_MENU]->addAction( m_arrayActions[ZOOM_OUT_ACT] ); m_arrayMenu[VIEW_MENU]->addAction( m_arrayActions[ZOOM_NORMAL_ACT] ); m_arrayMenu[VIEW_MENU]->addAction( m_arrayActions[ZOOM_FIT_ACT] ); + m_arrayMenu[VIEW_MENU]->addAction( m_arrayActions[ZOOM_FIT_ALL_ACT] ); m_arrayMenu[VIEW_MENU]->addSeparator(); diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 5da5a66..b02fa76 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -87,6 +87,7 @@ private Q_SLOTS: void setZoomFromSBox( double ratio ); void normalSize(); void zoomToFit(); + void zoomToFitAll(); void setTool( int idxTool ); @@ -141,12 +142,8 @@ private: QString m_cLastOpenPath; - Void zoomToFitAll(); - Void updateMenus(); - - Void createActions(); Void createMenus(); Void createToolBars(); @@ -252,8 +249,9 @@ private: EXIT_ACT, ZOOM_IN_ACT, ZOOM_OUT_ACT, - ZOOM_FIT_ACT, ZOOM_NORMAL_ACT, + ZOOM_FIT_ACT, + ZOOM_FIT_ALL_ACT, NAVIGATION_TOOL_ACT, SELECTION_TOOL_ACT, TILE_WINDOWS_ACT,