Skip to content

Commit

Permalink
Moved SPIERSedit output SPV file version to a define and renamed SPE …
Browse files Browse the repository at this point in the history
…version define
  • Loading branch information
alanspencer committed Oct 29, 2018
1 parent cea2ce2 commit 975d8c3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion SPIERSedit/src/copyingimpl2_ouput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ void CopyingImpl::ExportSPV_2(int flag) //0 for export, 1 for export and launch
out.setByteOrder(QDataStream::LittleEndian);

out << static_cast<double>(-1); //start with -1 - historical reasons
out << static_cast<int>(1000); //file version
out << static_cast<int>(SPVFILEVERSION); //file version
//- 5 was first QT one, 4 was last one from VB, 3 is last Mac one. 6 includes grid/flag support.
//Now - 1000+ are exports from edit only
out << PixPerMM / (static_cast<double>(XYDownsample * ColMonoScale));
Expand Down
10 changes: 5 additions & 5 deletions SPIERSedit/src/fileio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ void DumpSettings()
//Message("HERE");
//First header - standard text, v number, then SettingsFileName (might not be same as current filename - so store!)
qDebug() << QString("SPIERSedit settings file");
qDebug() << static_cast<int>(SPIERS_VERSION);
qDebug() << static_cast<int>(SPEFILEVERSION);
qDebug() << SettingsFileName;

//Do all the simple stuff first
Expand Down Expand Up @@ -2060,7 +2060,7 @@ void WriteSettings()

//First header - standard text, v number, then SettingsFileName (might not be same as current filename - so store!)
out << QString("SPIERSedit settings file");
out << static_cast<int>(SPIERS_VERSION);
out << static_cast<int>(SPEFILEVERSION);
out << SettingsFileName;

//Do all the simple stuff first
Expand Down Expand Up @@ -2154,7 +2154,7 @@ void WriteSettings()
out << o->Merge;
}

QByteArray b = AppMainWindow->saveState(SPIERS_VERSION);
QByteArray b = AppMainWindow->saveState(SPEFILEVERSION);
out << b;

out << MenuGenChecked;
Expand Down Expand Up @@ -2226,7 +2226,7 @@ void ReadSettings()

in >> version;

if (version > SPIERS_VERSION) Message("Warning - settings file " + SettingsFileName + " is too recent for this version of SPIERSedit. Will try to read anyway...");
if (version > SPEFILEVERSION) Message("Warning - settings file " + SettingsFileName + " is too recent for this version of SPIERSedit. Will try to read anyway...");

in >> dummy;
//qDebug()<<"Read"<<dummy;
Expand Down Expand Up @@ -2413,7 +2413,7 @@ void ReadSettings()

QByteArray b;
in >> b;
AppMainWindow->restoreState(b, SPIERS_VERSION);
AppMainWindow->restoreState(b, SPEFILEVERSION);

in >> MenuGenChecked;
in >> MenuMasksChecked;
Expand Down
5 changes: 3 additions & 2 deletions SPIERSedit/src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@

#include "mainwindowimpl.h"

// internal version for file purposes - take as SPIERSedit 2.this
#define SPIERS_VERSION 2
// Internal versions for input/output file purposes
#define SPEFILEVERSION 2
#define SPVFILEVERSION 1010

//Legal Stuff
#define COPYRIGHT "Copyright © 2018 Mark D. Sutton, Russell J. Garwood, Alan R.T.Spencer"
Expand Down
11 changes: 7 additions & 4 deletions SPIERSview/src/spvreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,13 @@ int SPVreader::ProcessSPV(QString filename, unsigned int index, float *PassedMat

version = 1; //default

// V1 SPV files lacked a versioning system...
// Work around is for first param to be negative in
// v2 and up. For V2 and up, next param is int version
// followed by real p1.
// v1 SPV files lacked a versioning system...
// ... so work around is for first param to be negative in v2 and up. For v2
// and up, next param is int version followed by real p1.
// Note 1: version numbers >= 1000 are reserved for SPIERSedit generated files
// that have not yet been resaved by SPIERSview
// Note 2: v5 was first QT one; v4 was last one from VB; v3 is last Mac one;
// v6 includes grid/flag support. (this note is out fo date)
if (p1 < 0)
{
fread(&version, sizeof(int), 1, file);
Expand Down

0 comments on commit 975d8c3

Please sign in to comment.