mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsongdata/stub/src/thumbnailmanager_qt.cpp
branchGCC_SURGE
changeset 44 eff9df3d9c98
parent 30 b95ddb5a0d10
parent 42 79c49924ae23
equal deleted inserted replaced
30:b95ddb5a0d10 44:eff9df3d9c98
     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: ThumbnailManager stub for testing MpSongData
       
    15 *
       
    16 */
       
    17 #include <qsize.h>
       
    18 #include "stub/inc/thumbnailmanager_qt.h"
       
    19 
       
    20 int gInitCounter = 0;
       
    21 
       
    22 /*!
       
    23  Returns gInitCounter.
       
    24  gInitCounter counts the number of constructor/destructor calls.
       
    25  */
       
    26 int ThumbnailManager::getInitCounter()
       
    27 {
       
    28     return gInitCounter;
       
    29 }
       
    30 
       
    31 /*!
       
    32  Resets gInitCounter to zero.
       
    33  */
       
    34 void ThumbnailManager::resetInitCounter()
       
    35 {
       
    36     gInitCounter = 0;
       
    37 }
       
    38 
       
    39 /*!
       
    40  Stub function.
       
    41  */
       
    42 ThumbnailManager::ThumbnailManager( QObject* parentPtr ) :
       
    43 QObject( parentPtr ),
       
    44 mGetThumbFails(false),
       
    45 mThumbnailReqCounter(0),
       
    46 mCancelCounter(0)
       
    47 {
       
    48     gInitCounter++;
       
    49 }
       
    50 
       
    51 /*!
       
    52  Stub function.
       
    53  */
       
    54 ThumbnailManager::~ThumbnailManager()
       
    55 {
       
    56     gInitCounter--;
       
    57 }
       
    58 
       
    59 /*!
       
    60  Stub function.
       
    61  */
       
    62 bool ThumbnailManager::setMode( ThumbnailMode mode )
       
    63 {
       
    64     Q_UNUSED(mode);
       
    65     return true;
       
    66 }
       
    67 
       
    68 /*!
       
    69  Stub function.
       
    70  */
       
    71 bool ThumbnailManager::setQualityPreference( QualityPreference
       
    72     qualityPreference )
       
    73 {
       
    74     Q_UNUSED(qualityPreference);
       
    75     return true;
       
    76 }
       
    77 
       
    78 /*!
       
    79  Stub function.
       
    80  */
       
    81 bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize )
       
    82 {
       
    83     Q_UNUSED(thumbnailSize);
       
    84     return true;
       
    85 }
       
    86 
       
    87 /*!
       
    88  Stub function.
       
    89  */
       
    90 int ThumbnailManager::getThumbnail( const QString& fileName, void *clientData,
       
    91         int priority )
       
    92 {
       
    93     Q_UNUSED(fileName);
       
    94     Q_UNUSED(priority);
       
    95 
       
    96     if (clientData) {
       
    97         // Delete this to prevent memory leak
       
    98         int *data = (int *)clientData;
       
    99         delete data;
       
   100 
       
   101         data = 0;
       
   102     }
       
   103 
       
   104     if ( mGetThumbFails ) {
       
   105         return -1;
       
   106     }
       
   107 
       
   108     mThumbnailReqCounter++;
       
   109     return mThumbnailReqCounter;
       
   110 }
       
   111 
       
   112 /*!
       
   113  Stub function.
       
   114  */
       
   115 bool ThumbnailManager::cancelRequest( int id )
       
   116 {
       
   117     Q_UNUSED(id);
       
   118     mCancelCounter++;
       
   119     return true;
       
   120 }