2
* Copyright (C) 2012 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Charles Lindsay <chaz@yorba.org>
20
#ifndef GALLERY_PHOTO_CACHES_H_
21
#define GALLERY_PHOTO_CACHES_H_
28
* \brief The PhotoCaches class
30
* An abstraction around the various files we keep in addition to the photo
31
* file itself: the original, the pristine version of the file without any
32
* applied edits; and the enhanced, a version of the original with auto-enhance
33
* applied to it (necessary because of how slow auto-enhance is).
38
static const QString ORIGINAL_DIR;
39
static const QString ENHANCED_DIR;
41
PhotoCaches(); // FIXME: remove this class and only deal with a stack of temporary rollback files
42
PhotoCaches(const QFileInfo& file);
44
bool hasCachedOriginal() const;
45
bool hasCachedEnhanced() const;
47
const QFileInfo& originalFile() const;
48
const QFileInfo& enhancedFile() const;
49
const QFileInfo& pristineFile() const;
52
bool restoreOriginal();
53
bool cacheEnhancedFromOriginal();
54
bool overwriteFromCache(bool preferEnhanced);
56
void discardCachedOriginal();
57
void discardCachedEnhanced();
61
static bool remove(const QFileInfo& file) {
62
return QFile::remove(file.filePath());
64
static bool rename(const QFileInfo& oldName, const QFileInfo& newName) {
65
return QFile::rename(oldName.filePath(), newName.filePath());
67
static bool copy(const QFileInfo& oldName, const QFileInfo& newName) {
68
return QFile::copy(oldName.filePath(), newName.filePath());
72
QFileInfo m_originalFile;
73
QFileInfo m_enhancedFile;