controlpanelui/src/tonefetcher/tonefetcherengine/tonefetcherengine.cpp
author hgs
Thu, 10 Jun 2010 16:07:41 +0800
changeset 21 2883a5458389
parent 19 36aa4756ee82
child 22 a5692c68d772
permissions -rw-r--r--
201023
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 * 
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 * 
hgs
parents:
diff changeset
    14
 * Description:
hgs
parents:
diff changeset
    15
 *     The source file for tone fetcher engine.
hgs
parents:
diff changeset
    16
 *     
hgs
parents:
diff changeset
    17
 */
hgs
parents:
diff changeset
    18
#include "tonefetcherengine.h"
hgs
parents:
diff changeset
    19
#include "toneselectionengine_p.h"
hgs
parents:
diff changeset
    20
#include "tonepreviewprivate.h"
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
ToneFetcherEngine::ToneFetcherEngine(QObject* parent) : QObject(parent)
hgs
parents:
diff changeset
    23
{
hgs
parents:
diff changeset
    24
    d = new ToneSelectionEnginePrivate(this);
hgs
parents:
diff changeset
    25
    Q_ASSERT(d);
hgs
parents:
diff changeset
    26
    mAudioPlayer = new TonePreviewPrivate( this );
hgs
parents:
diff changeset
    27
    Q_ASSERT(mAudioPlayer);
hgs
parents:
diff changeset
    28
    connect(d, SIGNAL(mdeSessionOpened()), 
hgs
parents:
diff changeset
    29
            this, SIGNAL(mdeSessionOpened()));
hgs
parents:
diff changeset
    30
    connect(d, SIGNAL(mdeSessionError(int)),
hgs
parents:
diff changeset
    31
            this, SIGNAL(mdeSessionError(int)));
hgs
parents:
diff changeset
    32
    connect(d, SIGNAL(queryComplete(QStringList, QStringList)),
hgs
parents:
diff changeset
    33
            this, SIGNAL(queryComplete(QStringList, QStringList)));
hgs
parents:
diff changeset
    34
    connect(d, SIGNAL(queryError(int)),
hgs
parents:
diff changeset
    35
            this, SIGNAL(queryError(int)));
hgs
parents:
diff changeset
    36
    connect(d, SIGNAL(notifyObjectChanged()),
hgs
parents:
diff changeset
    37
            this, SIGNAL(notifyObjectChanged()));
21
hgs
parents: 19
diff changeset
    38
    connect(d, SIGNAL(notifyRefreshStart()),
hgs
parents: 19
diff changeset
    39
            this, SIGNAL(notifyRefreshStart()));
hgs
parents: 19
diff changeset
    40
    connect(d, SIGNAL(notifyRefreshFinish()),
hgs
parents: 19
diff changeset
    41
            this, SIGNAL(notifyRefreshFinish()));
19
hgs
parents:
diff changeset
    42
    connect(mAudioPlayer, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)),
hgs
parents:
diff changeset
    43
            this, SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)));
hgs
parents:
diff changeset
    44
}
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
ToneFetcherEngine::~ToneFetcherEngine()
hgs
parents:
diff changeset
    47
{
hgs
parents:
diff changeset
    48
    delete d;
hgs
parents:
diff changeset
    49
}
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
void ToneFetcherEngine::getTone()
hgs
parents:
diff changeset
    52
{
hgs
parents:
diff changeset
    53
    d->QueryTones();
hgs
parents:
diff changeset
    54
}
hgs
parents:
diff changeset
    55
hgs
parents:
diff changeset
    56
void ToneFetcherEngine::preview(const QString &file )
hgs
parents:
diff changeset
    57
{
hgs
parents:
diff changeset
    58
    mAudioPlayer->SetAttr(file);
hgs
parents:
diff changeset
    59
    mAudioPlayer->Play();
hgs
parents:
diff changeset
    60
}
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
bool ToneFetcherEngine::IsPlaying()
hgs
parents:
diff changeset
    63
{
hgs
parents:
diff changeset
    64
    mAudioPlayer->IsPlaying();
hgs
parents:
diff changeset
    65
}
21
hgs
parents: 19
diff changeset
    66
hgs
parents: 19
diff changeset
    67
void ToneFetcherEngine::stop()
hgs
parents: 19
diff changeset
    68
{
hgs
parents: 19
diff changeset
    69
    mAudioPlayer->Stop();
hgs
parents: 19
diff changeset
    70
}
hgs
parents: 19
diff changeset
    71
19
hgs
parents:
diff changeset
    72
//End of File