main/glxapplication.cpp
author William Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:33:32 +0100
branchGCC_SURGE
changeset 51 525c140ec8db
parent 48 d0b4e67b3a60
child 58 383b67fbdb11
permissions -rw-r--r--
Catchup to latest Symbian^4

/*
* 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();
}