controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:39:17 +0300
changeset 17 4a9568303383
parent 14 23411a3be0db
child 24 f5dfdd5e4a1b
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
 * 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();
}

void ToneFetcherEngine::stop()
{
    mAudioPlayer->Stop();
}

//End of File