videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videoproxymodelgeneric.h
changeset 62 0e1e938beb1a
child 63 4707a0db12f6
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
       
     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 VideoProxyModelGeneric class definition
       
    15 * 
       
    16 */
       
    17 
       
    18 #ifndef VIDEOPROXYMODELGENERIC_H
       
    19 #define VIDEOPROXYMODELGENERIC_H
       
    20     
       
    21 // INCLUDES
       
    22 #include <e32const.h>
       
    23 #include <mpxitemid.h>
       
    24 #include <QModelIndex>
       
    25 
       
    26 #include "videocollectioncommon.h"
       
    27 
       
    28 class VideoListDataModel;
       
    29 
       
    30 // CLASS DECLARATION
       
    31 class VideoProxyModelGeneric : public QObject 
       
    32 {
       
    33     Q_OBJECT
       
    34     
       
    35 public: 
       
    36     
       
    37     /**
       
    38      * Contructor.
       
    39      *
       
    40      * @param QObject parent object.
       
    41      */
       
    42     VideoProxyModelGeneric(QObject *parent = 0);
       
    43     
       
    44     /**
       
    45      * Destructor.
       
    46      *
       
    47      */
       
    48     virtual ~VideoProxyModelGeneric();
       
    49 
       
    50 public:
       
    51     
       
    52     /**
       
    53     * Opens the defined item. This is quite abstract as depending
       
    54     * on the type of the item, the behaviour or result could be
       
    55     * quite different.
       
    56     * 
       
    57     * @param item id id of the item to be opened
       
    58     * @return int 0 succeeds, <0 if opening does not succeed.
       
    59     */    
       
    60     virtual int openItem(TMPXItemId mediaId);
       
    61         
       
    62 	/**
       
    63 	 * Gets the currently opened item.
       
    64 	 * 
       
    65 	 * @param None.
       
    66 	 * @return TMPXItemId.
       
    67 	 */
       
    68     virtual TMPXItemId getOpenItem() const;
       
    69     
       
    70     /**
       
    71      * Compares items based in the role setted before sorting. From QSortFilterProxyModel.
       
    72      *  
       
    73      */
       
    74     virtual bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
       
    75     
       
    76     /**
       
    77      * Filtering functionality. Called by the FW. From QSortFilterProxyModel.
       
    78      *  
       
    79      * @param source_row row to check
       
    80      * @param source_parent row's parent
       
    81      * 
       
    82      * @return bool row accepted(true) or not accepted(false)
       
    83      */
       
    84     virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
       
    85 
       
    86     /**
       
    87      * Connects all signals emitted from or throught this object.
       
    88      * 
       
    89      * @return bool
       
    90      */
       
    91     virtual bool connectSignals();
       
    92     
       
    93     /**
       
    94      * Disconnects all signals.
       
    95      */
       
    96     void disconnectSignals();
       
    97     
       
    98     /**
       
    99      * Does actual sorting and emits sortingReady.
       
   100      *  
       
   101      */
       
   102     virtual void processSorting();
       
   103     
       
   104     /**
       
   105      * Returns sourceModel;
       
   106      */
       
   107     virtual const VideoListDataModel *sourceModel() const;
       
   108     
       
   109 public:
       
   110     static int mOpenItemCallCount;
       
   111     static int mGetOpenItemCallCount;
       
   112     static int mLessThanCallCount;
       
   113     static int mFilterAcceptsRowCallCount;
       
   114     static int mConnectSignalsCallCount;
       
   115     static int mDisconnectSignalsCallCount;
       
   116     static int mProcessSortingCallCount;
       
   117 
       
   118 public:
       
   119 
       
   120     /**
       
   121      * Pointer to the actual model.
       
   122      */
       
   123     VideoListDataModel *mModel;
       
   124     
       
   125     /**
       
   126      * Collection client.
       
   127      */
       
   128     int mCollectionClient;
       
   129     
       
   130     /**
       
   131      * Currently open level.
       
   132      */
       
   133     VideoCollectionCommon::TCollectionLevels mLevel;
       
   134     
       
   135     /**
       
   136      * Sort order (ascending or descending).
       
   137      */
       
   138     Qt::SortOrder mWantedSortOrder;
       
   139     
       
   140     /*
       
   141      * Default sort role for the model.
       
   142      */
       
   143     int mDefaultSortRole;    
       
   144 };
       
   145 
       
   146 #endif // VIDEOPROXYMODELGENERIC_H