#include "SALOME_LifeCycleCORBA.hxx"
#include "QtxPopupMgr.h"
+#include <LightApp_Preferences.h>
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#endif
}
+void
+MEDModule::createPreferences()
+{
+ int genTab = addPreference(tr("PREF_TAB_GENERAL"));
+
+ int themeGroup = addPreference(tr("PREF_THEME_GROUP"), genTab);
+ setPreferenceProperty(themeGroup, "columns", 2);
+ int icons = addPreference(tr("PREF_ICONS"), themeGroup, LightApp_Preferences::Selector, "MEDCalc", "icons" );
+ QStringList iconsThemes;
+ iconsThemes.append(tr("PREF_ICON_THEME_MODERN"));
+ iconsThemes.append(tr("PREF_ICON_THEME_CLASSIC"));
+ QList<QVariant> indices;
+ indices.append(0);
+ indices.append(1);
+ setPreferenceProperty(icons, "strings", iconsThemes);
+ setPreferenceProperty(icons, "indexes", indices);
+}
+
bool
MEDModule::activateModule( SUIT_Study* theStudy )
{
virtual void windows(QMap<int, int>& theMap) const;
virtual void viewManagers(QStringList& theList) const;
+ virtual void createPreferences();
+
int createStandardAction(const QString& label,
QObject* slotobject,
const char* slotmember,
<source>ICO_WORKSPACE_SAVE</source>
<translation>workspace_save.png</translation>
</message>
+ <!-- Presentation toolbar icons (default theme)-->
<message>
- <source>ICO_PRESENTATION_SCALAR_MAP</source>
+ <source>ICO_PRESENTATION_SCALAR_MAP_DEFAULT</source>
<translation>scalarmap24.png</translation>
</message>
<message>
- <source>ICO_PRESENTATION_CONTOUR</source>
+ <source>ICO_PRESENTATION_CONTOUR_DEFAULT</source>
<translation>pqIsosurface24.png</translation>
</message>
<message>
- <source>ICO_PRESENTATION_VECTOR_FIELD</source>
+ <source>ICO_PRESENTATION_VECTOR_FIELD_DEFAULT</source>
<translation>pqGlyph24.png</translation>
</message>
<message>
- <source>ICO_PRESENTATION_SLICES</source>
+ <source>ICO_PRESENTATION_SLICES_DEFAULT</source>
<translation>pqSlice24.png</translation>
</message>
<message>
- <source>ICO_PRESENTATION_DEFLECTION_SHAPE</source>
+ <source>ICO_PRESENTATION_DEFLECTION_SHAPE_DEFAULT</source>
<translation>pqWarp24.png</translation>
</message>
<message>
- <source>ICO_PRESENTATION_POINT_SPRITE</source>
+ <source>ICO_PRESENTATION_POINT_SPRITE_DEFAULT</source>
<translation>pqNodeMapData24.png</translation>
</message>
+ <!-- Presentation tree icons (default theme)-->
<message>
- <source>ICO_MEDPresentationScalarMap</source>
+ <source>ICO_MEDPresentationScalarMap_DEFAULT</source>
<translation>scalarmap16.png</translation>
</message>
<message>
- <source>ICO_MEDPresentationContour</source>
+ <source>ICO_MEDPresentationContour_DEFAULT</source>
<translation>pqIsosurface16.png</translation>
</message>
<message>
- <source>ICO_MEDPresentationVectorField</source>
+ <source>ICO_MEDPresentationVectorField_DEFAULT</source>
<translation>pqGlyph16.png</translation>
</message>
<message>
- <source>ICO_MEDPresentationSlices</source>
+ <source>ICO_MEDPresentationSlices_DEFAULT</source>
<translation>pqSlice16.png</translation>
</message>
<message>
- <source>ICO_MEDPresentationDeflectionShape</source>
+ <source>ICO_MEDPresentationDeflectionShape_DEFAULT</source>
<translation>pqWarp16.png</translation>
</message>
<message>
- <source>ICO_MEDPresentationPointSprite</source>
+ <source>ICO_MEDPresentationPointSprite_DEFAULT</source>
<translation>pqNodeMapData16.png</translation>
</message>
+ <!-- Presentation toolbar icons (modern theme)-->
+ <message>
+ <source>ICO_PRESENTATION_SCALAR_MAP_MODERN</source>
+ <translation>scalarmap24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_CONTOUR_MODERN</source>
+ <translation>pqIsosurface24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_VECTOR_FIELD_MODERN</source>
+ <translation>pqGlyph24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_SLICES_MODERN</source>
+ <translation>pqSlice24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_DEFLECTION_SHAPE_MODERN</source>
+ <translation>pqWarp24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_POINT_SPRITE_MODERN</source>
+ <translation>pqNodeMapData24.png</translation>
+ </message>
+ <!-- Presentation tree icons (modern theme)-->
+ <message>
+ <source>ICO_MEDPresentationScalarMap_MODERN</source>
+ <translation>scalarmap16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationContour_MODERN</source>
+ <translation>pqIsosurface16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationVectorField_MODERN</source>
+ <translation>pqGlyph16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationSlices_MODERN</source>
+ <translation>pqSlice16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationDeflectionShape_MODERN</source>
+ <translation>pqWarp16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationPointSprite_MODERN</source>
+ <translation>pqNodeMapData16.png</translation>
+ </message>
+ <!-- Presentation toolbar icons (classic theme)-->
+ <message>
+ <source>ICO_PRESENTATION_SCALAR_MAP_CLASSIC</source>
+ <translation>visu_scalars24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_CONTOUR_CLASSIC</source>
+ <translation>visu_isosurfaces24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_VECTOR_FIELD_CLASSIC</source>
+ <translation>visu_vectors24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_SLICES_CLASSIC</source>
+ <translation>visu_cutplanes24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_DEFLECTION_SHAPE_CLASSIC</source>
+ <translation>visu_deformed24.png</translation>
+ </message>
+ <message>
+ <source>ICO_PRESENTATION_POINT_SPRITE_CLASSIC</source>
+ <translation>visu_points24.png</translation>
+ </message>
+ <!-- Presentation tree icons (classic theme)-->
+ <message>
+ <source>ICO_MEDPresentationScalarMap_CLASSIC</source>
+ <translation>visu_scalars16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationContour_CLASSIC</source>
+ <translation>visu_isosurfaces16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationVectorField_CLASSIC</source>
+ <translation>visu_vectors16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationSlices_CLASSIC</source>
+ <translation>visu_cutplanes16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationDeflectionShape_CLASSIC</source>
+ <translation>visu_deformed16.png</translation>
+ </message>
+ <message>
+ <source>ICO_MEDPresentationPointSprite_CLASSIC</source>
+ <translation>visu_points16.png</translation>
+ </message>
</context>
</TS>
<source>MEN_FILE</source>
<translation>&File</translation>
</message>
+ <message>
+ <source>PREF_TAB_GENERAL</source>
+ <translation>General</translation>
+ </message>
+ <message>
+ <source>PREF_THEME_GROUP</source>
+ <translation>Theme</translation>
+ </message>
+ <message>
+ <source>PREF_ICONS</source>
+ <translation>Icons</translation>
+ </message>
+ <message>
+ <source>PREF_ICON_THEME_MODERN</source>
+ <translation>Modern</translation>
+ </message>
+ <message>
+ <source>PREF_ICON_THEME_CLASSIC</source>
+ <translation>Classic</translation>
+ </message>
</context>
<context>
<name>WorkspaceController</name>
<source>MEN_FILE</source>
<translation>&Fichier</translation>
</message>
+ <message>
+ <source>PREF_TAB_GENERAL</source>
+ <translation>Général</translation>
+ </message>
+ <message>
+ <source>PREF_THEME_GROUP</source>
+ <translation>Thème</translation>
+ </message>
+ <message>
+ <source>PREF_ICONS</source>
+ <translation>Icones</translation>
+ </message>
+ <message>
+ <source>PREF_ICON_THEME_MODERN</source>
+ <translation>Moderne</translation>
+ </message>
+ <message>
+ <source>PREF_ICON_THEME_CLASSIC</source>
+ <translation>Classique</translation>
+ </message>
</context>
<context>
<name>WorkspaceController</name>
#include <SALOMEDS_Study.hxx>
#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
#include <QMessageBox>
static const int OPTIONS_VIEW_MODE_ID = 943;
STDLOG("Deleting the PresentationController");
}
+std::string
+PresentationController::_getIconName(const std::string& name)
+{
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if (!mgr)
+ return name;
+
+ // Read value from preferences and suffix name to select icon theme
+ int theme = mgr->integerValue("MEDCalc", "icons");
+ if (theme == 0) {
+ return name + "_MODERN";
+ } else if (theme == 1) {
+ return name + "_CLASSIC";
+ }
+ return name + "_DEFAULT";
+}
+
void
PresentationController::createActions()
{
// Presentations
label = tr("LAB_PRESENTATION_SCALAR_MAP");
tooltip = tr("TIP_PRESENTATION_SCALAR_MAP");
- QString icon = tr("ICO_PRESENTATION_SCALAR_MAP");
+ QString icon = tr(_getIconName("ICO_PRESENTATION_SCALAR_MAP").c_str());
int actionId;
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeScalarMap()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
label = tr("LAB_PRESENTATION_CONTOUR");
tooltip = tr("TIP_PRESENTATION_CONTOUR");
- icon = tr("ICO_PRESENTATION_CONTOUR");
+ icon = tr(_getIconName("ICO_PRESENTATION_CONTOUR").c_str());
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeContour()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
_salomeModule->action(actionId)->setIconVisibleInMenu(true);
label = tr("LAB_PRESENTATION_VECTOR_FIELD");
tooltip = tr("TIP_PRESENTATION_VECTOR_FIELD");
- icon = tr("ICO_PRESENTATION_VECTOR_FIELD");
+ icon = tr(_getIconName("ICO_PRESENTATION_VECTOR_FIELD").c_str());
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeVectorField()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
_salomeModule->action(actionId)->setIconVisibleInMenu(true);
label = tr("LAB_PRESENTATION_SLICES");
tooltip = tr("TIP_PRESENTATION_SLICES");
- icon = tr("ICO_PRESENTATION_SLICES");
+ icon = tr(_getIconName("ICO_PRESENTATION_SLICES").c_str());
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeSlices()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
_salomeModule->action(actionId)->setIconVisibleInMenu(true);
label = tr("LAB_PRESENTATION_DEFLECTION_SHAPE");
tooltip = tr("TIP_PRESENTATION_DEFLECTION_SHAPE");
- icon = tr("ICO_PRESENTATION_DEFLECTION_SHAPE");
+ icon = tr(_getIconName("ICO_PRESENTATION_DEFLECTION_SHAPE").c_str());
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizeDeflectionShape()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
_salomeModule->action(actionId)->setIconVisibleInMenu(true);
label = tr("LAB_PRESENTATION_POINT_SPRITE");
tooltip = tr("TIP_PRESENTATION_POINT_SPRITE");
- icon = tr("ICO_PRESENTATION_POINT_SPRITE");
+ icon = tr(_getIconName("ICO_PRESENTATION_POINT_SPRITE").c_str());
actionId = _salomeModule->createStandardAction(label,this, SLOT(OnVisualizePointSprite()),icon,tooltip);
_salomeModule->createTool(actionId, toolbarId);
_salomeModule->action(actionId)->setIconVisibleInMenu(true);
std::string name = MEDFactoryClient::getPresentationManager()->getPresentationProperty(presentationId, "name");
std::string icon = std::string("ICO_") + name;
+ icon = _getIconName(icon);
name = tr(name.c_str()).toStdString();
std::string label = tr(icon.c_str()).toStdString();
MEDCALC::MEDPresentationViewMode getSelectedViewMode();
signals:
- void presentationSignal(const PresentationEvent* event);
+ void presentationSignal(const PresentationEvent*);
protected slots:
void OnVisualizeScalarMap();
void OnVisualizeSlices();
void OnVisualizeDeflectionShape();
void OnVisualizePointSprite();
- void processWorkspaceEvent(const MEDCALC::MedEvent* event);
+ void processWorkspaceEvent(const MEDCALC::MedEvent*);
private:
void visualize(PresentationEvent::EventType);
- void updateTreeViewWithNewPresentation(long fieldId, long presentationId);
+ void updateTreeViewWithNewPresentation(long, long);
+ std::string _getIconName(const std::string&);
private:
MEDModule* _salomeModule;
ADD_SUBDIRECTORY(testfiles)
ADD_SUBDIRECTORY(presentations)
-SET(MED_RESOURCES_FILES
- datasource_add.png
- datasource_changeUnderlyingMesh.png
- datasource_interpolateField.png
- datasource_expandfield.png
- datasource_field.png
- datasource_mesh.png
- datasource.png
- datasource_use.png
- datasource_view.png
- fileimport-32.png
- folder.png
- image_add.png
- MEDCalc.png
- MEDCalc_small.png
- workspace_clean.png
- workspace_save.png
- pqAppIcon16.png
- )
+FILE(GLOB MED_RESOURCES_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
+
INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-SET(MED_RESOURCES_FILES
- pqGlyph16.png
- pqGlyph24.png
- pqIsosurface16.png
- pqIsosurface24.png
- pqNodeMapData16.png
- pqNodeMapData24.png
- pqSlice16.png
- pqSlice24.png
- pqWarp16.png
- pqWarp24.png
- scalarmap16.png
- scalarmap24.png
- )
-INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
+ADD_SUBDIRECTORY(modern)
+ADD_SUBDIRECTORY(classic)
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+FILE(GLOB MED_RESOURCES_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
+
+INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
--- /dev/null
+# Copyright (C) 2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+FILE(GLOB MED_RESOURCES_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
+
+INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})