From: vsr Date: Fri, 18 Apr 2008 13:04:37 +0000 (+0000) Subject: Improve SALOME style: provide standard icons for the message box X-Git-Tag: V5_0_0~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2bf31c52071be8c51da9dd2f0dac28a9abcb22eb;p=modules%2Fgui.git Improve SALOME style: provide standard icons for the message box --- diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index c4cf97577..ecead78c2 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -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 diff --git a/src/Style/Makefile.am b/src/Style/Makefile.am index c56fdb1a2..518ff8d09 100644 --- a/src/Style/Makefile.am +++ b/src/Style/Makefile.am @@ -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 index 000000000..7c529c541 --- /dev/null +++ b/src/Style/Style.qrc @@ -0,0 +1,8 @@ + + + images/critical.png + images/information.png + images/question.png + images/warning.png + + diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index 58b302c2a..ceb378a71 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -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 { diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h index 67e6472eb..edcfd1973 100644 --- a/src/Style/Style_Salome.h +++ b/src/Style/Style_Salome.h @@ -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 index 000000000..3cf8e5b53 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 index 000000000..3cd976403 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 index 000000000..b42fc1c7f 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 index 000000000..471ec5888 Binary files /dev/null and b/src/Style/images/warning.png differ