digiKam
statesavingobject.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 : 2009-20-12
7  * Description : Interface class for objects that can store their state.
8  *
9  * Copyright (C) 2009 by Johannes Wienke <languitar at semipol dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_STATE_SAVING_OBJECT_H
25 #define DIGIKAM_STATE_SAVING_OBJECT_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 
35 class KConfigGroup;
36 
37 namespace Digikam
38 {
39 
75 class DIGIKAM_EXPORT StateSavingObject
76 {
77 public:
78 
84  {
90 
96 
101  RECURSIVE
102  };
103 
110  explicit StateSavingObject(QObject* const host);
111 
115  virtual ~StateSavingObject();
116 
123  StateSavingDepth getStateSavingDepth() const;
124 
130  void setStateSavingDepth(const StateSavingDepth depth);
131 
142  virtual void setConfigGroup(const KConfigGroup& group);
143 
153  virtual void setEntryPrefix(const QString& prefix);
154 
158  void loadState();
159 
163  void saveState();
164 
165 protected:
166 
171  virtual void doLoadState() = 0;
172 
177  virtual void doSaveState() = 0;
178 
184  KConfigGroup getConfigGroup() const;
185 
193  QString entryName(const QString& base) const;
194 
195 private:
196 
197  // Disable
198  StateSavingObject(const StateSavingObject&) = delete;
199  StateSavingObject& operator=(const StateSavingObject&) = delete;
200 
201 private:
202 
203  class Private;
204  Private* const d;
205 };
206 
207 } // namespace Digikam
208 
209 #endif // DIGIKAM_STATE_SAVING_OBJECT_H
Definition: statesavingobject.h:76
virtual void doSaveState()=0
virtual void doLoadState()=0
StateSavingDepth
Definition: statesavingobject.h:84
@ DIRECT_CHILDREN
Definition: statesavingobject.h:95
@ INSTANCE
Definition: statesavingobject.h:89
QStringView prefix
Definition: itemviewutilities.cpp:593
Definition: datefolderview.cpp:43