]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Improve SALOME style: provide standard icons for the message box
authorvsr <vsr@opencascade.com>
Fri, 18 Apr 2008 13:04:37 +0000 (13:04 +0000)
committervsr <vsr@opencascade.com>
Fri, 18 Apr 2008 13:04:37 +0000 (13:04 +0000)
adm_local/unix/make_common_starter.am
src/Style/Makefile.am
src/Style/Style.qrc [new file with mode: 0644]
src/Style/Style_Salome.cxx
src/Style/Style_Salome.h
src/Style/images/critical.png [new file with mode: 0644]
src/Style/images/information.png [new file with mode: 0644]
src/Style/images/question.png [new file with mode: 0644]
src/Style/images/warning.png [new file with mode: 0644]

index c4cf97577072badf34f5486121636ab5cb26263b..ecead78c2220067d91721ebad8437b3426bb962f 100644 (file)
@@ -39,7 +39,11 @@ docdir             = $(datadir)/doc/@PACKAGE@
 %.qm: resources/%.ts
        $(LRELEASE) $< -qm $@
 
-EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=resources/%.ts)
+# resource files generation
+qrc_%.cxx: %.qrc
+       $(QRCC) $< -o $@ -name $(*F)
+
+EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cpp=%.qrc) $(nodist_salomeres_DATA:%.qm=resources/%.ts)
 
 mostlyclean-local:
        rm -f @builddir@/*_moc.cxx
index c56fdb1a21e3adc782d4758c217150e002dc63dd..518ff8d094003855908e7162a8b325d3c0e17f53 100644 (file)
@@ -38,11 +38,14 @@ dist_libSalomeStyle_la_SOURCES= \
 
 MOC_FILES= \
        Style_Salome_moc.cxx
-nodist_libSalomeStyle_la_SOURCES= $(MOC_FILES)
+
+QRC_FILES= \
+       qrc_Style.cxx
+
+nodist_libSalomeStyle_la_SOURCES= $(MOC_FILES) $(QRC_FILES)
 
 libSalomeStyle_la_CPPFLAGS=$(QT_INCLUDES) \
        -I$(srcdir)/../Qtx
 
 libSalomeStyle_la_LDFLAGS=$(QT_MT_LIBS) \
        ../Qtx/libqtx.la
-
diff --git a/src/Style/Style.qrc b/src/Style/Style.qrc
new file mode 100644 (file)
index 0000000..7c529c5
--- /dev/null
@@ -0,0 +1,8 @@
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+     <file>images/critical.png</file>
+     <file>images/information.png</file>
+     <file>images/question.png</file>
+     <file>images/warning.png</file>
+ </qresource>
+ </RCC>
index 58b302c2a5bc2ca6a104b12ed3a65813d1306412..ceb378a71f891a7e6a4e5d87cea40ca30c9354f2 100644 (file)
@@ -163,6 +163,8 @@ static const char* const minimize_xpm[] = {
 Style_Salome::Style_Salome()
   : QWindowsStyle()
 {
+  Q_INIT_RESOURCE(Style);
+
   myModel = new Style_Model();
   myModel->setDefaults( qApp );
 
@@ -1844,6 +1846,26 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption
   }
 }
 
+QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, 
+                                               const QStyleOption* opt,
+                                               const QWidget* widget ) const
+{
+  switch ( standardIcon )
+  {
+  case SP_MessageBoxInformation:
+    return QPixmap( ":/images/information.png" );
+  case SP_MessageBoxWarning:
+    return QPixmap( ":/images/warning.png" );
+  case SP_MessageBoxCritical:
+    return QPixmap( ":/images/critical.png" );
+  case SP_MessageBoxQuestion:
+    return QPixmap( ":/images/question.png" );
+  default:
+    break;
+  }
+  return QWindowsStyle::standardIconImplementation( standardIcon, opt, widget );
+}
+
 int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWidget* widget,
                             QStyleHintReturn* returnData ) const
 {
index 67e6472eb58dc31e0573c3f1afd3a455e01d1ef5..edcfd1973cc8e26b0f405fd4f3885bc7bae7998e 100644 (file)
@@ -69,6 +69,10 @@ public:
                                  SubControl, const QWidget* = 0 ) const;
   virtual QRect   subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
 
+protected slots:
+  QIcon standardIconImplementation( StandardPixmap, const QStyleOption* = 0,
+                                   const QWidget* = 0 ) const;
+
 private:
   void            updatePaletteColors();
   void            updateAllWidgets( QApplication* );
diff --git a/src/Style/images/critical.png b/src/Style/images/critical.png
new file mode 100644 (file)
index 0000000..3cf8e5b
Binary files /dev/null and b/src/Style/images/critical.png differ
diff --git a/src/Style/images/information.png b/src/Style/images/information.png
new file mode 100644 (file)
index 0000000..3cd9764
Binary files /dev/null and b/src/Style/images/information.png differ
diff --git a/src/Style/images/question.png b/src/Style/images/question.png
new file mode 100644 (file)
index 0000000..b42fc1c
Binary files /dev/null and b/src/Style/images/question.png differ
diff --git a/src/Style/images/warning.png b/src/Style/images/warning.png
new file mode 100644 (file)
index 0000000..471ec58
Binary files /dev/null and b/src/Style/images/warning.png differ