]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
[MEDCalc] View mode in a dedicated toolbar
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 18 Apr 2016 11:43:00 +0000 (13:43 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 18 Apr 2016 11:43:00 +0000 (13:43 +0200)
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.cxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.hxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.ui

index edeeb576c79516491c913e5fe65df3ba202ff50b..b727b6b4c722f69b27ef4079403aefcd5decb358 100644 (file)
 #include <SUIT_ResourceMgr.h>
 #include <QMessageBox>
 
+static const int OPTIONS_VIEW_MODE_ID = 943;
+static const int OPTIONS_VIEW_MODE_REPLACE_ID = 944;
+static const int OPTIONS_VIEW_MODE_OVERLAP_ID = 945;
+static const int OPTIONS_VIEW_MODE_NEW_LAYOUT_ID = 946;
+static const int OPTIONS_VIEW_MODE_SPLIT_VIEW_ID = 947;
+
 PresentationController::PresentationController(MEDModule* salomeModule)
 {
   STDLOG("Creating a PresentationController");
@@ -84,12 +90,44 @@ PresentationController::createActions()
 {
   STDLOG("Creating PresentationController actions");
 
+  // View Mode
+  int viewModeToolbarId = _salomeModule->createTool("View Mode", "ViewModeToolbar");
+  QtxActionGroup* ag = _salomeModule->createActionGroup(OPTIONS_VIEW_MODE_ID, true);
+  ag->setText("View mode");
+  ag->setUsesDropDown(true);
+  QString label   = tr("LAB_VIEW_MODE_REPLACE");
+  QString tooltip = tr("TIP_VIEW_MODE_REPLACE");
+  QAction* a = _salomeModule->createAction(OPTIONS_VIEW_MODE_REPLACE_ID,label,QIcon(),label,tooltip,0);
+  a->setCheckable(true);
+  a->setChecked(true);
+  ag->add(a);
+
+  label   = tr("LAB_VIEW_MODE_OVERLAP");
+  tooltip = tr("TIP_VIEW_MODE_OVERLAP");
+  a = _salomeModule->createAction(OPTIONS_VIEW_MODE_OVERLAP_ID,label,QIcon(),label,tooltip,0);
+  a->setCheckable(true);
+  ag->add(a);
+
+  label   = tr("LAB_VIEW_MODE_NEW_LAYOUT");
+  tooltip = tr("TIP_VIEW_MODE_NEW_LAYOUT");
+  a = _salomeModule->createAction(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID,label,QIcon(),label,tooltip,0);
+  a->setCheckable(true);
+  ag->add(a);
+
+  label   = tr("LAB_VIEW_MODE_SPLIT_VIEW");
+  tooltip = tr("TIP_VIEW_MODE_SPLIT_VIEW");
+  a = _salomeModule->createAction(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID,label,QIcon(),label,tooltip,0);
+  a->setCheckable(true);
+  ag->add(a);
+
+  _salomeModule->createTool(OPTIONS_VIEW_MODE_ID, viewModeToolbarId);
+
+  // Presentations
   int presentationToolbarId = _salomeModule->createTool("Presentations", "PresentationToolbar");
   int presentationMenuId = _salomeModule->createMenu(tr("MENU_PRESENTATIONS"), -1, 1);
 
-  // Presentations
-  QString label   = tr("LAB_PRESENTATION_SCALAR_MAP");
-  QString tooltip = tr("TIP_PRESENTATION_SCALAR_MAP");
+  label   = tr("LAB_PRESENTATION_SCALAR_MAP");
+  tooltip = tr("TIP_PRESENTATION_SCALAR_MAP");
   QString icon = tr(_getIconName("ICO_PRESENTATION_SCALAR_MAP").c_str());
   int actionId;
   actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeScalarMap()),icon,tooltip);
@@ -141,7 +179,21 @@ PresentationController::createActions()
 MEDCALC::MEDPresentationViewMode
 PresentationController::getSelectedViewMode()
 {
-  return _widgetPresentationParameters->getViewMode();
+  if (_salomeModule->action(OPTIONS_VIEW_MODE_REPLACE_ID)->isChecked()) {
+    return MEDCALC::VIEW_MODE_REPLACE;
+  }
+  else if (_salomeModule->action(OPTIONS_VIEW_MODE_OVERLAP_ID)->isChecked()) {
+    return MEDCALC::VIEW_MODE_OVERLAP;
+  }
+  else if (_salomeModule->action(OPTIONS_VIEW_MODE_NEW_LAYOUT_ID)->isChecked()) {
+    return MEDCALC::VIEW_MODE_NEW_LAYOUT;
+  }
+  else if (_salomeModule->action(OPTIONS_VIEW_MODE_SPLIT_VIEW_ID)->isChecked()) {
+    return MEDCALC::VIEW_MODE_SPLIT_VIEW;
+  }
+  // Should not happen
+  STDLOG("Strange!! No matching view mode found - returning VIEW_MODE_REPLACE.");
+  return MEDCALC::VIEW_MODE_REPLACE;
 }
 
 MEDCALC::MEDPresentationColorMap
index d314cfa355342193fd4587d2736196d590d283ef..380784b0200829cb8cc3d519c9e4fa3105abc5ca 100644 (file)
@@ -26,26 +26,6 @@ WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent)
   ui.setupUi(this); // To be done first
 }
 
-MEDCALC::MEDPresentationViewMode
-WidgetPresentationParameters::getViewMode() {
-  QString viewMode = this->ui.comboBoxViewMode->currentText();
-  if (viewMode == tr("LAB_VIEW_MODE_REPLACE")) {
-    return MEDCALC::VIEW_MODE_REPLACE;
-  }
-  else if (viewMode == tr("LAB_VIEW_MODE_OVERLAP")) {
-    return MEDCALC::VIEW_MODE_OVERLAP;
-  }
-  else if (viewMode == tr("LAB_VIEW_MODE_NEW_LAYOUT")) {
-    return MEDCALC::VIEW_MODE_NEW_LAYOUT;
-  }
-  else if (viewMode == tr("LAB_VIEW_MODE_SPLIT_VIEW")) {
-    return MEDCALC::VIEW_MODE_SPLIT_VIEW;
-  }
-  // Should not happen
-  STDLOG("Strange!! No matching view mode found - returning VIEW_MODE_REPLACE.");
-  return MEDCALC::VIEW_MODE_REPLACE;
-}
-
 std::string
 WidgetPresentationParameters::getField()
 {
index 0f88157598db1635c24623018b6d757f97df5fb3..b6dd8d36567a40bf3c8d3839d11fe069992d0958 100644 (file)
@@ -36,7 +36,6 @@ public:
   WidgetPresentationParameters(QWidget* parent = 0);
   virtual ~WidgetPresentationParameters() {}
 
-  MEDCALC::MEDPresentationViewMode getViewMode();
   std::string getField();
   std::string getScalarBarRange();
   double getScalarBarTimestep();
index 00882636e3fbef6ac6f7067e6bdd339ca8ae244d..f3feece34f1eb30b489c64b38f0b4fa4896c8da1 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>404</width>
-    <height>230</height>
+    <height>200</height>
    </rect>
   </property>
   <property name="minimumSize">
    <string>Form</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="1" column="0">
+   <item row="0" column="0">
     <widget class="QLabel" name="label">
      <property name="text">
       <string>LAB_FIELD</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="1">
+   <item row="0" column="1">
     <widget class="QComboBox" name="comboBoxField">
      <item>
       <property name="text">
@@ -36,7 +36,7 @@
      </item>
     </widget>
    </item>
-   <item row="5" column="0">
+   <item row="4" column="0">
     <widget class="QLabel" name="labelTimeStep">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="5" column="1">
+   <item row="4" column="1">
     <widget class="QDoubleSpinBox" name="doubleSpinBoxTimeStep">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="6" column="0">
+   <item row="5" column="0">
     <widget class="QLabel" name="labelMinVal">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="6" column="1">
+   <item row="5" column="1">
     <widget class="QDoubleSpinBox" name="doubleSpinBoxMinVal">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="7" column="0">
+   <item row="6" column="0">
     <widget class="QLabel" name="labelMaxVal">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="7" column="1">
+   <item row="6" column="1">
     <widget class="QDoubleSpinBox" name="doubleSpinBoxMaxVal">
      <property name="enabled">
       <bool>false</bool>
      </property>
     </widget>
    </item>
-   <item row="8" column="0">
+   <item row="7" column="0">
     <widget class="QLabel" name="label_3">
      <property name="text">
       <string>LAB_COLOR_MAP</string>
      </property>
     </widget>
    </item>
-   <item row="8" column="1">
+   <item row="7" column="1">
     <widget class="QComboBox" name="comboBoxColorMap">
      <item>
       <property name="text">
      </item>
     </widget>
    </item>
-   <item row="0" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>LAB_VIEW_MODE</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QComboBox" name="comboBoxViewMode">
-     <item>
-      <property name="text">
-       <string>LAB_VIEW_MODE_REPLACE</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>LAB_VIEW_MODE_OVERLAP</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>LAB_VIEW_MODE_NEW_LAYOUT</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>LAB_VIEW_MODE_SPLIT_VIEW</string>
-      </property>
-     </item>
-    </widget>
-   </item>
-   <item row="4" column="1">
+   <item row="3" column="1">
     <widget class="QComboBox" name="comboBoxScalarBarRange">
      <property name="enabled">
       <bool>true</bool>
      </item>
     </widget>
    </item>
-   <item row="2" column="0">
+   <item row="1" column="0">
     <widget class="QLabel" name="label_2">
      <property name="text">
       <string>LAB_SCALARBAR</string>
      </property>
     </widget>
    </item>
-   <item row="4" column="0">
+   <item row="3" column="0">
     <widget class="QLabel" name="label_5">
      <property name="enabled">
       <bool>true</bool>