videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videosortfilterproxymodel.h
changeset 62 0e1e938beb1a
parent 59 a76e86df7ccd
child 65 a9d57bd8d7b7
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:  Dummy videolistsortfilterproxymodel class definition*
       
    15 */
       
    16 
       
    17 #ifndef VIDEOSORTFILTERPROXYMODEL_H
       
    18 #define VIDEOSORTFILTERPROXYMODEL_H
       
    19 
       
    20 // INCLUDES
       
    21 #include <QObject>
       
    22 #include <qabstractitemmodel.h>
       
    23 #include <mpxitemid.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 
       
    27 
       
    28 class VideoSortFilterProxyModel : public QAbstractItemModel
       
    29 {    
       
    30     /**
       
    31      * define to be able to use signals and slots
       
    32      */
       
    33     Q_OBJECT
       
    34     
       
    35     /**
       
    36      * disable copy-constructor and assignment operator
       
    37      */
       
    38 	Q_DISABLE_COPY(VideoSortFilterProxyModel) 
       
    39 
       
    40 public: 
       
    41 
       
    42 	/**
       
    43 	 * Default constructor
       
    44      */
       
    45 	VideoSortFilterProxyModel();	
       
    46 	
       
    47 	/**
       
    48      * Destructor
       
    49      */
       
    50 	~VideoSortFilterProxyModel();
       
    51 	
       
    52 	/**
       
    53 	 * sets index.row() to mStartPlaybackIndex
       
    54 	 */
       
    55 	int openItem(const TMPXItemId &index);
       
    56 	
       
    57 	/**
       
    58      * sets first index.row() to mDeleteFileIndex
       
    59      */
       
    60 	int deleteItems(const QModelIndexList &indexList);
       
    61 	
       
    62     /**
       
    63      * returns qmodelindex of item id provided.
       
    64      * 
       
    65      * @param item id
       
    66      * @return QModelIndex;
       
    67      */
       
    68     QModelIndex indexOfId(TMPXItemId id);
       
    69 
       
    70 	
       
    71 	TMPXItemId getMediaIdAtIndex(const QModelIndex &index);
       
    72 
       
    73 signals:
       
    74 	
       
    75     void shortDetailsReady(TMPXItemId index);
       
    76     
       
    77     void fullVideoDetailsReady(QVariant& variant);
       
    78 
       
    79 public: // from QAbstractItemModel
       
    80     
       
    81     VideoSortFilterProxyModel* sourceModel();
       
    82     
       
    83     /**
       
    84      * Returns video item count 
       
    85      */
       
    86     int rowCount(const QModelIndex &parent = QModelIndex()) const;
       
    87 
       
    88     /**
       
    89      * Returns video item data from index pointed by.
       
    90      */
       
    91     QMap<int, QVariant> itemData(const QModelIndex &index) const;
       
    92     
       
    93     /**
       
    94      * data
       
    95      */
       
    96     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
       
    97     
       
    98     /**
       
    99      * columnCount
       
   100      */
       
   101     int columnCount(const QModelIndex & parent = QModelIndex()) const;
       
   102     
       
   103     /**
       
   104      * index
       
   105      */
       
   106     QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
       
   107     
       
   108     /**
       
   109      * Parent
       
   110      */
       
   111     QModelIndex parent(const QModelIndex & index) const;
       
   112     
       
   113 public: // dummy model helper methods
       
   114     /**
       
   115      * sets mDatareturnsInvalid
       
   116      */
       
   117     void setDataReturnInvalid(bool setInvalid);
       
   118     
       
   119     /**
       
   120      * returns mLastIndex
       
   121      */
       
   122     QModelIndex lastIndex();
       
   123     
       
   124     TMPXItemId lastId();
       
   125 
       
   126     /**
       
   127      * returns mDataAccessCount
       
   128      */
       
   129     int dataAccessCount();
       
   130     
       
   131     /**
       
   132      * clear everything
       
   133      */
       
   134     void reset();
       
   135     
       
   136     /**
       
   137      * sets role based value to mDatao 
       
   138      */
       
   139     void setData(int role, QVariant data);
       
   140     
       
   141     /**
       
   142      * sets mRowCount
       
   143      */
       
   144     void setRowCount(int count);
       
   145     
       
   146     /**
       
   147      * returns mStartPlaybackIndex
       
   148      */
       
   149     TMPXItemId startPlaybackIndex();
       
   150        
       
   151     /**
       
   152      * returns mDeleteFileIndex
       
   153      */
       
   154     int deleteFileIndex();
       
   155     
       
   156 private:
       
   157     
       
   158     /**
       
   159      * map item to return from data();
       
   160      */
       
   161     QMap<int, QVariant> mData;
       
   162     
       
   163     /**
       
   164      * latest used index
       
   165      */
       
   166     mutable QModelIndex mLastIndex;
       
   167     
       
   168     /**
       
   169      * total data -access count throught data() -method
       
   170      */
       
   171     mutable int mDataAccessCount;
       
   172     
       
   173     
       
   174     mutable TMPXItemId mLastId;
       
   175     
       
   176     /**
       
   177      * setted "row count"
       
   178      */
       
   179     int mRowCount;
       
   180     
       
   181     /**
       
   182      * lates passed index of openItem
       
   183      */
       
   184     TMPXItemId mStartPlaybackIndex;
       
   185      
       
   186     /**
       
   187      * latest passed for delete 
       
   188      */
       
   189     int mDeleteFileIndex;     
       
   190     
       
   191     /**
       
   192      * if true, data() -method returns invalid QVartiant
       
   193      */
       
   194     bool mDatareturnsInvalid;
       
   195        
       
   196 };
       
   197 #endif  // VIDEOSORTFILTERPROXYMODEL_H
       
   198 
       
   199 // End of file
       
   200     
       
   201 
       
   202