Improve saving of custom struct in QSettings
This commit is contained in:
1 parent
e9b5630ca3
commit
b9b2df9b7e
6 files changed
+48
-7
No files matched your search
@@ -61,7 +61,7 @@ public:
|
|||||||
Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement );
|
Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement );
|
||||||
|
|
||||||
// - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - -
|
// - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - -
|
||||||
Void setRecentFileList( PlaYUVerRecentFileListInfo );
|
Void setRecentFileList( PlaYUVerRecentFileListInfo recentFileList );
|
||||||
PlaYUVerRecentFileListInfo getRecentFileList();
|
PlaYUVerRecentFileListInfo getRecentFileList();
|
||||||
|
|
||||||
// - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - -
|
||||||
|
|||||||
@@ -29,6 +29,41 @@
|
|||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QDataStream& operator<<( QDataStream& out, const plaYUVer::PlaYUVerRecentFileListInfo& array )
|
||||||
|
{
|
||||||
|
PlaYUVerStreamInfo d;
|
||||||
|
out << array.size();
|
||||||
|
for( Int i = 0; i < array.size(); i++ )
|
||||||
|
{
|
||||||
|
d = array.at( i );
|
||||||
|
out << d.m_cFilename << d.m_cResolution.width()
|
||||||
|
<< d.m_cResolution.height()
|
||||||
|
<< d.m_iPelFormat
|
||||||
|
<< d.m_uiFrameRate;
|
||||||
|
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream& operator>>( QDataStream& in, plaYUVer::PlaYUVerRecentFileListInfo& array )
|
||||||
|
{
|
||||||
|
PlaYUVerStreamInfo d;
|
||||||
|
Int array_size;
|
||||||
|
in >> array_size;
|
||||||
|
for( Int i = 0; i < array_size; i++ )
|
||||||
|
{
|
||||||
|
in >> d.m_cFilename;
|
||||||
|
Int x, y;
|
||||||
|
in >> x;
|
||||||
|
in >> y;
|
||||||
|
in >> d.m_iPelFormat;
|
||||||
|
in >> d.m_uiFrameRate;
|
||||||
|
d.m_cResolution = QSize( x, y );
|
||||||
|
array.append( d );
|
||||||
|
}
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
|
SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
|
||||||
QMdiSubWindow( parent ),
|
QMdiSubWindow( parent ),
|
||||||
m_pCurrStream( NULL ),
|
m_pCurrStream( NULL ),
|
||||||
@@ -113,7 +148,7 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
|||||||
refreshFrame();
|
refreshFrame();
|
||||||
|
|
||||||
m_sStreamInfo.m_cFilename = cFilename;
|
m_sStreamInfo.m_cFilename = cFilename;
|
||||||
m_sStreamInfo.m_cResolution = QSize( Width, Height);
|
m_sStreamInfo.m_cResolution = QSize( Width, Height );
|
||||||
m_sStreamInfo.m_iPelFormat = InputFormat;
|
m_sStreamInfo.m_iPelFormat = InputFormat;
|
||||||
m_sStreamInfo.m_uiFrameRate = FrameRate;
|
m_sStreamInfo.m_uiFrameRate = FrameRate;
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,14 @@ struct structPlaYUVERStreamInfo
|
|||||||
UInt m_uiFrameRate;
|
UInt m_uiFrameRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
//typedef QVector<PlaYUVERStreamInfo> PlaYUVerRecentFileListInfo;
|
typedef QVector<structPlaYUVERStreamInfo> PlaYUVerRecentFileListInfo;
|
||||||
typedef struct structPlaYUVERStreamInfo PlaYUVerRecentFileListInfo;
|
//typedef structPlaYUVERStreamInfo PlaYUVerRecentFileListInfo;
|
||||||
typedef struct structPlaYUVERStreamInfo PlaYUVerStreamInfo;
|
typedef struct structPlaYUVERStreamInfo PlaYUVerStreamInfo;
|
||||||
|
|
||||||
|
QDataStream& operator<<(QDataStream& out, const plaYUVer::PlaYUVerRecentFileListInfo& d);
|
||||||
|
QDataStream& operator>>(QDataStream& in, plaYUVer::PlaYUVerRecentFileListInfo& d);
|
||||||
|
|
||||||
|
|
||||||
class SubWindowHandle: public QMdiSubWindow
|
class SubWindowHandle: public QMdiSubWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -230,6 +234,9 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
} // NAMESPACE
|
} // NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerRecentFileListInfo);
|
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerRecentFileListInfo);
|
||||||
|
//Q_DECLARE_METATYPE(plaYUVer::structPlaYUVERStreamInfo)
|
||||||
|
|
||||||
#endif // __SUBWINDOWHANDLE_H__
|
#endif // __SUBWINDOWHANDLE_H__
|
||||||
@@ -44,6 +44,7 @@ int main( int argc, char *argv[] )
|
|||||||
QApplication::setOrganizationDomain("playuver.pixlra");
|
QApplication::setOrganizationDomain("playuver.pixlra");
|
||||||
|
|
||||||
qRegisterMetaType<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
|
qRegisterMetaType<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
|
||||||
|
qRegisterMetaTypeStreamOperators<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
|
||||||
|
|
||||||
plaYUVerApp w;
|
plaYUVerApp w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|||||||
@@ -179,8 +179,6 @@ Void plaYUVerApp::loadFile( QString fileName )
|
|||||||
interfaceChild->zoomToFit();
|
interfaceChild->zoomToFit();
|
||||||
interfaceChild->getViewArea()->setTool( m_appTool );
|
interfaceChild->getViewArea()->setTool( m_appTool );
|
||||||
updateZoomFactorSBox();
|
updateZoomFactorSBox();
|
||||||
//m_aRecentFileStreamInfo.append( interfaceChild->getStreamInfo() );
|
|
||||||
m_aRecentFileStreamInfo = interfaceChild->getStreamInfo();
|
|
||||||
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
enum RecentFileList
|
enum RecentFileList
|
||||||
{
|
{
|
||||||
MAXRECENTFILES,
|
MAXRECENTFILES = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in new issue
Block a user