videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h
branchRCL_3
changeset 56 839377eedc2b
equal deleted inserted replaced
54:315810614048 56:839377eedc2b
       
     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:   VideoFileDetailsViewPlugin class definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef VIDEOFILEDETAILSPLUGIN_H
       
    19 #define VIDEOFILEDETAILSPLUGIN_H
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 #include <qobject.h>
       
    24 #include <mpxviewpluginqt.h>
       
    25 #include <hbdocumentloader.h>
       
    26 #include <qpixmap.h>
       
    27 #include <mpxitemid.h>
       
    28 
       
    29 class VideoSortFilterProxyModel;
       
    30 class QModelIndex;
       
    31 class HbAction;
       
    32 class HbMarqueeItem;
       
    33 class ThumbnailManager;
       
    34 class VideoServices;
       
    35 class VideoCollectionWrapper;
       
    36 class VideoDetailsLabel;
       
    37 class ShareUi;
       
    38 
       
    39 class VideoFileDetailsViewPlugin : public MpxViewPlugin
       
    40 	{
       
    41 
       
    42     Q_OBJECT
       
    43 
       
    44 public: // Constructor / destructor
       
    45 
       
    46     /**
       
    47      * Contructor.
       
    48      *
       
    49      */
       
    50     VideoFileDetailsViewPlugin();
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      *
       
    55      */
       
    56     virtual ~VideoFileDetailsViewPlugin();
       
    57 
       
    58 public: // from QViewPlugin
       
    59 
       
    60     /**
       
    61      * Initializes view creation.
       
    62      *
       
    63      */
       
    64     void createView();
       
    65 
       
    66     /**
       
    67      * Deallocates view and it's objects.
       
    68      */
       
    69     void destroyView();
       
    70 
       
    71     /**
       
    72      * Activates view
       
    73      *
       
    74      */
       
    75     void activateView();
       
    76 
       
    77     /**
       
    78      * Deactivates view
       
    79      *
       
    80      */
       
    81     void deactivateView();
       
    82 
       
    83     /**
       
    84      * Returns a pointer to the view read from the XML
       
    85      *
       
    86      * @return QGraphicsWidget*
       
    87      */
       
    88     QGraphicsWidget* getView();
       
    89 
       
    90 signals:
       
    91     /**
       
    92      * Command signal, plugin user shoulf connect this in case it wants
       
    93      * to receive commands emitted from the view.
       
    94      *
       
    95      * @param command id
       
    96      */
       
    97     void command( int );
       
    98 
       
    99     /**
       
   100      * Signals the URI of the current video to VideoServices
       
   101      *
       
   102      * @param URI of the video
       
   103      */
       
   104     void fileUri(const QString&);
       
   105 
       
   106 public slots: // from QViewPlugin
       
   107 
       
   108     /**
       
   109      * Plugin user can notify orientation changes by connecting into this slot
       
   110      * to it's signal. In normal cases, view handles orientation chages itself.
       
   111      *
       
   112      * @param orientation new orientation
       
   113      */
       
   114     void orientationChange( Qt::Orientation orientation );
       
   115 
       
   116     /**
       
   117      * Plugin user can notify back button changes by connecting into this slot
       
   118      *
       
   119      */
       
   120     void back();
       
   121     
       
   122     /**
       
   123      * Signaled by HbMessageBox when it's closed.
       
   124      */
       
   125     void deleteVideoDialogFinished(int action);
       
   126 
       
   127 private slots:
       
   128 
       
   129     /**
       
   130      * Signaled when attach button is clicked, only when started as a service.
       
   131 	 * Gets the URI of the current video
       
   132      *
       
   133      */
       
   134 	void getFileUri();
       
   135 
       
   136     /**
       
   137      * Signaled when short details are ready.
       
   138      *
       
   139      * @param id Mpx id of the clip, needed when getting the data from model.
       
   140      */
       
   141     void shortDetailsReadySlot(TMPXItemId id);
       
   142 
       
   143     /**
       
   144      * Signaled when full details are ready.
       
   145      *
       
   146      * @param metadata The metadata for the clip.
       
   147      */
       
   148     void fullDetailsReadySlot(QVariant& variant);
       
   149 
       
   150     /**
       
   151      * Slot that receives signal from play button to start playback.
       
   152      */
       
   153     void startPlaybackSlot();
       
   154 
       
   155     /**
       
   156      * Slot that receives signal from send button
       
   157      */
       
   158     void sendVideoSlot();
       
   159 
       
   160     /**
       
   161      * Slot that receives signal from delete button
       
   162      */
       
   163     void deleteVideoSlot();
       
   164 
       
   165     /**
       
   166      * Slot that receives signal when video(s) removed.
       
   167      * If video to be removed is the one whose details
       
   168      * are visible, this view is deactivated and collection
       
   169      * list view is put back on.
       
   170      *
       
   171      * @param parent parent item index (not used at the moment)
       
   172      * @param first first item to remove
       
   173      * @param last last item to remove
       
   174      */
       
   175     void rowsRemovedSlot(const QModelIndex &parent, int first, int last);
       
   176 
       
   177     /**
       
   178      * Slot is connected into videocollection wrapper's asyncStatus -signal
       
   179      *
       
   180      * Handles possible collection error; usually by just showing error msg
       
   181      *
       
   182      * @param errorCode error code
       
   183      * @param additional additional data gotten from the error
       
   184      */
       
   185     void handleErrorSlot(int errorCode, QVariant &additional);
       
   186 
       
   187     /**
       
   188      * Slot that is connected to thumbnailReady signal in tnwrapper, which
       
   189      * signals when thumbnail loading has been completed.
       
   190      *
       
   191      * @param pixmap     An object representing the resulting thumbnail.
       
   192      * @param clientData Client data
       
   193      * @param id         Request ID for the operation
       
   194      * @param errorCode  error code
       
   195      */
       
   196     void thumbnailReadySlot(QPixmap pixmap, void * clientData, int id, int errorCode);
       
   197 
       
   198 private:
       
   199 
       
   200     /**
       
   201      * Signaled for one item deletion.
       
   202      *
       
   203      */
       
   204     void deleteItem(QModelIndex index);
       
   205 
       
   206     /**
       
   207      * Starts fetching the large thumbnail with tnwrapper.
       
   208      */
       
   209     void startFetchingThumbnail();
       
   210     
       
   211     /**
       
   212      * Gets the play icon for thumbnail.
       
   213      */
       
   214     const QPixmap &playIcon();
       
   215 
       
   216     /**
       
   217      * Finds and return the widget from document loader with the given name. Casts
       
   218      * to templated type.
       
   219      *
       
   220      * @param name Name of the widget
       
   221      * @return The widget.
       
   222      */
       
   223     template<class T>
       
   224     T* findWidget(QString name);
       
   225 
       
   226     template<class T>
       
   227     T* findObject(QString name);
       
   228 
       
   229 private:
       
   230 
       
   231     /**
       
   232      * Document loader that holds the view object
       
   233      */
       
   234     HbDocumentLoader mLoader;
       
   235 
       
   236     /**
       
   237      * Pointer to the model that holds video details. Not owned.
       
   238      */
       
   239     VideoSortFilterProxyModel* mModel;
       
   240 
       
   241     /**
       
   242      * pointer to videoservices instance
       
   243      */
       
   244     VideoServices* mVideoServices;
       
   245 
       
   246     /**
       
   247      * Activated flag. Set as true when view is properly activated.
       
   248      * If flag is false, no operations can be do to the view.
       
   249      */
       
   250     bool mActivated;
       
   251 
       
   252     /**
       
   253      * Boolean for knowing when the app was started as a service.
       
   254      */
       
   255     bool mIsService;
       
   256 
       
   257     /**
       
   258      * Mpx id of the video clip.
       
   259      */
       
   260     TMPXItemId mVideoId;
       
   261     
       
   262     /**
       
   263      * Index of the clip to be deleted in the proxy model.
       
   264      */
       
   265     int mDeletedIndex;
       
   266     
       
   267     /**
       
   268      * Previously loaded orientation.
       
   269      */
       
   270     Qt::Orientation mPreviousOrietation;
       
   271 
       
   272 	/**
       
   273      * Navigation softkey action object for back.
       
   274      */
       
   275 	HbAction *mNavKeyBackAction;
       
   276 
       
   277     /**
       
   278      * Title animation widget
       
   279      */
       
   280     HbMarqueeItem *mTitleAnim;
       
   281 
       
   282     /**
       
   283      * Thumbnail label
       
   284      */
       
   285     VideoDetailsLabel *mThumbLabel;
       
   286 
       
   287     /**
       
   288      * Thumbnail manager.
       
   289      */
       
   290     ThumbnailManager* mThumbnailManager;
       
   291 
       
   292     /**
       
   293      * Collection wrapper.
       
   294      */
       
   295     VideoCollectionWrapper &mCollectionWrapper;
       
   296     
       
   297     /**
       
   298      * Play icon with transparent background.
       
   299      */
       
   300     QPixmap mPlayIcon;
       
   301     
       
   302     /**
       
   303      * Share ui object for handling of sharing videos
       
   304      */
       
   305     ShareUi *mShareUi;
       
   306     };
       
   307 
       
   308 #endif  // VIDEOFILEDETAILSPLUGIN_H
       
   309 
       
   310 // End of File