|
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 source file for tone fetcher engine private class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "tonefetcherengine_symbian.h" |
|
21 #include "CToneSelection.h" |
|
22 #include "CTonePlayer.h" |
|
23 #include "tonefetcherutils.h" |
|
24 #include <XQConversions> |
|
25 |
|
26 ToneFetcherEnginePrivate::ToneFetcherEnginePrivate() |
|
27 { |
|
28 TRAP_IGNORE( mToneSelection = CToneSelection::NewL( this ) ); |
|
29 TRAP_IGNORE( mTonePlayer = CTonePlayer::NewL( this ) ); |
|
30 } |
|
31 |
|
32 ToneFetcherEnginePrivate::~ToneFetcherEnginePrivate() |
|
33 { |
|
34 mResultList.clear(); |
|
35 delete mToneSelection; |
|
36 delete mTonePlayer; |
|
37 } |
|
38 |
|
39 void ToneFetcherEnginePrivate::getTones() |
|
40 { |
|
41 QT_TRAP_THROWING( mToneSelection->QueryTonesL() ); |
|
42 } |
|
43 |
|
44 void ToneFetcherEnginePrivate::play(const QString &file) |
|
45 { |
|
46 QT_TRAP_THROWING( mTonePlayer->SetAttrL( XQConversions::qStringToS60Desc( ToneFetcherUtils::normalizeSeperator(file) )->Des() ) ); |
|
47 QT_TRAP_THROWING( mTonePlayer->PlayL() ); |
|
48 } |
|
49 |
|
50 bool ToneFetcherEnginePrivate::isPlaying() |
|
51 { |
|
52 return mTonePlayer->IsPlaying(); |
|
53 } |
|
54 |
|
55 void ToneFetcherEnginePrivate::stopPlaying() |
|
56 { |
|
57 mTonePlayer->Stop(); |
|
58 } |
|
59 |
|
60 void ToneFetcherEnginePrivate::HandleMdeSessionError( TInt aError ) |
|
61 { |
|
62 emit mdeSessionError( aError ); |
|
63 } |
|
64 |
|
65 void ToneFetcherEnginePrivate::HandleMdeSessionOpened() |
|
66 { |
|
67 emit mdeSessionOpened(); |
|
68 } |
|
69 |
|
70 void ToneFetcherEnginePrivate::HandleQueryError( TInt aError ) |
|
71 { |
|
72 emit queryError(aError); |
|
73 } |
|
74 |
|
75 void ToneFetcherEnginePrivate::HandleQueryComplete( RPointerArray<TDesC>& aResultArray ) |
|
76 { |
|
77 mResultList.clear(); |
|
78 for ( int i = 0; i < aResultArray.Count(); ++i ) |
|
79 { |
|
80 mResultList.append( XQConversions::s60DescToQString( *(aResultArray[i]) ) ); |
|
81 } |
|
82 aResultArray.ResetAndDestroy(); |
|
83 emit queryComplete(mResultList); |
|
84 } |
|
85 |
|
86 void ToneFetcherEnginePrivate::HandleObjectChanged() |
|
87 { |
|
88 emit notifyObjectChanged(); |
|
89 } |
|
90 |
|
91 void ToneFetcherEnginePrivate::HandlePreviewEvent( TInt event ) |
|
92 { |
|
93 emit notifyPreviewEvent(event); |
|
94 } |