equal
deleted
inserted
replaced
17 |
17 |
18 #include "videosortfilterproxymodel.h" |
18 #include "videosortfilterproxymodel.h" |
19 #include "videosortfilterproxymodeldata.h" |
19 #include "videosortfilterproxymodeldata.h" |
20 #include "videocollectioncommon.h" |
20 #include "videocollectioncommon.h" |
21 #include "videolistdatamodel.h" |
21 #include "videolistdatamodel.h" |
|
22 |
|
23 using namespace VideoCollectionCommon; |
22 |
24 |
23 int VideoSortFilterProxyModelData::mSortRole = -1; |
25 int VideoSortFilterProxyModelData::mSortRole = -1; |
24 Qt::SortOrder VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder; |
26 Qt::SortOrder VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder; |
25 bool VideoSortFilterProxyModelData::mSortAsync = false; |
27 bool VideoSortFilterProxyModelData::mSortAsync = false; |
26 bool VideoSortFilterProxyModelData::mDeleteItemsFails = false; |
28 bool VideoSortFilterProxyModelData::mDeleteItemsFails = false; |
35 int VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = 0; |
37 int VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = 0; |
36 int VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = 0; |
38 int VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = 0; |
37 TMPXItemId VideoSortFilterProxyModelData::mGenericFilterId = TMPXItemId::InvalidId(); |
39 TMPXItemId VideoSortFilterProxyModelData::mGenericFilterId = TMPXItemId::InvalidId(); |
38 bool VideoSortFilterProxyModelData::mGenericFilterValue = false; |
40 bool VideoSortFilterProxyModelData::mGenericFilterValue = false; |
39 TMPXItemId VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId::InvalidId(); |
41 TMPXItemId VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId::InvalidId(); |
40 |
42 QString VideoSortFilterProxyModelData::mLastAlbumNameInRename; |
41 VideoSortFilterProxyModel::VideoSortFilterProxyModel(int type, QObject *parent): |
43 int VideoSortFilterProxyModelData::mRenameAlbumReturnValue = 0; |
|
44 QString VideoSortFilterProxyModelData::mLastAddedAlbumName = ""; |
|
45 |
|
46 VideoSortFilterProxyModel::VideoSortFilterProxyModel(VideoCollectionCommon::TModelType type, QObject *parent): |
42 QSortFilterProxyModel(parent), |
47 QSortFilterProxyModel(parent), |
43 mModel(0), |
48 mModel(0), |
44 mCollectionClient(0), |
49 mCollectionClient(0), |
45 mType(type), |
50 mType(type), |
46 mLevel(-1), |
51 mLevel(VideoCollectionCommon::ELevelInvalid), |
47 mIdleSortTimer(0), |
52 mIdleSortTimer(0), |
48 mWantedSortRole(VideoCollectionCommon::KeyDateTime) |
53 mWantedSortRole(VideoCollectionCommon::KeyDateTime) |
49 { |
54 { |
50 // NOP |
55 // NOP |
51 } |
56 } |
71 void VideoSortFilterProxyModel::disconnectSignals() |
76 void VideoSortFilterProxyModel::disconnectSignals() |
72 { |
77 { |
73 // not stubbed |
78 // not stubbed |
74 } |
79 } |
75 |
80 |
76 int VideoSortFilterProxyModel::open(int level) |
81 int VideoSortFilterProxyModel::open(VideoCollectionCommon::TCollectionLevels level) |
77 { |
82 { |
78 int err = 0; |
83 int err = 0; |
79 |
84 |
80 mLevel = level; |
85 mLevel = level; |
81 if (VideoSortFilterProxyModelData::mOpenFails) |
86 if (VideoSortFilterProxyModelData::mOpenFails) |
92 { |
97 { |
93 VideoSortFilterProxyModelData::mDoSortingCallCount++; |
98 VideoSortFilterProxyModelData::mDoSortingCallCount++; |
94 VideoSortFilterProxyModelData::mSortRole = sortingRole; |
99 VideoSortFilterProxyModelData::mSortRole = sortingRole; |
95 VideoSortFilterProxyModelData::mSortOrder = order; |
100 VideoSortFilterProxyModelData::mSortOrder = order; |
96 VideoSortFilterProxyModelData::mSortAsync = async; |
101 VideoSortFilterProxyModelData::mSortAsync = async; |
|
102 setSortRole(sortingRole); |
|
103 sort(0, order); |
97 } |
104 } |
98 |
105 |
99 void VideoSortFilterProxyModel::getSorting(int &sortingRole, |
106 void VideoSortFilterProxyModel::getSorting(int &sortingRole, |
100 Qt::SortOrder &order) |
107 Qt::SortOrder &order) |
101 { |
108 { |
147 // not stubbed |
154 // not stubbed |
148 } |
155 } |
149 |
156 |
150 void VideoSortFilterProxyModel::albumChangedSlot() |
157 void VideoSortFilterProxyModel::albumChangedSlot() |
151 { |
158 { |
|
159 // not stubbed |
|
160 } |
|
161 |
|
162 void VideoSortFilterProxyModel::itemModifiedSlot(const TMPXItemId &itemId) |
|
163 { |
|
164 Q_UNUSED(itemId); |
152 // not stubbed |
165 // not stubbed |
153 } |
166 } |
154 |
167 |
155 bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, |
168 bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, |
156 const QModelIndex &right) const |
169 const QModelIndex &right) const |
201 Q_UNUSED(mediaId); |
214 Q_UNUSED(mediaId); |
202 // not stubbed |
215 // not stubbed |
203 return QString(); |
216 return QString(); |
204 } |
217 } |
205 |
218 |
|
219 TModelType VideoSortFilterProxyModel::getType() |
|
220 { |
|
221 return mType; |
|
222 } |
|
223 |
206 TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title) |
224 TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title) |
207 { |
225 { |
208 Q_UNUSED(title); |
226 VideoSortFilterProxyModelData::mLastAddedAlbumName = title; |
209 return VideoSortFilterProxyModelData::mNewAlbumId; |
227 return VideoSortFilterProxyModelData::mNewAlbumId; |
210 } |
228 } |
211 |
229 |
212 QString VideoSortFilterProxyModel::resolveAlbumName( |
230 QString VideoSortFilterProxyModel::resolveAlbumName( |
213 const QString& albumName) const |
231 const QString& albumName) const |
261 void VideoSortFilterProxyModel::setAlbumInUse(TMPXItemId albumId) |
279 void VideoSortFilterProxyModel::setAlbumInUse(TMPXItemId albumId) |
262 { |
280 { |
263 VideoSortFilterProxyModelData::mLastItemId = albumId; |
281 VideoSortFilterProxyModelData::mLastItemId = albumId; |
264 } |
282 } |
265 |
283 |
|
284 int VideoSortFilterProxyModel::renameAlbum(const TMPXItemId &albumId, const QString &newTitle) |
|
285 { |
|
286 if(VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue >= 0) |
|
287 { |
|
288 VideoSortFilterProxyModelData::mLastItemId = albumId; |
|
289 VideoSortFilterProxyModelData::mLastAlbumNameInRename = newTitle; |
|
290 |
|
291 } |
|
292 return VideoSortFilterProxyModelData::mRenameAlbumReturnValue; |
|
293 } |
266 |
294 |
267 TMPXItemId VideoSortFilterProxyModel::getOpenItem() const |
295 TMPXItemId VideoSortFilterProxyModel::getOpenItem() const |
268 { |
296 { |
269 return VideoSortFilterProxyModelData::mOpenedItemId; |
297 return VideoSortFilterProxyModelData::mOpenedItemId; |
270 } |
298 } |