taskswitcher/utils/src/tsentry.cpp
changeset 124 e36b2f4799c0
parent 121 0b3699f6c654
child 125 26079c1bb561
equal deleted inserted replaced
121:0b3699f6c654 124:e36b2f4799c0
    14  * Description:  Task list entry
    14  * Description:  Task list entry
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #define __E32SVR_H__
    18 #define __E32SVR_H__
       
    19 
    19 #include <s32strm.h>
    20 #include <s32strm.h>
    20 #include <fbs.h>
    21 #include <fbs.h>
       
    22 
    21 #include "tsentry.h"
    23 #include "tsentry.h"
    22 #include "tsdataobserver.h"
    24 #include "tsdataobserver.h"
       
    25 #include "tsthumbnailprovider.h"
    23 
    26 
    24 // --------------------------------------------------------------------------
    27 // --------------------------------------------------------------------------
    25 // CTsFswEntry::NewL
    28 // CTsFswEntry::NewL
    26 // --------------------------------------------------------------------------
    29 // --------------------------------------------------------------------------
    27 //
    30 //
    28 CTsEntry* CTsEntry::NewL(const TTsEntryKey &key, MTsDataObserver &observer)
    31 CTsEntry* CTsEntry::NewL(const TTsEntryKey &key, MTsDataObserver &observer, QObject* obj)
    29 {
    32 {
    30     CTsEntry* self = NewLC(key, observer);
    33     CTsEntry* self = NewLC(key, observer, obj);
    31     CleanupStack::Pop(self);
    34     CleanupStack::Pop(self);
    32     return self;
    35     return self;
    33 }
    36 }
    34 
    37 
    35 // --------------------------------------------------------------------------
    38 // --------------------------------------------------------------------------
    36 // CTsFswEntry::NewLC
    39 // CTsFswEntry::NewLC
    37 // --------------------------------------------------------------------------
    40 // --------------------------------------------------------------------------
    38 //
    41 //
    39 CTsEntry* CTsEntry::NewLC(const TTsEntryKey &key, MTsDataObserver &observer)
    42 CTsEntry* CTsEntry::NewLC(const TTsEntryKey &key, MTsDataObserver &observer, QObject* obj)
    40 {
    43 {
    41     CTsEntry* self = new (ELeave) CTsEntry(key, observer);
    44     CTsEntry* self = new (ELeave) CTsEntry(key, observer);
    42     CleanupStack::PushL(self);
    45     CleanupStack::PushL(self);
       
    46     self->ConstructL(obj);
    43     return self;
    47     return self;
    44 }
    48 }
    45 
    49 
    46 // --------------------------------------------------------------------------
    50 // --------------------------------------------------------------------------
    47 // CTsFswEntry::~CTsFswEntry
    51 // CTsFswEntry::~CTsFswEntry
    50 CTsEntry::~CTsEntry()
    54 CTsEntry::~CTsEntry()
    51 {
    55 {
    52     delete mAppName;
    56     delete mAppName;
    53     delete mAppIconBitmap;
    57     delete mAppIconBitmap;
    54     delete mScreenshot;
    58     delete mScreenshot;
    55     delete mImgTool;
    59     delete iProvider;
    56 }
    60 }
    57 
    61 
    58 // --------------------------------------------------------------------------
    62 // --------------------------------------------------------------------------
    59 // CTsFswEntry::CTsFswEntry
    63 // CTsFswEntry::CTsFswEntry
    60 // --------------------------------------------------------------------------
    64 // --------------------------------------------------------------------------
    68 {
    72 {
    69     RefreshUpdateTimestamp();
    73     RefreshUpdateTimestamp();
    70 }
    74 }
    71 
    75 
    72 // --------------------------------------------------------------------------
    76 // --------------------------------------------------------------------------
       
    77 void CTsEntry::ConstructL(QObject* object)
       
    78 {
       
    79     QT_TRYCATCH_LEAVING(
       
    80        iProvider = new TsThumbnailProvider(*this, object);
       
    81     )
       
    82     
       
    83 }
       
    84 
       
    85 // --------------------------------------------------------------------------
    73 // CTsFswEntry::SetAppUid
    86 // CTsFswEntry::SetAppUid
    74 // --------------------------------------------------------------------------
    87 // --------------------------------------------------------------------------
    75 //
    88 //
    76 void CTsEntry::SetAppUid(const TUid &uid)
    89 void CTsEntry::SetAppUid(const TUid &uid)
    77 {
    90 {
   220     mPriority = priority;
   233     mPriority = priority;
   221     delete mScreenshot;
   234     delete mScreenshot;
   222     mScreenshot = bitmap;
   235     mScreenshot = bitmap;
   223     RefreshUpdateTimestamp();
   236     RefreshUpdateTimestamp();
   224 
   237 
   225     delete mImgTool;
   238     iProvider->createThumbnail( *mScreenshot, angle);
   226     mImgTool = 0;
       
   227 
       
   228     mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
       
   229     CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding, angle);
       
   230 }
   239 }
   231 
   240 
   232 // --------------------------------------------------------------------------
   241 // --------------------------------------------------------------------------
   233 // CTsFswEntry::RemoveScreenshot
   242 // CTsFswEntry::RemoveScreenshot
   234 // --------------------------------------------------------------------------
   243 // --------------------------------------------------------------------------
   254 {
   263 {
   255     return mScreenshot;
   264     return mScreenshot;
   256 }
   265 }
   257 
   266 
   258 // --------------------------------------------------------------------------
   267 // --------------------------------------------------------------------------
   259 // CTsFswEntry::Priority
   268 // CTsFswEntry::thumbnailCreated
   260 // --------------------------------------------------------------------------
   269 // --------------------------------------------------------------------------
   261 //
   270 //
   262 void CTsEntry::ImageReadyCallBack(TInt error, const CFbsBitmap *bitmap)
   271 void CTsEntry::thumbnailCreated(const CFbsBitmap& aThumbnail)
   263 {
   272 {
   264     if (KErrNone == error && 0 != bitmap) {
   273     mScreenshot->Reset();
   265         mScreenshot->Reset();
   274     mScreenshot->Duplicate(aThumbnail.Handle());
   266         mScreenshot->Duplicate(bitmap->Handle());
   275     RefreshUpdateTimestamp();
   267         RefreshUpdateTimestamp();
   276     mObserver.DataChanged();
   268         mObserver.DataChanged();
       
   269     }
       
   270 }
   277 }
   271 
   278 
   272 // end of file
   279 // end of file