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