qtms/src/qtmsglobalvoleffectimpl.cpp
changeset 27 cbb1bfb7ebfb
child 50 762d760dcfdf
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 <tmsglobalvoleffect.h>
       
    20 #include "tmsutility.h"
       
    21 #include "qtmsglobalvoleffectimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 using namespace TMS;
       
    25 
       
    26 QTMSGlobalVolEffectImpl::QTMSGlobalVolEffectImpl()
       
    27     {
       
    28     }
       
    29 
       
    30 QTMSGlobalVolEffectImpl::~QTMSGlobalVolEffectImpl()
       
    31     {
       
    32     RemoveObserver(*this);
       
    33     }
       
    34 
       
    35 gint QTMSGlobalVolEffectImpl::Create(QTMSEffect*& qglobalvol,
       
    36         TMS::TMSEffect*& tmsglobalvol)
       
    37     {
       
    38     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    39     QTMSGlobalVolEffectImpl* self = new QTMSGlobalVolEffectImpl();
       
    40     if (self)
       
    41         {
       
    42         ret = self->PostConstruct();
       
    43         if (ret != QTMS_RESULT_SUCCESS)
       
    44             {
       
    45             delete self;
       
    46             self = NULL;
       
    47             }
       
    48         self->iEffect = tmsglobalvol;
       
    49         ret = self->AddObserver(*self, NULL);
       
    50         }
       
    51     qglobalvol = self;
       
    52     return ret;
       
    53     }
       
    54 
       
    55 gint QTMSGlobalVolEffectImpl::PostConstruct()
       
    56     {
       
    57     gint ret(QTMS_RESULT_SUCCESS);
       
    58     return ret;
       
    59     }
       
    60 
       
    61 gint QTMSGlobalVolEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr,
       
    62         gpointer user_data)
       
    63     {
       
    64     gint ret(QTMS_RESULT_SUCCESS);
       
    65 
       
    66     if (iEffect)
       
    67         {
       
    68         ret = static_cast<TMSGlobalVolEffect*> (iEffect)->AddObserver(obsrvr,
       
    69                 user_data);
       
    70         }
       
    71     return ret;
       
    72     }
       
    73 
       
    74 gint QTMSGlobalVolEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr)
       
    75     {
       
    76     gint ret(QTMS_RESULT_SUCCESS);
       
    77 
       
    78     if (iEffect)
       
    79         {
       
    80         ret = static_cast<TMSGlobalVolEffect*> (iEffect)->RemoveObserver(
       
    81                 obsrvr);
       
    82         }
       
    83     return ret;
       
    84     }
       
    85 
       
    86 void QTMSGlobalVolEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/,
       
    87         TMS::TMSSignalEvent event)
       
    88     {
       
    89     QTMSSignalEvent qevent;
       
    90 
       
    91     qevent.type = event.type;
       
    92     qevent.reason = event.reason;
       
    93     qevent.curr_state = event.curr_state;
       
    94     qevent.prev_state = event.prev_state;
       
    95     qevent.event_data = event.event_data;
       
    96     qevent.user_data = event.user_data;
       
    97 
       
    98     emit QTMS::QTMSGlobalVolEffect::EffectsEvent(static_cast<QTMSEffect&>
       
    99             (*this), qevent);
       
   100     }
       
   101 
       
   102 // End of file