camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp
changeset 19 d9aefe59d544
child 37 64817133cd1d
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QString>
       
    19 
       
    20 #include "cxutils.h"
       
    21 #include "thumbnailmanager_qt.h"
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 /*!
       
    27 * ThumbnailManager::ThumbnailManager
       
    28 */
       
    29 ThumbnailManager::ThumbnailManager(QObject* parentPtr)
       
    30 {
       
    31     Q_UNUSED(parentPtr);
       
    32 
       
    33     mCurrentThumbnailId = 0;
       
    34     mThumbnailManagerIds.clear();
       
    35 }
       
    36 
       
    37 
       
    38 /*!
       
    39 * ThumbnailManager::~ThumbnailManager
       
    40 */
       
    41 ThumbnailManager::~ThumbnailManager()
       
    42 {
       
    43 }
       
    44 
       
    45 
       
    46 
       
    47 /*!
       
    48 * create thumbnail for the given image/video file name and data.
       
    49 */
       
    50 int ThumbnailManager::getThumbnail(const QString& filename, void * clientData, int priority)
       
    51 {
       
    52     CX_DEBUG_ENTER_FUNCTION();
       
    53 
       
    54     Q_UNUSED(priority);
       
    55         
       
    56     int status = KErrNone;
       
    57 
       
    58     if (filename.isNull() || filename.isEmpty()) {
       
    59         status = KErrNotFound;
       
    60     } else {
       
    61         // generate thumbnail id
       
    62         mThumbnailManagerIds.append(mCurrentThumbnailId);
       
    63     }
       
    64 
       
    65     emit thumbnailReady(QPixmap(), clientData, mCurrentThumbnailId, status);
       
    66 
       
    67     mCurrentThumbnailId++;
       
    68     
       
    69     CX_DEBUG_EXIT_FUNCTION();
       
    70 
       
    71     return status;
       
    72 }
       
    73 
       
    74 
       
    75 
       
    76 /*!
       
    77 * start canceling creating thumbnail operation
       
    78 */
       
    79 bool ThumbnailManager::cancelRequest(int id)
       
    80 {
       
    81     return mThumbnailManagerIds.contains(id);
       
    82 }