File indexing completed on 2025-01-05 03:58:20
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2014-08-05 0007 * Description : Plasma file indexer interface. 0008 * 0009 * SPDX-FileCopyrightText: 2014 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_BALOO_WRAP_H 0016 #define DIGIKAM_BALOO_WRAP_H 0017 0018 // Qt includes 0019 0020 #include <QObject> 0021 #include <QStringList> 0022 #include <QPointer> 0023 0024 // Local includes 0025 0026 #include "digikam_export.h" 0027 0028 class QUrl; 0029 0030 namespace Digikam 0031 { 0032 0033 class ItemInfo; 0034 0035 class BalooInfo 0036 { 0037 public: 0038 0039 BalooInfo() 0040 : rating(-1) 0041 { 0042 } 0043 0044 QStringList tags; 0045 QString comment; 0046 int rating; 0047 }; 0048 0049 /** 0050 * @brief The BalooWrap class is a singleton class which offer 0051 * functionality for reading and writing image 0052 * comment, tags and rating from Baloo to digiKam 0053 * and from digiKam to Baloo 0054 * 0055 * The singleton functionality is required because 0056 * it also watches for changes in Baloo and notify 0057 * digiKam, so it could trigger a scan 0058 */ 0059 class DIGIKAM_EXPORT BalooWrap : public QObject 0060 { 0061 Q_OBJECT 0062 0063 public: 0064 0065 BalooWrap(); 0066 ~BalooWrap() override; 0067 0068 /** 0069 * @brief internalPtr - singleton implementation 0070 */ 0071 static QPointer<BalooWrap> internalPtr; 0072 static BalooWrap* instance(); 0073 static bool isCreated(); 0074 0075 /** 0076 * @brief setSemanticInfo - generic method to set all data from digiKam to Baloo 0077 * @param url - image url 0078 * @param bInfo - container class for tags, comment, rating 0079 */ 0080 void setSemanticInfo(const QUrl& url, const BalooInfo& bInfo); 0081 0082 /** 0083 * @brief getSemanticInfo - used by ItemScanner to retrieve all information 0084 * tags, comment, rating 0085 * @param url - image url 0086 * @return - container class for tags, comment, rating 0087 */ 0088 BalooInfo getSemanticInfo(const QUrl& url) const; 0089 0090 void setSyncToBaloo(bool value); 0091 0092 bool getSyncToBaloo() const; 0093 0094 void setSyncToDigikam(bool value); 0095 0096 bool getSyncToDigikam() const; 0097 0098 private: 0099 0100 // Disable 0101 explicit BalooWrap(QObject*) = delete; 0102 0103 private: 0104 0105 class Private; 0106 Private* const d; 0107 }; 0108 0109 } // namespace Digikam 0110 0111 #endif // DIGIKAM_BALOO_WRAP_H