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 );
|
||||
|
||||
// - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - -
|
||||
Void setRecentFileList( PlaYUVerRecentFileListInfo );
|
||||
Void setRecentFileList( PlaYUVerRecentFileListInfo recentFileList );
|
||||
PlaYUVerRecentFileListInfo getRecentFileList();
|
||||
|
||||
// - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -29,6 +29,41 @@
|
||||
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 ) :
|
||||
QMdiSubWindow( parent ),
|
||||
m_pCurrStream( NULL ),
|
||||
@@ -113,7 +148,7 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
|
||||
refreshFrame();
|
||||
|
||||
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_uiFrameRate = FrameRate;
|
||||
|
||||
|
||||
@@ -49,10 +49,14 @@ struct structPlaYUVERStreamInfo
|
||||
UInt m_uiFrameRate;
|
||||
};
|
||||
|
||||
//typedef QVector<PlaYUVERStreamInfo> PlaYUVerRecentFileListInfo;
|
||||
typedef struct structPlaYUVERStreamInfo PlaYUVerRecentFileListInfo;
|
||||
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);
|
||||
|
||||
|
||||
class SubWindowHandle: public QMdiSubWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -230,6 +234,9 @@ public Q_SLOTS:
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
|
||||
|
||||
Q_DECLARE_METATYPE(plaYUVer::PlaYUVerRecentFileListInfo);
|
||||
//Q_DECLARE_METATYPE(plaYUVer::structPlaYUVERStreamInfo)
|
||||
|
||||
#endif // __SUBWINDOWHANDLE_H__
|
||||
@@ -44,6 +44,7 @@ int main( int argc, char *argv[] )
|
||||
QApplication::setOrganizationDomain("playuver.pixlra");
|
||||
|
||||
qRegisterMetaType<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
|
||||
qRegisterMetaTypeStreamOperators<PlaYUVerRecentFileListInfo>("PlaYUVerRecentFileListInfo");
|
||||
|
||||
plaYUVerApp w;
|
||||
w.show();
|
||||
|
||||
@@ -179,8 +179,6 @@ 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
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
enum RecentFileList
|
||||
{
|
||||
MAXRECENTFILES,
|
||||
MAXRECENTFILES = 2,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user