return;
}
- if ( !isPossibleToClose() )
+ bool closePermanently;
+ if ( !isPossibleToClose( closePermanently ) )
{
e->ignore();
return;
/*!Close document, if it's possible.*/
void STD_Application::onCloseDoc( bool ask )
{
- if ( ask && !isPossibleToClose() )
+ bool closePermanently = true;
+
+ if ( ask && !isPossibleToClose( closePermanently ) )
return;
SUIT_Study* study = activeStudy();
beforeCloseDoc( study );
if ( study )
- study->closeDocument();
-// TODO: myClosePermanently move to SalomeApp
-// study->closeDocument( myClosePermanently );
+ study->closeDocument( closePermanently );
clearViewManagers();
/*!Check the application on closing.
* \retval true if possible, else false
*/
-bool STD_Application::isPossibleToClose()
+bool STD_Application::isPossibleToClose( bool& closePermanently )
{
-// TODO: myClosePermanently move to SalomeApp
-// myClosePermanently = true;
if ( activeStudy() )
{
activeStudy()->abortAllOperations();
if ( activeStudy()->isModified() )
{
QString sName = activeStudy()->studyName().trimmed();
- return closeAction( closeChoice( sName ) );
+ return closeAction( closeChoice( sName ), closePermanently );
}
}
return true;
return res;
}
-bool STD_Application::closeAction( const int choice )
+bool STD_Application::closeAction( const int choice, bool& closePermanently )
{
bool res = true;
switch( choice )
break;
case CloseDiscard:
break;
-/*
- case 3:
- myClosePermanently = false;
- break;
-*/
case CloseCancel:
default:
res = false;
virtual QString applicationName() const;
- virtual bool isPossibleToClose();
+ virtual bool isPossibleToClose( bool& );
virtual bool useFile( const QString& );
virtual void createEmptyStudy();
virtual void setActiveViewManager( SUIT_ViewManager* );
- virtual bool closeAction( const int );
+ virtual bool closeAction( const int, bool& );
virtual int closeChoice( const QString& );
private:
private:
bool myExitConfirm;
bool myEditEnabled;
-// bool myClosePermanently; TODO: Move into SalomeApp_Application
};
#if defined WIN32
msgid "STD_Application::INF_DOC_SAVING_FAILS"
msgstr "Can't save file \"%1\".\nPossible reason is permission denied or disc full.\nTry to use another file name."
-msgid "CLOSE_DLG_SAVE_CLOSE"
-msgstr "&Save&&Close"
-
-msgid "CLOSE_DLG_CLOSE"
-msgstr "C&lose w/o saving"
-
-msgid "CLOSE_DLG_UNLOAD"
-msgstr "&Unload"
-
msgid "TOT_DESK_FILE_LOAD"
msgstr "Load document"
msgid "MEN_DESK_FILE_LOAD"
msgstr "Conn&ect..."
-msgid "CLOSE_DLG_CAPTION"
-msgstr "Close active study"
-
-msgid "CLOSE_DLG_DESCRIPTION"
-msgstr "Do you want to close or only unload the study"
-
msgid "DLG_LOAD_STUDY_CAPTION"
msgstr "Load Study"
\return FALSE if application can not be closed (because of non saved data for example).
This method called by SUIT_Session whin closing of application was requested.
*/
-bool SUIT_Application::isPossibleToClose()
+bool SUIT_Application::isPossibleToClose( bool& closePermanently )
{
return true;
}
/*! Returns FALSE if application can not be closed (because of non saved data for example).
This method called by SUIT_Session whin closing of application was requested. */
- virtual bool isPossibleToClose();
+ virtual bool isPossibleToClose( bool& );
/*! Performs some finalization of life cycle of this application.
For instance, the application can force its documents(s) to close. */
for ( AppList::const_iterator it = apps.begin(); it != apps.end(); ++it )
{
SUIT_Application* app = *it;
- if ( mode == ASK && !app->isPossibleToClose() )
+ bool closePermanently;
+ if ( mode == ASK && !app->isPossibleToClose( closePermanently ) )
return;
else if ( mode == SAVE )
{
-I$(srcdir)/../LightApp -I$(srcdir)/../CAM -I$(srcdir)/../Qtx \
-I$(srcdir)/../SUIT -I$(srcdir)/../OBJECT -I$(srcdir)/../SVTK \
-I$(srcdir)/../STD -I$(srcdir)/../VTKViewer -I$(srcdir)/../ObjBrowser \
- -I$(srcdir)/../PythonConsole -I$(srcdir)/../TOOLSGUI \
+ -I$(srcdir)/../PyConsole -I$(srcdir)/../TOOLSGUI \
-I$(srcdir)/../PyInterp -I$(srcdir)/../Session -I$(top_builddir)/idl \
-I$(srcdir)/../Event \
-I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeApp_la_LDFLAGS=$(PYTHON_LIBS) $(QT_MT_LIBS)
libSalomeApp_la_LIBADD= $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSalomeDSClient \
- ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la ../ObjBrowser/libObjBrowser.la \
+ ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la \ #../ObjBrowser/libObjBrowser.la \
../Prs/libSalomePrs.la ../SPlot2d/libSPlot2d.la ../GLViewer/libGLViewer.la \
../OCCViewer/libOCCViewer.la ../VTKViewer/libVTKViewer.la ../OBJECT/libSalomeObject.la \
../SVTK/libSVTK.la ../SOCC/libSOCC.la ../PyInterp/libPyInterp.la \
- ../PythonConsole/libPythonConsole.la ../LogWindow/libLogWindow.la \
+ ../PyConsole/libPyConsole.la ../LogWindow/libLogWindow.la \
../LightApp/libLightApp.la ../TOOLSGUI/libToolsGUI.la $(CAS_KERNEL)
EXTRA_DIST+=SalomeApp_PyInterp.h
#include "SalomeApp_VisualState.h"
#include "SalomeApp_StudyPropertiesDlg.h"
+#include "SalomeApp_LoadStudiesDlg.h"
#include "LightApp_Application.h"
#include "LightApp_Preferences.h"
-#include "LightApp_WidgetContainer.h"
#include "LightApp_SelectionMgr.h"
#include "LightApp_NameDlg.h"
-#include "SalomeApp_LoadStudiesDlg.h"
+#include "CAM_Module.h"
#include <SUIT_Tools.h>
#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
#include <QtxMRUAction.h>
-#include <OB_Browser.h>
-#include <OB_ListItem.h>
+// temporary commented
+//#include <OB_Browser.h>
+//#include <OB_ListItem.h>
-#include <PythonConsole_PyConsole.h>
+#include <PyConsole_Console.h>
#include <SUIT_FileDlg.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
-#include <SUIT_ActionOperation.h>
#include <Utils_ORB_INIT.hxx>
#include <Utils_SINGLETON.hxx>
-#include <SALOME_ModuleCatalog_impl.hxx>
#include <SALOME_LifeCycleCORBA.hxx>
-#include <qaction.h>
-#include <qcombobox.h>
-#include <qlistbox.h>
-#include <qregexp.h>
-#include <qcheckbox.h>
-#include <qpushbutton.h>
-#include <qlabel.h>
+#include <QApplication>
+#include <QAction>
+#include <QRegExp>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QLabel>
+#include <QListWidget>
+#include <QGridLayout>
+#include <QMenu>
#include "SALOMEDSClient_ClientFactory.hxx"
-#include "SALOMEDSClient_IParameters.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
#include "ToolsGUI_CatalogGeneratorDlg.h"
#include "ToolsGUI_RegWidget.h"
-#include <SALOMEDSClient_ClientFactory.hxx>
-
#include <vector>
+
/*!Internal class that updates object browser item properties */
-class SalomeApp_Updater : public OB_Updater
+// temporary commented
+/*class SalomeApp_Updater : public OB_Updater
{
public:
SalomeApp_Updater() : OB_Updater(){};
// _PTR(AttributeOpened) aAttrOpen = anAttr;
// theItem->setOpen( aAttrOpen->IsOpened() );
//}
-}
+}*/
/*!Create new instance of SalomeApp_Application.*/
extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication()
for (int i = 1; i < qApp->argc(); i++) {
QRegExp rxs ("--study-hdf=(.+)");
- if ( rxs.search( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
+ if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
QString file = rxs.capturedTexts()[1];
QFileInfo fi ( file );
- QString extension = fi.extension( false ).lower();
+ QString extension = fi.suffix().toLower();
if ( extension == "hdf" && fi.exists() )
- hdffile = fi.absFilePath();
+ hdffile = fi.absoluteFilePath();
}
else {
QRegExp rxp ("--pyscript=(.+)");
- if ( rxp.search( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
- QStringList files = QStringList::split(",",rxp.capturedTexts()[1],false);
+ if ( rxp.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
+ QStringList files = rxp.capturedTexts()[1].split(",",QString::SkipEmptyParts);
pyfiles += files;
}
}
if ( !aStudy->GetProperties()->IsLocked() ) {
for (uint j = 0; j < pyfiles.count(); j++ ) {
QFileInfo fi ( pyfiles[j] );
- PythonConsole* pyConsole = pythonConsole();
+ PyConsole_Console* pyConsole = pythonConsole();
if ( pyConsole ) {
- QString extension = fi.extension( false ).lower();
+ QString extension = fi.suffix().toLower();
if ( extension == "py" && fi.exists() ) {
// execute python script
- QString command = QString( "execfile(\"%1\")" ).arg( fi.absFilePath() );
+ QString command = QString( "execfile(\"%1\")" ).arg( fi.absoluteFilePath() );
pyConsole->exec( command );
}
else {
//! Save GUI state
// "Save GUI State" command is moved to VISU module
- // createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIconSet(),
+ // createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
// tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
// 0, desk, false, this, SLOT( onSaveGUIState() ) );
//! Dump study
- createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
+ createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIcon(),
tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
- CTRL+Key_D, desk, false, this, SLOT( onDumpStudy() ) );
+ Qt::CTRL+Qt::Key_D, desk, false, this, SLOT( onDumpStudy() ) );
//! Load script
- createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIconSet(),
+ createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIcon(),
tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
- CTRL+Key_T, desk, false, this, SLOT( onLoadScript() ) );
+ Qt::CTRL+Qt::Key_T, desk, false, this, SLOT( onLoadScript() ) );
//! Properties
- createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIconSet(),
+ createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIcon(),
tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
- CTRL+Key_P, desk, false, this, SLOT( onProperties() ) );
+ Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onProperties() ) );
//! Catalog Generator
- createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIconSet(),
+ createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIcon(),
tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
- SHIFT+Key_G, desk, false, this, SLOT( onCatalogGen() ) );
+ Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
//! Registry Display
- createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIconSet(),
+ createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIcon(),
tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
- /*SHIFT+Key_D*/0, desk, false, this, SLOT( onRegDisplay() ) );
+ /*Qt::SHIFT+Qt::Key_D*/0, desk, false, this, SLOT( onRegDisplay() ) );
//SRN: BugID IPAL9021, add an action "Load"
createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ),
resourceMgr()->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ),
- CTRL+Key_L, desk, false, this, SLOT( onLoadDoc() ) );
+ Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) );
//SRN: BugID IPAL9021: End
// Look among opened studies
if (activeStudy()) { // at least one study is opened
SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> aAppList = aSession->applications();
- QPtrListIterator<SUIT_Application> it (aAppList);
+ QList<SUIT_Application*> aAppList = aSession->applications();
+ QListIterator<SUIT_Application*> it (aAppList);
SUIT_Application* aApp = 0;
// iterate on all applications
- for (; (aApp = it.current()) && !isAlreadyOpen; ++it) {
- if (aApp->activeStudy()->studyName() == aName) {
+ while ( it.hasNext() && !isAlreadyOpen ) {
+ aApp = it.next();
+
+ if (aApp && aApp->activeStudy()->studyName() == aName) {
isAlreadyOpen = true; // Already opened, ask user what to do
// The document ... is already open.
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
SUIT_MessageBox::No);
if (aAnswer == SUIT_MessageBox::Yes) {
- _PTR(Study) aStudy = studyMgr()->GetStudyByName(aName.latin1());
+ _PTR(Study) aStudy = studyMgr()->GetStudyByName(aName.toStdString());
if (aStudy)
studyMgr()->Close(aStudy);
} else {
std::vector<std::string> List = studyMgr()->GetOpenStudies();
SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> aAppList = aSession->applications();
+ QList<SUIT_Application*> aAppList = aSession->applications();
SUIT_Application* aApp = 0;
for (unsigned int ind = 0; ind < List.size(); ind++) {
studyname = List[ind].c_str();
//Add to list only unloaded studies
bool isAlreadyOpen = false;
- for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
+ QListIterator<SUIT_Application*> it( aAppList );
+ while ( it.hasNext() && !isAlreadyOpen )
{
- aApp = it.current();
+ aApp = it.next();
if(!aApp || !aApp->activeStudy()) continue;
if ( aApp->activeStudy()->studyName() == studyname ) isAlreadyOpen = true;
}
- if ( !isAlreadyOpen ) aDlg.ListComponent->insertItem( studyname );
+ if ( !isAlreadyOpen ) aDlg.ListComponent->addItem( studyname );
}
int retVal = aDlg.exec();
- studyname = aDlg.ListComponent->currentText();
+ studyname = aDlg.ListComponent->currentItem()->text();
if (retVal == QDialog::Rejected)
return;
}
}
+/*!Check the application on closing.
+ * \retval true if possible, else false
+ */
+bool SalomeApp_Application::isPossibleToClose( bool& closePermanently )
+{
+ return LightApp_Application::isPossibleToClose( closePermanently );
+}
+
/*! Check if the study is locked */
void SalomeApp_Application::onCloseDoc( bool ask )
{
/*!Private SLOT. */
void SalomeApp_Application::onOpenWith()
{
- QApplication::setOverrideCursor( Qt::waitCursor );
+ QApplication::setOverrideCursor( Qt::WaitCursor );
SALOME_ListIO aList;
LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
public:
DumpStudyFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true )
{
- QHBox* hB = new QHBox( this );
- myPublishChk = new QCheckBox( tr("PUBLISH_IN_STUDY"), hB );
- mySaveGUIChk = new QCheckBox( tr("SAVE_GUI_STATE"), hB );
- QPushButton* pb = new QPushButton(this);
- addWidgets( new QLabel("", this), hB, pb );
- pb->hide();
+ QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
+ if ( grid )
+ {
+ QWidget *hB = new QWidget( this );
+ myPublishChk = new QCheckBox( tr("PUBLISH_IN_STUDY") );
+ mySaveGUIChk = new QCheckBox( tr("SAVE_GUI_STATE") );
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget(myPublishChk);
+ layout->addWidget(mySaveGUIChk);
+ hB->setLayout(layout);
+
+ QPushButton* pb = new QPushButton(this);
+
+ int row = grid->rowCount();
+ grid->addWidget( new QLabel("", this), row, 0 );
+ grid->addWidget( hB, row, 1, 1, 3 );
+ grid->addWidget( pb, row, 5 );
+
+ pb->hide();
+ }
}
QCheckBox* myPublishChk;
QCheckBox* mySaveGUIChk;
aFilters.append( tr( "PYTHON_FILES_FILTER" ) );
DumpStudyFileDlg* fd = new DumpStudyFileDlg( desktop() );
- fd->setCaption( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
+ fd->setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
fd->setFilters( aFilters );
fd->myPublishChk->setChecked( true );
fd->mySaveGUIChk->setChecked( true );
ip->setDumpPython(appStudy->studyDS());
savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
}
- bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish);
+ bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(),
+ aFileInfo.baseName().toStdString(), toPublish);
if ( toSaveGUI )
appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
if ( !res )
{
QString command = QString("execfile(\"%1\")").arg(aFile);
- PythonConsole* pyConsole = pythonConsole();
+ PyConsole_Console* pyConsole = pythonConsole();
if ( pyConsole )
pyConsole->exec( command );
if ( study ) {
SalomeApp_VisualState( this ).storeState();
updateSavePointDataObjects( study );
- objectBrowser()->updateTree( study->root() );
+ // temporary commented
+ //objectBrowser()->updateTree( study->root() );
}
updateActions();
}
if ( flag == WT_ObjectBrowser )
{
- OB_Browser* ob = (OB_Browser*)wid;
+ // temporary commented
+ /*OB_Browser* ob = (OB_Browser*)wid;
ob->setUpdater( new SalomeApp_Updater() );
- connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );
+ connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );*/
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ),
autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
{
- ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i );
+ // temporary commented
+ /*ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i );
ob->setColumnShown( i, resMgr->booleanValue( "ObjectBrowser",
- QString().sprintf( "visibility_column_%d", i ), true ) );
+ QString().sprintf( "visibility_column_%d", i ), true ) );*/
}
- ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
+ // temporary commented
+ /*ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
- ob->resize( desktop()->width()/3, ob->height() );
+ ob->resize( desktop()->width()/3, ob->height() );*/
}
else if ( flag == WT_PyConsole )
{
- PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
- pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
+ PyConsole_Console* pyCons = new PyConsole_Console( desktop(), new SalomeApp_PyInterp() );
+ pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
wid = pyCons;
pyCons->resize( pyCons->width(), desktop()->height()/4 );
//pyCons->connectPopupRequest(this, SLOT(onConnectPopupRequest(SUIT_PopupClient*, QContextMenuEvent*)));
int defCols = pref->addPreference( tr( "PREF_GROUP_DEF_COLUMNS" ), obTab );
for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
{
- pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), defCols,
+ pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ).toLatin1() ), defCols,
LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
}
pref->setItemProperty( defCols, "columns", 1 );
if ( activeStudy() )
{
- QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
+ QString sName = SUIT_Tools::file( activeStudy()->studyName().trimmed(), false );
if ( !sName.isEmpty() ) {
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if ( study ) {
}
}
- desktop()->setCaption( aTitle );
+ desktop()->setWindowTitle( aTitle );
+}
+
+int SalomeApp_Application::closeChoice( const QString& docName )
+{
+ int answer = SUIT_MessageBox::question( desktop(), tr( "APPCLOSE_CAPTION" ), tr( "APPCLOSE_DESCRIPTION" ).arg( docName ),
+ tr ("APPCLOSE_SAVE"), tr ("APPCLOSE_CLOSE"),
+ tr ("APPCLOSE_UNLOAD"), tr ("APPCLOSE_CANCEL"), 1 );
+
+ int res = CloseCancel;
+ if ( answer == 1 )
+ res = CloseSave;
+ else if ( answer == 2 )
+ res = CloseDiscard;
+ else if ( answer == 3 )
+ res = CloseUnload;
+
+ return res;
+}
+
+bool SalomeApp_Application::closeAction( const int choice, bool& closePermanently )
+{
+ bool res = true;
+ switch( choice )
+ {
+ case CloseSave:
+ if ( activeStudy()->isSaved() )
+ onSaveDoc();
+ else if ( !onSaveAsDoc() )
+ res = false;
+ break;
+ case CloseDiscard:
+ break;
+ case CloseUnload:
+ closePermanently = false;
+ break;
+ case CloseCancel:
+ default:
+ res = false;
+ }
+
+ return res;
}
/*!Gets CORBA::ORB_var*/
}
/*!Insert items in popup, which necessary for current application*/
-void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title )
+void SalomeApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title )
{
LightApp_Application::contextMenuPopup( type, thePopup, title );
- OB_Browser* ob = objectBrowser();
+ // temporary commented
+ /*OB_Browser* ob = objectBrowser();
if ( !ob || type != ob->popupClientType() )
- return;
+ return;*/
// Get selected objects
SALOME_ListIO aList;
// add GUI state commands: restore, rename
if ( aList.Extent() == 1 && aList.First()->hasEntry() &&
QString( aList.First()->getEntry() ).startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) {
- thePopup->insertSeparator();
- thePopup->insertItem( tr( "MEN_RESTORE_VS" ), this, SLOT( onRestoreGUIState() ) );
- thePopup->insertItem( tr( "MEN_RENAME_VS" ), this, SLOT( onRenameGUIState() ) );
- thePopup->insertItem( tr( "MEN_DELETE_VS" ), this, SLOT( onDeleteGUIState() ) );
+ thePopup->addSeparator();
+ thePopup->addAction( tr( "MEN_RESTORE_VS" ), this, SLOT( onRestoreGUIState() ) );
+ thePopup->addAction( tr( "MEN_RENAME_VS" ), this, SLOT( onRenameGUIState() ) );
+ thePopup->addAction( tr( "MEN_DELETE_VS" ), this, SLOT( onDeleteGUIState() ) );
}
// "Delete reference" item should appear only for invalid references
// Add "Delete reference" item to popup
if ( isInvalidRefs )
{
- thePopup->insertSeparator();
- thePopup->insertItem( tr( "MEN_DELETE_INVALID_REFERENCE" ), this, SLOT( onDeleteInvalidReferences() ) );
+ thePopup->addSeparator();
+ thePopup->addAction( tr( "MEN_DELETE_INVALID_REFERENCE" ), this, SLOT( onDeleteInvalidReferences() ) );
return;
}
if (currentModule && currentModule->moduleName() == aModuleTitle)
return;
if ( !aModuleTitle.isEmpty() )
- thePopup->insertItem( tr( "MEN_OPENWITH" ).arg( aModuleTitle ), this, SLOT( onOpenWith() ) );
+ thePopup->addAction( tr( "MEN_OPENWITH" ).arg( aModuleTitle ), this, SLOT( onOpenWith() ) );
}
/*!Update obect browser:
if ( aComponent->ComponentDataType() == "Interface Applicative" )
continue; // skip the magic "Interface Applicative" component
- OB_Browser* ob = static_cast<OB_Browser*>( getWindow( WT_ObjectBrowser ));
+ // temporary commented
+ /*OB_Browser* ob = static_cast<OB_Browser*>( getWindow( WT_ObjectBrowser ));
const bool isAutoUpdate = ob->isAutoUpdate();
- ob->setAutoUpdate( false );
+ ob->setAutoUpdate( false );*/
SalomeApp_DataModel::synchronize( aComponent, study );
- ob->setAutoUpdate( isAutoUpdate );
+ // temporary commented
+ /*ob->setAutoUpdate( isAutoUpdate );*/
//SalomeApp_DataModel::BuildTree( aComponent, study->root(), study, /*skipExisitng=*/true );
}
}
ToolsGUI_RegWidget* regWnd = ToolsGUI_RegWidget::GetRegWidget( anOrb, desktop(), "Registry" );
regWnd->show();
regWnd->raise();
- regWnd->setActiveWindow();
+ regWnd->activateWindow();
}
/*!find original object by double click on item */
void SalomeApp_Application::onDblClick( QListViewItem* it )
{
- OB_ListItem* item = dynamic_cast<OB_ListItem*>( it );
+ // temporary commented
+ /*OB_ListItem* item = dynamic_cast<OB_ListItem*>( it );
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if( study && item )
break;
}
}
- }
+ }*/
}
/*!
if ( !newName.isNull() && !newName.isEmpty() ) {
study->setNameOfSavePoint( savePoint, newName );
updateSavePointDataObjects( study );
- objectBrowser()->updateTree( study->root() );
+ // temporary commented
+ //objectBrowser()->updateTree( study->root() );
}
}
{
LightApp_Application::onStudySaved( study );
- if ( objectBrowser() ) {
+ // temporary commented
+ /*if ( objectBrowser() ) {
updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
objectBrowser()->updateTree( study->root() );
- }
+ }*/
}
/*!Called on Open study operation*/
{
LightApp_Application::onStudyOpened( study );
- if ( objectBrowser() ) {
+ // temporary commented
+ /*if ( objectBrowser() ) {
updateSavePointDataObjects( dynamic_cast<SalomeApp_Study*>( study ) );
objectBrowser()->updateTree( study->root() );
- }
-}
-
-/*! utility function. returns true if list view item that correspond to given SUIT_DataObject is open.
- only first level items are traversed */
-bool isListViewItemOpen( QListView* lv, const SUIT_DataObject* dobj )
-{
- if ( !lv || !dobj )
- return false;
-
- QListViewItem* item = lv->firstChild();
- while ( item ) {
- OB_ListItem* ob_item = dynamic_cast<OB_ListItem*>( item );
- if ( ob_item && ob_item->dataObject() == dobj )
- return ob_item->isOpen();
- item = item->nextSibling();
- }
- return false;
+ }*/
}
/*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/
void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study )
{
- OB_Browser* ob = objectBrowser();
+ // temporary commented
+ //OB_Browser* ob = objectBrowser();
- if ( !study || !ob )
+ if ( !study /*|| !ob */) // temporary commented
return;
// find GUI states root object
// delete DataObjects that are still in the map -- their IDs were not found in data model
for ( QMap<int,SalomeApp_SavePointObject*>::Iterator it = mapDO.begin(); it != mapDO.end(); ++it )
- delete it.data();
+ delete it.value();
}
/*! Check data object */
void SalomeApp_Application::onDesktopMessage( const QString& message )
{
// update object browser
- if ( message.lower() == "updateobjectbrowser" ||
- message.lower() == "updateobjbrowser" )
+ if ( message.toLower() == "updateobjectbrowser" ||
+ message.toLower() == "updateobjbrowser" )
updateObjectBrowser();
}
#include "SalomeApp.h"
#include <LightApp_Application.h>
-#include <qmap.h>
-
#include <CORBA.h>
#include <SALOMEconfig.h>
#include "SALOMEDSClient.hxx"
-class QAction;
-class QComboBox;
-class QDockWindow;
-
class LightApp_Preferences;
-class SalomeApp_Module;
class SalomeApp_Study;
class SALOME_LifeCycleCORBA;
-class QListViewItem;
+class QListViewItem;//? waiting for object browser porting
#ifdef WIN32
#pragma warning( disable:4251 )
enum { MenuToolsId = 5 };
enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, UserID };
+ enum { CloseUnload = STD_Application::CloseCancel+1 };
public:
SalomeApp_Application();
virtual void start();
- virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
+ virtual void contextMenuPopup( const QString&, QMenu*, QString& );
virtual bool checkDataObject(LightApp_DataObject* theObj);
SUIT_ViewManager* newViewManager(const QString&);
void updateSavePointDataObjects( SalomeApp_Study* );
+
+ virtual bool isPossibleToClose( bool& );
public slots:
virtual bool onOpenDoc( const QString& );
virtual void createPreferences( LightApp_Preferences* );
virtual void updateDesktopTitle();
+
+ virtual bool closeAction( const int, bool& );
+ virtual int closeChoice( const QString& );
private slots:
void onDeleteInvalidReferences();
void onCatalogGen();
void onRegDisplay();
void onOpenWith();
-
};
#ifdef WIN32
//
#include "SalomeApp_CheckFileDlg.h"
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
+#include <QCheckBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
/*!
Constructor
SalomeApp_CheckFileDlg::SalomeApp_CheckFileDlg( QWidget* parent, bool open, const QString& theCheckBoxName, bool showQuickDir, bool modal) :
SUIT_FileDlg( parent, open, showQuickDir, modal )
{
- myCheckBox = new QCheckBox( theCheckBoxName, this );
- QLabel* label = new QLabel("", this);
- QPushButton* pb = new QPushButton(this);
- addWidgets( label, myCheckBox, pb );
- pb->hide();
+ QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
+ if ( grid )
+ {
+ myCheckBox = new QCheckBox( theCheckBoxName, this );
+ QLabel* label = new QLabel("", this);
+ QPushButton* pb = new QPushButton(this);
+
+ int row = grid->rowCount();
+ grid->addWidget( label, row, 0 );
+ grid->addWidget( myCheckBox, row, 1 );
+ grid->addWidget( pb, row, 2 );
+
+ pb->hide();
+ }
}
/*!
#include "SalomeApp_DataObject.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_Engine_i.hxx"
#include "LightApp_RootObject.h"
#include <CAM_DataObject.h>
-#include <SUIT_Application.h>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_Session.h>
#include <SUIT_TreeSync.h>
#include <SUIT_DataObjectIterator.h>
bool isEqual( const kerPtr&, const suitPtr& ) const;
kerPtr nullSrc() const;
suitPtr nullTrg() const;
- void children( const kerPtr&, QValueList<kerPtr>& ) const;
- void children( const suitPtr&, QValueList<suitPtr>& ) const;
+ void children( const kerPtr&, QList<kerPtr>& ) const;
+ void children( const suitPtr&, QList<suitPtr>& ) const;
suitPtr parent( const suitPtr& ) const;
bool isCorrect( const kerPtr& ) const;
void updateItem( const kerPtr&, const suitPtr& ) const;
{
DataObjectList ch;
parent->children( ch );
- int pos = ch.find( after );
+ int pos = ch.indexOf( after );
if( pos>=0 )
parent->insertChild( nitem, pos+1 );
else
\param obj - kernel object
\param ch - list to be filled
*/
-void SalomeApp_DataModelSync::children( const kerPtr& obj, QValueList<kerPtr>& ch ) const
+void SalomeApp_DataModelSync::children( const kerPtr& obj, QList<kerPtr>& ch ) const
{
ch.clear();
_PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) );
\param p - SUIT object
\param ch - list to be filled
*/
-void SalomeApp_DataModelSync::children( const suitPtr& p, QValueList<suitPtr>& ch ) const
+void SalomeApp_DataModelSync::children( const suitPtr& p, QList<suitPtr>& ch ) const
{
DataObjectList l;
if( p )
{
p->children( l );
ch.clear();
- for( SUIT_DataObject* o = l.first(); o; o = l.next() )
- ch.append( o );
+ QListIterator<suitPtr> it( ch );
+ while ( it.hasNext() )
+ ch.append( it.next() );
}
}
{
QString marg; marg.fill( ' ', 3*it.depth() );
QString nnn = "%1 '%2'";
- qDebug( nnn.arg( marg ).arg( it.current()->name() ) );
+ qDebug( nnn.arg( marg ).arg( it.current()->name() ).toLatin1() );
}
}
return true; // Probably nothing to load
_PTR(Study) aStudy ( aDoc->studyDS() ); // shared_ptr cannot be used here
- _PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.latin1() ) ) );
+ _PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.toLatin1() ) ) );
if ( aSComp )
updateTree( aSComp, aDoc );
QString anId = getRootEntry( aSStudy );
if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
_PTR(Study) aStudy ( aSStudy->studyDS() );
- sobj = aStudy->FindComponentID( std::string( anId.latin1() ) );
+ sobj = aStudy->FindComponentID( std::string( anId.toLatin1() ) );
}
}
}
if ( aSStudy ) {
_PTR(Study) aStudy ( aSStudy->studyDS() );
// modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon
- sobj = aStudy->FindComponentID( std::string( modelRoot->entry().latin1() ) );
+ sobj = aStudy->FindComponentID( std::string( modelRoot->entry().toLatin1() ) );
}
}
}
anEntry = anObj->entry();
}
else if ( study && study->studyDS() ) { // this works even if <myRoot> is null
- _PTR(SComponent) aSComp( study->studyDS()->FindComponent( module()->name() ) );
+ _PTR(SComponent) aSComp( study->studyDS()->FindComponent( module()->name().toStdString() ) );
if ( aSComp )
anEntry = aSComp->GetID().c_str();
}
class SalomeApp_Module;
class SalomeApp_Study;
-class SalomeApp_DataObject;
+class SUIT_DataObject;
+class LightApp_DataObject;
// Class : SalomeApp_DataModel
/// Description : Base class of data model
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
-#include <SUIT_DataObjectKey.h>
-#include <qobject.h>
-
-#include <SALOMEDSClient_AttributeReal.hxx>
-#include <SALOMEDSClient_AttributeInteger.hxx>
-#include <SALOMEDSClient_AttributeComment.hxx>
-#include <SALOMEDSClient_AttributeTableOfReal.hxx>
-#include <SALOMEDSClient_AttributeTableOfInteger.hxx>
+#include <QObject>
/*!Constructor. Initialize by \a parent*/
SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent )
//
#include "SalomeApp_EventFilter.h"
-#include <SALOME_Event.hxx>
+#include <SALOME_Event.h>
-#include <qapplication.h>
+#include <QApplication>
SalomeApp_EventFilter* SalomeApp_EventFilter::myFilter = NULL;
{
if ( e->type() == SALOME_EVENT )
{
- SALOME_Event* aSE = (SALOME_Event*)((QCustomEvent*)e)->data();
+ SALOME_Event* aSE = (SALOME_Event*)((SALOME_CustomEvent*)e)->data();
processEvent(aSE);
- ((QCustomEvent*)e)->setData( 0 );
+ ((SALOME_CustomEvent*)e)->setData( 0 );
return true;
}
return QObject::eventFilter( o, e );
#define SALOMEAPP_EVENTFILTER_H
#include "SalomeApp.h"
-#include <qobject.h>
+#include <QObject>
#if defined WIN32
#pragma warning( disable: 4251 )
#include <stdexcept>
#include <exception>
-#include <qstring.h>
+#include <QString>
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
#include <Standard_ErrorHandler.hxx>
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
-#include <qheader.h>
-#include <qvalidator.h>
-#include <qapplication.h>
-#include <qtoolbutton.h>
+#include <QValidator>
+#include <QToolButton>
+#include <QPixmap>
+#include <QHeaderView>
+#include <QKeyEvent>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListOfReal.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include "utilities.h"
-
using namespace std;
+using namespace Qt;
+
/*!
Used for resizing editing widget
*/
{
if (!theItem)
return;
- QListView* aListView = theItem->listView();
+ QTreeWidget* aListView = theItem->treeWidget();
int anEditColumn = theItem->getEditedColumn();
if (anEditColumn < 0)
return;
int aX = 0, aY = 0, aW = 0, aH = 0;
- QRect aRect = aListView->itemRect(theItem);
- aListView->contentsToViewport(aListView->header()->sectionPos(anEditColumn), 0, aX, aY);
+ QRect aRect = aListView->visualItemRect(theItem);
+ aX = aListView->header()->sectionViewportPosition(anEditColumn);
if (aX < 0)
aX = 0; // THIS CAN BE REMOVED
QSize aSize = theWidget->getControl()->sizeHint();
- aH = QMAX(aSize.height() , aRect.height() );
+ aH = qMax(aSize.height() , aRect.height() );
aY = aRect.y() - ((aH - aRect.height()) / 2);
//aW = aListView->columnWidth(anEditColumn); // CAN SUBSTITUTE NEXT 3 ROWS
aW = aListView->viewport()->width() - aX;
Constructor
*/
SalomeApp_ListView::SalomeApp_ListView( QWidget* parent )
-: QtxListView( parent )
+ : QTreeWidget/*QtxListView*/( parent )
{
myMouseEnabled = true;
myEditingEnabled = false;
- setSelectionMode(Single);
- setSorting(-1);
+ setSelectionMode(QAbstractItemView::SingleSelection);
setRootIsDecorated(false);
setAllColumnsShowFocus(false);
// header()->setClickEnabled(false);
- header()->setMovingEnabled(false);
+ header()->setMovable(false);
myEditedItem = 0;
myEdit = 0;
viewport()->installEventFilter(this);
- connect(this, SIGNAL(selectionChanged()),
+ connect(this, SIGNAL(itemSelectionChanged()),
this, SLOT(onSelectionChanged()));
connect(header(), SIGNAL(sizeChange(int, int, int)),
this, SLOT(onHeaderSizeChange(int, int, int)));
{
// temporary disconnecting selection changed SIGNAL
blockSignals(true);
- SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)firstChild();
+ QTreeWidgetItemIterator it( this );
+ SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)(*it);
if (aRoot)
aRoot->updateAllLevels();
- updateContents();
+ update( contentsRect() );//updateContents();
// connecting again selection changed SIGNAL
blockSignals(false);
- emit selectionChanged();
+ emit itemSelectionChanged();
}
/*!
{
// temporary disconnecting selection changed SIGNAL
blockSignals(true);
- SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)selectedItem();
+ SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(selectedItems().first());
if (aChild)
aChild->updateAllLevels();
- updateContents();
+ update( contentsRect() );//updateContents();
// connecting again selection changed SIGNAL
blockSignals(false);
- emit selectionChanged();
+ emit itemSelectionChanged();
}
/*!
/*!
Fills popup menu with items
*/
-void SalomeApp_ListView::contextMenuPopup( QPopupMenu* aPopup )
+void SalomeApp_ListView::contextMenuPopup( QMenu* aPopup )
{
if (aPopup) {
// add items here...
myEdit = 0;
myEditedItem = 0;
}
- QListView::clear();
+ QTreeWidget::clear();
}
/*!
!isMouseEnabled())
return true;
else
- return QListView::eventFilter(object, event);
+ return QTreeWidget::eventFilter(object, event);
}
/*!
myEdit = 0;
if (myEditedItem && !myEditedItem->isAccepted()) {
delete myEditedItem;
- updateContents();
+ update( contentsRect() );//updateContents();
}
myEditedItem = 0;
}
// editing is allowed in Single Selection Mode only
- if (selectionMode() != Single || !isEnableEditing())
+ if (selectionMode() != QAbstractItemView::SingleSelection || !isEnableEditing())
return;
- SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)selectedItem();
+ SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)(selectedItems().first());
if (anItem) {
if (!anItem->isEditable())
return;
*/
void SalomeApp_ListView::resizeEvent( QResizeEvent * e)
{
- QListView::resizeEvent(e);
- int aW = columnWidth(columns()-1);
- int aX = header()->sectionPos(columns()-1);
+ QTreeWidget::resizeEvent(e);
+ int aW = columnWidth(columnCount()-1);
+ int aX = header()->sectionPosition(columnCount()-1);
if (aW < width() - frameWidth() * 2 - aX - 1)
- setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
- updateContents();
+ setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1);
+ update( contentsRect() );//updateContents();
}
/*!
*/
void SalomeApp_ListView::onHeaderSizeChange(int, int, int)
{
- int aW = columnWidth(columns()-1);
- int aX = header()->sectionPos(columns()-1);
+ int aW = columnWidth(columnCount()-1);
+ int aX = header()->sectionPosition(columnCount()-1);
if (aW < width() - frameWidth() * 2 - aX - 1)
- setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
+ setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1);
}
/*!
*/
void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e)
{
- QListView::viewportPaintEvent(e);
+ QTreeWidget::paintEvent(e);
if (myEditedItem && myEdit) {
computeEditGeometry(myEditedItem, myEdit);
}
\retval valid rect in success
*/
QRect SalomeApp_ListView::tip(QPoint aPos,
- QString& aText,
- QRect& dspRect,
- QFont& dspFnt) const
+ QString& aText,
+ QRect& dspRect,
+ QFont& dspFnt) const
{
QRect result( -1, -1, -1, -1 );
SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos );
if ( aItem ) {
- for (int i = 0; i < columns(); i++) {
+ for (int i = 0; i < columnCount(); i++) {
QRect aItemRect = aItem->itemRect(i);
QRect aTextRect = aItem->textRect(i);
if ( !aItem->text(i).isEmpty() &&
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) :
-QListViewItem( parent )
-{
- init();
-}
-
-/*!
- Constructor
-*/
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after) :
-QListViewItem( parent, after )
+QTreeWidgetItem( parent )
{
init();
}
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- const QString& theName,
- const bool theEditable) :
-QListViewItem(parent, theName)
+ SalomeApp_ListViewItem* after) :
+QTreeWidgetItem( parent, after )
{
init();
- setEditable(theEditable);
}
/*!
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
-QListViewItem(parent, theName, theValue)
+ const QStringList& theStrings,
+ const bool theEditable) :
+QTreeWidgetItem(parent, theStrings)
{
init();
setEditable(theEditable);
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- const QString& theName,
- const bool theEditable) :
-QListViewItem(parent, theName)
+ const QStringList& theString,
+ const bool theEditable) :
+QTreeWidgetItem(parent, theString)
{
init();
setEditable(theEditable);
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
-QListViewItem(parent, after, theName)
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
+QTreeWidgetItem(parent, after)
{
+ setData(0,Qt::DisplayRole,QVariant(theName));
init();
setEditable(theEditable);
}
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
-QListViewItem(parent, after, theName)
-{
- init();
- setEditable(theEditable);
-}
-
-
-/*!
- Constructor
-*/
-SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
-QListViewItem(parent, theName, theValue)
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
+QTreeWidgetItem(parent, after)
{
+ setData(0,Qt::DisplayRole,QVariant(theName));
init();
setEditable(theEditable);
}
-
/*!
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
-QListViewItem(parent, after, theName, theValue)
-{
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
+QTreeWidgetItem(parent, after)
+{
+ setData(0,Qt::DisplayRole,QVariant(theName));
+ setData(1,Qt::DisplayRole,QVariant(theValue));
init();
setEditable(theEditable);
}
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
-QListViewItem(parent, after, theName, theValue)
-{
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
+QTreeWidgetItem(parent, after)
+{
+ setData(0,Qt::DisplayRole,QVariant(theName));
+ setData(1,Qt::DisplayRole,QVariant(theValue));
init();
setEditable(theEditable);
}
myUserType = -1;
}
+/*!
+ Returns the depth of this item
+*/
+int SalomeApp_ListViewItem::depth() const
+{
+ int aDepth = 0;
+ QTreeWidgetItem* aParent = parent();
+ while ( aParent ) {
+ aParent = aParent->parent();
+ aDepth++;
+ }
+ return aDepth;
+}
+
/*!
\return text in the first column
*/
QString SalomeApp_ListViewItem::getName() const
{
- return ( listView()->columns() > 0 ) ? text(0) : QString("");
+ return ( treeWidget()->columnCount() > 0 ) ? text(0) : QString("");
}
/*!
UpdateType SalomeApp_ListViewItem::setName(const QString& theName)
{
UpdateType aNeedsUpdate = utCancel;
- if (listView()->columns() > 0) {
+ if (treeWidget()->columnCount() > 0) {
setText(0, theName);
aNeedsUpdate = utNone;
}
*/
QString SalomeApp_ListViewItem::getValue() const
{
- return ( listView()->columns() > 1 ) ? text(1) : QString("");
+ return ( treeWidget()->columnCount() > 1 ) ? text(1) : QString("");
}
/*!
UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue)
{
UpdateType aNeedsUpdate = utCancel;
- if (listView()->columns() > 1) {
+ if (treeWidget()->columnCount() > 1) {
setText(1, theValue);
aNeedsUpdate = utNone;
}
*/
void SalomeApp_ListViewItem::openAllLevels()
{
- setOpen(true);
- SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+ setExpanded(true);
+ QTreeWidgetItemIterator it( this );
+ SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it);
while( aChild ) {
aChild->openAllLevels();
- aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+ ++it;
+ aChild = (SalomeApp_ListViewItem*)(*it);
}
}
*/
void SalomeApp_ListViewItem::updateAllLevels()
{
- SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
+ QTreeWidgetItemIterator it( this );
+ SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it);
while( aChild ) {
aChild->updateAllLevels();
- aChild = (SalomeApp_ListViewItem*)(aChild->nextSibling());
+ ++it;
+ aChild = (SalomeApp_ListViewItem*)(*it);
}
}
*/
int SalomeApp_ListViewItem::getEditedColumn()
{
- return listView()->columns()-1;
+ return treeWidget()->columnCount()-1;
}
/*!
SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
{
SalomeApp_EntityEdit* aWidget = 0;
- QListView* aListView = listView();
+ QTreeWidget* aListView = treeWidget();
if (aListView) {
if (!isEditable())
return 0;
QRect SalomeApp_ListViewItem::tipRect()
{
QRect aRect = QRect(-1, -1, -1, -1);
- QRect aItemRect = listView()->itemRect(this);
+ QRect aItemRect = treeWidget()->visualItemRect(this);
if ( !aItemRect.isValid() )
return aItemRect;
QString aTip = tipText();
if (!aTip.isEmpty()) {
QRect aRect0 = textRect(0);
- QFont aFont(listView()->font());
+ QFont aFont(treeWidget()->font());
QFontMetrics fm(aFont);
int iw = fm.width(aTip);
aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(),
*/
QRect SalomeApp_ListViewItem::textRect(const int column) const
{
- QRect aItemRect = listView()->itemRect( this );
+ QRect aItemRect = treeWidget()->visualItemRect( this );
if ( !aItemRect.isValid() )
return aItemRect;
- QFont aFont(listView()->font());
+ QFont aFont(treeWidget()->font());
QFontMetrics fm(aFont);
- int decorWidth = ( listView()->rootIsDecorated() ) ?
- ( listView()->treeStepSize() * (depth() + 1) ) :
- ( listView()->treeStepSize() * depth() );
- int pixmapWidth = ( pixmap(column) ) ?
- pixmap(column)->width() + listView()->itemMargin() * 2 :
- listView()->itemMargin();
+ int decorWidth = ( treeWidget()->rootIsDecorated() ) ?
+ ( treeWidget()->indentation() * (depth() + 1) ) :
+ ( treeWidget()->indentation() * depth() );
+ int pixmapWidth = ( !icon(column).isNull() ) ?
+ treeWidget()->iconSize().width() + 2 :
+ 1;
int prevWidth = 0;
for (int i = 0; i < column; i++)
- prevWidth += listView()->header()->sectionSize(i);
+ prevWidth += treeWidget()->header()->sectionSize(i);
int ix = prevWidth +
pixmapWidth +
((column == 0) ? decorWidth : 0);
int iy = aItemRect.y();
int iw = fm.width(text(column));
int ih = aItemRect.height();
- if (pixmap(column)) {
- iy += listView()->itemMargin();
- ih -= listView()->itemMargin() * 2;
+ if (!icon(column).isNull()) {
+ iy += 1;
+ ih -= 2;
}
- ix -= listView()->contentsX();
+ ix -= treeWidget()->contentsRect().left();
QRect theResult(QPoint(ix, iy), QSize(iw, ih));
return theResult;
*/
QRect SalomeApp_ListViewItem::itemRect(const int column) const
{
- QRect aItemRect = listView()->itemRect( this );
+ QRect aItemRect = treeWidget()->visualItemRect( this );
if ( !aItemRect.isValid() )
return aItemRect;
- QFont aFont(listView()->font());
+ QFont aFont(treeWidget()->font());
QFontMetrics fm(aFont);
- int decorWidth = ( listView()->rootIsDecorated() ) ?
- ( listView()->treeStepSize() * (depth() + 1) ) :
- ( listView()->treeStepSize() * depth() );
- int pixmapWidth = ( pixmap(column) ) ?
- pixmap(column)->width() + listView()->itemMargin() * 2 :
+ int decorWidth = ( treeWidget()->rootIsDecorated() ) ?
+ ( treeWidget()->indentation() * (depth() + 1) ) :
+ ( treeWidget()->indentation() * depth() );
+ int pixmapWidth = ( !icon(column).isNull() ) ?
+ treeWidget()->iconSize().width() + 2 :
0;
int prevWidth = 0;
for (int i = 0; i < column; i++)
- prevWidth += listView()->header()->sectionSize(i);
+ prevWidth += treeWidget()->header()->sectionSize(i);
int ix = prevWidth;
int iy = aItemRect.y();
int iw = pixmapWidth +
- listView()->itemMargin() * 2 +
+ 2 +
((column == 0) ? decorWidth : 0) +
fm.width(text(column));
int ih = aItemRect.height();
- ix -= listView()->contentsX();
+ ix -= treeWidget()->contentsRect().left();
QRect theResult(QPoint(ix, iy), QSize(iw, ih));
return theResult;
Constructor
*/
SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) :
-QComboBox(rw, parent, name)
+QComboBox(parent)
{
+ setEditable( rw );
+ setObjectName( name );
}
/*!
int SalomeApp_ComboBox::findItem(const QString& theText)
{
for (int i = 0; i < count(); i++)
- if (text(i) == theText)
+ if (itemText(i) == theText)
return i;
return -1;
}
Adds item in combo box
*/
void SalomeApp_ComboBox::insertItem(const QString& theValue,
- int theIndex)
+ int theIndex)
{
if (duplicatesEnabled() || findItem(theValue) < 0)
- QComboBox::insertItem(theValue, theIndex);
+ QComboBox::insertItem(theIndex, theValue);
}
/*!
int aNum;
bool bOk;
for (int i = 0; i < count(); i++) {
- aNum = text(i).toInt(&bOk);
+ aNum = itemText(i).toInt(&bOk);
if (bOk) {
if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
- insertItem(QString::number(theValue), i);
+ insertItem(QString::number(theValue),i);
return;
}
}
double aNum;
bool bOk;
for (int i = 0; i < count(); i++) {
- aNum = text(i).toDouble(&bOk);
+ aNum = itemText(i).toDouble(&bOk);
if (bOk) {
if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) {
insertItem(QString::number(theValue), i);
myCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Fixed));
// no insertions
- myCombo->setInsertionPolicy(QComboBox::NoInsertion);
+ myCombo->setInsertPolicy(QComboBox::NoInsert);
// no duplicates enabled by default
myCombo->setDuplicatesEnabled(false);
aTopLayout->addWidget(myCombo);
if( mgr )
anIcon = mgr->loadPixmap( "STD", tr( "ICON_APPLY" ), false );
- myApplyBtn->setPixmap(anIcon);
+ myApplyBtn->setIcon(anIcon);
myApplyBtn->setEnabled(false);
myApplyBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
myApplyBtn->setMinimumSize(16, 16);
QPixmap anIcon;
if( mgr )
anIcon = mgr->loadPixmap( "STD", tr( "ICON_CANCEL" ), false );
- myCancelBtn->setPixmap(anIcon);
+ myCancelBtn->setIcon(anIcon);
myCancelBtn->setEnabled(false);
myCancelBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
myCancelBtn->setMinimumSize(16, 16);
if (myCombo) {
int aFound = myCombo->findItem(theText);
if (aFound >= 0) {
- myCombo->setCurrentItem(aFound);
+ myCombo->setCurrentIndex(aFound);
onTextChanged(theText);
}
}
if (theOrder == atTop)
aIndexAt = 0;
else if (theOrder == atBeforeCurrent && myCombo->count() > 0)
- aIndexAt = myCombo->currentItem();
+ aIndexAt = myCombo->currentIndex();
else if (theOrder == atAfterCurrent &&
myCombo->count() > 0 &&
- myCombo->currentItem() < myCombo->count()-1)
- aIndexAt = myCombo->currentItem() + 1;
+ myCombo->currentIndex() < myCombo->count()-1)
+ aIndexAt = myCombo->currentIndex() + 1;
myCombo->insertItem(theValue, aIndexAt);
}
if (theSetCurrent)
myEdit->setFocus();
//myEdit->selectAll();
}
- else if (myCombo && myCombo->editable()) {
+ else if (myCombo && myCombo->isEditable()) {
myCombo->setFocus();
//myCombo->lineEdit()->selectAll();
}
#ifndef SALOMEAPP_LISTVIEW_H
#define SALOMEAPP_LISTVIEW_H
-#include <QtxListView.h>
+//#include <QtxListView.h>
-#include <qlist.h>
-#include <qstring.h>
-#include <qpixmap.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qtoolbutton.h>
+#include <SUIT_PopupClient.h>
-#include <TColStd_ListOfInteger.hxx>
-#include <TColStd_ListOfReal.hxx>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QString>
+#include <QLineEdit>
+#include <QComboBox>
-#include <SUIT_PopupClient.h>
+class QToolButton;
+
+class TColStd_ListOfInteger;
+class TColStd_ListOfReal;
// enumeration for ListView updating mode
enum UpdateType {
\class SalomeApp_ListView
parent class for Data Viewer and Properties Viewer
*/
-class SalomeApp_ListView : public QtxListView , public SUIT_PopupClient {
+class SalomeApp_ListView : public QTreeWidget/*QtxListView*/ , public SUIT_PopupClient {
Q_OBJECT
// fills popup with items
virtual QString popupClientType() const;
- virtual void contextMenuPopup( QPopupMenu* );
+ virtual void contextMenuPopup( QMenu* );
// setting editing of items availbale/not available
void enableEditing(bool theFlag);
QString myString;
};
-class SalomeApp_ListViewItem : public QListViewItem
+class SalomeApp_ListViewItem : public QTreeWidgetItem
{
public:
SalomeApp_ListViewItem( SalomeApp_ListView* );
SalomeApp_ListViewItem( SalomeApp_ListView*,
SalomeApp_ListViewItem* );
SalomeApp_ListViewItem( SalomeApp_ListView*,
- const QString&,
- const bool = false );
- SalomeApp_ListViewItem( SalomeApp_ListView*,
- const QString& theName,
- const QString& theValue,
+ const QStringList&,
const bool = false );
- SalomeApp_ListViewItem( SalomeApp_ListViewItem* theParent,
- const QString&,
+ SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
+ const QStringList&,
const bool = false );
SalomeApp_ListViewItem( SalomeApp_ListView*,
SalomeApp_ListViewItem*,
SalomeApp_ListViewItem*,
const QString&,
const bool = false);
- SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
- const QString& theName,
- const QString& theValue,
- const bool = false);
SalomeApp_ListViewItem( SalomeApp_ListView*,
SalomeApp_ListViewItem*,
const QString& theName,
protected:
// initialization
void init();
+ int depth() const;
private:
bool myEditable;
//
#include "SalomeApp_LoadStudiesDlg.h"
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlistbox.h>
-#include <qpushbutton.h>
+#include <QLabel>
+#include <QGridLayout>
+#include <QListWidget>
+#include <QPushButton>
#define SPACING_SIZE 6
#define MARGIN_SIZE 11
* \param f style flags
*/
-SalomeApp_LoadStudiesDlg::SalomeApp_LoadStudiesDlg( QWidget* parent, bool modal, WFlags fl )
-: QDialog( parent, "SalomeApp_LoadStudiesDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SalomeApp_LoadStudiesDlg::SalomeApp_LoadStudiesDlg( QWidget* parent, bool modal, Qt::WindowFlags fl )
+: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
{
+ setObjectName( "SalomeApp_LoadStudiesDlg" );
+ setModal( modal );
+
resize( 321, 181 );
- setCaption( tr("DLG_LOAD_STUDY_CAPTION") );
+ setWindowTitle( tr("DLG_LOAD_STUDY_CAPTION") );
setSizeGripEnabled( TRUE );
QGridLayout* aTopLayout = new QGridLayout(this);
aTopLayout->setMargin(MARGIN_SIZE);
aTopLayout->setSpacing(SPACING_SIZE);
- TextLabel1 = new QLabel( this, "TextLabel1" );
+ TextLabel1 = new QLabel( this );
+ TextLabel1->setObjectName( "TextLabel1" );
TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) );
TextLabel1->setText( tr( "MEN_STUDIES_CHOICE" ) );
aBtnLayout->setSpacing( SPACING_SIZE );
aBtnLayout->setMargin( 0 );
- buttonOk = new QPushButton( this, "buttonOk" );
+ buttonOk = new QPushButton( this );
+ buttonOk->setObjectName( "buttonOk" );
buttonOk->setText( tr( "BUT_OK" ) );
buttonOk->setAutoDefault( true );
buttonOk->setDefault( true );
- buttonCancel = new QPushButton( this, "buttonCancel" );
+ buttonCancel = new QPushButton( this );
+ buttonCancel->setObjectName( "buttonCancel" );
buttonCancel->setText( tr( "BUT_CANCEL" ) );
buttonCancel->setAutoDefault( true );
aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
aBtnLayout->addWidget( buttonCancel );
- ListComponent = new QListBox( this, "ListComponent" );
- ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
+ ListComponent = new QListWidget( this );
+ ListComponent->setObjectName( "ListComponent" );
ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- ListComponent->setSelectionMode(QListBox::Single);
+ ListComponent->setSelectionMode(QAbstractItemView::SingleSelection);
aTopLayout->addWidget(TextLabel1, 0, 0);
aTopLayout->addWidget(ListComponent, 1, 0);
#include <STD.h>
-#include <qdialog.h>
-#include <qvariant.h>
+#include <QDialog>
class QLabel;
-class QListBox;
+class QListWidget;
class QPushButton;
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QListBoxItem;
/*!\class SalomeApp_LoadStudiesDlg
* \brief Describes a dialog box that gives a list of opened studies.
Q_OBJECT
public:
- SalomeApp_LoadStudiesDlg( QWidget* parent = 0, bool modal = FALSE, WFlags fl = 0 );
+ SalomeApp_LoadStudiesDlg( QWidget* parent = 0, bool modal = FALSE, Qt::WindowFlags fl = 0 );
~SalomeApp_LoadStudiesDlg() {}
/*!\var TextLabel1
/*!\var ListComponent
* \brief stores a dialog list compoent
*/
- QListBox* ListComponent;
+ QListWidget* ListComponent;
};
#include "SalomeApp_Study.h"
#include "LightApp_Selection.h"
-#include "LightApp_Operation.h"
-#include "LightApp_Preferences.h"
-//#include "LightApp_Displayer.h"
#include "CAM_DataModel.h"
-#include "OB_Browser.h"
+// temporary commented
+//#include "OB_Browser.h"
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_InteractiveObject.hxx>
-//#include <SALOME_Actor.h>
#include <SUIT_Session.h>
-#include <SUIT_ViewModel.h>
-#include <SVTK_ViewWindow.h>
-//#include <SVTK_ViewModel.h>
-//#include <SVTK_MainWindow.h>
-//#include <SVTK_RenderWindowInteractor.h>
-
-#include <qstring.h>
-#include <qmap.h>
-
-//#include <vtkActorCollection.h>
-//#include <vtkRenderer.h>
+#include <QString>
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
}
/*!Create and return instance of LightApp_Selection.*/
-LightApp_Selection* SalomeApp_Module::createSelection() const
+LightApp_Selection* SalomeApp_Module::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const
{
- return LightApp_Module::createSelection();
+ return LightApp_Module::createSelection( client, mgr );
}
/*!
val = valSO->GetName().c_str();
Handle( SALOME_InteractiveObject ) new_obj =
- new SALOME_InteractiveObject( id.latin1(), comp.latin1(), val.latin1() );
+ new SALOME_InteractiveObject( id.toLatin1(), comp.toLatin1(), val.toLatin1() );
dest.Append( new_obj );
}
anIter->Next();
class CAM_DataModel;
class SalomeApp_Application;
-class LightApp_Operation;
class LightApp_Selection;
class SALOME_ListIO;
class QString;
virtual void storeVisualParameters(int savePoint);
virtual void restoreVisualParameters(int savePoint);
- virtual LightApp_Selection* createSelection() const;
+ virtual LightApp_Selection* createSelection( const QString&, LightApp_SelectionMgr* ) const;
protected:
virtual CAM_DataModel* createDataModel();
#include <utilities.h>
#include <Container_init_python.hxx>
-#include <string>
-#include <vector>
+#include "PyInterp.h" // this include must be first (see PyInterp_base.h)!
-#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
-
-#include <cStringIO.h>
using namespace std;
/*!
* initstate & initcontext redefined here.
*/
SalomeApp_PyInterp::SalomeApp_PyInterp():
- PythonConsole_PyInterp(), myFirstRun( true )
+ PyConsole_Interp(), myFirstRun( true )
{
}
* It is the caller responsability caller to acquire the GIL
* It will still be held on initContext output
*/
- if ( !PythonConsole_PyInterp::initContext() )
+ if ( !PyConsole_Interp::initContext() )
return false;
// Import special module to change the import mechanism
#ifndef _SalomeApp_PYINTERP_H_
#define _SalomeApp_PYINTERP_H_
-#include <PythonConsole_PyInterp.h> // this include must be first (see PyInterp_base.h)!
+#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
-class SalomeApp_PyInterp : public PythonConsole_PyInterp
+class SalomeApp_PyInterp : public PyConsole_Interp
{
public:
SalomeApp_PyInterp();
protected:
virtual bool initContext();
- virtual bool beforeRun();
+ virtual int beforeRun();
private:
bool myFirstRun;
#include "SalomeApp_Module.h"
#include "SalomeApp_DataModel.h"
-#include "SalomeApp_DataObject.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Engine_i.hxx"
#include "SalomeApp_VisualState.h"
#include "LightApp_RootObject.h"
-#include <OB_Browser.h>
+// temporary commented
+//#include <OB_Browser.h>
#include <SUIT_ResourceMgr.h>
-#include <qptrlist.h>
-#include <qapplication.h>
-#include <qdict.h>
-
#include "utilities.h"
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include <SUIT_Session.h>
#include "SALOMEDS_Tool.hxx"
#include "SALOMEDSClient_ClientFactory.hxx"
-#include "SALOMEDSClient_IParameters.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
/*!
Create document.
*/
-void SalomeApp_Study::createDocument()
+bool SalomeApp_Study::createDocument( const QString& theStr )
{
MESSAGE( "openDocument" );
// initialize myStudyDS, read HDF file
QString aName = newStudyName();
- _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.latin1() ) );
+ _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.toStdString() ) );
if ( !study )
- return;
+ return false;
setStudyDS( study );
setStudyName( aName );
// create myRoot
setRoot( new LightApp_RootObject( this ) );
- CAM_Study::createDocument();
+ bool aRet = CAM_Study::createDocument( theStr );
emit created( this );
+
+ return aRet;
}
/*!
MESSAGE( "openDocument" );
// initialize myStudyDS, read HDF file
- _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( (char*) theFileName.latin1() ) );
+ _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( (char*) theFileName.toStdString().c_str() ) );
if ( !study )
return false;
// update loaded data models: call open() and update() on them.
ModelList dm_s;
dataModels( dm_s );
- for ( ModelListIterator it( dm_s ); it.current(); ++it )
- openDataModel( studyName(), it.current() );
+ 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
MESSAGE( "loadDocument" );
// obtain myStudyDS from StudyManager
- _PTR(Study) study ( SalomeApp_Application::studyMgr()->GetStudyByName( (char*) theStudyName.latin1() ) );
+ _PTR(Study) study ( SalomeApp_Application::studyMgr()->GetStudyByName( (char*) theStudyName.toStdString().c_str() ) );
if ( !study )
return false;
ModelList dm_s;
dataModels( dm_s );
- for ( ModelListIterator it( dm_s ); it.current(); ++it )
- openDataModel( studyName(), it.current() );
+ 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
ModelList list; dataModels( list );
- SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ QListIterator<CAM_DataModel*> it( list );
QStringList listOfFiles;
- for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
- listOfFiles.clear();
- aModel->saveAs( theFileName, this, listOfFiles );
- if ( !listOfFiles.isEmpty() )
- saveModuleData(aModel->module()->name(), listOfFiles);
+ while ( it.hasNext() ) {
+ if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) {
+ listOfFiles.clear();
+ aModel->saveAs( theFileName, this, listOfFiles );
+ if ( !listOfFiles.isEmpty() )
+ saveModuleData(aModel->module()->name(), listOfFiles);
+ }
}
// save SALOMEDS document
bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
bool res = (isAscii ?
- SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
- SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile ))
+ SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.toStdString(), studyDS(), isMultiFile ) :
+ SalomeApp_Application::studyMgr()->SaveAs ( theFileName.toStdString(), studyDS(), isMultiFile ))
&& CAM_Study::saveDocumentAs( theFileName );
res = res && saveStudyData(theFileName);
ModelList list; dataModels( list );
- SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ QListIterator<CAM_DataModel*> it( list );
QStringList listOfFiles;
- for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() ) {
- listOfFiles.clear();
- aModel->save(listOfFiles);
- if ( !listOfFiles.isEmpty() )
- saveModuleData(aModel->module()->name(), listOfFiles);
+ while ( it.hasNext() ) {
+ if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) {
+ listOfFiles.clear();
+ aModel->save(listOfFiles);
+ if ( !listOfFiles.isEmpty() )
+ saveModuleData(aModel->module()->name(), listOfFiles);
+ }
}
// save SALOMEDS document
for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) {
if ( (*it).isEmpty() )
continue;
- aListOfFiles[anIndex] = (*it).latin1();
+ aListOfFiles[anIndex] = (*it).toStdString();
anIndex++;
}
- SetListOfFiles(theModuleName, aListOfFiles);
+ SetListOfFiles(theModuleName.toStdString().c_str(), aListOfFiles);
}
/*!
*/
void SalomeApp_Study::openModuleData( QString theModuleName, QStringList& theListOfFiles )
{
- std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
+ std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName.toStdString().c_str() );
int i, aLength = aListOfFiles.size() - 1;
if ( aLength < 0 )
bool SalomeApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
- SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)list.first();
+ QListIterator<CAM_DataModel*> it( list );
std::vector<std::string> listOfFiles(0);
- for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
- SetListOfFiles(aModel->module()->name(), listOfFiles);
+ while ( it.hasNext() )
+ if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() )
+ SetListOfFiles(aModel->module()->name().toStdString().c_str(), listOfFiles);
return true;
}
*/
void SalomeApp_Study::dataModelInserted (const CAM_DataModel* dm)
{
- MESSAGE("SalomeApp_Study::dataModelInserted() : module name() = " << dm->module()->name());
+ MESSAGE("SalomeApp_Study::dataModelInserted() : module name() = " << dm->module()->name().toStdString());
CAM_Study::dataModelInserted(dm);
_PTR(Study) aStudy = studyDS();
if (!aStudy)
return;
- _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name());
+ _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name().toStdString());
if (!aComp) {
// Create SComponent
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- aComp = aBuilder->NewComponent(dm->module()->name());
- aBuilder->SetName(aComp, dm->module()->moduleName().latin1());
+ aComp = aBuilder->NewComponent(dm->module()->name().toStdString());
+ aBuilder->SetName(aComp, dm->module()->moduleName().toStdString());
QString anIconName = dm->module()->iconName();
if (!anIconName.isEmpty()) {
_PTR(AttributePixMap) anAttr = aBuilder->FindOrCreateAttribute(aComp, "AttributePixMap");
if (anAttr)
- anAttr->SetPixMap(anIconName.latin1());
+ anAttr->SetPixMap(anIconName.toStdString());
}
// Set default engine IOR
- aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
+ aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().toStdString());
//SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true );
SalomeApp_DataModel::synchronize( aComp, this );
}
// 1. aModule == 0 means that this is a light module (no CORBA enigine)
if (!aModule) {
anEngine = SalomeApp_Application::defaultEngineIOR();
- aSComp = aStudy->FindComponent(dm->module()->name());
+ aSComp = aStudy->FindComponent(dm->module()->name().toStdString());
}
else {
SalomeApp_DataModel* aDM = dynamic_cast<SalomeApp_DataModel*>( dm );
anEngine = aDM->getModule()->engineIOR();
if ( anEngine.isEmpty() )
return false;
- aSComp = aStudy->FindComponentID( std::string( anId.latin1() ) );
+ aSComp = aStudy->FindComponentID( std::string( anId.toLatin1() ) );
}
}
if ( aSComp ) {
_PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() );
if ( aBuilder ) {
try {
- aBuilder->LoadWith( aSComp, std::string( anEngine.latin1() ) );
+ aBuilder->LoadWith( aSComp, std::string( anEngine.toLatin1() ) );
}
catch( const SALOME::SALOME_Exception& ) {
// Oops, something went wrong while loading -> return an error
// Remove the files and temporary directory, created
// for this module by LightApp_Engine_i::Load()
bool isMultiFile = false; // TODO: decide, how to access this parameter
- RemoveTemporaryFiles( dm->module()->name(), isMultiFile );
+ RemoveTemporaryFiles( dm->module()->name().toStdString().c_str(), isMultiFile );
// Something has been read -> create data model tree
LightApp_DataModel* aDM = dynamic_cast<LightApp_DataModel*>( dm );
while ( newName.isEmpty() ){
curName = prefix.arg( i );
for ( j = 0 ; j < n; j++ ){
- if ( !strcmp( studies[j].c_str(), curName.latin1() ) )
+ if ( !strcmp( studies[j].c_str(), curName.toLatin1() ) )
break;
}
if ( j == n )
*/
QString SalomeApp_Study::referencedToEntry( const QString& entry ) const
{
- _PTR(SObject) obj = studyDS()->FindObjectID( entry.latin1() );
+ _PTR(SObject) obj = studyDS()->FindObjectID( entry.toStdString() );
_PTR(SObject) refobj;
if( obj && obj->ReferencedObject( refobj ) )
*/
QString SalomeApp_Study::componentDataType( const QString& entry ) const
{
- _PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
+ _PTR(SObject) obj( studyDS()->FindObjectID( entry.toStdString() ) );
if ( !obj )
return LightApp_Study::componentDataType( entry );
return obj->GetFatherComponent()->ComponentDataType().c_str();
*/
bool SalomeApp_Study::isComponent( const QString& entry ) const
{
- _PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
+ _PTR(SObject) obj( studyDS()->FindObjectID( entry.toStdString() ) );
return obj && QString( obj->GetID().c_str() ) == obj->GetFatherComponent()->GetID().c_str();
}
*/
void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const
{
- _PTR(SObject) SO = studyDS()->FindObjectID( entry.latin1() );
+ _PTR(SObject) SO = studyDS()->FindObjectID( entry.toStdString() );
_PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( SO ) );
anIter->InitEx( true );
while( anIter->More() )
{
_PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
_PTR(IParameters) ip = ClientFactory::getIParameters(AP);
- ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.latin1());
+ ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.toStdString());
}
/*!
#include "SalomeApp.h"
#include <LightApp_Study.h>
-#include <string>
#ifdef WIN32
#pragma warning( disable:4251 )
virtual int id() const;
- virtual void createDocument();
+ virtual bool createDocument( const QString& );
virtual bool openDocument( const QString& );
virtual bool loadDocument( const QString& );
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
-// OCCT Includes
-#include <OSD_Process.hxx>
-#include <Quantity_Date.hxx>
-
// CORBA Headers
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
// QT Includes
-#include <qpushbutton.h>
-#include <qlayout.h>
+#include <QPushButton>
+#include <QGridLayout>
using namespace std;
const QString theName,
const bool theEditable,
const int theUserType) :
- SalomeApp_ListViewItem( parent, theName, theEditable )
+ SalomeApp_ListViewItem( parent, QStringList(theName), theEditable )
{
setUserType(theUserType);
}
/*!Constructor. Initialize study properties dialog.*/
SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent)
- : QDialog(parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
myChanged( false )
{
- setCaption(tr("TLT_STUDY_PROPERTIES"));
+ setObjectName( "" );
+ setModal( TRUE );
+
+ setWindowTitle(tr("TLT_STUDY_PROPERTIES"));
setSizeGripEnabled( true );
- clearWFlags(Qt::WStyle_ContextHelp);
+ //clearWFlags(Qt::WindowContextHelpButtonHint);
QGridLayout* mainLayout = new QGridLayout(this);
mainLayout->setMargin(DEFAULT_MARGIN);
mainLayout->setSpacing(DEFAULT_SPACING);
myPropList = new SalomeApp_ListView(this);
- myPropList->addColumn("");
- myPropList->addColumn("");
+ myPropList->setColumnCount(2);
+ QStringList aLabels;
+ aLabels << "" << "";
+ myPropList->setHeaderLabels( aLabels );
myPropList->enableEditing(TRUE);
myPropList->setMinimumSize(MIN_LIST_WIDTH, MIN_LIST_HEIGHT);
- mainLayout->addMultiCellWidget(myPropList, 0, 0, 0, 2);
+ mainLayout->addWidget(myPropList, 0, 0, 1, 3);
myOKBtn = new QPushButton(tr("BUT_OK"), this);
mainLayout->addWidget(myOKBtn, 1, 0);
_PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
//myChanged = propChanged();
if ( propAttr /*&& myChanged*/ ) {
- QListViewItemIterator it( myPropList );
+ QTreeWidgetItemIterator it( myPropList );
// iterate through all items of the listview
- for ( ; it.current(); ++it ) {
- SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
+ while (*it) {
+ SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it);
switch (item->getUserType()) {
case prpAuthorId:
- if (QString(propAttr->GetUserName().c_str()) != item->getValue().stripWhiteSpace()) {
+ if (QString(propAttr->GetUserName().c_str()) != item->getValue().trimmed()) {
if (!propAttr->IsLocked()) {
- propAttr->SetUserName(item->getValue().stripWhiteSpace().latin1());
+ propAttr->SetUserName(item->getValue().trimmed().toStdString());
myChanged = true;
} else {
SUIT_MessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(),
}
break;
//case prpModeId:
- // propAttr->SetCreationMode(item->getValue().stripWhiteSpace().latin1());
+ // propAttr->SetCreationMode(item->getValue().trimmed().latin1());
// break;
case prpLockedId:
{
default:
break;
}
+ ++it;
}
}
accept();
{
_PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties();
if (propAttr) {
- QListViewItemIterator it (myPropList);
+ QTreeWidgetItemIterator it (myPropList);
+
// iterate through all items of the listview
- for (; it.current(); ++it) {
- SalomeApp_PropItem* item = (SalomeApp_PropItem*)(it.current());
+ while (*it) {
+ SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it);
switch (item->getUserType()) {
case prpAuthorId:
- if ( QString( propAttr->GetUserName().c_str() ) != item->getValue().stripWhiteSpace() ) {
+ if ( QString( propAttr->GetUserName().c_str() ) != item->getValue().trimmed() ) {
return true;
}
break;
//case prpModeId:
- // if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().stripWhiteSpace() ) {
+ // if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().trimmed() ) {
// return true;
// }
// break;
default:
break;
}
+ ++it;
}
}
return false;
#define SALOMEAPP_STUDY_PROPERTIES_DLG_H
#include "SalomeApp.h"
-#include <SALOMEDSClient_definitions.hxx>
-#include <qdialog.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qlistview.h>
+
+#include <QDialog>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
class SalomeApp_ListView;
class QPushButton;
-class QToolButton;
class SALOMEAPP_EXPORT SalomeApp_StudyPropertiesDlg : public QDialog
{
#include <utilities.h>
+#include <QColor>
+#include <QString>
+
+#include <Quantity_Color.hxx>
+
/*!
Convert QColor to Quantity_Color, if QColor is valid.
*/
#include <SUIT_Tools.h>
-#include <qcolor.h>
-#include <qstring.h>
+class QColor;
+class QString;
-#include <Quantity_Color.hxx>
+class Quantity_Color;
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Exception)
_PTR(Study) aStudy = aDoc->studyDS();
QString entry = owner->entry();
- _PTR(SObject) aSObj( aStudy->FindObjectID( entry.latin1() ) );
+ _PTR(SObject) aSObj( aStudy->FindObjectID( entry.toStdString() ) );
if (aSObj)
{
_PTR(SComponent) aComponent(aSObj->GetFatherComponent());
- if ( aComponent && (aComponent->ComponentDataType() == myKind.latin1()) )
+ if ( aComponent && (aComponent->ComponentDataType() == myKind.toStdString()) )
return true;
}
}
#ifndef SALOMEAPP_TYPEFILTER_H
#define SALOMEAPP_TYPEFILTER_H
-#include <qstring.h>
+#include <QString>
#include "SalomeApp_Filter.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
-#include <SUIT_ResourceMgr.h>
+//#include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
#include <QtxWorkstack.h>
#include <STD_TabDesktop.h>
-#include <qptrlist.h>
-#include <qapplication.h>
-#include <qdict.h>
+#include <QList>
+#include <QApplication>
+#include <QMultiHash>
-#include <SALOMEDSClient_ClientFactory.hxx>
-#include <SALOMEDSClient_IParameters.hxx>
+#include <SALOMEDSClient_ClientFactory.hxx>//?
+#include <SALOMEDSClient_IParameters.hxx>//?
-#include <vector>
-#include <string>
+#include <vector>//?
+#include <string>//?
/*!
Constructor.
*/
void nameViewWindows( const ViewManagerList& lst )
{
- QDict<int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
- viewersCounter.setAutoDelete( true );
- for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it) {
- int view_count = it.current()->getViewsCount();
- QString vType = it.current()->getType();
+ QMultiHash<QString,int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
+ QListIterator<SUIT_ViewManager*> it(lst);
+ SUIT_ViewManager* aVM = 0;
+ while ( it.hasNext() ) {
+ aVM = it.next();
+ if ( !aVM ) continue;
+
+ int view_count = aVM->getViewsCount();
+ QString vType = aVM->getType();
if ( !view_count )
continue; //No views is opened in the viewer
- int* viewerID = viewersCounter[ vType ];
+ int viewerID = viewersCounter.value( vType );
if ( !viewerID ) {
- viewerID = new int( 0 );
+ viewerID = 0;
viewersCounter.insert( vType, viewerID );
}
else
- ++(*viewerID);
+ ++viewerID;
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ QVector<SUIT_ViewWindow*> views = aVM->getViews();
for ( int i = 0; i < view_count; i++ ) {
- QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( *viewerID ).arg( i );
- views[i]->setName( vName );
+ QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( viewerID ).arg( i );
+ views[i]->setObjectName( vName );
}
}
+ viewersCounter.clear();
}
/*!
// store active window's name
SUIT_ViewWindow* win = myApp->desktop()->activeWindow();
if ( win )
- ip->setProperty("AP_ACTIVE_VIEW", win->name() );
+ ip->setProperty("AP_ACTIVE_VIEW", win->objectName().toStdString() );
int viewerID = 0;
SUIT_ViewManager* vm = 0;
- for (QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it ) {
- vm = it.current();
+ QListIterator<SUIT_ViewManager*> it( lst );
+ while ( it.hasNext() ) {
+ vm = it.next();
+ if ( !vm ) continue;
+
int view_count = vm->getViewsCount();
if ( !view_count )
continue; //No views is opened in the viewer
- std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).latin1();
+ std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).toStdString();
ip->append("AP_VIEWERS_LIST", viewerEntry);
- QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ QVector<SUIT_ViewWindow*> views = vm->getViews();
for(int i = 0; i<view_count; i++) {
- ip->append( viewerEntry, views[i]->caption().latin1() );
- ip->append( viewerEntry, views[i]->getVisualParameters().latin1() );
+ ip->append( viewerEntry, views[i]->windowTitle().toStdString() );
+ ip->append( viewerEntry, views[i]->getVisualParameters().toStdString() );
}
}
QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack();
QString workstackInfo;
(*workstack) >> workstackInfo;
- ip->setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() );
+ ip->setProperty( "AP_WORKSTACK_INFO", workstackInfo.toStdString() );
}
//Save a name of the active module
if ( CAM_Module* activeModule = myApp->activeModule() )
- ip->setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().latin1() );
+ ip->setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().toStdString() );
//Store visual parameters of the modules
- QPtrList<CAM_Module> mlist;
+ QList<CAM_Module*> mlist;
myApp->modules( mlist );
+ QListIterator<CAM_Module*> itM( mlist );
CAM_Module* module = 0;
- for ( module = mlist.first(); module; module = mlist.next() ) {
+ while ( itM.hasNext() ) {
+ module = itM.next();
+ if ( !module ) continue;
+
if ( SalomeApp_Module* sModule = dynamic_cast<SalomeApp_Module*>( module ) ) {
- ip->append( "AP_MODULES_LIST", sModule->moduleName().latin1() );
+ ip->append( "AP_MODULES_LIST", sModule->moduleName().toStdString() );
sModule->storeVisualParameters( savePoint );
}
}
//Remove all already existent veiwers and their views
ViewManagerList lst;
myApp->viewManagers( lst );
- for ( QPtrListIterator<SUIT_ViewManager> it(lst); it.current(); ++it ) {
- myApp->removeViewManager( it.current() );
+ QListIterator<SUIT_ViewManager*> it(lst);
+ while ( it.hasNext() ) {
+ myApp->removeViewManager( it.next() );
qApp->processEvents();
}
//Restore the viewers and view windows
}
//Resize the views, set their captions and apply visual parameters.
- QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+ QVector<SUIT_ViewWindow*> views = vm->getViews();
for (int i = 0, j = 0; i<viewCount; i++, j++) {
viewWin = views[i];
if ( !viewWin )
while ( !viewWin->isVisible() )
qApp->processEvents();
- viewWin->setCaption(ip->getValue(viewerEntry, j).c_str());
+ viewWin->setWindowTitle(ip->getValue(viewerEntry, j).c_str());
// printf ( "VP for viewWin \"%s\": %s\n", viewerEntry.c_str(), ip->getValue(viewerEntry, j+1).c_str() );
viewersParameters[ viewWin ] = ip->getValue(viewerEntry, j+1).c_str();
// so here we store their visual parameters for later restoring..
lst.clear();
myApp->viewManagers(lst);
- QPtrListIterator<SUIT_ViewManager> it( lst );
- for ( ; it.current(); ++it ) {
- int view_count = it.current()->getViewsCount();
- QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
+ QListIterator<SUIT_ViewManager*> itVM( lst );
+ SUIT_ViewManager* aVM = 0;
+ while ( itVM.hasNext() ) {
+ aVM = itVM.next();
+ if ( !aVM ) continue;
+
+ int view_count = aVM->getViewsCount();
+ QVector<SUIT_ViewWindow*> views = aVM->getViews();
for ( int i = 0; i < view_count; i++ ) {
if ( !viewersParameters.contains( views[i] ) ) {
viewersParameters[ views[i] ] = views[i]->getVisualParameters();
- // printf ( "store VP for viewWin \"%s\": %s\n", views[i]->name(), views[i]->getVisualParameters().latin1() );
+ // printf ( "store VP for viewWin \"%s\": %s\n", views[i]->name(), views[i]->getVisualParameters().toLatin1().constData() );
}
}
}
std::string activeViewName = ip->getProperty("AP_ACTIVE_VIEW");
QMap<SUIT_ViewWindow*, QString>::Iterator mapIt;
for ( mapIt = viewersParameters.begin(); mapIt != viewersParameters.end(); ++mapIt ) {
- mapIt.key()->setVisualParameters( mapIt.data() );
- if ( activeViewName == mapIt.key()->name() )
+ mapIt.key()->setVisualParameters( mapIt.value() );
+ if ( activeViewName == mapIt.key()->objectName().toStdString() )
mapIt.key()->setFocus();
}
--- /dev/null
+<!DOCTYPE TS><TS>
+</TS>
msgid "SalomeApp_Application::MEN_DELETE_VS"
msgstr "Delete"
+
+//=======================================================================================
+
+msgid "APPCLOSE_SAVE"
+msgstr "&Save&&Close"
+
+msgid "APPCLOSE_CLOSE"
+msgstr "&Close w/o saving"
+
+msgid "APPCLOSE_UNLOAD"
+msgstr "&Unload"
+
+msgid "APPCLOSE_CANCEL"
+msgstr "&Cancel"
+
+msgid "APPCLOSE_CAPTION"
+msgstr "Close active study"
+
+msgid "APPCLOSE_DESCRIPTION"
+msgstr "Do you want to close or only unload the study"
+