3
|
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: Juha Kauppinen, Mika Hokkanen
|
|
13 |
*
|
|
14 |
* Description: Photo Browser
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __IEFILELOADER_H__
|
|
19 |
#define __IEFILELOADER_H__
|
|
20 |
|
|
21 |
// Include files
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <f32file.h>
|
|
24 |
#include <IEEngine.h>
|
|
25 |
#include "IEBitmapLoader.h"
|
|
26 |
#include "IEThreadEngine.h"
|
|
27 |
#include "IEImageList.h"
|
|
28 |
//#include "FileSystemMonitorAO.h"
|
|
29 |
//#include "IEEngineImp.h"
|
|
30 |
|
|
31 |
// Forward class declarations
|
|
32 |
class CIEBitmapLoader;
|
|
33 |
class IEImageFinderAO;
|
|
34 |
class CIEEngineImp;
|
|
35 |
class IEImageFinderAO;
|
|
36 |
class CFileFinderThreadAO;
|
|
37 |
class CImageMonitorAO;
|
|
38 |
|
|
39 |
// Class declaration
|
|
40 |
class CIEFileLoader : public CBase
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
static CIEFileLoader* NewL(RFs& aFileServer, CIEEngineImp* aEngImp, RCriticalSection* aCritical);
|
|
44 |
~CIEFileLoader();
|
|
45 |
|
|
46 |
enum TImageFinderState {
|
|
47 |
EImageFinderRunning,
|
|
48 |
EImageFinderStopping,
|
|
49 |
EImageFinderStopped
|
|
50 |
};
|
|
51 |
|
|
52 |
private:
|
|
53 |
void ConstructL();
|
|
54 |
CIEFileLoader(RFs& aFileServer, CIEEngineImp* aEngImp, RCriticalSection* aCritical);
|
|
55 |
|
|
56 |
private:
|
|
57 |
void LoadImageNamesL();
|
|
58 |
void Load320x320ThumbImageNamesL();
|
|
59 |
void FindThumbnailFolderL(TBuf<KMaxFileName> folderName, RFs& session);
|
|
60 |
void FillImageDataArrayL(TBuf<KMaxFileName> folder, RFs& session, TBool IsThumbnail);
|
|
61 |
TInt ScanDirFileCountL(const TDesC& aDir, const TDesC& aWild);
|
|
62 |
void SearchFileCountL(const TDesC& aRootPath, const TDesC& aSearchName, TInt& imageFileCount, TInt& facesFileCount);
|
|
63 |
|
|
64 |
public:
|
|
65 |
void GetFileNameL(const TInt aFileIndex, TFileName& aFileName, TThumbSize aThumbRes);
|
|
66 |
void SaveFileL(const TDesC& aFileName, const TDesC8& aData);
|
|
67 |
TInt GetImageCount(TThumbSize aThumbRes);
|
|
68 |
TInt GetTotalNumOfImages();
|
|
69 |
void GetTotalNumOfImages(TInt& aNumOfImages, TInt& aNumOfFaces);
|
|
70 |
RArray<CImageData*>& GetFileNameArray();
|
|
71 |
RArray<CImageData*>& GetFacesFileNameArray();
|
|
72 |
/*void SetAll640x480TNsDone(TBool aValue);
|
|
73 |
TBool GetAll640x480TNsDone();
|
|
74 |
void SetAll128x128TNsDone(TBool aValue);
|
|
75 |
TBool GetAll128x128TNsDone();*/
|
|
76 |
void AllFilesAddedToFilenameArray();
|
|
77 |
TInt DeleteFile(TInt aIndex);
|
|
78 |
TInt DeleteFaceFile(TInt aIndex);
|
|
79 |
void AddNewImage(CImageData* aTmpImageData, TInt iImageIndex);
|
|
80 |
void AddNewFaceCropImage(CImageData* aTmpImageData, TInt aImageIndex);
|
|
81 |
void ModifyImageData(CImageData* aTmpImageData, TInt aImageIndex);
|
|
82 |
void ImageListChanged(TInt aIndex, TBool aAdded);
|
|
83 |
CIEEngineImp* GetEngineImpPtr();
|
|
84 |
/*void StartFileSystemMonitoring();
|
|
85 |
void StopFileSystemMonitoring();
|
|
86 |
void FileSystemChanged();*/
|
|
87 |
void GetUpdatedNumOfImages(TInt& aNumOfImages, TInt& aNumOfFaces);
|
|
88 |
|
|
89 |
// Functions for handling UI access to Filename array
|
|
90 |
CImageData* GetImageData(TInt aIndex/*, TImageArrayMode aMode*/);
|
|
91 |
//CImageData* GetImageData(TInt aIndex);
|
|
92 |
void SetImageData(TInt aIndex, CImageData* aGridData);
|
|
93 |
CIEImageList& GetImageList();
|
|
94 |
TInt DeleteFile(const CImageData* aImageData);
|
|
95 |
void StopImageFinder();
|
|
96 |
void ImageFinderStopped(); // callback
|
|
97 |
TImageFinderState ImageFinderState() const;
|
|
98 |
#ifdef _ACCELEROMETER_SUPPORTED_
|
|
99 |
TImagicDeviceOrientation CIEFileLoader::DeviceOrientation();
|
|
100 |
#endif
|
|
101 |
|
|
102 |
private: // Data
|
|
103 |
TBuf<KMaxFileName> iTotalRootFolder;
|
|
104 |
|
|
105 |
//CFileSystemMonitorAO* iFileSystemMonitor;
|
|
106 |
RFs& iFileServer;
|
|
107 |
CIEEngineImp* iEngImp;
|
|
108 |
TInt iCurrentFileIndex;
|
|
109 |
RArray<CImageData*> iFileNameData;
|
|
110 |
RArray<CImageData*> iFaceFilenameData;
|
|
111 |
CIEImageList* iImageList;
|
|
112 |
|
|
113 |
//For file searching
|
|
114 |
RFile iFile;
|
|
115 |
TInt iOffSet;
|
|
116 |
TInt iNumberOfImages;
|
|
117 |
TInt iNumberOfFaces;
|
|
118 |
CFileFinderThread* iImageFinderThread;
|
|
119 |
RCriticalSection* iCritical;
|
|
120 |
CImageMonitorAO* iImageFinderMonitor;
|
|
121 |
TThreadId iMainThreadId;
|
|
122 |
//TBool iJpgFileCountingComplete;
|
|
123 |
TImageFinderState iImageFinderState;
|
|
124 |
};
|
|
125 |
|
|
126 |
#endif // __IEFILELOADER_H__
|