34
|
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: contains stub model for unit testing videolistdatamodel_p*
|
|
15 |
*/
|
|
16 |
|
|
17 |
#ifndef __VIDEOLISTDATAMODEL_H__
|
|
18 |
#define __VIDEOLISTDATAMODEL_H__
|
|
19 |
|
|
20 |
#include <qabstractitemmodel.h>
|
|
21 |
#include "videodeleteworker.h"
|
|
22 |
#include "videocollectionclient.h"
|
|
23 |
|
|
24 |
class VideoListDataModel : public QAbstractItemModel
|
|
25 |
{
|
|
26 |
Q_OBJECT
|
|
27 |
|
|
28 |
/**
|
|
29 |
* disable copy-constructor and assignment operator
|
|
30 |
*/
|
|
31 |
Q_DISABLE_COPY(VideoListDataModel)
|
|
32 |
|
36
|
33 |
friend class VideoListDataModelPrivate;
|
34
|
34 |
|
|
35 |
public:
|
|
36 |
|
|
37 |
/**
|
|
38 |
* Default constructor
|
|
39 |
*/
|
|
40 |
VideoListDataModel(){};
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Destructor
|
|
44 |
*/
|
|
45 |
~VideoListDataModel(){};
|
|
46 |
|
|
47 |
signals:
|
|
48 |
|
|
49 |
/**
|
|
50 |
* dummy signal
|
|
51 |
*/
|
|
52 |
void modelReady();
|
|
53 |
|
|
54 |
/**
|
|
55 |
* dummy signal
|
|
56 |
*/
|
|
57 |
void modelChanged();
|
|
58 |
|
|
59 |
/**
|
|
60 |
* dummy signal
|
|
61 |
*/
|
|
62 |
void albumChanged();
|
|
63 |
|
|
64 |
public: // from QAbstractItemModel
|
|
65 |
|
|
66 |
/**
|
|
67 |
* return 0 always
|
|
68 |
*/
|
|
69 |
int rowCount(const QModelIndex &parent = QModelIndex()) const
|
|
70 |
{
|
|
71 |
Q_UNUSED(parent);
|
|
72 |
return 0;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
QMap<int, QVariant> itemData(const QModelIndex &index) const
|
|
77 |
{
|
|
78 |
Q_UNUSED(index);
|
|
79 |
return QMap<int, QVariant>();
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
* return empty qvariant
|
|
84 |
*/
|
|
85 |
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const
|
|
86 |
{
|
|
87 |
Q_UNUSED(index);
|
|
88 |
Q_UNUSED(role);
|
|
89 |
return QVariant();
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* columnCount
|
|
94 |
*/
|
|
95 |
int columnCount(const QModelIndex & parent = QModelIndex()) const
|
|
96 |
{
|
|
97 |
Q_UNUSED(parent);
|
|
98 |
return 0;
|
|
99 |
}
|
|
100 |
|
|
101 |
/**
|
|
102 |
* index
|
|
103 |
*/
|
|
104 |
QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const
|
|
105 |
{
|
|
106 |
Q_UNUSED(parent);
|
36
|
107 |
if(mIndexReturnsInvalid)
|
|
108 |
{
|
|
109 |
return QModelIndex();
|
|
110 |
}
|
34
|
111 |
return createIndex(row, column);
|
|
112 |
}
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Parent
|
|
116 |
*/
|
|
117 |
QModelIndex parent(const QModelIndex & index) const
|
|
118 |
{
|
|
119 |
Q_UNUSED(index);
|
|
120 |
return QModelIndex();
|
|
121 |
}
|
|
122 |
|
|
123 |
void beginInsertRows(const QModelIndex &parent, int first, int last)
|
|
124 |
{
|
|
125 |
Q_UNUSED(parent);
|
|
126 |
mFirstInserted = first;
|
|
127 |
mLastInserted = last;
|
|
128 |
}
|
|
129 |
|
|
130 |
void endInsertRows(){}
|
|
131 |
|
|
132 |
void beginRemoveRows(const QModelIndex &parent, int first, int last)
|
|
133 |
{
|
|
134 |
Q_UNUSED(parent);
|
|
135 |
mFirstRemoved = first;
|
|
136 |
mLastRemoved = last;
|
|
137 |
}
|
|
138 |
|
|
139 |
void endRemoveRows(){}
|
|
140 |
|
|
141 |
void reportAsyncStatus(int status, QVariant data)
|
|
142 |
{
|
|
143 |
mStatus = status;
|
|
144 |
mStatusData = data;
|
|
145 |
}
|
36
|
146 |
|
|
147 |
void itemModified(const TMPXItemId itemId)
|
|
148 |
{
|
|
149 |
mModifiedItemId = itemId;
|
|
150 |
}
|
|
151 |
|
34
|
152 |
/**
|
|
153 |
* dummy collectionclient
|
|
154 |
*/
|
|
155 |
VideoCollectionClient *mCollectionClient;
|
|
156 |
|
|
157 |
/**
|
|
158 |
* dummy delete worker
|
|
159 |
*/
|
|
160 |
VideoDeleteWorker *mDeleteWorker;
|
|
161 |
|
|
162 |
/**
|
|
163 |
* setted in beginInsertRows
|
|
164 |
*/
|
|
165 |
static int mFirstInserted;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* setted in beginInsertRows;
|
|
169 |
*/
|
|
170 |
static int mLastInserted;
|
|
171 |
|
|
172 |
/**
|
|
173 |
* setted in beginRemoveRows
|
|
174 |
*/
|
|
175 |
static int mFirstRemoved;
|
|
176 |
|
|
177 |
/**
|
|
178 |
* setted in beginRemoveRows;
|
|
179 |
*/
|
|
180 |
static int mLastRemoved;
|
|
181 |
|
|
182 |
/**
|
|
183 |
* setted in reportAsyncStatus
|
|
184 |
*/
|
|
185 |
static int mStatus;
|
|
186 |
|
|
187 |
/**
|
|
188 |
* setted in reportAsyncStatus
|
|
189 |
*/
|
|
190 |
static QVariant mStatusData;
|
36
|
191 |
|
|
192 |
/**
|
|
193 |
* setted in itemModified
|
|
194 |
*/
|
|
195 |
static TMPXItemId mModifiedItemId;
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Flag if index() should return invalid index.
|
|
199 |
*/
|
|
200 |
static bool mIndexReturnsInvalid;
|
34
|
201 |
};
|
|
202 |
#endif // __STUBTESTMODEL_H__
|
|
203 |
|
|
204 |
// End of file
|