camerauis/cameraxui/cxengine/src/cxestillimagesymbian.cpp
changeset 46 c826656d6714
parent 19 d9aefe59d544
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #include <QString>
       
    19 #include <QPixmap>
       
    20 
       
    21 #include "cxeimagedataitem.h"
    18 #include "cxestillimagesymbian.h"
    22 #include "cxestillimagesymbian.h"
    19 #include "cxutils.h"
    23 #include "cxutils.h"
    20 
    24 
       
    25 // Static initialization
    21 int CxeStillImageSymbian::mNextId = CxeStillImage::INVALID_ID + 1;
    26 int CxeStillImageSymbian::mNextId = CxeStillImage::INVALID_ID + 1;
    22 
    27 
       
    28 /*!
       
    29 * Constructor.
       
    30 */
    23 CxeStillImageSymbian::CxeStillImageSymbian()
    31 CxeStillImageSymbian::CxeStillImageSymbian()
    24   : mSnapshot(),
    32   : mSnapshot(),
    25     mDataItem(NULL),
    33     mDataItem(NULL),
    26     mSaved(false),
    34     mSaved(false),
    27     mId(++mNextId)
    35     mId(++mNextId)
    28 {
    36 {
    29 }
    37 }
    30 
    38 
       
    39 /*!
       
    40 * Destructor.
       
    41 */
    31 CxeStillImageSymbian::~CxeStillImageSymbian()
    42 CxeStillImageSymbian::~CxeStillImageSymbian()
    32 {
    43 {
    33     // Not owned.
    44     // Not owned.
    34     mDataItem = NULL;
    45     mDataItem = NULL;
    35 }
    46 }
    36 
    47 
    37 CxeImageDataItem* CxeStillImageSymbian::dataItem()
    48 /*!
       
    49 * Get the contained data item.
       
    50 * @return Image data item.
       
    51 */
       
    52 CxeImageDataItem *CxeStillImageSymbian::dataItem()
    38 {
    53 {
    39     return mDataItem;
    54     return mDataItem;
    40 }
    55 }
    41 
    56 
       
    57 /*!
       
    58 * Get the filename of this image.
       
    59 * @return The filename.
       
    60 */
    42 QString CxeStillImageSymbian::filename() const
    61 QString CxeStillImageSymbian::filename() const
    43 {
    62 {
    44     return mFilename;
    63     return mFilename;
    45 }
    64 }
    46 
    65 
       
    66 /*!
       
    67 * Get snapshot for this image.
       
    68 * @return Snapshot for this image if set. Null pixmap otherwise.
       
    69 */
    47 QPixmap CxeStillImageSymbian::snapshot() const
    70 QPixmap CxeStillImageSymbian::snapshot() const
    48 {
    71 {
    49     return mSnapshot;
    72     return mSnapshot;
    50 }
    73 }
    51 
    74 
       
    75 /*!
       
    76 * Image saved status.
       
    77 * @return Is this image saved.
       
    78 */
    52 bool CxeStillImageSymbian::saved() const
    79 bool CxeStillImageSymbian::saved() const
    53 {
    80 {
    54     return mSaved;
    81     return mSaved;
    55 }
    82 }
    56 
    83 
       
    84 /*!
       
    85 * Set the unique id of this image.
       
    86 * Usable in one application run context.
       
    87 */
    57 int CxeStillImageSymbian::id() const
    88 int CxeStillImageSymbian::id() const
    58 {
    89 {
    59     return mId;
    90     return mId;
    60 }
    91 }
    61 
    92 
    62 void CxeStillImageSymbian::setSnapshot( QPixmap pixmap )
    93 /*!
       
    94 * Set snapshot for this image.
       
    95 * @param pixmap The snapshot.
       
    96 */
       
    97 void CxeStillImageSymbian::setSnapshot(QPixmap pixmap)
    63 {
    98 {
    64     mSnapshot = pixmap;
    99     mSnapshot = pixmap;
    65 }
   100 }
    66 
   101 
    67 void CxeStillImageSymbian::setFilename( const QString& filename )
   102 /*!
       
   103 * Set the filename of this image.
       
   104 * @param filename The filename.
       
   105 */
       
   106 void CxeStillImageSymbian::setFilename(const QString &filename)
    68 {
   107 {
    69     mFilename = filename;
   108     mFilename = filename;
    70 }
   109 }
    71 
   110 
    72 void CxeStillImageSymbian::setSaved( bool saved )
   111 /*!
       
   112 * Set this image as saved.
       
   113 * @param saved Is this item saved or not.
       
   114 */
       
   115 void CxeStillImageSymbian::setSaved(bool saved)
    73 {
   116 {
    74     mSaved = saved;
   117     mSaved = saved;
    75 }
   118 }
    76 
   119 
    77 void CxeStillImageSymbian::setDataItem( CxeImageDataItem* dataItem )
   120 /*!
       
   121 * Set the contained image data item.
       
   122 * @param dataItem Image data item to store. Ownership not taken.
       
   123 */
       
   124 void CxeStillImageSymbian::setDataItem(CxeImageDataItem *dataItem)
    78 {
   125 {
       
   126     // Disconnect from old data item if it exists.
       
   127     if (mDataItem) {
       
   128         disconnect(mDataItem, 0, this, 0);
       
   129     }
       
   130 
       
   131     // Set the new item.
    79     mDataItem = dataItem;
   132     mDataItem = dataItem;
       
   133 
       
   134     // Connnect to the new item's saved signal.
       
   135     if (mDataItem) {
       
   136         bool ok = connect(mDataItem, SIGNAL(imageSaved(CxeError::Id, const QString&, int)),
       
   137                           this, SLOT(imageDataSaved(CxeError::Id)), Qt::UniqueConnection);
       
   138         CX_ASSERT_ALWAYS(ok);
       
   139     }
    80 }
   140 }
       
   141 
       
   142 /*!
       
   143 * Slot to handle saving the data item has finished.
       
   144 */
       
   145 void CxeStillImageSymbian::imageDataSaved(CxeError::Id status)
       
   146 {
       
   147     setSaved(status == CxeError::None);
       
   148 }
       
   149 
       
   150 // end of file