main/glxapplication.cpp
branchGCC_SURGE
changeset 51 525c140ec8db
parent 48 d0b4e67b3a60
child 58 383b67fbdb11
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/glxapplication.cpp	Thu Jul 22 16:33:32 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   ?Description
+*
+*/
+
+//include
+#include <qsymbianevent.h>
+#include <oommonitorplugin.h>
+#include <w32std.h>
+
+//userinclude
+#include "glxapplication.h"
+#include "mglxcache.h"
+
+GlxApplication::GlxApplication( int &argc, char *argv[ ], Hb::ApplicationFlags flags )
+    : HbApplication( argc, argv, flags )
+{
+}
+
+GlxApplication::GlxApplication( QApplication::QS60MainApplicationFactory factory, int &argc, char *argv[], Hb::ApplicationFlags flags  )
+    : HbApplication( factory, argc, argv, flags )
+{
+}
+
+bool GlxApplication::symbianEventFilter(const QSymbianEvent *aQSEvent)
+{
+    if ( aQSEvent->type( ) == QSymbianEvent::WindowServerEvent ) {
+        const TWsEvent *aEvent = aQSEvent->windowServerEvent();
+        if ( aEvent && aEvent->Type() == KAppOomMonitor_FreeRam ) {
+            cleanUpCache();
+        }
+    }
+    return HbApplication::symbianEventFilter( aQSEvent );
+}
+
+void GlxApplication::cleanUpCache()
+{
+    qDebug("GlxApplication::cleanUpCache()");
+    MGlxCache* cacheManager = MGlxCache::InstanceL();
+    cacheManager->ReleaseRAML(true);
+    cacheManager->Close();
+}
+