File indexing completed on 2025-01-19 03:57:00

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-06-18
0007  * Description : class for determining new file name in terms of version management
0008  *
0009  * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_VERSION_MANAGER_H
0017 #define DIGIKAM_VERSION_MANAGER_H
0018 
0019 // Qt includes
0020 
0021 #include <QFlags>
0022 #include <QMap>
0023 #include <QString>
0024 
0025 // Local includes
0026 
0027 #include "digikam_export.h"
0028 #include "dimagehistory.h"
0029 #include "versionfileoperation.h"
0030 #include "versionmanagersettings.h"
0031 #include "versionnamingscheme.h"
0032 
0033 namespace Digikam
0034 {
0035 
0036 class DIGIKAM_EXPORT VersionManager
0037 {
0038 public:
0039 
0040     enum FileNameType
0041     {
0042         CurrentVersionName,
0043         NewVersionName
0044     };
0045 
0046 public:
0047 
0048     explicit VersionManager();
0049     virtual ~VersionManager();
0050 
0051     void setSettings(const VersionManagerSettings& settings);
0052     VersionManagerSettings settings() const;
0053 
0054     void setNamingScheme(VersionNamingScheme* scheme);
0055     VersionNamingScheme* namingScheme() const;
0056 
0057     VersionFileOperation operation(FileNameType request, const VersionFileInfo& loadedFile,
0058                                    const DImageHistory& initialResolvedHistory,
0059                                    const DImageHistory& currentHistory);
0060 
0061     VersionFileOperation operationNewVersionInFormat(const VersionFileInfo& loadedFile,
0062                                    const QString& format,
0063                                    const DImageHistory& initialResolvedHistory,
0064                                    const DImageHistory& currentHistory);
0065 
0066     VersionFileOperation operationNewVersionAs(const VersionFileInfo& loadedFile,
0067                                                const VersionFileInfo& saveLocation,
0068                                                const DImageHistory& initialResolvedHistory,
0069                                                const DImageHistory& currentHistory);
0070 
0071     virtual QString toplevelDirectory(const QString& path);
0072 
0073     virtual QStringList workspaceFileFormats() const;
0074 
0075 private:
0076 
0077     // Disable
0078     VersionManager(const VersionManager&)            = delete;
0079     VersionManager& operator=(const VersionManager&) = delete;
0080 
0081 private:
0082 
0083     class VersionManagerPriv;
0084     VersionManagerPriv* const d;
0085 };
0086 
0087 } // namespace Digikam
0088 
0089 #endif // DIGIKAM_VERSION_MANAGER_H