src/hbcore/utils/hboogmwatcher.cpp
changeset 2 06ff229162e9
parent 0 16d8024aca5e
child 3 11d3954df52a
--- a/src/hbcore/utils/hboogmwatcher.cpp	Mon May 03 12:48:33 2010 +0300
+++ b/src/hbcore/utils/hboogmwatcher.cpp	Fri May 14 16:09:54 2010 +0300
@@ -35,6 +35,7 @@
 #include <hbvgeffect_p.h>
 #endif
 #include <QApplication>
+#include "hbiconloader_p.h"
 
 /*!
   \class HbOogmWatcher
@@ -71,6 +72,7 @@
 {
     Q_D(HbOogmWatcher);
     d->q_ptr = this;
+    d->mRenderMode = EHWRendering;
 }
 
 HbOogmWatcher::~HbOogmWatcher()
@@ -94,6 +96,10 @@
 void HbOogmWatcherPrivate::graphicsMemoryLow()
 {
     qWarning("HbOogmWatcher::graphicsMemoryLow()");
+    if (mRenderMode == EHWRendering) {        
+        mRenderMode = ESWRendering;
+        HbIconLoader::global()->switchRenderingMode(mRenderMode);
+    }    
 #ifdef HB_EFFECTS_OPENVG
     // Destroy the cached pixmaps of effects. This is also necessary
     // to make the OpenVG filter effect caching working properly. (if
@@ -112,7 +118,20 @@
         }
     }
     emit q_ptr->iconCleanupDone(n);
-    emit q_ptr->graphicsMemoryNeeded();
+    emit q_ptr->graphicsMemoryLow();
+}
+
+/*!
+  \internal
+*/
+void HbOogmWatcherPrivate::graphicsMemoryGood()
+{
+    qWarning("HbOogmWatcher::graphicsMemoryGood()");
+    if (mRenderMode == ESWRendering) {        
+        mRenderMode = EHWRendering;
+        HbIconLoader::global()->switchRenderingMode(mRenderMode);
+    }     
+    emit q_ptr->graphicsMemoryGood();
 }
 
 /*!  Registers an HbIconItem instance. Whenever graphics memory is
@@ -136,12 +155,3 @@
     Q_D(HbOogmWatcher);
     d->mIconItems.removeOne(item);
 }
-
-/*!  To be called by the framework (HbInstance) when a mainwindow becomes
-  available.
- */
-void HbOogmWatcher::mainWindowReady()
-{
-    Q_D(HbOogmWatcher);
-    d->mainWindowReady();
-}