[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/kpager
From:       Pino Toscano <pino () kde ! org>
Date:       2010-12-31 23:26:00
Message-ID: 20101231232600.90405AC8AE () svn ! kde ! org
[Download RAW message or body]

SVN commit 1210521 by pino:

Q3IntDict -> QHash


 M  +9 -10     desktop.cpp  
 M  +3 -4      desktop.h  


--- trunk/extragear/utils/kpager/desktop.cpp #1210520:1210521
@@ -64,7 +64,6 @@
   setAcceptDrops(true);
   setAttribute(Qt::WA_NoSystemBackground, true);
 
-  if (m_desk==1) Desktop::m_windowPixmaps.setAutoDelete(true);
   KSharedConfig::Ptr cfg = KGlobal::config();
   KConfigGroup grp(cfg,"KPager");
   m_transparentMode=static_cast<WindowTransparentMode>
@@ -560,9 +559,9 @@
   rSmall = QRect( r.x() * width() / dw, 2 + r.y() * height() / dh,
       r.width() * width() / dw, r.height() * height() / dh );
 
-  QPixmap *pixmap=m_windowPixmaps[info->win()];
+  QPixmap pixmap = m_windowPixmaps.value(info->win());
   bool isDirty=m_windowPixmapsDirty[info->win()];
-  if ( !pixmap || isDirty || m_grabWindows )
+  if ( !pixmap.isNull() || isDirty || m_grabWindows )
   {
     if ( isCurrent() )
     {
@@ -581,15 +580,15 @@
 		nWd = rSmall.width();
 		nHg = rSmall.height();
 	}
-	pixmap=new QPixmap(fastScalePixmap(tmp, nWd, nHg));
-	m_windowPixmaps.replace(info->win(),pixmap);
+	pixmap = fastScalePixmap(tmp, nWd, nHg);
+	m_windowPixmaps[info->win()] = pixmap;
 	m_windowPixmapsDirty.remove(info->win());
 	m_windowPixmapsDirty.insert(info->win(),false);
       }
     }
 
     // It was impossible to get the pixmap, let's fallback to the icon mode.
-    if ( !pixmap || pixmap->isNull() )
+    if ( pixmap.isNull() )
     {
       paintWindowIcon(p, info, onDesktop);
       return;
@@ -600,14 +599,14 @@
   if ( !onDesktop )
     rSmall.moveTopLeft(QPoint(0,0));
 
-  if (rSmall.width() != pixmap->width() || rSmall.height() != pixmap->height())
+  if (rSmall.width() != pixmap.width() || rSmall.height() != pixmap.height())
 	{
-		QPixmap pixmapSmall(fastScalePixmap(*pixmap,rSmall.width(),rSmall.height()));
+		QPixmap pixmapSmall(fastScalePixmap(pixmap,rSmall.width(),rSmall.height()));
 		p.drawPixmap( rSmall.topLeft(), pixmapSmall );
 	}
 	else
 	{
-		p.drawPixmap( rSmall.topLeft(), *pixmap);
+		p.drawPixmap( rSmall.topLeft(), pixmap);
 	}
 
 }
@@ -671,7 +670,7 @@
 
 QPixmap *Desktop::m_bgCommonSmallPixmap=0L;
 bool Desktop::m_isCommon=false;
-Q3IntDict<QPixmap> Desktop::m_windowPixmaps;
+QHash<WId, QPixmap> Desktop::m_windowPixmaps;
 QMap<int,bool> Desktop::m_windowPixmapsDirty;
 
 // Default Configuration -------------------------------------------------
--- trunk/extragear/utils/kpager/desktop.h #1210520:1210521
@@ -26,14 +26,13 @@
 #define __DESKTOP_H
 
 #include <QWidget>
-#include <Qt3Support/Q3IntDict>
-//Added by qt3to4:
 #include <QDragEnterEvent>
 #include <QMouseEvent>
 #include <QPixmap>
 #include <QDragMoveEvent>
 #include <QDropEvent>
 #include <QPaintEvent>
+#include <QHash>
 #include <kwindowsystem.h>
 
 class KSharedPixmap;
@@ -77,7 +76,7 @@
   void convertRectS2P(QRect &r);
   void convertCoordP2S(int &x, int &y);
 
-	static void removeCachedPixmap(int nWin) { m_windowPixmaps.remove(nWin); }
+  static void removeCachedPixmap(WId nWin) { m_windowPixmaps.remove(nWin); }
 
   QSize sizeHint() const;
 
@@ -112,7 +111,7 @@
   QPixmap *m_bgSmallPixmap;
   static QPixmap *m_bgCommonSmallPixmap;
   static bool m_isCommon;
-  static Q3IntDict<QPixmap> m_windowPixmaps;
+  static QHash<WId, QPixmap> m_windowPixmaps;
   static QMap<int,bool> m_windowPixmapsDirty;
   WindowTransparentMode m_transparentMode;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic