digiKam
inatwindow.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_WINDOW_H
24 #define DIGIKAM_INAT_WINDOW_H
25 
26 // Qt includes
27 
28 #include <QUrl>
29 #include <QHash>
30 #include <QList>
31 #include <QPair>
32 #include <QLabel>
33 #include <QDialog>
34 #include <QLineEdit>
35 #include <QComboBox>
36 #include <QTreeWidgetItem>
37 
38 // Local includes
39 
40 #include "wscomboboxintermediate.h"
41 #include "dinfointerface.h"
42 #include "wstooldialog.h"
43 #include "inattaxon.h"
44 #include "inattalker.h"
45 
46 using namespace Digikam;
47 
49 {
50 
51 class INatWindow : public WSToolDialog
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit INatWindow(DInfoInterface* const iface,
58  QWidget* const parent,
59  const QString& serviceName = QLatin1String("iNaturalist"));
60  ~INatWindow() override;
61 
66  void reactivate();
67 
68  void setItemsList(const QList<QUrl>& urls);
69 
70 private Q_SLOTS:
71 
72  void slotLinkingSucceeded(const QString& login, const QString& name,
73  const QUrl& iconUrl);
74  void slotLinkingFailed(const QString& error);
75  void slotLoadUrlSucceeded(const QUrl&, const QByteArray&);
76  void slotApiTokenExpires();
77  void slotBusy(bool val);
78  void slotError(const QString& msg);
79  void slotFinished();
80  void slotUser1();
81  void slotCancelClicked();
82 
83  void slotTaxonSelected(const Taxon&, bool fromVision);
84  void slotTaxonDeselected();
85  void slotComputerVision();
86  void slotObservationCreated(const INatTalker::PhotoUploadRequest&);
87  void slotPhotoUploaded(const INatTalker::PhotoUploadResult&);
88  void cancelUpload(const INatTalker::PhotoUploadRequest&);
89  void slotObservationDeleted(int id);
90  void slotUserChangeRequest();
91  void slotRemoveAccount();
92  void slotAuthCancel();
93  void slotImageListChanged();
94  void slotValueChanged(int);
95  void slotClosestChanged(int);
96  void slotMoreOptionsButton(bool);
97  void slotNearbyPlaces(const QStringList&);
98  void slotNearbyObservation(const INatTalker::NearbyObservation&);
99 
100 private:
101 
102  void closeEvent(QCloseEvent*) override;
103  void readSettings(const QString& uname);
104  void writeSettings();
105 
106  void setUiInProgressState(bool inProgress);
107  void updateProgressBarValue(unsigned);
108  void updateProgressBarMaximum(unsigned);
109  void switchUser(bool restoreToken = true);
110  void saveEditedPlaceName(const QString&);
111 
112 private:
113 
114  class Private;
115  Private* const d;
116 };
117 
118 } // namespace DigikamGenericINatPlugin
119 
120 #endif // DIGIKAM_INAT_WINDOW_H
Definition: inatwindow.h:52
Definition: inattaxon.h:57
Definition: dinfointerface.h:56
Definition: wstooldialog.h:43
Definition: inatbrowserdlg.cpp:64
Definition: datefolderview.cpp:43