videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videocollectionclient.cpp
changeset 62 0e1e938beb1a
parent 59 a76e86df7ccd
child 65 a9d57bd8d7b7
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
     1 /*
       
     2 * Copyright (c) 2008 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:  Stub collection client to be used when unit testing videocollectionsortfilterproxy 
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES>
       
    20 #include <mpxmediaarray.h>
       
    21 #include "stub/inc/videocollectionclient.h"
       
    22 
       
    23 VideoCollectionClient* VideoCollectionClient::testInstance = 0;
       
    24 
       
    25 bool VideoCollectionClient::mFailInit = false;
       
    26 bool VideoCollectionClient::mFailStartOpen = false;
       
    27 bool VideoCollectionClient::mFailMediaPlayback = false;
       
    28 bool VideoCollectionClient::mFailMediaDetails = false;
       
    29 bool VideoCollectionClient::mFailSetSort = false;
       
    30 bool VideoCollectionClient::mFailAddNewCollection = false;
       
    31 TMPXItemId VideoCollectionClient::mNewAlbumId = TMPXItemId::InvalidId();
       
    32 TVcxMyVideosSortingOrder VideoCollectionClient::mSettedSortOrder = EVcxMyVideosSortingNone;
       
    33 int VideoCollectionClient::mSortOrderSetCount = 0;
       
    34 QString VideoCollectionClient::mAddNewCollectionName = QString();
       
    35 QString VideoCollectionClient::mAddNewCollectionThumb = QString();
       
    36 QList<TMPXItemId> VideoCollectionClient::mAddNewCollectionIds = QList<TMPXItemId>();
       
    37 int VideoCollectionClient::mRenameItemReturnValue = 0;
       
    38 int VideoCollectionClient::mBackReturnValue = 0;
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // VideoCollectionClient
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 VideoCollectionClient::VideoCollectionClient()
       
    45 {
       
    46     testInstance = this;
       
    47 }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // ~CVideoCollectionClient
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 VideoCollectionClient::~VideoCollectionClient()
       
    54 {
       
    55 }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // initialize
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 int VideoCollectionClient::initialize()
       
    62 {
       
    63     if(mFailInit)
       
    64     {
       
    65         return -1;
       
    66     }
       
    67     return 0;
       
    68 }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // startOpenCollection
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 int VideoCollectionClient::startOpenCollection(int level)
       
    75 {
       
    76     Q_UNUSED(level);
       
    77     if(mFailStartOpen)
       
    78     {
       
    79         return -1;
       
    80     }
       
    81     return 0;
       
    82 }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // openItem
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 int VideoCollectionClient::openItem(int /*mpxId1*/)
       
    89 {
       
    90     if(mFailMediaPlayback)
       
    91     {
       
    92         return -1;
       
    93     }
       
    94     return 0;
       
    95 }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // addNewAlbum
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TMPXItemId VideoCollectionClient::addNewAlbum(QString title)
       
   102 {
       
   103     mAddNewCollectionName = title;
       
   104     return mNewAlbumId;
       
   105 }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // addItemsInAlbum
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 int VideoCollectionClient::addItemsInAlbum(TMPXItemId albumId, QList<TMPXItemId> items)
       
   112 {
       
   113     Q_UNUSED(albumId);
       
   114     Q_UNUSED(items);
       
   115     return 0;
       
   116 }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // revoveAlbums
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 int VideoCollectionClient::removeAlbums(const QList<TMPXItemId> &items)
       
   123 {
       
   124     Q_UNUSED(items);
       
   125     return 0;
       
   126 }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // deleteFile
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 int VideoCollectionClient::getVideoDetails(int /*mpxId1*/)
       
   133 {
       
   134     if(mFailMediaDetails)
       
   135     {
       
   136         return -1;
       
   137     }
       
   138     return 0;
       
   139 }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // getCategoryId
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void VideoCollectionClient::getCategoryId(TMPXItemId &id)
       
   146 {
       
   147     id.iId1 = 1;
       
   148     id.iId2 = 2;
       
   149 }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // back
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 int VideoCollectionClient::back()
       
   156 {
       
   157     return mBackReturnValue;
       
   158 }
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // renameItem
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 int VideoCollectionClient::renameItem(const TMPXItemId &itemId, const QString &newTitle)
       
   165 {
       
   166     Q_UNUSED(itemId);
       
   167     Q_UNUSED(newTitle);
       
   168     return mRenameItemReturnValue;
       
   169 }