61
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "cntthumbnailmanager.h"
|
|
18 |
|
|
19 |
CntThumbnailManager::CntThumbnailManager()
|
|
20 |
{
|
|
21 |
|
|
22 |
}
|
|
23 |
|
|
24 |
CntThumbnailManager::~CntThumbnailManager()
|
|
25 |
{
|
|
26 |
qDeleteAll( mManagers.values() );
|
|
27 |
mManagers.clear();
|
|
28 |
}
|
|
29 |
|
|
30 |
int CntThumbnailManager::getThumbnail( ThumbnailManager::ThumbnailSize aSize, const QString& aFile )
|
|
31 |
{
|
|
32 |
if ( !mManagers.contains( aSize ) )
|
|
33 |
{
|
|
34 |
ThumbnailManager* thumbnailManager = new ThumbnailManager(this);
|
|
35 |
thumbnailManager->setMode(ThumbnailManager::Default);
|
|
36 |
thumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
|
|
37 |
thumbnailManager->setThumbnailSize( aSize );
|
|
38 |
connect( thumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
|
|
39 |
this, SIGNAL(thumbnailReady(QPixmap,void*,int,int)) );
|
|
40 |
|
|
41 |
mManagers.insert( aSize, thumbnailManager );
|
|
42 |
}
|
|
43 |
|
|
44 |
ThumbnailManager* manager = mManagers.value( aSize );
|
|
45 |
return manager->getThumbnail( aFile );
|
|
46 |
}
|
|
47 |
|
|
48 |
void CntThumbnailManager::cancelRequest( int aRequestId )
|
|
49 |
{
|
|
50 |
foreach ( ThumbnailManager* mgr, mManagers.values() )
|
|
51 |
{
|
|
52 |
if ( mgr->cancelRequest(aRequestId) )
|
|
53 |
break;
|
|
54 |
}
|
|
55 |
}
|
|
56 |
// End of File
|