File indexing completed on 2025-01-05 03:57:26

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-12-20
0007  * Description : settings container for versioning
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_SETTINGS_H
0017 #define DIGIKAM_VERSION_MANAGER_SETTINGS_H
0018 
0019 // Qt includes
0020 
0021 #include <QFlags>
0022 #include <QString>
0023 
0024 // Local includes
0025 
0026 #include "digikam_export.h"
0027 
0028 class KConfigGroup;
0029 
0030 namespace Digikam
0031 {
0032 
0033 class DIGIKAM_EXPORT VersionManagerSettings
0034 {
0035 public:
0036 
0037     enum IntermediateSavepoint
0038     {
0039         NoIntermediates     = 0,
0040         AfterEachSession    = 1 << 0,
0041         AfterRawConversion  = 1 << 1,
0042         WhenNotReproducible = 1 << 2
0043     };
0044     Q_DECLARE_FLAGS(IntermediateBehavior, IntermediateSavepoint)
0045 
0046     enum ShowInViewFlag
0047     {
0048         OnlyShowCurrent     = 0,
0049         ShowOriginal        = 1 << 0,
0050         ShowIntermediates   = 1 << 1
0051     };
0052     Q_DECLARE_FLAGS(ShowInViewFlags, ShowInViewFlag)
0053 
0054     enum EditorClosingMode
0055     {
0056         AlwaysAsk,
0057         AutoSave
0058     };
0059 
0060 public:
0061 
0062     VersionManagerSettings();
0063 
0064     void readFromConfig(const KConfigGroup& group);
0065     void writeToConfig(KConfigGroup& group) const;
0066 
0067 public:
0068 
0069     bool                 enabled;
0070 
0071     IntermediateBehavior saveIntermediateVersions;
0072     ShowInViewFlags      showInViewFlags;
0073     EditorClosingMode    editorClosingMode;
0074 
0075     /// Image format string as defined for database, in upper case
0076     QString              format;
0077 };
0078 
0079 } // namespace Digikam
0080 
0081 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::VersionManagerSettings::IntermediateBehavior)
0082 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::VersionManagerSettings::ShowInViewFlags)
0083 
0084 #endif // DIGIKAM_VERSION_MANAGER_SETTINGS_H