pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" );
pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" );
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
- pref->addPreference( tr( "PREF_BACKUP" ), studyGroup, LightApp_Preferences::DblSpin, "Study", "backup_studies" );
+
+ if ( !SUIT_Session::session()->getBackupFolder().isEmpty() )
+ pref->addPreference( tr( "PREF_BACKUP" ), studyGroup, LightApp_Preferences::DblSpin, "Study", "backup_studies" );
int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
QString platform;
TCollection_AsciiString aTmpDir(const_cast<char*>(aFiles[0].c_str()));
int aNbFiles = 0;
- myFileNameSizes = new size_t[aLength];
- myFileSizes = new size_t[aLength];
+ myFileNameSizes = new t_size[aLength];
+ myFileSizes = new t_size[aLength];
//Determine the required size of the buffer
TCollection_AsciiString aFileName;
mySizeToBeWritten += 4; //4 bytes for a number of the files that will be written to the stream;
- size_t aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
+ t_size aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
theBuffer = new unsigned char[ aCurrSize ];
myCurrBuff = theBuffer;
{
myCurrIFile->seekg(0, ios::beg);
int aPos = myCurrIFile->tellg();
- size_t aSizeToRead = GetMaxBuffSize() - myCurrPos;
+ t_size aSizeToRead = GetMaxBuffSize() - myCurrPos;
if ( aSizeToRead > myFileSizes[myCurrFileIndex] - myCurrIFile->tellg() )
aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
TCollection_AsciiString aTmpDir(const_cast<char*>(aFiles[0].c_str()));
- size_t aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
+ t_size aCurrSize = mySizeToBeWritten <= GetMaxBuffSize() ? mySizeToBeWritten : GetMaxBuffSize();
for ( ; myCurrFileIndex < aLength; myCurrFileIndex++ )
{
if ( aCurrSize < GetMaxBuffSize() )
{
//myCurrIFile->seekg(0, ios::beg);
- size_t aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
+ t_size aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
myCurrIFile->close();
delete(myCurrIFile);
else // new code for big files
{
int aPos = myCurrIFile->tellg();
- size_t aFileSize = myFileSizes[myCurrFileIndex];
- size_t aSizeToRead = GetMaxBuffSize() - myCurrPos;
+ t_size aFileSize = myFileSizes[myCurrFileIndex];
+ t_size aSizeToRead = GetMaxBuffSize() - myCurrPos;
if ( aSizeToRead > myFileSizes[myCurrFileIndex] - myCurrIFile->tellg() )
aSizeToRead = myFileSizes[myCurrFileIndex] - myCurrIFile->tellg();
myCurrIFile->read((char *)(theBuffer + myCurrPos), aSizeToRead );
const int n = myNbFilles + 1;
theListOfFiles.resize( n );
- myFileSizes = new size_t[ n ];
- myFileNameSizes = new size_t[ n ];
+ myFileSizes = new t_size[ n ];
+ myFileNameSizes = new t_size[ n ];
theListOfFiles[ 0 ] = aDir;
myFileSizes[ 0 ] = 0;
myFileNameSizes[ 0 ] = 0;
else
{
// old code for big files
- size_t aSize = theBufferSize - myCurrPos;
+ t_size aSize = theBufferSize - myCurrPos;
myCurrOFile->write((char *)( theBuffer + myCurrPos ), aSize );
myFileSizes[ myCurrFileIndex ] -= aSize;
myCurrPos = 0;
else
{
// old code for big files
- size_t aFileSize = myFileSizes[ myCurrFileIndex ];
- size_t aSize = theBufferSize - myCurrPos;
+ t_size aFileSize = myFileSizes[ myCurrFileIndex ];
+ t_size aSize = theBufferSize - myCurrPos;
myCurrOFile->write((char *)( theBuffer + myCurrPos ), aSize );
myFileSizes[ myCurrFileIndex ] -= aSize;
myCurrPos = 0;
#pragma warning( disable:4251 )
#endif
+typedef unsigned int t_size;
+
class QString;
/*!Description : Driver can save to file and read from file list of files for light modules*/
void PutNextStreamToFiles( ListOfFiles& theListOfFiles, const unsigned char* theBuffer,
const long theBufferSize, bool theNamesOnly = false);
- inline static size_t GetMaxBuffSize();
+ inline static t_size GetMaxBuffSize();
std::string GetTmpDir();
std::string GetDirFromPath(const std::string& thePath);
int myCurrFileIndex;
// writing
- size_t myCurrPos;
+ t_size myCurrPos;
unsigned char* myCurrBuff;
ifstream* myCurrIFile;
- size_t mySizeToBeWritten;
- size_t* myFileSizes;
- size_t* myFileNameSizes;
+ t_size mySizeToBeWritten;
+ t_size* myFileSizes;
+ t_size* myFileNameSizes;
// reading
ofstream* myCurrOFile;
long myNbFilles;
};
-inline size_t LightApp_Driver::GetMaxBuffSize()
+inline t_size LightApp_Driver::GetMaxBuffSize()
{
- static size_t aValue = 0;
+ static t_size aValue = 0;
if ( !aValue )
{
char* aVar = getenv( "HDF_BUFFER_SIZE" );
if ( aVar )
- aValue = (size_t)atol( aVar );
+ aValue = (t_size)atol( aVar );
else
aValue = 50000000;
}
if ( var )
aRes = var;
- if ( aRes.isEmpty() || !QFileInfo( aRes ).exists() )
- aRes = QDir::tempPath();
-
return aRes;
}
if ( !app )
return;
+ QString backupFolder = getBackupFolder();
+ if ( backupFolder.isEmpty() )
+ return;
+
myBTimer = new QTimer( this );
connect( myBTimer, SIGNAL( timeout() ), this, SLOT( onBTimer() ) );
if ( mSec > 0 )
myBTimer->start( mSec );
- QString pref = QDir::convertSeparators( getBackupFolder() + "/" + getBackupPrefix() );
+ QString pref = QDir::convertSeparators( backupFolder + "/" + getBackupPrefix() );
myBFolder = pref;
int i = 0;
do
{
QString pref = getBackupPrefix();
+ QString bkpFold = getBackupFolder();
+ if ( bkpFold .isEmpty() )
+ return;
+
// checks whether temp folder contains old backups
- QDir bkpDir( getBackupFolder() );
-
+ QDir bkpDir( bkpFold );
+
QStringList filt;
filt.append( pref + "*" );
bkpDir.setNameFilters( filt );