camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp
changeset 37 64817133cd1d
parent 19 d9aefe59d544
child 52 7e18d488ac5f
--- a/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp	Wed Jun 23 17:59:54 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp	Tue Jul 06 14:04:02 2010 +0300
@@ -180,15 +180,27 @@
         // Use a dummy "image data item" with empty data and saved state for videos.
         // We just need to harvest the file and provide snapshot to Thumbnail Manager.
         QByteArray empty;
-        CxeImageDataItem* item = new CxeImageDataItemSymbian(empty, filename, CxeStillImage::INVALID_ID, CxeImageDataItem::Saved);
-        if(item) {
+        CxeImageDataItem* item = new CxeImageDataItemSymbian(empty,
+                                                             filename,
+                                                             CxeStillImage::INVALID_ID,
+                                                             false,
+                                                             CxeImageDataItem::Saved);
+        if (item) {
             save(item);
         }
     }
+
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param filename Name of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename)
 {
     CX_DEBUG_ENTER_FUNCTION();
     CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -199,8 +211,6 @@
         if (!snapshot.isNull()) {
             // QMutexLocker handles locking and unlocking automaticly.
             QMutexLocker lock(&mSnapshotsMutex);
-
-            //!@todo: Store as QImage once TNM API is fixed.
             mSnapshots.insert(filename, snapshot);
         }
     }
@@ -208,7 +218,14 @@
     CX_DEBUG_EXIT_FUNCTION();
 }
 
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param id Id of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id)
 {
     CX_DEBUG_ENTER_FUNCTION();
     CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -316,13 +333,13 @@
                 // so we can find the snapshot when harvesting is ready.
                 QString idString(QString::number(item->id()));
                 if (mSnapshots.contains(idString)) {
-                    const QPixmap& snapshot(mSnapshots[idString]);
+                    QImage snapshot(mSnapshots[idString]);
                     mSnapshots.remove(idString);
                     mSnapshots.insert(path, snapshot);
                 }
             }
 
-            harvestFile(path);
+            harvestFile(path, qobject_cast<CxeImageDataItemSymbian*>(item)->isLocationEnabled());
         }
 
         // Delete item, since we own it
@@ -337,7 +354,7 @@
 * Harvest one file.
 * @param filename Path of the file to be harvested.
 */
-void CxeFileSaveThreadSymbian::harvestFile(const QString& filename)
+void CxeFileSaveThreadSymbian::harvestFile(const QString& filename, bool addLocation)
 {
     CX_DEBUG_ENTER_FUNCTION();
     if (mHarvesterControl) {
@@ -345,8 +362,8 @@
         QMutexLocker lock(&mSnapshotsMutex);
 
         // harvest file ( filename, add to album, album id )
-        CX_DEBUG(("Requesting harvesting for file: %s", filename.toAscii().constData()));
-        CxeError::Id status = mHarvesterControl->harvestFile(filename, false, MDS_CAPTURED_ALBUM_ID);
+        CX_DEBUG(("Requesting harvesting for file: %s addLocation = %d", filename.toAscii().constData(), addLocation));
+        CxeError::Id status = mHarvesterControl->harvestFile(filename, addLocation, MDS_CAPTURED_ALBUM_ID);
         CX_DEBUG(("Status for starting harvesting: %d", status));
 
         // If there were errors, release any snapshot stored for this file.