digiKam
fuzzysearchview.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 : 2008-05-19
7  * Description : Fuzzy search sidebar tab contents.
8  *
9  * Copyright (C) 2016-2018 by Mario Frank <mario dot frank at uni minus potsdam dot de>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2008-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_FUZZY_SEARCH_VIEW_H
27 #define DIGIKAM_FUZZY_SEARCH_VIEW_H
28 
29 // Qt includes
30 
31 #include <QDragEnterEvent>
32 #include <QDragMoveEvent>
33 #include <QScrollArea>
34 #include <QDropEvent>
35 #include <QList>
36 
37 // Local includes
38 
39 #include "statesavingobject.h"
40 #include "album.h"
41 
42 class QMimeData;
43 class QPixmap;
44 
45 namespace Digikam
46 {
47 
48 class FuzzySearchFolderView;
49 class ItemInfo;
50 class LoadingDescription;
51 class SearchModel;
52 class SearchModificationHelper;
53 class SearchTextBar;
54 
55 class FuzzySearchView : public QScrollArea,
56  public StateSavingObject
57 {
58  Q_OBJECT
59 
60 public:
61 
62  explicit FuzzySearchView(SearchModel* const searchModel,
63  SearchModificationHelper* const searchModificationHelper,
64  QWidget* const parent = nullptr);
65  ~FuzzySearchView() override;
66 
67  SAlbum* currentAlbum() const;
68  void setCurrentAlbum(SAlbum* const album);
69 
70  void setActive(bool val);
71  void setItemInfo(const ItemInfo& info);
72 
73  void newDuplicatesSearch(const QList<PAlbum*>& albums);
74  void newDuplicatesSearch(const QList<TAlbum*>& albums);
75 
76  void setConfigGroup(const KConfigGroup& group) override;
77  void doLoadState() override;
78  void doSaveState() override;
79 
80 protected:
81 
82  void dragEnterEvent(QDragEnterEvent* e) override;
83  void dragMoveEvent(QDragMoveEvent* e) override;
84  void dropEvent(QDropEvent* e) override;
85 
86 Q_SIGNALS:
87 
88  void signalNotificationError(const QString& message, int type);
89 
90 private Q_SLOTS:
91 
92  void slotTabChanged(int);
93 
94  void slotHSChanged(int h, int s);
95  void slotVChanged(int v);
96  void slotPenColorChanged(const QColor&);
97  void slotClearSketch();
98  void slotSaveSketchSAlbum();
99  void slotCheckNameEditSketchConditions();
100 
101  void slotAlbumSelected(Album* album);
102 
103  void slotSaveImageSAlbum();
104  void slotCheckNameEditImageConditions();
105  void slotThumbnailLoaded(const LoadingDescription&, const QPixmap&);
106 
107  void slotDirtySketch();
108  void slotTimerSketchDone();
109  void slotUndoRedoStateChanged(bool, bool);
110 
111  void slotMinLevelImageChanged(int);
112  void slotMaxLevelImageChanged(int);
113  void slotFuzzyAlbumsChanged();
114  void slotTimerImageDone();
115 
116  void slotApplicationSettingsChanged();
117 
118 private:
119 
120  void setCurrentImage(qlonglong imageid);
121  void setCurrentImage(const ItemInfo& info);
122 
123  void createNewFuzzySearchAlbumFromSketch(const QString& name, bool force = false);
124  void createNewFuzzySearchAlbumFromImage(const QString& name, bool force = false);
125  bool dragEventWrapper(const QMimeData* data) const;
126 
127  void setColor(QColor c);
128 
129  QWidget* setupFindSimilarPanel() const;
130  QWidget* setupSketchPanel() const;
131  void setupConnections();
132 
133 private:
134 
135  class Private;
136  Private* const d;
137 };
138 
139 } // namespace Digikam
140 
141 #endif // DIGIKAM_FUZZY_SEARCH_VIEW_H
Abstract base class for all album types.
Definition: album.h:67
Definition: fuzzysearchview_p.h:91
Definition: fuzzysearchview.h:57
void doLoadState() override
Definition: fuzzysearchview.cpp:236
void doSaveState() override
Definition: fuzzysearchview.cpp:263
FuzzySearchView(SearchModel *const searchModel, SearchModificationHelper *const searchModificationHelper, QWidget *const parent=nullptr)
Definition: fuzzysearchview.cpp:32
void setItemInfo(const ItemInfo &info)
Definition: fuzzysearchview_similar.cpp:300
SAlbum * currentAlbum() const
Definition: fuzzysearchview.cpp:200
void newDuplicatesSearch(const QList< PAlbum * > &albums)
Definition: fuzzysearchview.cpp:210
void dragMoveEvent(QDragMoveEvent *e) override
Definition: fuzzysearchview_similar.cpp:135
void setCurrentAlbum(SAlbum *const album)
Definition: fuzzysearchview.cpp:205
void signalNotificationError(const QString &message, int type)
~FuzzySearchView() override
Definition: fuzzysearchview.cpp:111
void setConfigGroup(const KConfigGroup &group) override
Definition: fuzzysearchview.cpp:230
void dragEnterEvent(QDragEnterEvent *e) override
Definition: fuzzysearchview_similar.cpp:127
void setActive(bool val)
Definition: fuzzysearchview.cpp:280
void dropEvent(QDropEvent *e) override
Definition: fuzzysearchview_similar.cpp:171
Definition: iteminfo.h:78
Definition: loadingdescription.h:45
Definition: album.h:493
Definition: albummodel.h:95
Definition: searchmodificationhelper.h:59
Definition: statesavingobject.h:76
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43