main/glxapplication.cpp
author hgs
Thu, 14 Oct 2010 17:54:23 +0530
changeset 72 0a8e959402e5
parent 58 383b67fbdb11
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:   ?Description
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
//include
hgs
parents:
diff changeset
    19
#include <qsymbianevent.h>
hgs
parents:
diff changeset
    20
#include <oommonitorplugin.h>
58
hgs
parents: 44
diff changeset
    21
#include <hbinstance.h>
44
hgs
parents:
diff changeset
    22
#include <w32std.h>
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
//userinclude
hgs
parents:
diff changeset
    25
#include "glxapplication.h"
hgs
parents:
diff changeset
    26
#include "mglxcache.h"
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
GlxApplication::GlxApplication( int &argc, char *argv[ ], Hb::ApplicationFlags flags )
hgs
parents:
diff changeset
    29
    : HbApplication( argc, argv, flags )
hgs
parents:
diff changeset
    30
{
hgs
parents:
diff changeset
    31
}
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
GlxApplication::GlxApplication( QApplication::QS60MainApplicationFactory factory, int &argc, char *argv[], Hb::ApplicationFlags flags  )
hgs
parents:
diff changeset
    34
    : HbApplication( factory, argc, argv, flags )
hgs
parents:
diff changeset
    35
{
hgs
parents:
diff changeset
    36
}
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
bool GlxApplication::symbianEventFilter(const QSymbianEvent *aQSEvent)
hgs
parents:
diff changeset
    39
{
hgs
parents:
diff changeset
    40
    if ( aQSEvent->type( ) == QSymbianEvent::WindowServerEvent ) {
hgs
parents:
diff changeset
    41
        const TWsEvent *aEvent = aQSEvent->windowServerEvent();
hgs
parents:
diff changeset
    42
        if ( aEvent && aEvent->Type() == KAppOomMonitor_FreeRam ) {
hgs
parents:
diff changeset
    43
            cleanUpCache();
hgs
parents:
diff changeset
    44
        }
hgs
parents:
diff changeset
    45
    }
hgs
parents:
diff changeset
    46
    return HbApplication::symbianEventFilter( aQSEvent );
hgs
parents:
diff changeset
    47
}
hgs
parents:
diff changeset
    48
58
hgs
parents: 44
diff changeset
    49
void GlxApplication::initMattiAutomation()
hgs
parents: 44
diff changeset
    50
{
hgs
parents: 44
diff changeset
    51
    //For Matti Automation 
hgs
parents: 44
diff changeset
    52
    //Monitor the first view ready signal to emit the application ready signal.
hgs
parents: 44
diff changeset
    53
    HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 44
diff changeset
    54
    connect( window, SIGNAL( viewReady() ), this, SLOT( handleAppReady() ) );    
hgs
parents: 44
diff changeset
    55
}
hgs
parents: 44
diff changeset
    56
hgs
parents: 44
diff changeset
    57
void GlxApplication::handleAppReady()
hgs
parents: 44
diff changeset
    58
{
hgs
parents: 44
diff changeset
    59
    emit applicationReady();
hgs
parents: 44
diff changeset
    60
    HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 44
diff changeset
    61
    disconnect( window, SIGNAL( viewReady() ), this, SLOT( handleAppReady() ) ); 
hgs
parents: 44
diff changeset
    62
}
hgs
parents: 44
diff changeset
    63
44
hgs
parents:
diff changeset
    64
void GlxApplication::cleanUpCache()
hgs
parents:
diff changeset
    65
{
hgs
parents:
diff changeset
    66
    qDebug("GlxApplication::cleanUpCache()");
hgs
parents:
diff changeset
    67
    MGlxCache* cacheManager = MGlxCache::InstanceL();
hgs
parents:
diff changeset
    68
    cacheManager->ReleaseRAML(true);
hgs
parents:
diff changeset
    69
    cacheManager->Close();
hgs
parents:
diff changeset
    70
}
hgs
parents:
diff changeset
    71