digiKam
versionfileoperation.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-12-20
7  * Description : description of actions when saving a file with versioning
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_VERSION_FILE_OPERATION_H
26 #define DIGIKAM_VERSION_FILE_OPERATION_H
27 
28 // Qt includes
29 
30 #include <QFlags>
31 #include <QMap>
32 #include <QString>
33 
34 // Local includes
35 
36 #include "digikam_export.h"
37 #include "dimagehistory.h"
38 
39 class QUrl;
40 
41 namespace Digikam
42 {
43 
44 class DIGIKAM_EXPORT VersionFileInfo
45 {
46 public:
47 
48  explicit VersionFileInfo()
49  {
50  }
51 
52  VersionFileInfo(const QString& path, const QString& fileName, const QString& format)
53  : path(path),
54  fileName(fileName),
55  format(format)
56  {
57  }
58 
59  bool isNull() const;
60 
61  QString filePath() const;
62  QUrl fileUrl() const;
63 
64  QString path;
65  QString fileName;
66  QString format;
67 };
68 
69 // -------------------------------------------------------------------------------------------
70 
71 class DIGIKAM_EXPORT VersionFileOperation
72 {
73 public:
74 
87  {
88  }
89 
90 public:
91 
92  enum Task
93  {
95  NewFile = 1 << 0,
97  Replace = 1 << 1,
99  SaveAndDelete = 1 << 2,
101  MoveToIntermediate = 1 << 3,
103  StoreIntermediates = 1 << 4
104  };
105  Q_DECLARE_FLAGS(Tasks, Task)
106 
107 public:
108 
109  Tasks tasks;
110 
112 
114 
116 
117  QMap<int, VersionFileInfo> intermediates;
118 
122  QStringList allFilePaths() const;
123 };
124 
125 } // namespace Digikam
126 
127 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::VersionFileOperation::Tasks)
128 
129 #endif // DIGIKAM_VERSION_FILE_OPERATION_H
Definition: task.h:43
Definition: versionfileoperation.h:45
QString path
Definition: versionfileoperation.h:64
QString format
Definition: versionfileoperation.h:66
VersionFileInfo(const QString &path, const QString &fileName, const QString &format)
Definition: versionfileoperation.h:52
QString fileName
Definition: versionfileoperation.h:65
VersionFileInfo()
Definition: versionfileoperation.h:48
Definition: versionfileoperation.h:72
VersionFileInfo saveFile
Definition: versionfileoperation.h:113
QMap< int, VersionFileInfo > intermediates
Definition: versionfileoperation.h:117
VersionFileInfo intermediateForLoadedFile
Definition: versionfileoperation.h:115
VersionFileOperation()
Definition: versionfileoperation.h:86
VersionFileInfo loadedFile
Definition: versionfileoperation.h:111
Task
Definition: versionfileoperation.h:93
Tasks tasks
Definition: versionfileoperation.h:109
Definition: datefolderview.cpp:43