videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/testviewplugin.h
changeset 15 cf5481c2bc0b
child 17 69946d1824c4
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
       
     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:  Stub test class
       
    15 *
       
    16 */
       
    17 
       
    18 #include "stub/inc/mpxviewpluginqt.h"
       
    19 
       
    20 class TestViewPlugin : public MpxViewPlugin
       
    21 {
       
    22     Q_OBJECT
       
    23 
       
    24 public:
       
    25     TestViewPlugin();
       
    26     ~TestViewPlugin();
       
    27 
       
    28     /**
       
    29      * createView is the second operation (after plugin construction which is done somewhere 
       
    30      * in the plugin framework) executed in the application layer to make a fully operational 
       
    31      * View Plugin descendant.
       
    32      * I should allocate all of those resources that are required by plugin, but which are
       
    33      * too expensive to allocate in constructor (eg. in case of plugin prefetching).
       
    34      */
       
    35     virtual void createView();
       
    36 
       
    37     /**
       
    38      * destroyView is an operation that should be executed just before plugin deletion.
       
    39      * Implementation should destroy all of resources allocated during createView execution.
       
    40      * It's reason d'etre is based on a fact, that application doesn't controll when exactly
       
    41      * plugin will be deleted, so destructor execution could be postponed still holding resources.
       
    42      */
       
    43     virtual void destroyView();
       
    44 
       
    45     /* COMMENT:
       
    46      * view activation and deactivation are reversible operations
       
    47      * that allows us to give up resources that we could temporary deallocate when that 
       
    48      * specific view plugin goes into background.
       
    49      */
       
    50 
       
    51     /**
       
    52      * Called to notice view activation.
       
    53      */
       
    54     virtual void activateView();
       
    55 
       
    56     /**
       
    57      * Called to notice view deactivation.
       
    58      */
       
    59     virtual void deactivateView();
       
    60 
       
    61     /**
       
    62      * Is active.
       
    63      */
       
    64     virtual bool activated();
       
    65     
       
    66     /**
       
    67      * gives actual view component, ready to put somewhere into the app layout.
       
    68      * However, beware that calling to activate/deactivate in the meantime
       
    69      * can invalidate that pointer.
       
    70      * 
       
    71      * NOTE: Returned type is choosen to be as generic as possible, 
       
    72      * so please ensure that it fulfills all your needs (it was HbView* before)
       
    73      */
       
    74     virtual QGraphicsWidget* getView();
       
    75     
       
    76     
       
    77     virtual MpxViewPlugin* viewPlugin();
       
    78 
       
    79 public slots:
       
    80 
       
    81     /**
       
    82      * Signalled by application when orientation has changed.
       
    83      */ 
       
    84     virtual void orientationChange(Qt::Orientation orientation);
       
    85 
       
    86     /**
       
    87      * Implementation should take care either to implement
       
    88        * go-back operation internally or to emit proper
       
    89      * command signal to delegate that responsibility to
       
    90      * framework (eg. to switch to previous view).
       
    91      */ 
       
    92     virtual void back();
       
    93 
       
    94 signals:
       
    95 
       
    96     /**
       
    97      * Command is the only way to notify from plugin to application
       
    98      * about action needed to be executed.
       
    99      *
       
   100      * @param aCommand  enumeration of command type. 
       
   101      * Currently supported are: ViewBack, CloseApp, GoToNowPlaying, GoToCollectionView.
       
   102      * NOTE: It should be specified how to determine between broadly supported operations 
       
   103      * (back, close etc.) and application/plugin specific (go to collection, go to now playing etc.)
       
   104      *
       
   105      * There is also one major issue here, that there is no guaranted order of command delivery,
       
   106      * so there is second option to use common observer pattern. Should be discussed.
       
   107      */ 
       
   108     void command(int aCommand);    
       
   109     
       
   110 private:
       
   111 
       
   112     bool mActive;
       
   113 };
       
   114