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