videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videosortfilterproxymodel.cpp
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:  Videolist sort filter proxy stub implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include <qstringlist.h>
       
    19 #include <qdatetime.h>
       
    20 
       
    21 #include "videocollectioncommon.h"
       
    22 #include "videosortfilterproxymodel.h"
       
    23 
       
    24 int VideoSortFilterProxyModel::mRowCountCallCount = 0;
       
    25 bool VideoSortFilterProxyModel::mReturnInvalidIndexes = false;
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // VideoSortFilterProxyModel::VideoSortFilterProxyModel
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
       
    32  QSortFilterProxyModel(parent)
       
    33 {
       
    34     reset();
       
    35 }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // VideoSortFilterProxyModel::~VideoSortFilterProxyModel
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
       
    42 {
       
    43     disconnect();
       
    44 }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // VideoSortFilterProxyModel::lessThan
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
       
    51 {
       
    52     return false;
       
    53 }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // VideoSortFilterProxyModel::getMediaIdAtIndex
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(QModelIndex index)
       
    60 {
       
    61 	return TMPXItemId(index.row(), 0);
       
    62 }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // VideoSortFilterProxyModel::getMediaFilePathForId()
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 QString VideoSortFilterProxyModel::getMediaFilePathForId(TMPXItemId mediaId)
       
    69 {
       
    70     if(mediaId.iId1 >= 0 && mediaId.iId1 < mFileNames.count())
       
    71     {
       
    72         return mFileNames.at(mediaId.iId1);
       
    73     }
       
    74     return "";
       
    75 }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // VideoSortFilterProxyModel::back
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void VideoSortFilterProxyModel::back()
       
    82 {
       
    83 }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // VideoSortFilterProxyModel::reset
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void VideoSortFilterProxyModel::reset()
       
    90 {
       
    91 
       
    92 }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // VideoSortFilterProxyModel::appendData
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void VideoSortFilterProxyModel::appendData(QString fileName)
       
    99 {
       
   100     mFileNames.append(fileName);
       
   101 }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // VideoSortFilterProxyModel::rowCount
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 int VideoSortFilterProxyModel::rowCount(const QModelIndex &parent) const
       
   108 {
       
   109     VideoSortFilterProxyModel::mRowCountCallCount++;
       
   110     return mFileNames.count();
       
   111 }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // VideoSortFilterProxyModel::index
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 QModelIndex VideoSortFilterProxyModel::index(int row, int column, const QModelIndex &parent) const
       
   118 {
       
   119     if(mReturnInvalidIndexes)
       
   120         return QModelIndex();
       
   121     else
       
   122         return QModelIndex(createIndex(row, column));
       
   123 }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // VideoSortFilterProxyModel::mapToSource
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 QModelIndex VideoSortFilterProxyModel::mapToSource(const QModelIndex &proxyIndex) const
       
   130 {
       
   131     return QModelIndex(proxyIndex);
       
   132 }
       
   133 
       
   134 VideoSortFilterProxyModel* VideoSortFilterProxyModel::sourceModel()
       
   135 {
       
   136     return this;
       
   137 }
       
   138 
       
   139 // end of file
       
   140