00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GALLERYUTIL_H
00021 #define GALLERYUTIL_H
00022
00023 #include <QFileInfo>
00024
00025 #include "iconview.h"
00026
00027 typedef enum {
00028 kScaleToFit,
00029 kScaleToFill,
00030 kReduceToFit,
00031 kScaleMaxCount
00032 } ScaleMax;
00033
00034 class GalleryUtil
00035 {
00036 public:
00037 static QStringList GetImageFilter(void);
00038 static QStringList GetMovieFilter(void);
00039 static QStringList GetMediaFilter(void);
00040
00041 static bool IsImage(const QString &filePath);
00042 static bool IsMovie(const QString &filePath);
00043 static long GetNaturalRotation(const unsigned char *buffer, int size);
00044 static long GetNaturalRotation(const QString &filePath);
00045
00046 static QString GetCaption(const QString &filePath);
00047
00048 static bool LoadDirectory(ThumbList &itemList, const QString &dir,
00049 const GalleryFilter& flt, bool recurse,
00050 ThumbHash *itemHash, ThumbGenerator *thumbGen);
00051
00052 static QSize ScaleToDest(const QSize &sz, const QSize &dest, ScaleMax scaleMax);
00053
00054 static bool CopyMove(const QFileInfo &src, QFileInfo &dst, bool move)
00055 { if (move) return Move(src, dst); else return Copy(src, dst); }
00056
00057 static bool Copy(const QFileInfo &src, QFileInfo &dst);
00058 static bool Move(const QFileInfo &src, QFileInfo &dst);
00059 static bool Delete(const QFileInfo &file);
00060 static bool Rename(const QString &currDir, const QString &oldName,
00061 const QString &newName);
00062
00063 static void PlayVideo(const QString &filename);
00064
00065 private:
00066 static bool CopyDirectory(const QFileInfo src, QFileInfo &dst);
00067 static bool MoveDirectory(const QFileInfo src, QFileInfo &dst);
00068 static bool DeleteDirectory(const QFileInfo &dir);
00069 static bool RenameDirectory(const QString &currDir, const QString &oldName,
00070 const QString &newName);
00071 static long GetNaturalRotation(void *exifData);
00072 };
00073
00074 #endif