return res;
}
+bool LightApp_Study::openEmptyDocument( )
+{
+ setRoot( new LightApp_RootObject( this ) ); // create myRoot
+
+ // update loaded data models: call open() and update() on them.
+ ModelList dm_s;
+ dataModels( dm_s );
+ QListIterator<CAM_DataModel*> it( dm_s );
+ while ( it.hasNext() )
+ openDataModel( studyName(), it.next() );
+ // this will build a SUIT_DataObject-s tree under myRoot member field
+ // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step
+ // but tree that corresponds to not-loaded data models will be updated any way.
+ ((LightApp_Application*)application())->updateObjectBrowser( false );
+
+ emit opened( this );
+ return true;
+}
+
/*!
Loads document
*/
virtual bool createDocument( const QString& );
virtual bool openDocument( const QString& );
+ virtual bool openEmptyDocument();
virtual bool loadDocument( const QString& );
virtual bool saveDocument();
return status;
}
+bool SUIT_Application::useDatFile()
+{
+ createEmptyStudy();
+ SUIT_Study* study = activeStudy();
+
+ return study->openEmptyDocument();
+}
+
+
/*!
Creates new empty Study if active Study = 0
*/
//! Opens document <theFileName> into active Study. If Study is empty - creates it.
virtual bool useFile( const QString& theFileName);
+ virtual bool useDatFile( );
//! Creates new empty Study if active Study = 0
virtual void createEmptyStudy();
}
// Prepare Resource Manager for the new application if it doesn't exist yet
+ bool firstRun = false;
if ( !myResMgr )
{
myResMgr = createResourceMgr( appName );
myResMgr->loadLanguage();
+ firstRun = true;
}
//jfa 22.06.2005:SUIT_Application* app = crtInst( args, argv );
if ( !myBTimer )
{
- QString anHDFName;
- QStringList anArgs = QCoreApplication::arguments();
- QStringList::const_iterator anArgsIt = anArgs.constBegin();
- for ( ; anArgsIt != anArgs.constEnd(); anArgsIt++ )
+ QString anHDFName, aDatName;
+ if (firstRun)
{
- QString anArg = *anArgsIt;
- QFileInfo aFileInfo( anArg );
- if ( aFileInfo.exists() && aFileInfo.suffix().toLower() == "hdf" )
+ QStringList anArgs = QCoreApplication::arguments();
+ QStringList::const_iterator anArgsIt = anArgs.constBegin();
+ for ( ; anArgsIt != anArgs.constEnd(); anArgsIt++ )
{
- anHDFName = anArg;
- break;
+ QString anArg = *anArgsIt;
+ QFileInfo aFileInfo( anArg );
+ if ( aFileInfo.exists() && aFileInfo.suffix().toLower() == "hdf" )
+ {
+ anHDFName = anArg;
+ break;
+ }
+ else if ( aFileInfo.exists() && aFileInfo.suffix().toLower() == "dat" )
+ {
+ aDatName = anArg;
+ break;
+ }
}
}
for ( ; aFoldersIt != aFolders.constEnd(); ++aFoldersIt )
Qtx::rmDir( (*aFoldersIt).absoluteFilePath() );
}
+ else if ( !aDatName.isEmpty() && app )
+ {
+ app->useDatFile();
+ }
else
{
//Try to restore backup
return true;
}
+bool SUIT_Study::openEmptyDocument( )
+{
+ myName = "";
+ myIsSaved = true;
+ myIsModified = false;
+
+ return true;
+}
+
/*!
* Save document as \a fileName. Set file name.
*/
virtual void closeDocument( bool = true );
virtual bool openDocument( const QString& );
+ virtual bool openEmptyDocument( );
virtual bool createDocument( const QString& );
bool saveDocument();