]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Support of 64-bit platforms
authorsln <sln@opencascade.com>
Wed, 22 Aug 2012 11:53:54 +0000 (11:53 +0000)
committersln <sln@opencascade.com>
Wed, 22 Aug 2012 11:53:54 +0000 (11:53 +0000)
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Driver.cxx
src/LightApp/LightApp_Driver.h
src/SUIT/SUIT_Session.cxx

index dce1076b2f82e59b64a2a624d0e84bbe82ddedb2..02c07a4ee3b9337bda03cd15590950bc14cbe709 100644 (file)
@@ -1846,7 +1846,9 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   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;
index eb42e2d33b5b512f51a809dbfd3a585e2c1cacad..15bf1452162f93f43283f23fcf7c49a8d69d15a5 100644 (file)
@@ -509,8 +509,8 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
   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;
@@ -544,7 +544,7 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
 
   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;
 
@@ -609,7 +609,7 @@ bool LightApp_Driver::PutFilesToFirstStream( const std::string& theModuleName, u
       {
         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 );
@@ -666,7 +666,7 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
 
   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++ ) 
   {
@@ -713,7 +713,7 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
     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);
@@ -724,8 +724,8 @@ bool LightApp_Driver::PutFilesToNextStream( const std::string& theModuleName, un
     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 );
@@ -792,8 +792,8 @@ void LightApp_Driver::PutFirstStreamToFiles( ListOfFiles& theListOfFiles,
 
   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;
@@ -840,7 +840,7 @@ void LightApp_Driver::PutFirstStreamToFiles( ListOfFiles& theListOfFiles,
       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;
@@ -922,8 +922,8 @@ void LightApp_Driver::PutNextStreamToFiles( ListOfFiles& theListOfFiles,
     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;
index 25d4842bed7ea983a1f6d099cd751f057b59a285..1ef96c4e82097d349418bdec1a1ef07178bbef47 100644 (file)
@@ -31,6 +31,8 @@
 #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*/
@@ -76,7 +78,7 @@ protected:
   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);
@@ -103,26 +105,26 @@ private:
   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;
   }
index 9ab60b1ab43a5e4126512facad90f121c612b481..f263bf13ba8ad3ef8a4bb446f6ee5b490a14e45e 100755 (executable)
@@ -433,9 +433,6 @@ QString SUIT_Session::getBackupFolder() const
   if ( var )
     aRes = var;
 
-  if ( aRes.isEmpty() || !QFileInfo( aRes ).exists() )
-    aRes = QDir::tempPath();
-
   return aRes;
 }
 
@@ -530,6 +527,10 @@ void SUIT_Session::createBackupTimer()
   if ( !app )
     return;
 
+  QString backupFolder = getBackupFolder();
+  if ( backupFolder.isEmpty() )
+    return;
+
   myBTimer = new QTimer( this );
   connect( myBTimer, SIGNAL( timeout() ), this, SLOT( onBTimer() ) );
 
@@ -537,7 +538,7 @@ void SUIT_Session::createBackupTimer()
   if ( mSec > 0  )
     myBTimer->start( mSec );
 
-  QString pref = QDir::convertSeparators( getBackupFolder() + "/" + getBackupPrefix() );
+  QString pref = QDir::convertSeparators( backupFolder + "/" + getBackupPrefix() );
   myBFolder = pref;
   int i = 0;
   do
@@ -637,9 +638,13 @@ void SUIT_Session::restoreBackup()
 {
   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 );