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