mpviewplugins/mpdetailsviewplugin/src/mpdetailsviewplugin.cpp
branchRCL_3
changeset 25 14979e23cb5e
equal deleted inserted replaced
24:26a1709b9fec 25:14979e23cb5e
       
     1 /*
       
     2 * Copyright (c) 2009 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: Plugin interface for Music Player details view.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <xqplugin.h>
       
    19 
       
    20 #include "mpdetailsviewplugin.h"
       
    21 #include "mpdetailsview.h"
       
    22 #include "mptrace.h"
       
    23 
       
    24 /*!
       
    25     \class MpDetailsViewPlugin
       
    26     \brief Plugin interface for Music Player details view.
       
    27 
       
    28     Details view plugin provides interface to the details view
       
    29     beyond a plugin interface for application and view separation.
       
    30 */
       
    31 
       
    32 /*!
       
    33     \fn void command( int command )
       
    34 
       
    35     This signal is emitted when the view issues a \a command to the
       
    36     application such as request to switch to a different view.
       
    37  */
       
    38 
       
    39 /*!
       
    40  Constructs the details view plugin.
       
    41  */
       
    42 MpDetailsViewPlugin::MpDetailsViewPlugin()
       
    43     : mView(0),
       
    44       mState(NullView)
       
    45 {
       
    46     TX_LOG
       
    47 }
       
    48 
       
    49 /*!
       
    50  Destructs the details view plugin.
       
    51  */
       
    52 MpDetailsViewPlugin::~MpDetailsViewPlugin()
       
    53 {
       
    54     TX_LOG
       
    55 }
       
    56 
       
    57 /*!
       
    58  Creates the details view.
       
    59  */
       
    60 void MpDetailsViewPlugin::createView()
       
    61 {
       
    62     TX_ENTRY
       
    63     if ( mState == NullView ) {
       
    64         mView = new MpDetailsView();
       
    65         connect( mView, SIGNAL( command( int ) ), this, SIGNAL( command( int ) ) );
       
    66         mState = Created;
       
    67     }
       
    68     TX_EXIT
       
    69 }
       
    70 
       
    71 /*!
       
    72  Destroys the details view.
       
    73  */
       
    74 void MpDetailsViewPlugin::destroyView()
       
    75 {
       
    76     TX_ENTRY
       
    77     if ( mState != NullView ) {
       
    78         delete mView;
       
    79         mView = NULL;
       
    80         mState = NullView;
       
    81     }
       
    82     TX_EXIT
       
    83 }
       
    84 
       
    85 /*!
       
    86  Activates the details view. View initialization is done very first time.
       
    87  */
       
    88 void MpDetailsViewPlugin::activateView()
       
    89 {
       
    90     TX_ENTRY_ARGS( "mState=" << mState );
       
    91     switch ( mState ) {
       
    92     case Created:
       
    93         mView->initializeView();
       
    94         mView->activateView();
       
    95         mState = Activated;
       
    96         break;
       
    97     case Initialized:
       
    98         mView->activateView();
       
    99         mState = Activated;
       
   100         break;
       
   101     default:
       
   102         // Ignore
       
   103         break;
       
   104     }
       
   105     TX_EXIT
       
   106 }
       
   107 
       
   108 /*!
       
   109  Deactivates the details view.
       
   110  */
       
   111 void MpDetailsViewPlugin::deactivateView()
       
   112 {
       
   113     TX_ENTRY
       
   114     if ( mState == Activated ) {
       
   115         mView->deactivateView();
       
   116         mState = Initialized;
       
   117     }
       
   118     TX_EXIT
       
   119 }
       
   120 
       
   121 /*!
       
   122  Returns pointer to QGraphicsWidget, which is the details view.
       
   123  The returned pointer is 0, if it is not created first.
       
   124 
       
   125  \sa createView()
       
   126  */
       
   127 QGraphicsWidget* MpDetailsViewPlugin::getView()
       
   128 {
       
   129     TX_LOG
       
   130     return mView;
       
   131 }
       
   132 
       
   133 /*!
       
   134  Slot to be called when application orientation changes.
       
   135 
       
   136  \reimp
       
   137  */
       
   138 void MpDetailsViewPlugin::orientationChange( Qt::Orientation orientation )
       
   139 {
       
   140     TX_LOG
       
   141     Q_UNUSED( orientation );
       
   142 }
       
   143 
       
   144 /*!
       
   145  Slot to handle back command from softkey.
       
   146 
       
   147  \reimp
       
   148  */
       
   149 void MpDetailsViewPlugin::back()
       
   150 {
       
   151     //do nothing, softkey is handledinternally by the view.
       
   152     TX_LOG
       
   153 }
       
   154 
       
   155 XQ_EXPORT_PLUGIN2( mpdetailsviewplugin, MpDetailsViewPlugin );
       
   156