digiKam
inatsuggest.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 : 2021-03-20
7  * Description : a tool to export images to iNaturalist web service
8  *
9  * Copyright (C) 2021 by Joerg Lohse <joergmlpts at gmail dot com>
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) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * ============================================================ */
22 
23 #ifndef DIGIKAM_INAT_SUGGEST_H
24 #define DIGIKAM_INAT_SUGGEST_H
25 
26 // Qt includes
27 
28 #include <QObject>
29 #include <QLineEdit>
30 #include <QEvent>
31 #include <QTreeWidget>
32 #include <QTreeWidgetItem>
33 #include <QTimer>
34 #include <QList>
35 #include <QVector>
36 #include <QHash>
37 
38 // Local includes
39 
40 #include "inattaxon.h"
41 #include "inattaxonedit.h"
42 #include "inatscore.h"
43 
45 {
46 
47 class INatTalker;
48 
49 typedef QPair<QString, QList<Taxon> > AutoCompletions;
50 
51 class SuggestTaxonCompletion : public QObject
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit SuggestTaxonCompletion(TaxonEdit* const parent);
59 
60  void setTalker(INatTalker* const talker);
61 
62 Q_SIGNALS:
63 
64  void signalTaxonSelected(const Taxon&, bool fromVision);
67 
68 private Q_SLOTS:
69 
70  void slotDoneCompletion();
71  void slotPreventSuggest();
72  void slotAutoSuggest();
73  void slotInFocus();
74  void slotTaxonAutoCompletions(const AutoCompletions&);
75  void slotComputerVisionResults(const ImageScores&);
76  void slotImageLoaded(const QUrl&, const QByteArray&);
77  void slotTextEdited(const QString&);
78 
79 private:
80 
81  bool eventFilter(QObject* obj, QEvent* ev) override;
82  void showCompletion(const struct Completions&);
83  void taxon2Item(const Taxon&, QTreeWidgetItem*, const QString&);
84  QString getText() const;
85 
86 private:
87 
88  class Private;
89  Private* const d;
90 };
91 
92 } // namespace DigikamGenericINatPlugin
93 
94 #endif // DIGIKAM_INAT_SUGGEST_H
95 
Definition: inattalker.h:62
SuggestTaxonCompletion(TaxonEdit *const parent)
Definition: inatsuggest.cpp:99
void setTalker(INatTalker *const talker)
Definition: inatsuggest.cpp:143
~SuggestTaxonCompletion()
Definition: inatsuggest.cpp:131
void signalTaxonSelected(const Taxon &, bool fromVision)
Definition: inattaxonedit.h:36
Definition: inattaxon.h:57
Definition: inatbrowserdlg.cpp:64
QPair< QString, QList< Taxon > > AutoCompletions
Definition: inatsuggest.h:47
QPair< QString, QList< ComputerVisionScore > > ImageScores
Definition: inatscore.h:75