controlpanelui/src/tonefetcher/tonefetcherengine/private/symbian/toneselectionengine_p.h
changeset 19 36aa4756ee82
child 21 2883a5458389
equal deleted inserted replaced
12:624337f114fe 19:36aa4756ee82
       
     1 /*
       
     2  * Copyright (c) 2009 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:
       
    15  *     The header file for mde tone fetcher.
       
    16  *     
       
    17  */
       
    18 #ifndef TONESELECTIONENGINEPRIVATE_H
       
    19 #define TONESELECTIONENGINEPRIVATE_H
       
    20 
       
    21 #include "toneselectionengine_p.h"
       
    22 #include <mdesession.h>
       
    23 #include <mdequery.h>
       
    24 #include <mdelogiccondition.h>
       
    25 #include <mdeconstants.h>
       
    26 #include <mdeobjectquery.h>
       
    27 #include <mdccommon.h>
       
    28 #include <mdeitem.h>
       
    29 #include <mdeobject.h>
       
    30 #include <e32base.h>
       
    31 #include <QObject>
       
    32 #include <QStringList>
       
    33 // FORWARD DECLARATIONS
       
    34 class ToneFetcherEngine;
       
    35 // CONSTANTS
       
    36 _LIT( KMimeMp3, "mp3" );
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40  *  This class is used for quering tones from mde.
       
    41  *
       
    42  */
       
    43 class ToneSelectionEnginePrivate : public QObject,
       
    44                             public CBase, 
       
    45                             public MMdESessionObserver,
       
    46                             public MMdEQueryObserver,
       
    47                             public MMdEObjectObserver,
       
    48                             public MMdEObjectPresentObserver                            
       
    49 {
       
    50     Q_OBJECT
       
    51 public:
       
    52 
       
    53     enum TStorageType
       
    54         {
       
    55         EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard
       
    56         };
       
    57     
       
    58     enum TQueryAttribute
       
    59         {
       
    60         EAttrMediaType = 20, // integer
       
    61         EAttrFileSize, // integer
       
    62         EAttrStorageType, // integer
       
    63         EAttrMediaFileId, // integer
       
    64         EAttrFileName, // string
       
    65         EAttrFullName, // string
       
    66         EAttrSongName, // string
       
    67         EAttrArtist, // string
       
    68         EAttrAlbum, // string
       
    69         EAttrGenre, // string
       
    70         EAttrComposer
       
    71         // string
       
    72         };
       
    73 
       
    74 public:
       
    75     ToneSelectionEnginePrivate(  ToneFetcherEngine *engine );
       
    76     virtual ~ToneSelectionEnginePrivate();
       
    77     
       
    78 signals:
       
    79     void mdeSessionOpened();
       
    80     void mdeSessionError( int error );
       
    81     void queryComplete( QStringList nameList, QStringList uriList );
       
    82     void queryError( int error );
       
    83     void notifyObjectChanged();
       
    84 
       
    85 
       
    86 public:
       
    87     static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr);
       
    88     void QueryTones();   
       
    89     void SetAttr( int attr, int value );
       
    90 
       
    91 private:   
       
    92     void ExcludeMusicPropertiesL(CMdELogicCondition& aCondition);    
       
    93     void LeaveIfSessionClosedL();
       
    94     CMdEPropertyDef& PropertyDefL(TInt aAttr);
       
    95 
       
    96 private:
       
    97     // from MMdESessionObserver
       
    98     void HandleSessionOpened(CMdESession& aSession, TInt aError);
       
    99     void HandleSessionError(CMdESession& aSession, TInt aError);
       
   100 
       
   101 private:
       
   102     // from MMdEQueryObserver (mdequery.h)
       
   103     void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex,
       
   104             TInt aNewItemCount);
       
   105     void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);    
       
   106 private:
       
   107     // from MMdEObjectObserver
       
   108     void HandleObjectNotification(CMdESession& aSession,
       
   109             TObserverNotificationType aType,
       
   110             const RArray<TItemId>& aObjectIdArray);
       
   111 
       
   112 private:
       
   113     // from MMdEObjectPresentObserver
       
   114     void HandleObjectPresentNotification(CMdESession& aSession,
       
   115             TBool aPresent, const RArray<TItemId>& aObjectIdArray);
       
   116     void AddObjectObserverL();
       
   117 private:
       
   118 
       
   119     ToneFetcherEngine *mServiceEngine;
       
   120 
       
   121     // session to metadata engine
       
   122     CMdESession* iSession;
       
   123 
       
   124     // metadata query
       
   125     CMdEObjectQuery* iQuery;
       
   126 
       
   127     // used for saving the quering result.
       
   128     //both name and uri.
       
   129     QStringList iNameList;
       
   130     QStringList iUriList;
       
   131 
       
   132     // is metadata session open
       
   133     TBool iSessionOpen;
       
   134 
       
   135     // max audio file file size
       
   136     TInt iMaxFileSize;
       
   137     
       
   138     // query error
       
   139     TInt iQueryError;
       
   140 };
       
   141 #endif /* TONESELECTIONENGINE_H_ */
       
   142