#include <SALOME_LifeCycleCORBA.hxx>
#include <SALOMEDS_Study.hxx>
-#include <SALOME_Event.hxx>
+#include <SALOME_Event.h>
#include <QtxPopupMgr.h>
// QT Includes
-#include <qapplication.h>
-#include <qinputdialog.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-#include <qvariant.h>
-#include <qlineedit.h>
-#include <qspinbox.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qmessagebox.h>
-#include <qaction.h>
-#include <qtimer.h>
-#include <qthread.h>
-
+#include <QApplication>
+#include <QInputDialog>
+#include <QLayout>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QButtonGroup>
+#include <QLabel>
+#include <QComboBox>
+#include <QVariant>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QToolTip>
+#include <QWhatsThis>
+#include <QImage>
+#include <QPixmap>
+#include <QMessageBox>
+#include <QAction>
+#include <QTimer>
+#include <QThread>
+//#include <QPtrList>
+#include <QListIterator>
#include <stdexcept>
using namespace std;
-
//*****************************************************************************
// Global variable
//*****************************************************************************
virtual void Execute()
{
if (myIsError) {
- SUIT_MessageBox::error1(myApp->desktop(),
- "Save distributed MED file error",
- "Error while writing distributed MED file",
- myApp->tr("MULTIPR_BUT_OK"));
+ SUIT_MessageBox::critical((QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("SAVE_DISTMED_ERROR"),
+// QString("Save distributed MED file error"),
+ QObject::tr("WRIT_DISTMED_ERROR"));
+// QString("Error while writing distributed MED file"));
}
else {
myApp->updateObjectBrowser();
{
try
{
- mObj->save(mPath);
+ mObj->save(mPath.toLatin1());
}
catch(...)
{
//*****************************************************************************
// singleton
-MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (const CAM_Module* theModule)
+MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (SalomeApp_Application* app)
{
static MULTIPR_ORB::MULTIPR_Gen_ptr aGen = NULL;
if (!aGen)
{
SALOME_LifeCycleCORBA aLCC (SalomeApp_Application::namingService());
- Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer", "MULTIPR");
- aGen = MULTIPR_ORB::MULTIPR_Gen::_narrow(aComponent);
+ Engines::Component_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","MULTIPR" );
+ aGen = MULTIPR_ORB::MULTIPR_Gen::_narrow(comp);
if (!CORBA::is_nil(aGen))
{
// Set current study
- SalomeApp_Study* aSAStudy =
- dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
+ SalomeApp_Study* aSAStudy =dynamic_cast<SalomeApp_Study*>(app->activeStudy());
_PTR(Study) aStudy = aSAStudy->studyDS();
SALOMEDS::Study_ptr aStudyDS;
if (aStudy)
MULTIPR_GUI::MULTIPR_GUI()
: SalomeApp_Module("MULTIPR"),
+ LightApp_Module( "MULTIPR" ),
//mMULTIPRObj(NULL),
mMEDFileName(""),
mProgress(NULL)
{
SalomeApp_Module::initialize(app);
- GetMultiprGen(this);
+ GetMultiprGen(dynamic_cast<SalomeApp_Application*>( app ));
- QWidget* aParent = app->desktop();
+ QWidget* aParent = (QWidget*) application()->desktop();
SUIT_ResourceMgr* aResourceMgr = app->resourceMgr();
//-------------------------------------------------------------------------
createAction(
ACTION_IMPORT_MED,
tr("MULTIPR_TLT_IMPORT_FROM_MED_FILE"),
- QIconSet(aPixmapImportFromMEDFile),
+ QIcon(aPixmapImportFromMEDFile),
tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"),
tr("MULTIPR_STS_IMPORT_FROM_MED_FILE"),
- (CTRL + Key_I),
+ (Qt::CTRL + Qt::Key_I),
aParent,
false,
this,
createAction(
ACTION_SPLIT,
tr("MULTIPR_TLT_SPLIT"),
- QIconSet(),
+ QIcon(),
tr("MULTIPR_MEN_SPLIT"),
tr("MULTIPR_STS_SPLIT"),
0,
createAction(
ACTION_DECIMATE,
tr("MULTIPR_TLT_DECIMATE"),
- QIconSet(),
+ QIcon(),
tr("MULTIPR_MEN_DECIMATE"),
tr("MULTIPR_STS_DECIMATE"),
0,
createAction(
ACTION_REMOVE,
tr("MULTIPR_TLT_REMOVE"),
- QIconSet(),
+ QIcon(),
tr("MULTIPR_MEN_REMOVE"),
tr("MULTIPR_STS_REMOVE"),
0,
createAction(
ACTION_SAVE,
tr("MULTIPR_TLT_SAVE"),
- QIconSet(aPixmapSaveMEDFile),
+ QIcon(aPixmapSaveMEDFile),
tr("MULTIPR_MEN_SAVE"),
tr("MULTIPR_STS_SAVE"),
0,
mgr->insert( action(ACTION_SAVE), -1, -1, -1 );
QString aRule = "client='ObjectBrowser' and selcount>=1"; // $type in {'VISU::TMESH'}";
- mgr->setRule(action(ACTION_SPLIT), aRule, true);
- mgr->setRule(action(ACTION_DECIMATE), aRule, true);
- mgr->setRule(action(ACTION_REMOVE), aRule, true);
- mgr->setRule(action(ACTION_SAVE), aRule, true);
+ mgr->setRule(action(ACTION_SPLIT), aRule);
+ mgr->setRule(action(ACTION_DECIMATE), aRule);
+ mgr->setRule(action(ACTION_REMOVE), aRule);
+ mgr->setRule(action(ACTION_SAVE), aRule);
//-------------------------------------------------------------------------
// set progress dialog
QString MULTIPR_GUI::engineIOR() const
{
- CORBA::String_var anIOR = getApp()->orb()->object_to_string(GetMultiprGen(this));
+// SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(this);
+ CORBA::String_var anIOR = getApp()->orb()->object_to_string(GetMultiprGen(getApp()));
return QString(anIOR.in());
}
setMenuShown(true);
setToolShown(true);
- action(ACTION_IMPORT_MED)->setAccel(QKeySequence(CTRL + Key_I));
+ action(ACTION_IMPORT_MED)->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_I));
// Set current study
- MULTIPR_ORB::MULTIPR_Gen_ptr aGen = GetMultiprGen(this);
+ MULTIPR_ORB::MULTIPR_Gen_ptr aGen = GetMultiprGen(dynamic_cast<SalomeApp_Application*>(this));
SalomeApp_Study* aSAStudy = dynamic_cast<SalomeApp_Study*>(theStudy);
_PTR(Study) aStudy = aSAStudy->studyDS();
SALOMEDS::Study_ptr aStudyDS;
aGen->SetCurrentStudy(aStudyDS);
// Init mMULTIPRObj
- _PTR(SComponent) aSComp = aStudy->FindComponent(name());
+ _PTR(SComponent) aSComp = aStudy->FindComponent(name().toStdString());
if (aSComp) {
_PTR(ChildIterator) it (aStudy->NewChildIterator(aSComp));
if (it->More()) {
setToolShown(false);
// Unset actions accelerator keys
- action(ACTION_IMPORT_MED)->setAccel(QKeySequence());
+ action(ACTION_IMPORT_MED)->setShortcut(QKeySequence());
mMULTIPRObj = MULTIPR_ORB::MULTIPR_Obj::_nil();
void MULTIPR_GUI::windows(QMap<int, int>& theMap) const
{
theMap.clear();
- theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft);
- theMap.insert(SalomeApp_Application::WT_PyConsole, Qt::DockBottom);
+ theMap.insert(SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea);
+ theMap.insert(SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
}
aFilter.append(tr("MULTIPR_FLT_ALL_FILES"));
SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg(
- this->application()->desktop(),
+ (QWidget*) MULTIPR_GUI::desktop(),
true,
tr("") );
- fd->setCaption(tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"));
+ fd->setWindowTitle(tr("MULTIPR_MEN_IMPORT_FROM_MED_FILE"));
fd->setFilters(aFilter);
if (fd->exec() == QDialog::Rejected)
{
mMEDFileName = aFileInfo.filePath();
- QApplication::setOverrideCursor(Qt::waitCursor);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
// Delete previous MULTIPR object.
//if (mMULTIPRObj != NULL)
mMULTIPRObj->reset();
}
- MULTIPR_ORB::MULTIPR_Gen_ptr multiprgen = GetMultiprGen(this);
+ MULTIPR_ORB::MULTIPR_Gen_ptr multiprgen = GetMultiprGen(dynamic_cast<SalomeApp_Application*>( this ));
try
{
- mMULTIPRObj = multiprgen->getObject(mMEDFileName.latin1());
+ mMULTIPRObj = multiprgen->getObject(mMEDFileName.toLatin1());
}
catch(...)
{
- SUIT_MessageBox::error1(
- getApp()->desktop(),
- "Import MED file error",
- "Invalid MED file (not recognized by MULTIPR)",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::critical(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("IMPORT_MED_ERROR"),
+// "Import MED file error",
+ QObject::tr("INVALID_MED_FILE"));
+// "Invalid MED file (not recognized by MULTIPR)");
}
QApplication::restoreOverrideCursor();
// Now we need to save the file.
SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg(
- this->application()->desktop(),
+ (QWidget*) MULTIPR_GUI::desktop(),
true,
tr("") );
- fd->setCaption(tr("Save distributed MED file - Destination directory"));
- fd->setMode(QFileDialog::DirectoryOnly);
+ fd->setWindowTitle(tr("Save distributed MED file - Destination directory"));
+ fd->setFileMode(QFileDialog::DirectoryOnly);
if (fd->exec() == QDialog::Rejected)
{
QString path = aFileInfo.filePath();
- QApplication::setOverrideCursor(Qt::waitCursor);
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
mMULTIPRObj->resetSaveProgress();
MULTIPR_GUI_SaveThread* a = new MULTIPR_GUI_SaveThread (this, mMULTIPRObj, path);
//mProgress = new MULTIPR_GUI_ProgressCallbackDlg (getApp()->desktop());
//mProgress->start("Save mesh", 100);
if (mProgress == NULL)
- mProgress = new QProgressDialog ("Save mesh", "Cancel", /*totalSteps*/100, getApp()->desktop());
+ mProgress = new QProgressDialog ("Save mesh", "Cancel", 0,/*totalSteps*/100, (QWidget*) MULTIPR_GUI::desktop());
//mProgress->setProgress(0);
//mProgress->init(100);
//mTimer->start(500); // 0.5 seconds timer
if (mSelectedParts.count() == 0)
{
- SUIT_MessageBox::warn1(
- getApp()->desktop(),
- "Split warning",
- "No parts selected",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::warning(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("SPLIT_WARN"),
+// "Split warning",
+ QObject::tr("NO_PART_SELECTED"));
+// "No parts selected");
return;
}
if (mSelectedParts.count() == 0)
{
- SUIT_MessageBox::warn1(
- getApp()->desktop(),
- "Decimation warning",
- "No parts selected",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::warning(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DECIMATION_WARN"),
+// "Decimation warning",
+ QObject::tr("NO_PART_SELECTED"));
+// "No parts selected");
return;
}
const QStringList& partsList = this->getSelectedParts();
QString allParts = partsList.join("|");
- MULTIPR_ORB::string_array* listFields = this->getMULTIPRObj()->getFields(allParts.latin1());
+ MULTIPR_ORB::string_array* listFields = this->getMULTIPRObj()->getFields(allParts.toLatin1());
if (listFields->length() == 0)
{
- SUIT_MessageBox::error1(
- this->getAppli()->desktop(),
- "Decimation error",
- "No field for this part.",
- tr("OK") );
+ SUIT_MessageBox::critical(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DECIM_ERROR"),
+// "Decimation error",
+ QObject::tr("NO_FIELD_ON_PART"));
+// "No field for this part.",);
return ;
}
if (mSelectedParts.count() == 0)
{
- SUIT_MessageBox::warn1(
- getApp()->desktop(),
- "Remove warning",
- "No parts selected",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::warning(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DEL_WARN"),
+// "Remove warning",
+ QObject::tr("NO_PART_SELECTED"));
+// "No parts selected");
return;
}
if (QMessageBox::question(
- getApp()->desktop(),
- tr("Remove selected part(s)"),
- tr("Do you want to remove selected part(s)?"),
- tr("&Yes"), tr("&No"),
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DEL_SELECTED_PARTS"),
+// QObject::tr("Remove selected part(s)"),
+ QObject::tr("DEL_SELECTED_PARTS_QUEST"),
+// QObject::tr("Do you want to remove selected part(s)?"),
+ QObject::tr("&Yes"), tr("&No"),
QString::null, 0, 1 ) )
{
return;
}
- QApplication::setOverrideCursor(Qt::waitCursor);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
try
{
for (; it != last; it++)
{
const QString& partName = (*it);
- cout << "Remove " << partName.latin1() << endl;
- mMULTIPRObj->removeParts(partName.latin1());
+ cout << "Remove " << (const char*)partName.toLatin1() << endl;
+ mMULTIPRObj->removeParts(partName.toLatin1());
}
}
catch(...)
{
- SUIT_MessageBox::error1(
- getApp()->desktop(),
- "Remove error",
- "Error while removing selected part(s)",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::critical(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DEL_ERROR"),
+// "Remove error",
+ QObject::tr("ERROR_DEL_PART"));
+// "Error while removing selected part(s)");
}
QApplication::restoreOverrideCursor();
return;
}
- SalomeApp_CheckFileDlg* fd =
- new SalomeApp_CheckFileDlg(this->application()->desktop(),
- true,
- tr(""));
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( (QWidget*) MULTIPR_GUI::desktop(), true,tr(""));
- fd->setCaption(tr("Save distributed MED file - Destination directory"));
- fd->setMode(QFileDialog::DirectoryOnly);
+ fd->setWindowTitle(tr("Save distributed MED file - Destination directory"));
+ fd->setFileMode(QFileDialog::DirectoryOnly);
if (fd->exec() == QDialog::Rejected)
{
QFileInfo aFileInfo(fd->selectedFile());
delete fd;
- QApplication::setOverrideCursor(Qt::waitCursor);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
QString path = aFileInfo.filePath();
mMULTIPRObj->resetSaveProgress();
//mProgress = new MULTIPR_GUI_ProgressCallbackDlg (getApp()->desktop());
//mProgress->start("Save mesh", 100);
if (mProgress == NULL)
- mProgress = new QProgressDialog ("Save mesh", "Cancel", /*totalSteps*/100, getApp()->desktop());
+ mProgress = new QProgressDialog ("Save mesh", "Cancel", 0,/*totalSteps*/100, (QWidget*) MULTIPR_GUI::desktop());
//mProgress->setProgress(0);
//mProgress->init(100);
mTimer->start(500); // 0.5 seconds timer
{
int progress = mMULTIPRObj->getSaveProgress();
if (mProgress != NULL) {
- mProgress->setProgress(progress);
+ mProgress->setValue(progress);
if (progress >= 100) {
mTimer->stop();
for (QStringList::const_iterator it = userSelection.begin(), last = userSelection.end(); it != last; it++)
{
const QString& str = (*it);
- QStringList words = QStringList::split(":", str);
+ QStringList words = str.split(":");
if (words.count() == 2)
{
if (words[0] == "MULTIPR_PART")
const QString& partName = (*it);
QString partNameLow = partName + "_LOW";
QString partNameMed = partName + "_MED";
- const char* strPartNameLow = partNameLow.latin1();
- const char* strPartNameMed = partNameMed.latin1();
+ const char* strPartNameLow = partNameLow.toLatin1();
+ const char* strPartNameMed = partNameMed.toLatin1();
if (isPartExist(strPartNameLow))
{
partNameLowerResolution.push_back(partNameLow);
- cout << "Part to be removed: " << partNameLow << endl;
+ cout << "Part to be removed: " << strPartNameLow << endl;
}
if (isPartExist(strPartNameMed))
{
partNameLowerResolution.push_back(partNameMed);
- cout << "Part to be removed: " << partNameMed << endl;
+ cout << "Part to be removed: " << strPartNameMed << endl;
}
}
if (partNameLowerResolution.count() > 0)
{
if (QMessageBox::question(
- getApp()->desktop(),
- tr("Remove previous results"),
- tr("Do you want to remove previous results?"),
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DEL_PREV_RESULTS"),
+// tr("Remove previous results"),
+ QObject::tr("DEL_PREV_RESULTS_QUEST"),
+// tr("Do you want to remove previous results?"),
tr("&Yes"), tr("&No"),
QString::null, 0, 1 ) )
{
return false;
}
- QApplication::setOverrideCursor(Qt::waitCursor);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
try
{
last = partNameLowerResolution.end(); it != last; it++)
{
const QString& partName = (*it);
- cout << "Remove " << partName.latin1() << endl;
- mMULTIPRObj->removeParts(partName.latin1());
+ cout << "Remove " << (const char*)partName.toLatin1() << endl;
+ mMULTIPRObj->removeParts(partName.toLatin1());
}
}
catch(...)
{
- SUIT_MessageBox::error1(
- getApp()->desktop(),
- "Remove error",
- "Error while removing previous results",
- tr("MULTIPR_BUT_OK") );
+ SUIT_MessageBox::critical(
+ (QWidget*) MULTIPR_GUI::desktop(),
+ QObject::tr("DEL_ERROR"),
+// "Remove error",
+ QObject::tr("ERROR_DEL_PREV_RESULT"));
+// "Error while removing previous results",
}
QApplication::restoreOverrideCursor();
return true;
}
+SUIT_Desktop* MULTIPR_GUI::desktop()
+{
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if( app )
+ return app->desktop();
+ else
+ return 0;
+}
+
//*****************************************************************************
// Super class Data Object implementation
// Class Data Object Module implementation
//*****************************************************************************
+
MULTIPR_GUI_DataObject_Module::MULTIPR_GUI_DataObject_Module (CAM_DataModel* dm,
SUIT_DataObject* parent,
const char* name)
: MULTIPR_GUI_DataObject(parent, name),
- LightApp_ModuleObject(dm, parent),
+// LightApp_DataObject(dm, parent),
CAM_DataObject(parent)
{
// do nothing!
+ mDm = dm;
+ mParent = parent;
}
QString MULTIPR_GUI_DataObject_Module::name() const
{
- return CAM_RootObject::name();
+ CAM_ModuleObject cam(mDm,mParent);
+ return cam.name();
}
//*****************************************************************************
MULTIPR_GUI_DataModel::MULTIPR_GUI_DataModel(CAM_Module* module)
- //: LightApp_DataModel(module)
+// : LightApp_DataModel(module)
: SalomeApp_DataModel(module)
{
mMULTIPR_GUI = dynamic_cast<MULTIPR_GUI*>(module);
// do nothing!
}
-
void MULTIPR_GUI_DataModel::update (LightApp_DataObject*, LightApp_Study* theStudy)
{
LightApp_ModuleObject* modelRoot = dynamic_cast<LightApp_ModuleObject*>( root() );
DataObjectList ch;
+ //QListIterator<SUIT_DataObject> it1,it2;
QMap<SUIT_DataObject*,int> aMap;
if( modelRoot )
{
ch = modelRoot->children();
- for ( DataObjectListIterator it( ch ); it.current(); ++it )
- it.current()->setParent( 0 );
+ DataObjectList::const_iterator it = ch.begin(), it_last = ch.end();
+ for (; it != it_last; it++)
+ (*it)->setParent( 0);
}
buildAll(theStudy);
if( modelRoot )
{
DataObjectList new_ch = modelRoot->children();
- for ( DataObjectListIterator it1( new_ch ); it1.current(); ++it1 )
- aMap.insert( it1.current(), 0 );
+ DataObjectList::const_iterator it1 = new_ch.begin(), it1_last = new_ch.end();
+ for (; it1 != it1_last; it1++)
+ aMap.insert((*it1),0);
}
updateWidgets();
-
- for( DataObjectListIterator it( ch ); it.current(); ++it )
- if( !aMap.contains( it.current() ) )
- delete it.current();
+ DataObjectList::const_iterator it_del = ch.begin(), it_del_last = ch.end();
+ for (; it_del != it_del_last; it_del++)
+ if( !aMap.contains( (*it_del) ) )
+ delete (*it_del);
}
void MULTIPR_GUI_DataModel::build()
// find SObject in Study
MULTIPR_ORB::MULTIPR_Obj_ptr obj = MULTIPR_ORB::MULTIPR_Obj::_nil();
- _PTR(SComponent) aSComp = aSAStudy->studyDS()->FindComponent(module()->name());
+ _PTR(SComponent) aSComp = aSAStudy->studyDS()->FindComponent(module()->name().toStdString());
if (aSComp)
{
_PTR(ChildIterator) it (aSAStudy->studyDS()->NewChildIterator(aSComp));