Salome HOME
Correction to CoTech ACTION 61.7 implementation
authorvsr <vsr@opencascade.com>
Mon, 5 May 2014 11:36:32 +0000 (15:36 +0400)
committervsr <vsr@opencascade.com>
Mon, 5 May 2014 11:36:32 +0000 (15:36 +0400)
- Change a way the default pixmap for resource manager is set/get.

src/LightApp/resources/LightApp_msg_en.ts
src/Qtx/QtxResourceMgr.cxx
src/Qtx/QtxResourceMgr.h

index 8e44f37f91d432028f327b653ac246ebc13d221b..306362bd5aad07ffd43610007a5495fcc209c468 100644 (file)
@@ -597,7 +597,7 @@ The changes will be applied on the next application session.</translation>
     </message>
     <message>
         <source>PREF_CURRENT_LOCALE</source>
-        <translation>Use C locale</translation>
+        <translation>Use &quot;C&quot; locale</translation>
     </message>
     <message>
         <source>PREF_GROUP_LOOK_AND_FEEL</source>
index 0e74d6a8dc6da70eac854cea7db917a72024dd44..d3c2aa09886e3cc147263455fac25344a10a76f1 100644 (file)
@@ -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 );
 }
 
 /*!
index 11eab4a4a5b7f0b41895b8fbd85203fb080a9313..6abab30100c71d21ec4b00239827dbd5cf35a9ce 100644 (file)
@@ -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