/
galleryutil.h
72 lines (58 loc) · 2.46 KB
/
galleryutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// -*- Mode: c++ -*-
/* ============================================================
* File : exifutil.h
* Description :
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published bythe Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef GALLERYUTIL_H
#define GALLERYUTIL_H
#include <QFileInfo>
#include "iconview.h"
typedef enum {
kScaleToFit,
kScaleToFill,
kReduceToFit,
kScaleMaxCount // must be last
} ScaleMax;
class GalleryUtil
{
public:
static QStringList GetImageFilter(void);
static QStringList GetMovieFilter(void);
static QStringList GetMediaFilter(void);
static bool IsImage(const QString &filePath);
static bool IsMovie(const QString &filePath);
static long GetNaturalRotation(const unsigned char *buffer, int size);
static long GetNaturalRotation(const QString &filePath);
static QString GetCaption(const QString &filePath);
static bool LoadDirectory(ThumbList &itemList, const QString &dir,
const GalleryFilter& flt, bool recurse,
ThumbHash *itemHash, ThumbGenerator *thumbGen);
static QSize ScaleToDest(const QSize &sz, const QSize &dest, ScaleMax scaleMax);
static bool CopyMove(const QFileInfo &src, QFileInfo &dst, bool move)
{ if (move) return Move(src, dst); else return Copy(src, dst); }
static bool Copy(const QFileInfo &src, QFileInfo &dst);
static bool Move(const QFileInfo &src, QFileInfo &dst);
static bool Delete(const QFileInfo &file);
static bool Rename(const QString &currDir, const QString &oldName,
const QString &newName);
private:
static bool CopyDirectory(const QFileInfo src, QFileInfo &dst);
static bool MoveDirectory(const QFileInfo src, QFileInfo &dst);
static bool DeleteDirectory(const QFileInfo &dir);
static bool RenameDirectory(const QString &currDir, const QString &oldName,
const QString &newName);
static long GetNaturalRotation(void *exifData);
};
#endif /* GALLERYUTIL_H */