camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp
changeset 43 0e652f8f1fbd
parent 19 d9aefe59d544
child 45 24fd82631616
equal deleted inserted replaced
28:3075d9b614e6 43:0e652f8f1fbd
     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".
    29 
    29 
    30 
    30 
    31 CxeImageDataItemSymbian::CxeImageDataItemSymbian(QByteArray data,
    31 CxeImageDataItemSymbian::CxeImageDataItemSymbian(QByteArray data,
    32                                                  QString filename,
    32                                                  QString filename,
    33                                                  int id,
    33                                                  int id,
       
    34                                                  bool addLocation,
    34                                                  CxeImageDataItem::State state)
    35                                                  CxeImageDataItem::State state)
    35   : CxeStateMachine("CxeImageDataItemSymbian"),
    36   : CxeStateMachine("CxeImageDataItemSymbian"),
    36     mError(KErrNone),
    37     mError(KErrNone),
    37     mId(id),
    38     mId(id),
    38     mData(data),
    39     mData(data),
       
    40     mAddLocationInfo(addLocation),
    39     mPath(filename)
    41     mPath(filename)
    40 {
    42 {
    41     CX_DEBUG_ENTER_FUNCTION();
    43     CX_DEBUG_ENTER_FUNCTION();
    42 
    44 
    43     qRegisterMetaType<CxeImageDataItem::State>();
    45     qRegisterMetaType<CxeImageDataItem::State>();
   163 */
   165 */
   164 
   166 
   165 CxeError::Id CxeImageDataItemSymbian::save()
   167 CxeError::Id CxeImageDataItemSymbian::save()
   166 {
   168 {
   167     CX_DEBUG_ENTER_FUNCTION();
   169     CX_DEBUG_ENTER_FUNCTION();
       
   170     OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_IN, "msg: e_CX_IMAGEDATAITEM_SAVE 1");
   168 
   171 
   169     mError = KErrNone;
   172     mError = KErrNone;
   170 
   173 
   171     CX_DEBUG(( "Starting to save %s", mPath.toAscii().constData() ));
   174     CX_DEBUG(( "Starting to save %s", mPath.toAscii().constData() ));
   172 
   175 
   223         CX_DEBUG(("file write completed"));
   226         CX_DEBUG(("file write completed"));
   224     }
   227     }
   225 
   228 
   226     mFile.Close(); //~400us
   229     mFile.Close(); //~400us
   227     mFs.Close();   //~450us
   230     mFs.Close();   //~450us
   228     OstTrace0(camerax_performance, CXEIMAGEDATAIMTEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
   231     OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
   229 
   232 
   230     if (mError == KErrNone) {
   233     if (mError == KErrNone) {
   231         setState(CxeImageDataItem::Saved);
   234         setState(CxeImageDataItem::Saved);
   232     } else {
   235     } else {
   233         setState(CxeImageDataItem::SaveFailed);
   236         setState(CxeImageDataItem::SaveFailed);
   234     }
   237     }
   235     emit imageSaved(CxeErrorHandlingSymbian::map(mError), mPath, mId);
   238     emit imageSaved(CxeErrorHandlingSymbian::map(mError), mPath, mId);
   236 
   239 
   237     CX_DEBUG(("mError: %d", mError));
   240     OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_OUT, "msg: e_CX_IMAGEDATAITEM_SAVE 0");
   238     CX_DEBUG_EXIT_FUNCTION();
   241     CX_DEBUG_EXIT_FUNCTION();
   239     return CxeErrorHandlingSymbian::map(mError);
   242     return CxeErrorHandlingSymbian::map(mError);
   240 }
   243 }
   241 
   244 
   242 /**
   245 /**
   325 void CxeImageDataItemSymbian::handleStateChanged(int newStateId, CxeError::Id error)
   328 void CxeImageDataItemSymbian::handleStateChanged(int newStateId, CxeError::Id error)
   326 {
   329 {
   327     emit stateChanged(static_cast<State> (newStateId), error);
   330     emit stateChanged(static_cast<State> (newStateId), error);
   328 }
   331 }
   329 
   332 
       
   333 
       
   334 bool CxeImageDataItemSymbian::isLocationEnabled() const
       
   335 {
       
   336     return mAddLocationInfo;
       
   337 }
       
   338 
   330 void CxeImageDataItemSymbian::initializeStates()
   339 void CxeImageDataItemSymbian::initializeStates()
   331 {
   340 {
   332     // addState( id, name, allowed next states )
   341     // addState( id, name, allowed next states )
   333     addState(new CxeState(SavePending, "SavePending", Saving | SaveFailed));
   342     addState(new CxeState(SavePending, "SavePending", Saving | SaveFailed));
   334     addState(new CxeState(Saving, "Saving", Saved | SaveFailed));
   343     addState(new CxeState(Saving, "Saving", Saved | SaveFailed));