--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Tue May 25 13:01:47 2010 +0300
@@ -26,6 +26,7 @@
#include <thumbnailobjectsource.h>
class MThumbnailManagerObserver;
+class MThumbnailManagerRequestObserver;
typedef TInt TThumbnailRequestId;
@@ -45,7 +46,8 @@
EAudioFullScreenThumbnailSize,
EGridThumbnailSize,
EListThumbnailSize,
-EFullScreenThumbnailSize
+EFullScreenThumbnailSize,
+EThumbnailSizeCount //last item, don't remove
} TThumbnailSize;
/**
* Thumbnail engine.
@@ -413,8 +415,7 @@
* @return Symbian OS error code or KErrNone if change was
* successful.
*/
- virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) =
- 0;
+ virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) = 0;
/**
* Get a list of supported file formats for object files.
@@ -566,6 +567,21 @@
virtual TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ) = 0;
+ /**
+ * Set optional request observer for getting information about completed
+ * requests that don't include a thumbnail.
+ *
+ * @since Symbian^3
+ * @param aObserver Observer to receive notifications.
+ */
+ virtual void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ) = 0;
+
+ /**
+ * Remove optional request observer.
+ *
+ * @since Symbian^3
+ */
+ virtual void RemoveRequestObserver() = 0;
};
#endif // THUMBNAILMANAGER_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Tue May 25 13:01:47 2010 +0300
@@ -101,4 +101,37 @@
TThumbnailRequestId aId ) = 0;
};
+/** Thumbnail request types */
+enum TThumbnailRequestType
+ {
+ ERequestDeleteThumbnails = 0
+ };
+
+/**
+ * Optional callback interface for getting information about other completed
+ * requests that don't include a thumbnail.
+ *
+ * Request types:
+ * - ERequestDeleteThumbnails
+ *
+ * Can be added using SetRequestObserver(MThumbnailManagerRequestObserver& aObserver)
+ * and removed using RemoveRequestObserver().
+ *
+ * @since Symbian^3
+ */
+class MThumbnailManagerRequestObserver
+ {
+public:
+ /**
+ * A request is complete.
+ *
+ * @since Symbian^3
+ * @param aError Error code.
+ * @param aRequestType Type of the completed request.
+ * @param aId Request ID for the operation.
+ */
+ virtual void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType,
+ TThumbnailRequestId aId ) = 0;
+};
+
#endif // THUMBNAILMANAGEROBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Tue May 25 13:01:47 2010 +0300
@@ -109,6 +109,7 @@
//default displaymode (bpp - bits per pixel) for TNs in DB
//this makes possible to provide all colour depths up to 16M aka 24 -bit full colour
+//Symbian^3 EColor16M
const TDisplayMode KStoreDisplayMode = EColor16M;
//required amount of memory to keep bitmaps on RAM in bits
@@ -155,7 +156,7 @@
_LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" );
_LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" );
_LIT8( KAudio3gppMime, "audio/3gpp" );
-_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" );
+_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" );
_LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" );
_LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" );
_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" );
@@ -280,8 +281,7 @@
* Control flags may be modified by server to signal client side what actually was done, like preview TN
*/
TThumbnailControlFlags iControlFlags;
-
-
+
/**
* Original control flags set by the server for handling specific situations
* (for example for distinguishing between preview thumbnails and
@@ -298,6 +298,11 @@
* Thumbnail's orientation
*/
TInt iOrientation;
+
+ /**
+ * Overwrite old thumbs (SetThumbnailL)
+ */
+ TBool iOverwrite;
};
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v9.20.6_SA_S60.50_Euro1.sis has changed
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/ThumbnailManager_0x102830AB_v9.20.7_SA_S60.50_Euro1.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Tue May 25 13:01:47 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager"},(0x102830AB), 9, 20, 6, TYPE=SA, RU
+#{"Thumbnail Manager"},(0x102830AB), 9, 20, 7, TYPE=SA, RU
; Localised Vendor name
%{"Nokia"}
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Tue May 25 13:01:47 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"ThumbnailManager"},(0x102830AB), 9, 20, 6, TYPE=SA
+#{"ThumbnailManager"},(0x102830AB), 9, 20, 7, TYPE=SA
; Localised Vendor name
%{"Nokia"}
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Tue May 25 13:01:47 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Thumbnail Manager Cenrep"},(0x10202BE9), 9, 20, 6, TYPE=SP
+#{"Thumbnail Manager Cenrep"},(0x10202BE9), 9, 20, 7, TYPE=SP
; Localised Vendor name
%{"Symbian Software Ltd."}
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Tue May 25 13:01:47 2010 +0300
@@ -173,6 +173,8 @@
// reconnect timer
CPeriodic* iReconnect;
+ TBool iSessionError;
+
#ifdef _DEBUG
TUint32 iAddCounter;
TUint32 iModCounter;
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Tue May 25 13:01:47 2010 +0300
@@ -43,6 +43,7 @@
*/
class CThumbAGProcessor: public CActive,
public MThumbnailManagerObserver,
+ public MThumbnailManagerRequestObserver,
public MMdEQueryObserver,
public MHarvesterEventObserver,
public MMPXCollectionObserver,
@@ -78,6 +79,8 @@
// from MThumbnailManagerObserver
void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+ // from MThumbnailManagerRequestObserver
+ void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType, TThumbnailRequestId aId );
// from MHarvesterEventObserver
void HarvestingUpdated(
@@ -311,7 +314,6 @@
TBool iMMCHarvesting;
TBool iMMCHarvestingTemp;
-
CPeriodic* iPeriodicTimer;
//MDS Harvester client
@@ -346,8 +348,7 @@
//Flag is MPX harvesting or MTP synchronisation in progress
TBool iMPXHarvesting;
- //inactivity polling timer
- CPeriodic* iInactivityTimer;
+
//overall status of device
TBool iIdle;
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Tue May 25 13:01:47 2010 +0300
@@ -147,6 +147,7 @@
}
iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
}
else
{
@@ -280,8 +281,10 @@
void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
{
TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
- if (aError != KErrNone)
+ if (aError != KErrNone && !iSessionError)
{
+ iSessionError = ETrue;
+
// kill processor right away, because it also has MdESession
if(iProcessor)
{
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Tue May 25 13:01:47 2010 +0300
@@ -66,6 +66,8 @@
TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" );
iTMSession = CThumbnailManager::NewL( *this );
+ iTMSession->SetRequestObserver(*this);
+
iQueryAllItems = NULL;
iQueryPlaceholders = NULL;
iQuery = NULL;
@@ -116,11 +118,13 @@
{
TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
- if(iForegroundGenerationObserver)
- {
- delete iForegroundGenerationObserver;
- iForegroundGenerationObserver = NULL;
- }
+ Cancel();
+
+ if(iPeriodicTimer)
+ {
+ iPeriodicTimer->Cancel();
+ delete iPeriodicTimer;
+ }
if(iActivityManager)
{
@@ -128,19 +132,27 @@
iActivityManager = NULL;
}
- if (iInactivityTimer)
+ if (iQuery)
{
- iInactivityTimer->Cancel();
- delete iInactivityTimer;
- iInactivityTimer = NULL;
+ iQuery->Cancel();
+ delete iQuery;
+ iQuery = NULL;
}
- if(iPeriodicTimer)
+ if(iQueryPlaceholders)
{
- iPeriodicTimer->Cancel();
- delete iPeriodicTimer;
+ iQueryPlaceholders->Cancel();
+ delete iQueryPlaceholders;
+ iQueryPlaceholders = NULL;
}
+ if (iQueryAllItems)
+ {
+ iQueryAllItems->Cancel();
+ delete iQueryAllItems;
+ iQueryAllItems = NULL;
+ }
+
if (!iInit)
{
#ifdef MDS_MODIFY_OBSERVER
@@ -149,35 +161,18 @@
#endif
}
+ if(iForegroundGenerationObserver)
+ {
+ delete iForegroundGenerationObserver;
+ iForegroundGenerationObserver = NULL;
+ }
+
if ( iCollectionUtility )
{
iCollectionUtility->Close();
iCollectionUtility = NULL;
}
- Cancel();
-
- if(iQueryPlaceholders)
- {
- iQueryPlaceholders->Cancel();
- delete iQueryPlaceholders;
- iQueryPlaceholders = NULL;
- }
-
- if (iQuery)
- {
- iQuery->Cancel();
- delete iQuery;
- iQuery = NULL;
- }
-
- if (iQueryAllItems)
- {
- iQueryAllItems->Cancel();
- delete iQueryAllItems;
- iQueryAllItems = NULL;
- }
-
iAddQueue.Close();
iModifyQueue.Close();
iRemoveQueue.ResetAndDestroy();
@@ -188,6 +183,7 @@
if (iTMSession)
{
+ iTMSession->RemoveRequestObserver();
delete iTMSession;
iTMSession = NULL;
}
@@ -435,6 +431,29 @@
TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" );
}
+// -----------------------------------------------------------------------------
+// CThumbAGProcessor::ThumbnailRequestReady()
+// -----------------------------------------------------------------------------
+//
+void CThumbAGProcessor::ThumbnailRequestReady( TInt /*aError*/, TThumbnailRequestType aRequestType,
+ TThumbnailRequestId /*aId*/ )
+ {
+ if (aRequestType == ERequestDeleteThumbnails)
+ {
+ TN_DEBUG1( "CThumbAGProcessor::ThumbnailRequestReady() - delete" );
+
+ iActiveCount--;
+
+ if(iActiveCount <= 0)
+ {
+ iActiveCount = 0;
+ iActive = EFalse;
+ }
+
+ ActivateAO();
+ }
+ }
+
// ---------------------------------------------------------------------------
// CThumbAGProcessor::SetMdESession()
// ---------------------------------------------------------------------------
@@ -665,10 +684,20 @@
}
}
- // 9.2 specific
- if( !(imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id()) )
+ /*CMdEProperty* inDefaultFolder = NULL;
+ TBool inDefaultFolderVal(ETrue);
+ TInt inDefaultFolderErr = aObject->Property( baseObjDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ), inDefaultFolder, 0 );
+
+ if(inDefaultFolder && inDefaultFolderErr >= 0 )
{
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round and not image or video, skip");
+ inDefaultFolderVal = inDefaultFolder->BoolValueL();
+ }*/
+
+ // Symbian^3 specific
+ if( !(( imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id())
+ /*&& inDefaultFolderVal*/ ) )
+ {
+ TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round; not image or video in default folder, skip");
ActivateAO();
return;
}
@@ -935,6 +964,7 @@
}
else
{
+ iTMSession->SetRequestObserver(*this);
iSessionDied = EFalse;
}
}
@@ -1110,9 +1140,10 @@
iRemoveQueue.Remove( 0 );
delete source;
delete uri;
+
+ iActiveCount++;
+ iActive = ETrue;
}
-
- ActivateAO();
}
else if( i2ndRoundGenerateQueue.Count() > 0)
{
@@ -1133,7 +1164,7 @@
//
void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
{
- TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
+ TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems );
if(iQuery)
{
@@ -1728,7 +1759,8 @@
{
iIdle = ETrue;
- if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
+ if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() +
+ iQueryQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
{
ActivateAO();
}
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Tue May 25 13:01:47 2010 +0300
@@ -353,6 +353,22 @@
*/
TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle );
+
+ /**
+ * Set optional request observer for getting information about completed
+ * requests that don't include a thumbnail.
+ *
+ * @since Symbian^3
+ * @param aObserver Observer to receive notifications.
+ */
+ void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver );
+
+ /**
+ * Remove optional request observer.
+ *
+ * @since Symbian^3
+ */
+ void RemoveRequestObserver();
private:
@@ -400,6 +416,11 @@
* Observer to receive notifications about completed operations.
*/
MThumbnailManagerObserver& iObserver;
+
+ /**
+ * Observer to receive notifications about completed requests.
+ */
+ MThumbnailManagerRequestObserver* iRequestObserver;
/**
* Session.
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Tue May 25 13:01:47 2010 +0300
@@ -32,7 +32,7 @@
class CThumbnailDataImpl;
class CThumbnailRequestQueue;
-enum TThumbnailRequestType
+enum TThumbnailReqType
{
EReqGetThumbnailHandle = 0,
EReqGetThumbnailPath = 1,
@@ -66,16 +66,17 @@
* @since S60 v5.0
* @param aFs Fileserver used.
* @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed
- * operations.
+ * @param aObserver Observer to receive notifications about completed operations.
+ * @param aRequestObserver Observer to receive notifications about completed requests.
* @param aId Assigned ID of the request, session specific.
* @param aPriority assigned processing priority
* @param aQueue request processor
* @return New CThumbnailRequestActive object.
*/
static CThumbnailRequestActive* NewL( RFs& aFs, RThumbnailSession&
- aThumbnailSession, MThumbnailManagerObserver& aObserver,
- TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue );
+ aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId,
+ TInt aPriority, CThumbnailRequestQueue* aQueue );
/**
* Get a thumbnail created from file object.
@@ -163,12 +164,13 @@
* @param aGeneratePersistentSizesOnly
* @param aTargetUri Target URI to which the imported thumbnail is linked.
* @param aThumbnailSize Requested thumbnail size
+ * @param aOverwrite Overwrite old existing thumbs
*/
void SetThumbnailL( TDesC8* aBuffer, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize );
+ const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
/**
* Set a thumbnail
@@ -187,12 +189,13 @@
* @param aGeneratePersistentSizesOnly
* @param aTargetUri Target URI to which the imported thumbnail is linked.
* @param aThumbnailSize Requested thumbnail size
+ * @param aOverwrite Overwrite old existing thumbs
*/
void SetThumbnailL( CFbsBitmap* aBitmap, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize );
+ const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
/**
* Update thumbnails by Id.
@@ -294,16 +297,16 @@
* @since S60 v5.0
* @param aFs Fileserver used.
* @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed
- * operations.
+ * @param aObserver Observer to receive notifications about completed operations.
+ * @param aRequestObserver Observer to receive notifications about completed requests.
* @param aId Assigned ID of the request, session specific.
* @param aPriority assigned processing priority
* @param aQueue request processor
* @return New CThumbnailRequestActive object.
*/
CThumbnailRequestActive( RFs& aFs, RThumbnailSession& aThumbnailSession,
- MThumbnailManagerObserver& aObserver, TThumbnailRequestId aId, TInt aPriority,
- CThumbnailRequestQueue* aQueue);
+ MThumbnailManagerObserver& aObserver, MThumbnailManagerRequestObserver* aRequestObserver,
+ TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue);
/**
* Symbian 2nd phase constructor can leave.
@@ -386,6 +389,11 @@
* Observer to receive notifications about completed operations.
*/
MThumbnailManagerObserver& iObserver;
+
+ /**
+ * Observer to receive notifications about completed requests.
+ */
+ MThumbnailManagerRequestObserver* iRequestObserver;
/**
* Fileserver, not own
@@ -454,7 +462,7 @@
// not own
CThumbnailRequestQueue* iRequestQueue;
- TThumbnailRequestType iRequestType;
+ TThumbnailReqType iRequestType;
// request timeout timer
CPeriodic* iTimer;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Tue May 25 13:01:47 2010 +0300
@@ -89,7 +89,7 @@
// ---------------------------------------------------------------------------
//
CThumbnailManagerImpl::CThumbnailManagerImpl( MThumbnailManagerObserver&
- aObserver ): iObserver( aObserver ), iDisplayMode(
+ aObserver ): iObserver( aObserver ), iRequestObserver( NULL ), iDisplayMode(
KThumbnailDefaultDisplayMode ), iFlags( EDefaultFlags ), iQualityPreference
( EOptimizeForQuality ), iRequestId( 0 )
{
@@ -154,7 +154,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
if(aObjectSource.Id() > 0)
@@ -215,7 +215,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, iFlags,
@@ -249,7 +249,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
if ( aObjectSource.Uri().Length())
@@ -290,16 +290,26 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
- if ( aObjectSource.Uri().Length() &&
- aObjectSource.Buffer() != NULL &&
- aObjectSource.MimeType() != KNullDesC8)
+ if (aObjectSource.Uri().Length() &&
+ aObjectSource.Bitmap() != NULL)
{
+ // from bitmap
+ getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
+ aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference,
+ iSize, iDisplayMode, priority, aClientData, ETrue,
+ aObjectSource.Uri(), iThumbnailSize, ETrue);
+ }
+ else if (aObjectSource.Uri().Length() &&
+ aObjectSource.Buffer() != NULL &&
+ aObjectSource.MimeType() != KNullDesC8)
+ {
+ // from buffer
getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(), aObjectSource.Id(),
aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, EFalse, aObjectSource.Uri(), iThumbnailSize);
+ priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
}
iRequestQueue->AddRequestL( getThumbnailActive );
@@ -329,7 +339,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -339,7 +349,7 @@
getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference,
iSize, iDisplayMode, priority, NULL, ETrue,
- aObjectSource.Uri(), EUnknownThumbnailSize);
+ aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
}
else if( !aObjectSource.Buffer() )
{
@@ -354,7 +364,7 @@
getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(),
aObjectSource.Id(), aObjectSource.MimeType(), iFlags,
iQualityPreference, iSize, iDisplayMode, priority, NULL,
- ETrue, aObjectSource.Uri(), EUnknownThumbnailSize);
+ ETrue, aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
}
iRequestQueue->AddRequestL( getThumbnailActive );
@@ -491,7 +501,8 @@
__ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
+ iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -533,7 +544,8 @@
__ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, CActive::EPriorityIdle, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
+ iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
@@ -620,7 +632,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->UpdateThumbnailsL( aPath, aItemId, iFlags, iQualityPreference,
@@ -648,7 +660,7 @@
TInt priority = ValidatePriority(aPriority);
CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestId, priority, iRequestQueue );
+ ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
CleanupStack::PushL( getThumbnailActive );
getThumbnailActive->RenameThumbnails( aCurrentPath, aNewPath, priority );
@@ -661,6 +673,32 @@
return iRequestId;
}
+
+// ---------------------------------------------------------------------------
+// CThumbnailManagerImpl::SetRequestObserver()
+// Adds optional request observer
+// ---------------------------------------------------------------------------
+//
+void CThumbnailManagerImpl::SetRequestObserver( MThumbnailManagerRequestObserver& aObserver )
+ {
+ iRequestObserver = NULL;
+ iRequestObserver = &aObserver;
+ }
+
+// ---------------------------------------------------------------------------
+// CThumbnailManagerImpl::RemoveRequestObserver()
+// Removes optional request observer
+// ---------------------------------------------------------------------------
+//
+void CThumbnailManagerImpl::RemoveRequestObserver()
+ {
+ if (iRequestObserver)
+ {
+ iRequestObserver = NULL;
+ }
+ }
+
+
// ---------------------------------------------------------------------------
// CThumbnailManagerImpl::ValidatePriority()
// Check that given priority is in range of CActive::TPriority
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Tue May 25 13:01:47 2010 +0300
@@ -134,6 +134,7 @@
iUri = aUri.AllocL();
iMimeType = HBufC8::NewL( aMimeType.Length() );
iMimeType->Des().Copy( aMimeType );
+ iBitmap = NULL;
}
@@ -149,6 +150,7 @@
iMimeType = HBufC8::NewL( aMimeType.Length() );
iMimeType->Des().Copy( aMimeType );
iThumbnailId = 0;
+ iBitmap = NULL;
}
// ---------------------------------------------------------------------------
@@ -177,6 +179,7 @@
iMimeType->Des().Copy( aMimeType );
iUri = aUri.AllocL();
iThumbnailId = 0;
+ iBitmap = NULL;
}
// ---------------------------------------------------------------------------
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Tue May 25 13:01:47 2010 +0300
@@ -65,10 +65,11 @@
//
CThumbnailRequestActive* CThumbnailRequestActive::NewL( RFs& aFs,
RThumbnailSession& aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver,
TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue )
{
CThumbnailRequestActive* self = new( ELeave )CThumbnailRequestActive( aFs,
- aThumbnailSession, aObserver, aId, aPriority, aQueue );
+ aThumbnailSession, aObserver, aRequestObserver, aId, aPriority, aQueue );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
@@ -83,10 +84,11 @@
//
CThumbnailRequestActive::CThumbnailRequestActive( RFs& aFs, RThumbnailSession&
aThumbnailSession, MThumbnailManagerObserver& aObserver,
+ MThumbnailManagerRequestObserver* aRequestObserver,
TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ):
CActive( aPriority ), iSession( aThumbnailSession ), iParamsPckg( iParams ),
- iObserver( aObserver ), iFs( aFs ), iBitmapHandle( 0 ), iRequestId( aId ),
- iRequestQueue( aQueue ), iCanceled( EFalse )
+ iObserver( aObserver ), iRequestObserver( aRequestObserver ), iFs( aFs ), iBitmapHandle( 0 ),
+ iRequestId( aId ), iRequestQueue( aQueue ), iCanceled( EFalse )
{
CActiveScheduler::Add( this );
TN_DEBUG2( "CThumbnaiRequestActive::CThumbnailRequestActive() AO's priority = %d", Priority());
@@ -244,10 +246,38 @@
iTimer->Cancel();
- if (iRequestType == EReqDeleteThumbnails || iCanceled ||
- iRequestType == EReqRenameThumbnails)
+ if (iRequestType == EReqDeleteThumbnails)
{
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename/delete/canceled" );
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - delete" );
+
+ if (iRequestObserver)
+ {
+ iRequestObserver->ThumbnailRequestReady(iStatus.Int(), ERequestDeleteThumbnails ,iParams.iRequestId);
+ }
+
+ iFile.Close();
+ iMyFileHandle.Close();
+
+ // no action for delete/rename or canceled request
+ iRequestQueue->RequestComplete(this);
+
+#ifdef _DEBUG
+ TTime stop;
+ stop.UniversalTime();
+ TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms",
+ iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
+#endif
+ }
+ else if (iCanceled || iRequestType == EReqRenameThumbnails)
+ {
+ if (iCanceled)
+ {
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - canceled" );
+ }
+ else if (iRequestType == EReqRenameThumbnails)
+ {
+ TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename" );
+ }
iFile.Close();
iMyFileHandle.Close();
@@ -287,7 +317,7 @@
TCallBack(TimerCallBack, this));
SetActive();
}
- else if ( iStatus.Int())
+ else if ( iStatus.Int() )
{
TN_DEBUG2( "CThumbnailRequestActive::RunL() - error (%d) occured", iStatus.Int() );
// An error occurred
@@ -527,17 +557,26 @@
TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected");
}
}
- iCallbackThumbnail->Set( NULL, iClientData );
+
+ if (iRequestObserver && iRequestType == EReqDeleteThumbnails)
+ {
+ TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId );
+ iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId);
+ }
+ else
+ {
+ iCallbackThumbnail->Set( NULL, iClientData );
- // don't leak internal TNM codes
- if (iError == KThumbnailErrThumbnailNotFound)
- {
- iError = KErrNotFound;
+ // don't leak internal TNM codes
+ if (iError == KThumbnailErrThumbnailNotFound)
+ {
+ iError = KErrNotFound;
+ }
+
+ TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId );
+ iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
}
- TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId );
- iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
-
iError = KErrNone;
}
@@ -589,6 +628,7 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
User::LeaveIfError( iFile.Duplicate( aFile ));
@@ -624,6 +664,7 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
iTargetUri = aTargetUri;
}
@@ -657,6 +698,7 @@
iParams.iThumbnailSize = aThumbnailSize;
iParams.iThumbnailId = aThumbnailId;
iParams.iFileName = aPath;
+ iParams.iOverwrite = EFalse;
iPath = aPath;
iTargetUri = aTargetUri;
@@ -671,7 +713,8 @@
const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize )
+ TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
+ TBool aOverwrite)
{
iRequestType = EReqSetThumbnailBuffer;
@@ -691,6 +734,7 @@
iParams.iFlags = aFlags;
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = aOverwrite;
iTargetUri = aTargetUri;
}
@@ -704,7 +748,8 @@
const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize )
+ TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
+ TBool aOverwrite)
{
iClientData = aClientData;
iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
@@ -721,6 +766,7 @@
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
iParams.iFileName = aTargetUri;
+ iParams.iOverwrite = aOverwrite;
iTargetUri = aTargetUri;
@@ -769,6 +815,7 @@
iParams.iFlags = aFlags;
iParams.iQualityPreference = aQualityPreference;
iParams.iThumbnailId = aThumbnailId;
+ iParams.iOverwrite = EFalse;
iPath = aPath;
iOrientation = aOrientation;
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Tue May 25 13:01:47 2010 +0300
@@ -685,11 +685,14 @@
#ifdef _DEBUG
TUint32 iPlaceholderCounter;
#endif
+
/**
* Fetched checker.
* Own.
*/
CThumbnailFetchedChecker* iFetchedChecker;
+
+ TBool iSessionError;
};
#endif // THUMBNAILSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Tue May 25 13:01:47 2010 +0300
@@ -204,7 +204,7 @@
_LIT8( KThumbnailTempRename, "UPDATE TempThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" );
// reset blacklisted
-_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Modified = 0 WHERE Flags & :Flag" );
+_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Flags = 4, Modified = 0 WHERE Flags & :Flag" );
// existence check
_LIT8( KThumbnailSelectAllPaths, "SELECT ThumbnailInfo.RowID,Path FROM ThumbnailInfo "
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Tue May 25 13:01:47 2010 +0300
@@ -240,6 +240,7 @@
size.iSize.iWidth );
aCroppedTargetSize.iHeight = Max( aCroppedTargetSize.iHeight,
size.iSize.iHeight );
+
if(iBuffer)
{
iFlags = ( CThumbnailManager::TThumbnailFlags ) (iFlags | CThumbnailManager::ECropToAspectRatio);
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue May 25 13:01:47 2010 +0300
@@ -224,6 +224,7 @@
// connect to MDS
iMdESession = CMdESession::NewL( *this );
+ iSessionError = EFalse;
User::LeaveIfError( iFbsSession.Connect());
User::LeaveIfError( Start( KThumbnailServerName ));
@@ -329,8 +330,10 @@
void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
{
TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError );
- if (aError != KErrNone && !iShutdown)
+ if (aError != KErrNone && !iShutdown && !iSessionError)
{
+ iSessionError = ETrue;
+
if (!iReconnect->IsActive())
{
iReconnect->Start( KMdEReconnect, KMdEReconnect,
@@ -425,17 +428,15 @@
const TThumbnailBitmapRef* ref = bpiter.NextValue();
while ( ref )
- {
+ {
+ if ( ref->iSession == aSession )
+ {
+ TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
- TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
-
- if ( ref->iSession == aSession )
- {
delete ref->iBitmap;
bpiter.RemoveCurrent();
- TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d",
- iBitmapPool.Count());
+ TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
}
ref = bpiter.NextValue();
@@ -1320,6 +1321,10 @@
{
aMimeType = TDataType( KVideo3gppMime );
}
+ else if ( ext.CompareF( K3gppExt ) == 0 )
+ {
+ aMimeType = TDataType( KVideo3gppMime );
+ }
else if ( ext.CompareF( KAmrExt ) == 0 )
{
aMimeType = TDataType( KAudioAmrMime );
@@ -1628,6 +1633,7 @@
// reconnect to MDS
TRAP_IGNORE( self->iMdESession = CMdESession::NewL( *self ) );
+ self->iSessionError = EFalse;
TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Tue May 25 13:01:47 2010 +0300
@@ -156,6 +156,8 @@
//
void CThumbnailServerSession::CreateL()
{
+ TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this );
+
Server()->AddSession();
}
@@ -471,8 +473,8 @@
if( err == KErrCompletion )
{
// If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
+
aMessage.Complete( err );
iMessage = RMessage2();
}
@@ -494,8 +496,7 @@
}
else if (!err && iBuffer)
{
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
@@ -515,8 +516,8 @@
}
else
{
- TN_DEBUG2(
- "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
+ TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
+
aMessage.Complete( ConvertSqlErrToE32Err( err ));
iMessage = RMessage2();
}
@@ -591,8 +592,8 @@
else if( err == KErrCompletion )
{
// If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
+
aMessage.Complete( err );
iMessage = RMessage2();
}
@@ -643,26 +644,31 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
- if(params.iThumbnailSize != EUnknownThumbnailSize)
+ // delete existing
+ if(params.iOverwrite)
{
Server()->DeleteThumbnailsL( params.iTargetUri);
}
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- TDataType mimetype;
- TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
-
- if( ret == KErrNone )
+ // if only one size
+ if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
+ {
+ if(params.iThumbnailSize == EFullScreenThumbnailSize ||
+ params.iThumbnailSize == EGridThumbnailSize ||
+ params.iThumbnailSize == EListThumbnailSize )
{
- sourceType = Server()->SourceTypeFromMimeType( mimetype );
- ModifyThumbnailSize(sourceType);
+ TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
+ TDataType mimetype;
+ TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
+
+ if( ret == KErrNone )
+ {
+ sourceType = Server()->SourceTypeFromMimeType( mimetype );
+ ModifyThumbnailSize(sourceType);
+ }
+ User::LeaveIfError( ret );
}
- User::LeaveIfError( ret );
- }
+ }
TInt bufferSize = aMessage.Int2();
HBufC8* buffer = HBufC8::NewMaxLC( bufferSize );
@@ -686,17 +692,44 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
+ const TThumbnailServerRequestId reqId( this, params.iRequestId );
+
+ // delete existing
+ if(params.iOverwrite)
+ {
+ Server()->DeleteThumbnailsL( params.iTargetUri);
+ }
+
+ // if only one size
+ if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
+ {
+ if(params.iThumbnailSize == EFullScreenThumbnailSize ||
+ params.iThumbnailSize == EGridThumbnailSize ||
+ params.iThumbnailSize == EListThumbnailSize )
+ {
+ TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
+ TDataType mimetype;
+ TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
+
+ if( ret == KErrNone )
+ {
+ sourceType = Server()->SourceTypeFromMimeType( mimetype );
+ ModifyThumbnailSize(sourceType);
+ }
+ User::LeaveIfError( ret );
+ }
+ }
+
TInt bitmapHandle = aMessage.Int1();
- TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId;
// get bitmap
CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
-
+
// use pool to prevent bitmap leak
// this bitmap is shared to several scale tasks, one of which can Leave
- Server()->AddBitmapToPoolL( reqId.iSession, bitmap, reqId );
+ Server()->AddBitmapToPoolL( this, bitmap, reqId );
CleanupStack::Pop( bitmap );
iBitmapHandle = bitmap->Handle();
@@ -765,7 +798,7 @@
// completion to first task, because task processor works like stack
if( i == 0 )
- {
+ {
// scaleTask is now responsible for completing the RMessage
scaleTask->SetMessageData( reqId, iMessage, iClientThread );
iMessage = RMessage2();
@@ -799,7 +832,7 @@
//
void CThumbnailServerSession::CreateGenerateTaskFromFileHandleL( RFile64* aFile)
{
- const TThumbnailRequestParams& params = iRequestParams();
+ TThumbnailRequestParams& params = iRequestParams();
TN_DEBUG2(
"CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", ¶ms.iFileName );
@@ -821,7 +854,6 @@
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
-
TBool gridSizeOnly(EFalse);
if ( params.iQualityPreference == CThumbnailManager
@@ -844,6 +876,25 @@
return;
}
}
+ // creating single TN on demand
+ else if( params.iThumbnailSize > ECustomThumbnailSize && params.iThumbnailSize < EThumbnailSizeCount)
+ {
+ TThumbnailPersistentSize persistentSize = Server()->PersistentSizeL(params.iThumbnailSize);
+
+ if(persistentSize.iCrop)
+ {
+ params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags | CThumbnailManager::ECropToAspectRatio);
+ }
+ else
+ {
+ params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags & CThumbnailManager::ECropToAspectRatio);
+ }
+
+ if( ClientThreadAlive() )
+ {
+ iMessage.Write( 0, iRequestParams );
+ }
+ }
// priority
TInt priority = params.iPriority;
@@ -1079,8 +1130,7 @@
TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool");
- TThumbnailServerRequestId &reqId = (TThumbnailServerRequestId&)params.iRequestId;
- Server()->AddBitmapToPoolL( this, iBitmap, reqId );
+ Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) );
iMessage.Complete( KErrNone );
iMessage = RMessage2();
@@ -1182,7 +1232,6 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
-
#ifdef RD_MDS_2_5
// try to query path from MDS
CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
@@ -1190,9 +1239,11 @@
CleanupStack::PushL( task );
task->QueryPathByIdL(params.iThumbnailId, ETrue);
+ task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ) );
Server()->QueueTaskL( task );
CleanupStack::Pop( task ); // owned by processor now
#endif // RD_MDS_2_5
+
aMessage.Complete( KErrNone );
iMessage = RMessage2();
}
@@ -1202,8 +1253,7 @@
// list of supported MIME types
// -----------------------------------------------------------------------------
//
-void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage
- )
+void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage )
{
TPckgBuf < TInt > buf;
buf() = Server()->GetMimeTypeBufferSize();
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Tue May 25 13:01:47 2010 +0300
@@ -35,7 +35,7 @@
#include "thumbnailserver.h"
-_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=32;" );
+_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=64;" );
const TInt KStreamBufferSize = 1024 * 8;
const TInt KMajor = 3;
@@ -299,6 +299,7 @@
{
TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() drive: %d", iDrive );
+ CloseStatements();
iDatabase.Close();
iUnrecoverable = ETrue;
@@ -474,6 +475,7 @@
TBuf<50> mediaid;
mediaid.Num(id);
+ CloseStatements();
iDatabase.Close();
iUnrecoverable = ETrue;
@@ -529,6 +531,7 @@
// delete db if not fully complete
if (prepareErr < 0 || mediaidErr < 0)
{
+ CloseStatements();
iDatabase.Close();
TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() delete database" );
TInt del = iDatabase.Delete(pathPtr);
@@ -1553,7 +1556,6 @@
TInt found = KErrNotFound;
TInt rowStatus = 0;
TInt column = 0;
- TBool inTempTable = ETrue;
TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- TEMP TABLE lookup" );
@@ -1575,7 +1577,6 @@
if(rowStatus != KSqlAtRow)
{
TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- MAIN TABLE lookup" );
- inTempTable = EFalse;
CleanupStack::PopAndDestroy( stmt );
stmt = &iStmt_KThumbnailSelectInfoByPath;
@@ -1602,21 +1603,23 @@
// KErrNotFound to get thumbnail regenerated.
column = 4;
TInt flags = stmt->ColumnInt( column );
- if( flags & KThumbnailDbFlagBlacklisted && (*path).Length() )
+ if( flags & KThumbnailDbFlagDeleted )
{
- TBool modified = EFalse;
- CheckModifiedByPathL( aPath, inTempTable, modified );
- if( modified )
- {
- // Close db to get deletion of thumbnails executed.
- CleanupStack::PopAndDestroy( &stmt );
- DeleteThumbnailsL( *path );
- User::Leave( KErrNotFound );
- }
- else
- {
- User::Leave( KErrCompletion );
- }
+ CleanupStack::PopAndDestroy( stmt );
+
+ // delete existing blacklisted thumbs
+ DeleteThumbnailsL(*path, ETrue);
+
+ CleanupStack::PopAndDestroy( path );
+
+ User::Leave( KErrNotFound );
+ }
+ else if( flags & KThumbnailDbFlagBlacklisted )
+ {
+ CleanupStack::PopAndDestroy( stmt );
+ CleanupStack::PopAndDestroy( path );
+
+ User::Leave( KErrCompletion );
}
else if( !(flags & KThumbnailDbFlagBlacklisted) )
{
@@ -1799,19 +1802,40 @@
}
else
{
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" );
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" );
- // only add path to deleted table
- stmt = &iStmt_KThumbnailSqlInsertDeleted;
+ stmt = &iStmt_KThumbnailSqlSelectRowIDInfoByPath;
CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
+
paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
User::LeaveIfError( paramIndex );
User::LeaveIfError( stmt->BindText( paramIndex, *path ));
+
+ rowStatus = stmt->Next();
+
+ CleanupStack::PopAndDestroy( stmt );
- count = stmt->Exec();
+ // there were matching rows in main table
+ if (rowStatus == KSqlAtRow)
+ {
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" );
- CleanupStack::PopAndDestroy( stmt );
+ // only add path to deleted table
+ stmt = &iStmt_KThumbnailSqlInsertDeleted;
+ CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
+
+ paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
+ User::LeaveIfError( paramIndex );
+ User::LeaveIfError( stmt->BindText( paramIndex, *path ));
+
+ count = stmt->Exec();
+
+ CleanupStack::PopAndDestroy( stmt );
+ }
+ else
+ {
+ TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- no thumbs in MAIN" );
+ }
}
if (aTransaction)
@@ -1937,6 +1961,7 @@
if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
{
// cache empty or db unusable
+ TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error ");
return;
}
@@ -1949,7 +1974,9 @@
}
//set init max flush delay
- TInt aMaxFlushDelay(KMaxFlushDelay);
+ TReal32 aMaxFlushDelay(KMaxFlushDelay);
+ TReal32 aPreviousFlushDelay(iPreviousFlushDelay);
+ TReal32 aBatchFlushItemCount(iBatchFlushItemCount);
if(MPXHarvesting)
{
@@ -1961,16 +1988,24 @@
//1st item in batch
if( iBatchItemCount == 1)
{
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() calculate new batch size iPreviousFlushDelay = %d", iPreviousFlushDelay);
//adjust batch size dynamically between min and max based on previous flush speed
- if(iPreviousFlushDelay > 0 )
+ if( iPreviousFlushDelay > 0 )
{
- iBatchFlushItemCount = (aMaxFlushDelay/iPreviousFlushDelay)*iBatchFlushItemCount;
+ TReal32 aNewBatchFlushItemCount = aMaxFlushDelay / aPreviousFlushDelay * aBatchFlushItemCount;
+ iBatchFlushItemCount = (TInt)aNewBatchFlushItemCount;
+
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aMaxFlushDelay %e", aMaxFlushDelay);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aPreviousFlushDelay %e", aPreviousFlushDelay);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aBatchFlushItemCount %e", aBatchFlushItemCount);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() aNewBatchFlushItemCount %e", aNewBatchFlushItemCount);
+ TN_DEBUG2("CThumbnailStore::FlushCacheTable() iBatchFlushItemCount %d", iBatchFlushItemCount);
- if(iBatchFlushItemCount < KMInBatchItems)
+ if( iBatchFlushItemCount < KMInBatchItems )
{
iBatchFlushItemCount = KMInBatchItems;
}
- else if(iBatchFlushItemCount > KMaxBatchItems)
+ else if( iBatchFlushItemCount > KMaxBatchItems )
{
iBatchFlushItemCount = KMaxBatchItems;
}
@@ -2203,14 +2238,14 @@
TRAPD( err, finished = self->FileExistenceCheckL() );
if (err != KErrNone)
{
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check failed, err %d", err);
+ TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check failed, err %d", err);
return err;
}
// all files checked.
if (finished)
{
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existance check finished, store %d", self->iDrive);
+ TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check finished, store %d", self->iDrive);
self->iCheckFilesExist = EFalse;
}
}
@@ -2288,9 +2323,9 @@
{
TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" );
}
- }
-
- rowStatus = stmt->Next();
+
+ rowStatus = stmt->Next();
+ }
//switch to main table if modified not found from temp
if(rowStatus != KSqlAtRow && !checkMain && !modifiedChanged)
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Tue May 11 16:30:11 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Tue May 25 13:01:47 2010 +0300
@@ -113,9 +113,9 @@
{
iState = EComplete;
- if ( iMessage.Handle())
+ if ( ClientThreadAlive() )
{
- if(iMessage.Identity() == KDaemonUid )
+ if( iMessage.Identity() == KDaemonUid )
{
iProcessor.SetDaemonAsProcess(ETrue);
}
@@ -123,10 +123,12 @@
{
iProcessor.SetDaemonAsProcess(EFalse);
}
+
iMessage.Complete( CThumbnailServerSession::ConvertSqlErrToE32Err( aReason ));
- ResetMessageData();
}
+ ResetMessageData();
+
iProcessor.TaskComplete( this );
}
}
@@ -230,15 +232,12 @@
//
void CThumbnailTask::CancelMessage()
{
- if ( iMessage.Handle())
+ if ( ClientThreadAlive() )
{
- if ( ClientThreadAlive() )
- {
- iMessage.Complete( KErrCancel );
- }
-
- ResetMessageData();
+ iMessage.Complete( KErrCancel );
}
+
+ ResetMessageData();
}
// ---------------------------------------------------------------------------