Support to save custom values. Add stream info struct in order to save relevant info about each sub window

This commit is contained in:
jfmcarreira committed 2014-10-04 14:40:40 +01:00
1 parent fdc4d8b923
commit 55c0e2b4c3
7 files changed
+82 -32

No files matched your search

+4 -4
View File
@@ -103,17 +103,17 @@ Void PlaYUVerSettings::setPlayingSettings( Bool repeat, Bool lock )
m_settings.setValue( "Playing/VideoLock", lock );
}
Void PlaYUVerSettings::setRecentFileList( PlaYUVerRecentFileListInfo recentFileList )
Void PlaYUVerSettings::setRecentFileList( PlaYUVerStreamInfoVector recentFileList )
{
QVariant var;
var.setValue<PlaYUVerRecentFileListInfo>( recentFileList );
var.setValue<PlaYUVerStreamInfoVector>( recentFileList );
m_settings.setValue("MainWindow/RecentFileList", var );
}
PlaYUVerRecentFileListInfo PlaYUVerSettings::getRecentFileList()
QVector<PlaYUVerStreamInfo> PlaYUVerSettings::getRecentFileList()
{
QVariant value = m_settings.value("MainWindow/RecentFileList");
return value.value<PlaYUVerRecentFileListInfo>();
return value.value<PlaYUVerStreamInfoVector>();
}
// - - - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - - - -
+2 -2
View File
@@ -61,8 +61,8 @@ public:
Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement );
// - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - -
Void setRecentFileList( PlaYUVerRecentFileListInfo recentFileList );
PlaYUVerRecentFileListInfo getRecentFileList();
Void setRecentFileList( PlaYUVerStreamInfoVector recentFileList );
PlaYUVerStreamInfoVector getRecentFileList();
// - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - -
GridManager::Style gridStyle();
+2 -2
View File
@@ -29,7 +29,7 @@
namespace plaYUVer
{
QDataStream& operator<<( QDataStream& out, const plaYUVer::PlaYUVerRecentFileListInfo& array )
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array )
{
PlaYUVerStreamInfo d;
out << array.size();
@@ -45,7 +45,7 @@ QDataStream& operator<<( QDataStream& out, const plaYUVer::PlaYUVerRecentFileLis
return out;
}
QDataStream& operator>>( QDataStream& in, plaYUVer::PlaYUVerRecentFileListInfo& array )
QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
{
PlaYUVerStreamInfo d;
Int array_size;
+8 -12
View File
@@ -41,20 +41,17 @@ namespace plaYUVer
class SubWindowHandle;
struct structPlaYUVERStreamInfo
typedef struct
{
QString m_cFilename;
QSize m_cResolution;
Int m_iPelFormat;
UInt m_uiFrameRate;
};
}PlaYUVerStreamInfo;
typedef QVector<PlaYUVerStreamInfo> PlaYUVerStreamInfoVector;
typedef QVector<structPlaYUVERStreamInfo> PlaYUVerRecentFileListInfo;
//typedef structPlaYUVERStreamInfo PlaYUVerRecentFileListInfo;
typedef struct structPlaYUVERStreamInfo PlaYUVerStreamInfo;
QDataStream& operator<<(QDataStream& out, const plaYUVer::PlaYUVerRecentFileListInfo& d);
QDataStream& operator>>(QDataStream& in, plaYUVer::PlaYUVerRecentFileListInfo& d);
QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d);
QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d);
class SubWindowHandle: public QMdiSubWindow
@@ -234,9 +231,8 @@ public Q_SLOTS:
} // NAMESPACE
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerRecentFileListInfo);
//Q_DECLARE_METATYPE(plaYUVer::structPlaYUVERStreamInfo)
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo);
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector);
#endif // __SUBWINDOWHANDLE_H__
+2 -2
View File
@@ -43,8 +43,8 @@ int main( int argc, char *argv[] )
QApplication::setOrganizationName("pixlra");
QApplication::setOrganizationDomain("playuver.pixlra");
qRegisterMetaType<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
qRegisterMetaTypeStreamOperators<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
qRegisterMetaType<PlaYUVerStreamInfoVector>("PlaYUVerStreamInfoVector");
qRegisterMetaTypeStreamOperators<PlaYUVerStreamInfoVector>("PlaYUVerStreamInfoVector");
plaYUVerApp w;
w.show();
+54 -3
View File
@@ -102,8 +102,8 @@ Void plaYUVerApp::parseArgs( Int argc, Char *argv[] )
Void plaYUVerApp::about()
{
if (!m_pcAboutDialog)
m_pcAboutDialog = new AboutDialog(this);
if( !m_pcAboutDialog )
m_pcAboutDialog = new AboutDialog( this );
m_pcAboutDialog->exec();
// QString about_message;
// about_message.append( "The <b>plaYUVer</b> is an open-source raw video player! " );
@@ -179,6 +179,12 @@ Void plaYUVerApp::loadFile( QString fileName )
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
updateZoomFactorSBox();
m_aRecentFileStreamInfo.prepend( interfaceChild->getStreamInfo() );
while ( m_aRecentFileStreamInfo.size() > MAX_RECENT_FILES )
m_aRecentFileStreamInfo.removeLast();
updateRecentFileActions();
statusBar()->showMessage( tr( "File loaded" ), 2000 );
}
else
@@ -226,11 +232,19 @@ Void plaYUVerApp::open()
}
}
Void plaYUVerApp::openRecent()
{
QAction *action = qobject_cast<QAction *>( sender() );
PlaYUVerStreamInfo recentFile = action->data().value<PlaYUVerStreamInfo>();
if( action )
loadFile( recentFile.m_cFilename );
}
Void plaYUVerApp::save()
{
if( m_pcCurrentSubWindow )
{
SubWindowHandle *saveWindow = m_pcCurrentSubWindow;
SubWindowHandle *saveWindow = m_pcCurrentSubWindow;
QString supported = tr( "Supported Files (" );
QStringList formatsList;
QStringList formatsExt = PlaYUVerStream::supportedSaveFormatsExt();
@@ -1049,6 +1063,28 @@ 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++;
}
}
Void plaYUVerApp::createActions()
{
m_arrayActions.resize( TOTAL_ACT );
@@ -1060,6 +1096,14 @@ Void plaYUVerApp::createActions()
m_arrayActions[OPEN_ACT]->setStatusTip( tr( "Open stream" ) );
connect( m_arrayActions[OPEN_ACT], SIGNAL( triggered() ), this, SLOT( open() ) );
m_arrayRecentFilesActions.resize( MAX_RECENT_FILES );
for( Int i = 0; i < MAX_RECENT_FILES; i++ )
{
m_arrayRecentFilesActions[i] = new QAction( this );
m_arrayRecentFilesActions[i]->setVisible( false );
connect( m_arrayRecentFilesActions[i], SIGNAL( triggered() ), this, SLOT( openRecent() ) );
}
m_arrayActions[SAVE_ACT] = new QAction( QIcon( ":/images/save.png" ), tr( "&Save Frame" ), this );
m_arrayActions[SAVE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogSaveButton ) );
m_arrayActions[SAVE_ACT]->setShortcuts( QKeySequence::SaveAs );
@@ -1254,6 +1298,12 @@ Void plaYUVerApp::createMenus()
m_arrayMenu[FILE_MENU] = menuBar()->addMenu( tr( "&File" ) );
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[OPEN_ACT] );
m_arrayMenu[RECENT_MENU] = m_arrayMenu[FILE_MENU]->addMenu( tr( "Open Recent" ) );
for( Int i = 0; i < MAX_RECENT_FILES; ++i )
{
m_arrayMenu[RECENT_MENU]->addAction( m_arrayRecentFilesActions[i] );
}
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[SAVE_ACT] );
m_arrayMenu[FILE_MENU]->addSeparator();
m_arrayMenu[FILE_MENU]->addAction( m_arrayActions[FORMAT_ACT] );
@@ -1415,6 +1465,7 @@ Void plaYUVerApp::readSettings()
m_arrayActions[VIDEO_LOCK_ACT]->setChecked( settings.getVideoLock() );
m_aRecentFileStreamInfo = settings.getRecentFileList();
updateRecentFileActions();
Bool visibleStreamProp, visibleFrameProp, visibleQualityMeasure;
settings.getDockVisibility( visibleStreamProp, visibleFrameProp, visibleQualityMeasure );
+10 -7
View File
@@ -52,11 +52,6 @@ public:
plaYUVerApp();
Void parseArgs( Int argc, Char *argv[] );
enum RecentFileList
{
MAXRECENTFILES = 2,
};
protected:
Void closeEvent( QCloseEvent *event );
@@ -66,6 +61,7 @@ private Q_SLOTS:
* File functions slots
*/
void open();
void openRecent();
void save();
void format();
void reload();
@@ -102,7 +98,7 @@ private Q_SLOTS:
void about();
void chageSubWindowSelection();
void updateWindowMenu();s
void updateWindowMenu();
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
@@ -177,6 +173,8 @@ private:
Void updateStreamProperties();
Void updateFrameProperties();
Void updateRecentFileActions();
Void createActions();
Void createMenus();
Void createToolBars();
@@ -213,6 +211,7 @@ private:
enum MAIN_APP_MENU_LIST
{
FILE_MENU = 0,
RECENT_MENU,
VIEW_MENU,
TOOLS_MENU,
VIDEO_MENU,
@@ -257,6 +256,7 @@ private:
enum APP_ACTION_LIST
{
OPEN_ACT = 0,
OPEN_RECENT_ACT,
SAVE_ACT,
FORMAT_ACT,
RELOAD_ACT,
@@ -290,6 +290,9 @@ private:
TOTAL_ACT,
};
QVector<QAction*> m_arrayActions;
#define MAX_RECENT_FILES 5
QVector<QAction*> m_arrayRecentFilesActions;
//QAction *actionPopupMenu;
// Tools Actions;
@@ -298,7 +301,7 @@ private:
QAction *actionSelectionTool;
enum eTool m_appTool;
PlaYUVerRecentFileListInfo m_aRecentFileStreamInfo;
PlaYUVerStreamInfoVector m_aRecentFileStreamInfo;
AboutDialog* m_pcAboutDialog;