psln/Inc/PslnSoundActivator.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:16:19 +0100
branchRCL_3
changeset 56 d48ab3b357f1
parent 0 2f259fa3e83a
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2004-2007 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:  Handles activation of sound files linked to skins.
*
*/


#ifndef PSLNSOUNDACTIVATOR_H
#define PSLNSOUNDACTIVATOR_H

#include <e32base.h>
#include <e32std.h>
#include <AknsItemID.h>

class CPslnProfileSettingsLoader;

// TYPE DEFINITIONS

// Struct containing sound activation data.
struct TPslnSoundActivatorEntry
    {
    // Filename for the audio file.
    TFileName iFullName;
    // Skin instance id.
    TAknsItemID iID;
    };

/**
* Class that handles the activation of sound files linked to skins.
*
* @since 2.5
*/
class CPslnSoundActivator : public CBase
    {
    public:
        
        /**
        * Two-phased constructor.
        * @return new instance of CPslnSoundActivator.
        */
        static CPslnSoundActivator* NewLC();
        
        /**
        * Destructor.
        */
        virtual ~CPslnSoundActivator();

        /**
        * Collects sound files of the current. Call to this method
        * must precede any other calls (except construction).
        * @param aSkinPath path to collect from.
        * @param number of sound files found.
        */
        void CollectSoundsL( const TDesC& aSkinPath, TInt& aCount );

        /**
        * Activates sound files into profiles.
        */
        void ActivateToProfilesL();

    private:

        /**
        * Symbian 2nd phase constructor can leave.
        */
        void ConstructL();

        /**
        * Find the complete filename of the given sound file.
        */
        void FindSoundFile( 
            TDes& aFullName, 
            const TDesC& aSoundFile, 
            const TDesC& aSkinPath );

        /**
        * Moves the sound files possibly in the skin directory.
        */
        void MoveSoundFilesL();

        /**
        * C++ default constructor.
        */
        CPslnSoundActivator();

    private: // Data

        /*
        * Array of sound activation entries.
        */
        RArray<TPslnSoundActivatorEntry> iSoundArray;

        /*
        * Has the Profiles Tone Settings DLL already been loaded.
        */
        TBool iProfilesDllLoaded;

        /*
        * A handle to a dynamically loadable DLL.
        */
        RLibrary iProfilesDll;

        /*
        * Loads Profiles Tone Settings DLL dynamically to memory.
        * Allows use of the DLL through this pointer, but only for
        * methods implemented within.
        * Own.
        */
        CPslnProfileSettingsLoader* iProfilesSetter;
    };

#endif // PSLNSOUNDACTIVATOR_H
            
// End of File