Add a new struct to include the stream info and save it in qsettings

This commit is contained in:
jfmcarreira committed 2014-07-06 03:18:31 +01:00
1 parent 4307d1a24c
commit bfa649d5e6
7 files changed
+70 -8

No files matched your search

+13
View File
@@ -103,6 +103,19 @@ Void PlaYUVerSettings::setPlayingSettings( Bool repeat, Bool lock )
m_settings.setValue( "Playing/VideoLock", lock );
}
Void PlaYUVerSettings::setRecentFileList( PlaYUVerRecentFileListInfo recentFileList )
{
QVariant var;
var.setValue<PlaYUVerRecentFileListInfo>( recentFileList );
m_settings.setValue("MainWindow/RecentFileList", var );
}
PlaYUVerRecentFileListInfo PlaYUVerSettings::getRecentFileList()
{
QVariant value = m_settings.value("MainWindow/RecentFileList");
return value.value<PlaYUVerRecentFileListInfo>();
}
// - - - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - - - -
GridManager::Style PlaYUVerSettings::gridStyle()
+5
View File
@@ -29,6 +29,7 @@
#include "PlaYUVerDefs.h"
#include <QtCore>
#include "GridManager.h"
#include "SubWindowHandle.h"
namespace plaYUVer
{
@@ -59,6 +60,10 @@ public:
Void setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement );
Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement );
// - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - -
Void setRecentFileList( PlaYUVerRecentFileListInfo );
PlaYUVerRecentFileListInfo getRecentFileList();
// - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - -
GridManager::Style gridStyle();
Void setGridStyle( GridManager::Style v );
+7 -3
View File
@@ -75,7 +75,7 @@ SubWindowHandle::~SubWindowHandle()
Void SubWindowHandle::reloadFile()
{
Int currFrameNum = m_pCurrStream->getCurrFrameNum();
loadFile( m_cCurrFileName, false );
loadFile( m_sStreamInfo.m_cFilename, false );
seekAbsoluteEvent( currFrameNum );
}
@@ -112,7 +112,11 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
refreshFrame();
m_cCurrFileName = cFilename;
m_sStreamInfo.m_cFilename = cFilename;
m_sStreamInfo.m_cResolution = QSize( Width, Height);
m_sStreamInfo.m_iPelFormat = InputFormat;
m_sStreamInfo.m_uiFrameRate = FrameRate;
m_cWindowName = m_pCurrStream->getStreamInformationString();
setWindowTitle( m_cWindowName );
return true;
@@ -233,7 +237,7 @@ Int SubWindowHandle::playEvent()
m_pCurrStream->readFrame();
if( m_pCurrStream->checkErrors( PlaYUVerStream::READING ) )
{
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cCurrFileName ) );
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_sStreamInfo.m_cFilename ) );
return -3;
}
return 0;
+23 -2
View File
@@ -38,8 +38,21 @@
namespace plaYUVer
{
class SubWindowHandle;
struct structPlaYUVERStreamInfo
{
QString m_cFilename;
QSize m_cResolution;
Int m_iPelFormat;
UInt m_uiFrameRate;
};
//typedef QVector<PlaYUVERStreamInfo> PlaYUVerRecentFileListInfo;
typedef struct structPlaYUVERStreamInfo PlaYUVerRecentFileListInfo;
typedef struct structPlaYUVERStreamInfo PlaYUVerStreamInfo;
class SubWindowHandle: public QMdiSubWindow
{
Q_OBJECT
@@ -49,6 +62,8 @@ private:
QScrollArea* m_cScrollArea;
ViewArea* m_cViewArea;
PlaYUVerStreamInfo m_sStreamInfo;
PlaYUVerStream* m_pCurrStream;
PlaYUVerFrame* m_pcCurrFrame;
@@ -57,7 +72,6 @@ private:
SubWindowHandle* m_pcReferenceSubWindow;
QString m_cWindowName;
QString m_cCurrFileName;
Bool m_bIsPlaying;
Bool m_bIsModule;
@@ -91,6 +105,11 @@ public:
Void refreshFrame();
Void setCurrFrame( PlaYUVerFrame* pcCurrFrame );
PlaYUVerStreamInfo getStreamInfo()
{
return m_sStreamInfo;
}
PlaYUVerStream* getInputStream()
{
return m_pCurrStream;
@@ -191,7 +210,7 @@ public:
QString currentFile()
{
return m_cCurrFileName;
return m_sStreamInfo.m_cFilename;
}
Bool getIsModule()
@@ -210,4 +229,6 @@ public Q_SLOTS:
} // NAMESPACE
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerRecentFileListInfo);
#endif // __SUBWINDOWHANDLE_H__
+4
View File
@@ -24,6 +24,7 @@
#include <QApplication>
#include "plaYUVerApp.h"
#include "SubWindowHandle.h"
#ifdef USE_FERVOR
#include "fvupdater.h"
#endif
@@ -36,6 +37,9 @@ int main( int argc, char *argv[] )
QApplication::setApplicationVersion("PLAYUVER_VERSION");
QApplication::setOrganizationName("pixlra");
QApplication::setOrganizationDomain("playuver.pixlra");
qRegisterMetaType<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
plaYUVerApp w;
w.show();
w.parseArgs( argc, argv );
+7 -2
View File
@@ -23,7 +23,6 @@
*/
#include "plaYUVerApp.h"
#include "SubWindowHandle.h"
#include "PlaYUVerStream.h"
#include "DialogSubWindowSelector.h"
#ifdef USE_FERVOR
@@ -176,6 +175,8 @@ Void plaYUVerApp::loadFile( QString fileName )
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
updateZoomFactorSBox();
//m_aRecentFileStreamInfo.append( interfaceChild->getStreamInfo() );
m_aRecentFileStreamInfo = interfaceChild->getStreamInfo();
statusBar()->showMessage( tr( "File loaded" ), 2000 );
}
else
@@ -658,7 +659,7 @@ Void plaYUVerApp::lockButtonEvent()
if( m_acPlayingSubWindows.contains( m_pcCurrentSubWindow ) )
{
m_acPlayingSubWindows.clear();
m_acPlayingSubWindows.append(m_pcCurrentSubWindow);
m_acPlayingSubWindows.append( m_pcCurrentSubWindow );
}
else
{
@@ -1372,6 +1373,9 @@ Void plaYUVerApp::readSettings()
setAllSubWindowTool();
m_arrayActions[VIDEO_LOOP_ACT]->setChecked( settings.getRepeat() );
m_arrayActions[VIDEO_LOCK_ACT]->setChecked( settings.getVideoLock() );
m_aRecentFileStreamInfo = settings.getRecentFileList();
Bool visibleStreamProp, visibleFrameProp, visibleQualityMeasure;
settings.getDockVisibility( visibleStreamProp, visibleFrameProp, visibleQualityMeasure );
if( !visibleStreamProp )
@@ -1390,6 +1394,7 @@ Void plaYUVerApp::writeSettings()
settings.setMainWindowSize( size() );
settings.setLastOpenPath( m_cLastOpenPath );
settings.setSelectedTool( ( Int )m_appTool );
settings.setRecentFileList( m_aRecentFileStreamInfo );
settings.setDockVisibility( m_pcStreamProperties->isVisible(), m_pcFrameProperties->isVisible(), m_pcQualityMeasurement->isVisible() );
settings.setPlayingSettings( m_arrayActions[VIDEO_LOOP_ACT]->isChecked(), m_arrayActions[VIDEO_LOCK_ACT]->isChecked() );
}
+11 -1
View File
@@ -33,6 +33,7 @@
#include <QtGui>
#endif
#include <QMainWindow>
#include "SubWindowHandle.h"
#include "ModulesHandle.h"
#include "PropertiesSidebar.h"
#include "QualityMeasurementSidebar.h"
@@ -40,7 +41,6 @@
namespace plaYUVer
{
class SubWindowHandle;
class PlaYUVerStream;
class plaYUVerApp: public QMainWindow
@@ -51,6 +51,11 @@ public:
plaYUVerApp();
Void parseArgs( Int argc, Char *argv[] );
enum RecentFileList
{
MAXRECENTFILES,
};
protected:
Void closeEvent( QCloseEvent *event );
@@ -125,6 +130,9 @@ private:
Void loadFile( QString fileName );
Void readRecentFileList();
Void writeRecentFileList();
Void zoomToFitAll();
//! Playing functions
@@ -249,6 +257,8 @@ private:
QAction *actionSelectionTool;
enum eTool m_appTool;
PlaYUVerRecentFileListInfo m_aRecentFileStreamInfo;
};
} // NAMESPACE