Baloo Widgets

widgetfactory.h
1 /*
2  SPDX-FileCopyrightText: 2012 Vishesh Handa <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef WIDGETFACTORY_H
8 #define WIDGETFACTORY_H
9 
10 #include "filemetadatawidget.h"
11 
12 #include <QObject>
13 #include <QStringList>
14 
15 class KJob;
16 class QLabel;
17 class QUrl;
18 class KCommentWidget;
19 class KRatingWidget;
20 
21 namespace Baloo
22 {
23 class Tag;
24 class TagWidget;
25 
26 class WidgetFactory : public QObject
27 {
28  Q_OBJECT
29 public:
30  explicit WidgetFactory(QObject *parent = nullptr);
31  ~WidgetFactory() override;
32 
33  void setItems(const KFileItemList &items);
34 
35  void setReadOnly(bool value);
36 
37  void setDateFormat(const DateFormats format);
38  DateFormats dateFormat() const;
39 
40  QWidget *createWidget(const QString &prop, const QVariant &value, QWidget *parent);
41 
42 Q_SIGNALS:
43  void urlActivated(const QUrl &url);
44  void dataChangeStarted();
45  void dataChangeFinished();
46 
47 private Q_SLOTS:
48  void slotTagsChanged(const QStringList &tags);
49  void slotCommentChanged(const QString &comment);
50  void slotRatingChanged(int rating);
51 
52  void slotTagClicked(const QString &tag);
53  void slotLinkActivated(const QString &url);
54 
55 private:
56  QWidget *createRatingWidget(int rating, QWidget *parent);
57  QWidget *createTagWidget(const QStringList &tags, QWidget *parent);
58  QWidget *createCommentWidget(const QString &comment, QWidget *parent);
59  QLabel *createValueWidget(QWidget *parent);
60 
61  TagWidget *m_tagWidget = nullptr;
62  KRatingWidget *m_ratingWidget = nullptr;
63  KCommentWidget *m_commentWidget = nullptr;
64 
65  KFileItemList m_items;
66  QStringList m_prevTags;
67  bool m_readOnly = false;
68  QLocale::FormatType m_dateFormat;
69 };
70 }
71 
72 #endif // WIDGETFACTORY_H
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 04:12:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.