]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
FIX: the icon of the "import MED" action in the menu "file"
authorboulant <boulant>
Wed, 17 Apr 2013 10:30:27 +0000 (10:30 +0000)
committerboulant <boulant>
Wed, 17 Apr 2013 10:30:27 +0000 (10:30 +0000)
src/MEDOP/gui/DatasourceController.cxx
src/MEDOP/gui/MEDOPModule.cxx
src/MEDOP/gui/MEDOPModule.hxx
src/MEDOP/gui/MED_images.ts
src/MEDOP/gui/MED_msg_fr.ts

index 6ca29b2236f18134375e64c235b5134d9cf8c110..861fb441ce61de6f368bc8a48ef4bece6060e389 100644 (file)
@@ -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"
index 2f580bcf1cf556fa55443e47a58d83518c6572f2..e32948385a1dae076d1286de8b41e71cf2023c0a 100644 (file)
@@ -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_ResourceMgr*>( 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<SalomeApp_Application*>( 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);
-  }
-}
index 578480ea6675dd96c00b75de95a38839fe4838bb..bf48d1b733849f1dd60459b5c1db22607b4ea780 100644 (file)
@@ -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;
index 50a15a5d4fbb9b2c1c75fad79a93ed35fb3946b9..3b312eda6a91268c6e6bd6651917a46be2dfbeb4 100644 (file)
@@ -5,7 +5,7 @@
     <name>@default</name>
     <message>
       <source>ICO_IMPORT_MED</source>
-      <translation>fileimport-32.png</translation>
+      <translation>datasource_add.png</translation>
     </message>
     <message>
       <source>ICO_DATASOURCE</source>
index 9578ff57670cb47973e33b70a68688a654716315..efef0fdfaf26a6f7399e51ba18c01fa266aaf2fa 100644 (file)
@@ -6,12 +6,12 @@
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="45"/>
       <source>LAB_ADD_DATA_SOURCE</source>
-      <translation>Ajouter des données</translation>
+      <translation>Importer des données MED</translation>
     </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="46"/>
       <source>TIP_ADD_DATA_SOURCE</source>
-      <translation>Ajouter un fichier de données (au format MED)</translation>
+      <translation>Ajouter des données par import de fichiers MED</translation>
     </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="52"/>
@@ -21,7 +21,7 @@
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="53"/>
       <source>TIP_ADD_IMAGE_SOURCE</source>
-      <translation>Créer des données à partir d'un fichier image</translation>
+      <translation>Ajouter des données par import d'un fichier image</translation>
     </message>
     <message>
       <location filename="MEDOP/gui/DatasourceController.cxx" line="62"/>