qtms/src/qtmsgaineffectimpl.cpp
branchRCL_3
changeset 56 63223d4fd956
parent 55 6c1dfe4da5dd
child 59 666f9a5a90a9
equal deleted inserted replaced
55:6c1dfe4da5dd 56:63223d4fd956
     1 /*
       
     2  * Copyright (c) 2010 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: QT Bindings for TMS
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qtms.h>
       
    19 #include <tmsgaineffect.h>
       
    20 #include "qtmsgaineffectimpl.h"
       
    21 
       
    22 using namespace QTMS;
       
    23 using namespace TMS;
       
    24 
       
    25 QTMSGainEffectImpl::QTMSGainEffectImpl()
       
    26 {
       
    27 }
       
    28 
       
    29 QTMSGainEffectImpl::~QTMSGainEffectImpl()
       
    30 {
       
    31     RemoveObserver(*this);
       
    32 }
       
    33 
       
    34 gint QTMSGainEffectImpl::Create(QTMSEffect*& qgain, TMS::TMSEffect*& tmsgain)
       
    35 {
       
    36     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    37     QTMSGainEffectImpl* self = new QTMSGainEffectImpl();
       
    38     if (self) {
       
    39         ret = self->PostConstruct();
       
    40         if (ret != QTMS_RESULT_SUCCESS) {
       
    41             delete self;
       
    42             self = NULL;
       
    43         }
       
    44         self->iEffect = tmsgain;
       
    45         ret = self->AddObserver(*self, NULL);
       
    46     }
       
    47     qgain = self;
       
    48     return ret;
       
    49 }
       
    50 
       
    51 gint QTMSGainEffectImpl::PostConstruct()
       
    52 {
       
    53     gint ret(QTMS_RESULT_SUCCESS);
       
    54     return ret;
       
    55 }
       
    56 
       
    57 gint QTMSGainEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr, gpointer user_data)
       
    58 {
       
    59     gint ret(QTMS_RESULT_SUCCESS);
       
    60 
       
    61     if (iEffect) {
       
    62         ret = static_cast<TMSGainEffect*> (iEffect)->AddObserver(obsrvr, user_data);
       
    63     }
       
    64     return ret;
       
    65 }
       
    66 
       
    67 gint QTMSGainEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr)
       
    68 {
       
    69     gint ret(QTMS_RESULT_SUCCESS);
       
    70 
       
    71     if (iEffect) {
       
    72         ret = static_cast<TMSGainEffect*> (iEffect)->RemoveObserver(obsrvr);
       
    73     }
       
    74     return ret;
       
    75 }
       
    76 
       
    77 gint QTMSGainEffectImpl::GetEffect(TMS::TMSEffect*& tmseffect)
       
    78 {
       
    79     gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT);
       
    80 
       
    81     if (iEffect) {
       
    82         tmseffect = iEffect;
       
    83         ret = QTMS_RESULT_SUCCESS;
       
    84     }
       
    85     return ret;
       
    86 }
       
    87 
       
    88 void QTMSGainEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/,
       
    89     TMS::TMSSignalEvent event)
       
    90 {
       
    91     QTMSSignalEvent qevent;
       
    92 
       
    93     qevent.type = event.type;
       
    94     qevent.reason = event.reason;
       
    95     qevent.curr_state = event.curr_state;
       
    96     qevent.prev_state = event.prev_state;
       
    97     qevent.event_data = event.event_data;
       
    98     qevent.user_data = event.user_data;
       
    99 
       
   100     emit QTMS::QTMSGainEffect::EffectsEvent(static_cast<QTMSEffect&> (*this), qevent);
       
   101 }
       
   102 
       
   103 // End of file