|
1 /* |
|
2 * Copyright (c) 2010 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 MSGAUDIOSELECTIONENGINE_H |
|
19 #define MSGAUDIOSELECTIONENGINE_H |
|
20 |
|
21 // SYSTEM INCLUDES |
|
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 <QObject> |
|
31 #include <QStringList> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 /** |
|
36 * This class is used for quering tones from mde. |
|
37 */ |
|
38 class MsgAudioSelectionEngine : public QObject, |
|
39 public MMdESessionObserver, |
|
40 public MMdEQueryObserver, |
|
41 public MMdEObjectObserver, |
|
42 public MMdEObjectPresentObserver |
|
43 { |
|
44 Q_OBJECT |
|
45 |
|
46 public: |
|
47 |
|
48 enum TStorageType |
|
49 { |
|
50 EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard |
|
51 }; |
|
52 |
|
53 enum TQueryAttribute |
|
54 { |
|
55 EAttrMediaType = 20, // integer |
|
56 EAttrFileSize, // integer |
|
57 EAttrStorageType, // integer |
|
58 EAttrMediaFileId, // integer |
|
59 EAttrFileName, // string |
|
60 EAttrFullName, // string |
|
61 EAttrSongName, // string |
|
62 EAttrArtist, // string |
|
63 EAttrAlbum, // string |
|
64 EAttrGenre, // string |
|
65 EAttrComposer |
|
66 // string |
|
67 }; |
|
68 |
|
69 public: |
|
70 MsgAudioSelectionEngine(); |
|
71 virtual ~MsgAudioSelectionEngine(); |
|
72 void CreateMetaDataSession(); |
|
73 signals: |
|
74 void mdeSessionOpened(); |
|
75 void mdeSessionError(int error); |
|
76 void queryComplete(QStringList nameList, QStringList uriList); |
|
77 void queryError(int error); |
|
78 void notifyObjectChanged(); |
|
79 |
|
80 public: |
|
81 static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr); |
|
82 void QueryTones(); |
|
83 void SetAttr(int attr, int value); |
|
84 |
|
85 private: |
|
86 void LeaveIfSessionClosedL(); |
|
87 CMdEPropertyDef& PropertyDefL(TInt aAttr); |
|
88 void QueryTonesL(); |
|
89 void HandleQueryCompletedL(CMdEQuery& aQuery, TInt aError); |
|
90 |
|
91 private: |
|
92 // from MMdESessionObserver |
|
93 void HandleSessionOpened(CMdESession& aSession, TInt aError); |
|
94 void HandleSessionError(CMdESession& aSession, TInt aError); |
|
95 |
|
96 private: |
|
97 // from MMdEQueryObserver (mdequery.h) |
|
98 void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, |
|
99 TInt aNewItemCount); |
|
100 void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); |
|
101 private: |
|
102 // from MMdEObjectObserver |
|
103 void HandleObjectNotification(CMdESession& aSession, |
|
104 TObserverNotificationType aType, |
|
105 const RArray<TItemId>& aObjectIdArray); |
|
106 |
|
107 private: |
|
108 // from MMdEObjectPresentObserver |
|
109 void HandleObjectPresentNotification(CMdESession& aSession, |
|
110 TBool aPresent, const RArray<TItemId>& aObjectIdArray); |
|
111 void AddObjectObserverL(); |
|
112 private: |
|
113 |
|
114 |
|
115 // session to metadata engine |
|
116 CMdESession* iSession; |
|
117 |
|
118 // metadata query |
|
119 CMdEObjectQuery* iQuery; |
|
120 |
|
121 // used for saving the quering result. |
|
122 //both name and uri. |
|
123 QStringList iNameList; |
|
124 QStringList iUriList; |
|
125 |
|
126 // is metadata session open |
|
127 TBool iSessionOpen; |
|
128 |
|
129 // max audio file file size |
|
130 TInt iMaxFileSize; |
|
131 |
|
132 // query error |
|
133 TInt iQueryError; |
|
134 }; |
|
135 #endif /* MSGAUDIOSELECTIONENGINE_H */ |
|
136 |