qtms/src/qtmsgaineffectimpl.cpp
changeset 27 cbb1bfb7ebfb
child 32 edd273b3192a
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
       
     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         {
       
    40         ret = self->PostConstruct();
       
    41         if (ret != QTMS_RESULT_SUCCESS)
       
    42             {
       
    43             delete self;
       
    44             self = NULL;
       
    45             }
       
    46         self->iEffect = tmsgain;
       
    47         ret = self->AddObserver(*self, NULL);
       
    48         }
       
    49     qgain = self;
       
    50     return ret;
       
    51     }
       
    52 
       
    53 gint QTMSGainEffectImpl::PostConstruct()
       
    54     {
       
    55     gint ret(QTMS_RESULT_SUCCESS);
       
    56     return ret;
       
    57     }
       
    58 
       
    59 gint QTMSGainEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr,
       
    60         gpointer /*user_data*/)
       
    61     {
       
    62     gint ret(QTMS_RESULT_SUCCESS);
       
    63 
       
    64     if (iEffect)
       
    65         {
       
    66         ret = static_cast<TMSGainEffect*> (iEffect)->AddObserver(obsrvr, NULL);
       
    67         }
       
    68     return ret;
       
    69     }
       
    70 
       
    71 gint QTMSGainEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr)
       
    72     {
       
    73     gint ret(QTMS_RESULT_SUCCESS);
       
    74 
       
    75     if (iEffect)
       
    76         {
       
    77         ret = static_cast<TMSGainEffect*> (iEffect)->RemoveObserver(obsrvr);
       
    78         }
       
    79     return ret;
       
    80     }
       
    81 
       
    82 gint QTMSGainEffectImpl::GetEffect(TMS::TMSEffect*& tmseffect)
       
    83     {
       
    84     gint ret(QTMS_RESULT_UNINITIALIZED_OBJECT);
       
    85 
       
    86     if (iEffect)
       
    87         {
       
    88         tmseffect = iEffect;
       
    89         ret = QTMS_RESULT_SUCCESS;
       
    90         }
       
    91     return ret;
       
    92     }
       
    93 
       
    94 void QTMSGainEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/,
       
    95         TMS::TMSSignalEvent event)
       
    96     {
       
    97     QTMSSignalEvent qevent;
       
    98 
       
    99     qevent.type = event.type;
       
   100     qevent.reason = event.reason;
       
   101     qevent.curr_state = event.curr_state;
       
   102     qevent.prev_state = event.prev_state;
       
   103     qevent.event_data = event.event_data;
       
   104     qevent.user_data = event.user_data;
       
   105 
       
   106     emit QTMS::QTMSGainEffect::EffectsEvent(static_cast<QTMSEffect&> (*this),
       
   107             qevent);
       
   108     }
       
   109 
       
   110 // End of file