camerauis/cameraxui/cxengine/src/cxeimagedataitemdesktop.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2010 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 "cxeimagedataitemdesktop.h"
       
    19 
       
    20 CxeImageDataItemDesktop::CxeImageDataItemDesktop(int index, QByteArray data, QString filename, int id) :
       
    21     mIndex(index),
       
    22     mData(data),
       
    23     mFilename(filename),
       
    24     mPixmapData(QPixmap()),
       
    25     mState(CxeImageDataItem::SavePending),
       
    26     mId(id)
       
    27 
       
    28 {
       
    29 
       
    30 }
       
    31 
       
    32 CxeImageDataItemDesktop::CxeImageDataItemDesktop(int index, QPixmap pixmapData, QString filename, int id) :
       
    33     mIndex(index),
       
    34     mData(QByteArray()),
       
    35     mFilename(filename),
       
    36     mPixmapData(pixmapData),
       
    37     mState(CxeImageDataItem::SavePending),
       
    38     mId(id)
       
    39 {
       
    40 
       
    41 }
       
    42 
       
    43 
       
    44 /**
       
    45  * Helper method to save file to Fs
       
    46  * @return CameraX error code
       
    47  */
       
    48 CxeError::Id CxeImageDataItemDesktop::save()
       
    49 {
       
    50     CxeError::Id errorId = CxeError::None;
       
    51 
       
    52     mPixmapData.save(mFilename);
       
    53 
       
    54     mState = CxeImageDataItem::Saved;
       
    55     emit stateChanged(mState, errorId);
       
    56 
       
    57     return errorId;
       
    58 }
       
    59 
       
    60 /**
       
    61  * Get the current state for this item.
       
    62  *
       
    63  * @return State
       
    64  */
       
    65 CxeImageDataItem::State CxeImageDataItemDesktop::state() const
       
    66 {
       
    67     return mState;
       
    68 }
       
    69 
       
    70 /**
       
    71  * Get the id of this item.
       
    72  */
       
    73 int CxeImageDataItemDesktop::id() const
       
    74 {
       
    75     return mId;
       
    76 }
       
    77 
       
    78 /**
       
    79  * Get the id of this item.
       
    80  */
       
    81 QString CxeImageDataItemDesktop::path() const
       
    82 {
       
    83     return mFilename;
       
    84 }