controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp
changeset 19 36aa4756ee82
child 17 4a9568303383
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 source file for tone fetcher engine.
       
    16  *     
       
    17  */
       
    18 #include "tonefetcherengine.h"
       
    19 #include "toneselectionengine_p.h"
       
    20 #include "tonepreviewprivate.h"
       
    21 
       
    22 ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent)
       
    23 {
       
    24     d = new ToneSelectionEnginePrivate(this);
       
    25     Q_ASSERT(d);
       
    26     mAudioPlayer = new TonePreviewPrivate( this );
       
    27     Q_ASSERT(mAudioPlayer);
       
    28     connect(d, SIGNAL(mdeSessionOpened()), 
       
    29             this, SIGNAL(mdeSessionOpened()));
       
    30     connect(d, SIGNAL(mdeSessionError(int)),
       
    31             this, SIGNAL(mdeSessionError(int)));
       
    32     connect(d, SIGNAL(queryComplete(QStringList, QStringList)),
       
    33             this, SIGNAL(queryComplete(QStringList, QStringList)));
       
    34     connect(d, SIGNAL(queryError(int)),
       
    35             this, SIGNAL(queryError(int)));
       
    36     connect(d, SIGNAL(notifyObjectChanged()),
       
    37             this, SIGNAL(notifyObjectChanged()));
       
    38     connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)),
       
    39             this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)));
       
    40 }
       
    41 
       
    42 ToneFetcherEngine::~ToneFetcherEngine()
       
    43 {
       
    44     delete d;
       
    45 }
       
    46 
       
    47 void ToneFetcherEngine::getTone()
       
    48 {
       
    49     d->QueryTones();
       
    50 }
       
    51 
       
    52 void ToneFetcherEngine::preview(const QString &file )
       
    53 {
       
    54     mAudioPlayer->SetAttr(file);
       
    55     mAudioPlayer->Play();
       
    56 }
       
    57 
       
    58 bool ToneFetcherEngine::IsPlaying()
       
    59 {
       
    60     mAudioPlayer->IsPlaying();
       
    61 }
       
    62 //End of File