]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Icons are shown in the object browser tree.
authorrkv <rkv@opencascade.com>
Mon, 2 Dec 2013 12:01:41 +0000 (12:01 +0000)
committerrkv <rkv@opencascade.com>
Mon, 2 Dec 2013 12:01:41 +0000 (12:01 +0000)
16 files changed:
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_DataObject.h
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/icon_artobj.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_bathymetry.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_calculation.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_hydro_obj.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_image.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_obstacle.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_partition.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_polyline.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_polyline_xy.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_profile.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_river.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_stream.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_vis_state.png [new file with mode: 0644]

index c35afa88d6f5bd148351adeed4d8934185efdcda..64f579ff688fb4f9aae0c57976a2ef08af460133 100644 (file)
@@ -24,6 +24,9 @@
 
 #include <SUIT_DataObject.h>
 #include <TDF_Tool.hxx>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <QPixmap>
 
 HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent, 
                                           Handle(HYDROData_Entity) theData,
@@ -99,6 +102,27 @@ QColor HYDROGUI_DataObject::color( const ColorRole theRole, const int theId ) co
   return aColor;
 }
 
+QPixmap HYDROGUI_DataObject::icon( const int theId ) const
+{
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  if ( theId == NameId )
+  {
+    QString anIcon;
+    Handle(HYDROData_Entity) aDataObject = modelObject();
+    if( aDataObject.IsNull() )
+    {
+      anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN
+    }
+    else
+    {
+      anIcon = QObject::tr( QString("HYDRO_TYPE%1_ICO").arg( (int)aDataObject->GetKind() ).toAscii() );
+    }
+
+    return aResMgr->loadPixmap( "HYDRO", anIcon );
+  }
+  return LightApp_DataObject::icon( theId );
+}
+
 QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
                                               const bool theWithPrefix )
 {
@@ -147,10 +171,19 @@ QString HYDROGUI_NamedObject::name() const
   return myName;
 }
 
+QPixmap HYDROGUI_NamedObject::icon( const int theId ) const
+{
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  if ( theId == NameId )
+  {
+    return aResMgr->loadPixmap( "HYDRO", QObject::tr( "PARTITION_ICO" ) );
+  }
+  return LightApp_DataObject::icon( theId );
+}
+
 HYDROGUI_DropTargetObject::HYDROGUI_DropTargetObject( SUIT_DataObject* theParent,
                                             const QString&   theName,
                                             const QString&   theParentEntry  )
 : HYDROGUI_NamedObject( theParent, theName, theParentEntry ), CAM_DataObject( theParent )
 {
 }
-
index 72f31ed52780cec3a6202fcb5f0412f4bfadcffd..ea9fb38c00edada61d75d32e37f9c25f085d0888 100644 (file)
@@ -85,6 +85,11 @@ public:
    */
   virtual QColor color( const ColorRole, const int = NameId ) const;
 
+  /**
+   * Returns the object icon.
+   */
+  virtual QPixmap icon( const int = NameId ) const;
+
   /**
    * Returns the model data object.
    */
@@ -121,6 +126,7 @@ protected:
   Handle(HYDROData_Entity) myData; ///< object from data model
   QString myParentEntry;
   bool myIsValid; ///< indicates if the object is valid
+  QPixmap myIcon;
 };
 
 /**
@@ -154,9 +160,15 @@ public:
    */
   virtual QString name() const;
 
+  /**
+   * Returns the object icon.
+   */
+  virtual QPixmap icon( const int = NameId ) const;
+
 private:
   QString myName; ///< name in the OB
   QString myParentEntry;
+  QPixmap myIcon;
 };
 
 /**
index 633906cf166c3ffe8ed7180fe4908cbab48f85e3..c2b9f7a8abee25f366da5214636b6b5dcedb3f27 100644 (file)
       <source>UNDO_ICO</source>
       <translation>icon_undo.png</translation>
     </message>
+    <message>
+      <source>PARTITION_ICO</source>
+      <translation>icon_partition.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE0_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE1_ICO</source>
+      <translation>icon_image.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE2_ICO</source>
+      <translation>icon_polyline.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE3_ICO</source>
+      <translation>icon_bathymetry.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE4_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE5_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE6_ICO</source>
+      <translation>icon_river.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE7_ICO</source>
+      <translation>icon_stream.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE8_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE9_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE10_ICO</source>
+      <translation>icon_obstacle.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE11_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE12_ICO</source>
+      <translation>icon_profile.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE13_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE14_ICO</source>
+      <translation>icon_polyline_xy.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE15_ICO</source>
+      <translation>icon_calculation.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE16_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE17_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE18_ICO</source>
+      <translation>icon_vis_state.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE19_ICO</source>
+      <translation>icon_artobj.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_TYPE20_ICO</source>
+      <translation>icon_hydro_obj.png</translation>
+    </message>
   </context>
 </TS>
diff --git a/src/HYDROGUI/resources/icon_artobj.png b/src/HYDROGUI/resources/icon_artobj.png
new file mode 100644 (file)
index 0000000..6dd0b2a
Binary files /dev/null and b/src/HYDROGUI/resources/icon_artobj.png differ
diff --git a/src/HYDROGUI/resources/icon_bathymetry.png b/src/HYDROGUI/resources/icon_bathymetry.png
new file mode 100644 (file)
index 0000000..59c4544
Binary files /dev/null and b/src/HYDROGUI/resources/icon_bathymetry.png differ
diff --git a/src/HYDROGUI/resources/icon_calculation.png b/src/HYDROGUI/resources/icon_calculation.png
new file mode 100644 (file)
index 0000000..005fdd1
Binary files /dev/null and b/src/HYDROGUI/resources/icon_calculation.png differ
diff --git a/src/HYDROGUI/resources/icon_hydro_obj.png b/src/HYDROGUI/resources/icon_hydro_obj.png
new file mode 100644 (file)
index 0000000..e48ff95
Binary files /dev/null and b/src/HYDROGUI/resources/icon_hydro_obj.png differ
diff --git a/src/HYDROGUI/resources/icon_image.png b/src/HYDROGUI/resources/icon_image.png
new file mode 100644 (file)
index 0000000..e8b8d51
Binary files /dev/null and b/src/HYDROGUI/resources/icon_image.png differ
diff --git a/src/HYDROGUI/resources/icon_obstacle.png b/src/HYDROGUI/resources/icon_obstacle.png
new file mode 100644 (file)
index 0000000..44279dc
Binary files /dev/null and b/src/HYDROGUI/resources/icon_obstacle.png differ
diff --git a/src/HYDROGUI/resources/icon_partition.png b/src/HYDROGUI/resources/icon_partition.png
new file mode 100644 (file)
index 0000000..f1ed9ab
Binary files /dev/null and b/src/HYDROGUI/resources/icon_partition.png differ
diff --git a/src/HYDROGUI/resources/icon_polyline.png b/src/HYDROGUI/resources/icon_polyline.png
new file mode 100644 (file)
index 0000000..7ab0765
Binary files /dev/null and b/src/HYDROGUI/resources/icon_polyline.png differ
diff --git a/src/HYDROGUI/resources/icon_polyline_xy.png b/src/HYDROGUI/resources/icon_polyline_xy.png
new file mode 100644 (file)
index 0000000..e33487d
Binary files /dev/null and b/src/HYDROGUI/resources/icon_polyline_xy.png differ
diff --git a/src/HYDROGUI/resources/icon_profile.png b/src/HYDROGUI/resources/icon_profile.png
new file mode 100644 (file)
index 0000000..83f75d9
Binary files /dev/null and b/src/HYDROGUI/resources/icon_profile.png differ
diff --git a/src/HYDROGUI/resources/icon_river.png b/src/HYDROGUI/resources/icon_river.png
new file mode 100644 (file)
index 0000000..0f23f0e
Binary files /dev/null and b/src/HYDROGUI/resources/icon_river.png differ
diff --git a/src/HYDROGUI/resources/icon_stream.png b/src/HYDROGUI/resources/icon_stream.png
new file mode 100644 (file)
index 0000000..cff29e0
Binary files /dev/null and b/src/HYDROGUI/resources/icon_stream.png differ
diff --git a/src/HYDROGUI/resources/icon_vis_state.png b/src/HYDROGUI/resources/icon_vis_state.png
new file mode 100644 (file)
index 0000000..b17fe38
Binary files /dev/null and b/src/HYDROGUI/resources/icon_vis_state.png differ