controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp
author hgs
Fri, 14 May 2010 13:21:08 +0800
changeset 19 36aa4756ee82
child 17 4a9568303383
child 21 2883a5458389
permissions -rw-r--r--
201019

/*
 * Copyright (c) 2009 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:
 *     The source file for tone fetcher engine.
 *     
 */
#include "tonefetcherengine.h"
#include "toneselectionengine_p.h"
#include "tonepreviewprivate.h"

ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent)
{
    d = new ToneSelectionEnginePrivate(this);
    Q_ASSERT(d);
    mAudioPlayer = new TonePreviewPrivate( this );
    Q_ASSERT(mAudioPlayer);
    connect(d, SIGNAL(mdeSessionOpened()), 
            this, SIGNAL(mdeSessionOpened()));
    connect(d, SIGNAL(mdeSessionError(int)),
            this, SIGNAL(mdeSessionError(int)));
    connect(d, SIGNAL(queryComplete(QStringList, QStringList)),
            this, SIGNAL(queryComplete(QStringList, QStringList)));
    connect(d, SIGNAL(queryError(int)),
            this, SIGNAL(queryError(int)));
    connect(d, SIGNAL(notifyObjectChanged()),
            this, SIGNAL(notifyObjectChanged()));
    connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)),
            this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)));
}

ToneFetcherEngine::~ToneFetcherEngine()
{
    delete d;
}

void ToneFetcherEngine::getTone()
{
    d->QueryTones();
}

void ToneFetcherEngine::preview(const QString &file )
{
    mAudioPlayer->SetAttr(file);
    mAudioPlayer->Play();
}

bool ToneFetcherEngine::IsPlaying()
{
    mAudioPlayer->IsPlaying();
}
//End of File