From: vsr Date: Mon, 5 May 2014 11:36:32 +0000 (+0400) Subject: Correction to CoTech ACTION 61.7 implementation X-Git-Tag: V7_4_0rc1~2^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=41fb57a05af3212c44a734d58c44403ebbfe6d6b;p=modules%2Fgui.git Correction to CoTech ACTION 61.7 implementation - Change a way the default pixmap for resource manager is set/get. --- diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index 8e44f37f9..306362bd5 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -597,7 +597,7 @@ The changes will be applied on the next application session. PREF_CURRENT_LOCALE - Use C locale + Use "C" locale PREF_GROUP_LOOK_AND_FEEL diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index 0e74d6a8d..d3c2aa098 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -66,8 +66,6 @@ static const char* pixmap_not_found_xpm[] = { " ", " "}; -QPixmap* QtxResourceMgr::myDefaultPix = NULL; - /*! \class QtxResourceMgr::Resources \internal @@ -1239,6 +1237,7 @@ bool QtxResourceMgr::Format::save( Resources* res ) QtxResourceMgr::QtxResourceMgr( const QString& appName, const QString& resVarTemplate ) : myAppName( appName ), myCheckExist( true ), + myDefaultPix( 0 ), myIsPixmapCached( true ), myHasUserValues( true ), myWorkingMode( AllowUserValues ) @@ -1276,6 +1275,8 @@ QtxResourceMgr::~QtxResourceMgr() qDeleteAll( myResources ); qDeleteAll( myFormats ); + + delete myDefaultPix; } /*! @@ -2543,15 +2544,13 @@ QString QtxResourceMgr::sectionsToken() const \return default pixmap \sa setDefaultPixmap(), loadPixmap() */ -QPixmap QtxResourceMgr::defaultPixmap() +QPixmap QtxResourceMgr::defaultPixmap() const { - QPixmap res; - if(!myDefaultPix) - myDefaultPix = new QPixmap( pixmap_not_found_xpm ); - - if ( myDefaultPix && !myDefaultPix->isNull() ) - res = *myDefaultPix; - return res; + static QPixmap* defpx = 0; + if ( !defpx ) + defpx = new QPixmap( pixmap_not_found_xpm ); + + return myDefaultPix ? *myDefaultPix : *defpx; } /*! @@ -2568,7 +2567,7 @@ void QtxResourceMgr::setDefaultPixmap( const QPixmap& pix ) if ( pix.isNull() ) myDefaultPix = 0; else - myDefaultPix = new QPixmap( pix ); + myDefaultPix = new QPixmap( pix ); } /*! diff --git a/src/Qtx/QtxResourceMgr.h b/src/Qtx/QtxResourceMgr.h index 11eab4a4a..6abab3010 100644 --- a/src/Qtx/QtxResourceMgr.h +++ b/src/Qtx/QtxResourceMgr.h @@ -141,8 +141,8 @@ public: QString option( const QString& ) const; void setOption( const QString&, const QString& ); - static QPixmap defaultPixmap(); - static void setDefaultPixmap( const QPixmap& ); + QPixmap defaultPixmap() const; + virtual void setDefaultPixmap( const QPixmap& ); QString resSection() const; QString langSection() const; @@ -201,7 +201,7 @@ private: ResList myResources; //!< resources list bool myCheckExist; //!< "check existance" flag TransListMap myTranslator; //!< map of loaded translators - static QPixmap* myDefaultPix; //!< default icon + QPixmap* myDefaultPix; //!< default icon bool myIsPixmapCached; //!< "cached pixmaps" flag bool myHasUserValues; //!< \c true if user preferences has been read