uiacceltk/hitchcock/goommonitor/src/goomactionconfig.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Configuration representation classes for Graphics Out of Memory Monitor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "goomactionconfig.h"
       
    20 #include "goomruleconfig.h"
       
    21 #include "goomtraces.h"
       
    22 
       
    23 // Add a rule
       
    24 // This class takes ownership of the given rule
       
    25 void CGOomActionConfig::AddRuleL(MGOomRuleConfig* aRule)    // Add the configuration for a rule (e.g. an idle time rule)
       
    26     {
       
    27     FUNC_LOG;
       
    28     
       
    29     iRules.AppendL(aRule);
       
    30     }
       
    31 	
       
    32 CGOomActionConfig::~CGOomActionConfig()
       
    33     {
       
    34     FUNC_LOG;
       
    35     
       
    36     iRules.ResetAndDestroy();
       
    37     iRules.Close();
       
    38     }
       
    39 
       
    40 // Utility function to return the priority for this action for the given rule
       
    41 TUint CGOomActionConfig::Priority(const CGOomWindowGroupList& aWindowGroupList, TInt aAppIndexInWindowGroup) const
       
    42     {
       
    43     FUNC_LOG;
       
    44     
       
    45     TUint priority = iDefaultPriority;
       
    46     
       
    47     // See if any rules apply
       
    48     TInt index = 0;
       
    49     while (index < iRules.Count())
       
    50         {
       
    51         if (iRules[index]->RuleIsApplicable(aWindowGroupList, aAppIndexInWindowGroup))
       
    52             {
       
    53             // If an applicable rule has been found, then apply the new priority
       
    54             // The last applicable rule in the config file should be used
       
    55             // This is ensured because the last rule in the list will be the last rule from the file
       
    56             if (iRules[index]->Priority())
       
    57                 priority = iRules[index]->Priority();
       
    58             }
       
    59         
       
    60         index++;
       
    61         }
       
    62         
       
    63     return priority;
       
    64     }
       
    65     
       
    66 void CGOomActionConfig::ConstructL()
       
    67     {
       
    68     FUNC_LOG;
       
    69     }
       
    70 	
       
    71 CGOomActionConfig::CGOomActionConfig(TInt32 aId) : iId(aId)
       
    72     {
       
    73     FUNC_LOG;
       
    74     }
       
    75 
       
    76