From: boulant Date: Wed, 17 Apr 2013 10:30:27 +0000 (+0000) Subject: FIX: the icon of the "import MED" action in the menu "file" X-Git-Tag: B4Mrg1804~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6975f1720a22216ce0f01b8f494fe22842ac465f;p=modules%2Fmed.git FIX: the icon of the "import MED" action in the menu "file" --- diff --git a/src/MEDOP/gui/DatasourceController.cxx b/src/MEDOP/gui/DatasourceController.cxx index 6ca29b223..861fb441c 100644 --- a/src/MEDOP/gui/DatasourceController.cxx +++ b/src/MEDOP/gui/DatasourceController.cxx @@ -67,6 +67,10 @@ void DatasourceController::createActions() { actionId = _salomeModule->createStandardAction(label,this, SLOT(OnAddDatasource()),icon,tooltip); _salomeModule->addActionInToolbar(actionId); + // This action has to be placed in the general file menu with the label "Import MED file" + int menuId = _salomeModule->createMenu( tr( "MEN_FILE" ), -1, 1 ); + _salomeModule->addActionInMenubar(actionId, menuId); + label = tr("LAB_ADD_IMAGE_SOURCE"); tooltip = tr("TIP_ADD_IMAGE_SOURCE"); icon = tr("ICO_IMAGE_ADD"); @@ -101,6 +105,7 @@ void DatasourceController::createActions() { icon = tr("ICO_DATASOURCE_CHANGE_MESH"); actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon); _salomeModule->addActionInPopupMenu(actionId); + } /** @@ -168,16 +173,30 @@ void DatasourceController::OnAddDatasource() QStringList filter; filter.append(tr("FILE_FILTER_MED")); + QString anInitialPath = ""; + if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) + anInitialPath = QDir::currentPath(); + + /* QString filename = SUIT_FileDlg::getFileName(_salomeModule->getApp()->desktop(), "", filter, tr("IMPORT_MED_FIELDS"), true); - - if ( filename.isEmpty() ) return; - - this->addDatasource(QCHARSTAR(filename)); - _salomeModule->updateObjBrowser(true); + */ + + QStringList filenames = SUIT_FileDlg::getOpenFileNames( _salomeModule->getApp()->desktop(), + anInitialPath, + filter, + tr("IMPORT_MED_FIELDS") ); + + if ( filenames.count() <= 0 ) return; + for ( QStringList::ConstIterator itFile = filenames.begin(); + itFile != filenames.end(); ++itFile ) { + QString filename = *itFile; + this->addDatasource(QCHARSTAR(filename)); + _salomeModule->updateObjBrowser(true); + } } #include "DlgImageToMed.hxx" diff --git a/src/MEDOP/gui/MEDOPModule.cxx b/src/MEDOP/gui/MEDOPModule.cxx index 2f580bcf1..e32948385 100644 --- a/src/MEDOP/gui/MEDOPModule.cxx +++ b/src/MEDOP/gui/MEDOPModule.cxx @@ -52,25 +52,6 @@ MEDOPModule::MEDOPModule() : // This part implements the mandatory interface // ===================================================================== // -//======================================================================= -// function : initialize -// purpose : -//======================================================================= -void MEDOPModule::initialize( CAM_Application* app ) { - StandardApp_Module::initialize( app ); - - QWidget* aParent = application()->desktop(); - SUIT_ResourceMgr* resMgr = dynamic_cast( SUIT_Session::session()->resourceMgr() ); - - QPixmap aPixmap = resMgr->loadPixmap("XMED", tr("ICO_IMPORT_MED")); - createAction( MEDOP_MENU_ACTION_ID_IMPORT_MED, tr("IMPORT_FROM_FILE"), QIcon(aPixmap), - tr("IMPORT_MED_FILE"), "", (Qt::CTRL + Qt::Key_M), aParent, false, - this, SLOT(onImportMedFile())); - - int xmedId = createMenu( tr( "MEN_FILE" ), -1, 1 ); - createMenu( MEDOP_MENU_ACTION_ID_IMPORT_MED, xmedId, 10 ); -} - /*! * Returns the engine of the XMED module, i.e. the SALOME component @@ -132,33 +113,3 @@ void MEDOPModule::createModuleActions() { // Creating actions concerning the workspace _workspaceController->createActions(); } - -void MEDOPModule::onImportMedFile() -{ - SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); - if( !app ) - return; - SUIT_Desktop* desktop = app->desktop(); - - QStringList filter; - filter.append( tr( "FILE_FILTER_MED" ) ); - - QString anInitialPath = ""; - if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) - anInitialPath = QDir::currentPath(); - - QString caption = tr( "IMPORT_FROM_FILE" ); - QStringList filenames = SUIT_FileDlg::getOpenFileNames( desktop, - anInitialPath, - filter, - caption ); - - if ( filenames.count() <= 0 ) - return; - - for ( QStringList::ConstIterator itFile = filenames.begin(); itFile != filenames.end(); ++itFile ) { - QString filename = *itFile; - _datasourceController->addDatasource(QCHARSTAR(filename)); - updateObjBrowser(true); - } -} diff --git a/src/MEDOP/gui/MEDOPModule.hxx b/src/MEDOP/gui/MEDOPModule.hxx index 578480ea6..bf48d1b73 100644 --- a/src/MEDOP/gui/MEDOPModule.hxx +++ b/src/MEDOP/gui/MEDOPModule.hxx @@ -47,8 +47,6 @@ class MEDOPGUI_EXPORT MEDOPModule: public StandardApp_Module public: MEDOPModule(); - virtual void initialize( CAM_Application* ); - protected: virtual Engines::EngineComponent_ptr getEngine() const; virtual QString studyIconName(); @@ -57,9 +55,6 @@ protected: virtual bool activateModule( SUIT_Study* theStudy ); virtual bool deactivateModule( SUIT_Study* theStudy ); - private slots: - void onImportMedFile(); - private: DatasourceController * _datasourceController; WorkspaceController * _workspaceController; diff --git a/src/MEDOP/gui/MED_images.ts b/src/MEDOP/gui/MED_images.ts index 50a15a5d4..3b312eda6 100644 --- a/src/MEDOP/gui/MED_images.ts +++ b/src/MEDOP/gui/MED_images.ts @@ -5,7 +5,7 @@ @default ICO_IMPORT_MED - fileimport-32.png + datasource_add.png ICO_DATASOURCE diff --git a/src/MEDOP/gui/MED_msg_fr.ts b/src/MEDOP/gui/MED_msg_fr.ts index 9578ff576..efef0fdfa 100644 --- a/src/MEDOP/gui/MED_msg_fr.ts +++ b/src/MEDOP/gui/MED_msg_fr.ts @@ -6,12 +6,12 @@ LAB_ADD_DATA_SOURCE - Ajouter des données + Importer des données MED TIP_ADD_DATA_SOURCE - Ajouter un fichier de données (au format MED) + Ajouter des données par import de fichiers MED @@ -21,7 +21,7 @@ TIP_ADD_IMAGE_SOURCE - Créer des données à partir d'un fichier image + Ajouter des données par import d'un fichier image