Debian Codegraph @

core/utilities/extrasupport/filesindexer/baloowrap.h

raw symbols SCIP
1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2014-08-05
7 * Description : Plasma file indexer interface.
8 *
9 * SPDX-FileCopyrightText: 2014 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15 #pragma once
16
17 // Qt includes
18
19 #include <QObject>
20 #include <QStringList>
21 #include <QPointer>
22
23 // Local includes
24
25 #include "digikam_export.h"
26
27 class QUrl;
28
29 namespace Digikam
30 {
31
32 class ItemInfo;
33
34 class BalooInfo
35 {
36 public:
37
38 BalooInfo() = default;
39
40 QStringList tags;
41 QString comment;
42 int rating = -1;
43 };
44
45 /**
46 * @brief The BalooWrap class is a singleton class which offer
47 * functionality for reading and writing image
48 * comment, tags and rating from Baloo to digiKam
49 * and from digiKam to Baloo
50 *
51 * The singleton functionality is required because
52 * it also watches for changes in Baloo and notify
53 * digiKam, so it could trigger a scan
54 */
55 class DIGIKAM_EXPORT BalooWrap : public QObject
56 {
57 Q_OBJECT
58
59 public:
60
61 BalooWrap();
62 ~BalooWrap() override;
63
64 /**
65 * @brief internalPtr - singleton implementation
66 */
67 static QPointer<BalooWrap> internalPtr;
68 static BalooWrap* instance();
69 static bool isCreated();
70
71 /**
72 * @brief setSemanticInfo - generic method to set all data from digiKam to Baloo
73 * @param url - image url
74 * @param bInfo - container class for tags, comment, rating
75 */
76 void setSemanticInfo(const QUrl& url, const BalooInfo& bInfo);
77
78 /**
79 * @brief getSemanticInfo - used by ItemScanner to retrieve all information
80 * tags, comment, rating
81 * @param url - image url
82 * @return - container class for tags, comment, rating
83 */
84 BalooInfo getSemanticInfo(const QUrl& url) const;
85
86 void setSyncToBaloo(bool value);
87
88 bool getSyncToBaloo() const;
89
90 void setSyncToDigikam(bool value);
91
92 bool getSyncToDigikam() const;
93
94 private:
95
96 /// @note disabled
97 explicit BalooWrap(QObject*) = delete;
98
99 private:
100
101 class Private;
102 Private* const d = nullptr;
103 };
104
105 } // namespace Digikam