File indexing completed on 2025-01-19 03:53:05
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2021-03-20 0007 * Description : a tool to export images to iNaturalist web service 0008 * 0009 * SPDX-FileCopyrightText: 2021 by Joerg Lohse <joergmlpts at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_INAT_WINDOW_H 0016 #define DIGIKAM_INAT_WINDOW_H 0017 0018 // Qt includes 0019 0020 #include <QUrl> 0021 #include <QHash> 0022 #include <QList> 0023 #include <QPair> 0024 #include <QLabel> 0025 #include <QDialog> 0026 #include <QLineEdit> 0027 #include <QComboBox> 0028 #include <QTreeWidgetItem> 0029 0030 // Local includes 0031 0032 #include "wscomboboxintermediate.h" 0033 #include "dinfointerface.h" 0034 #include "wstooldialog.h" 0035 #include "inattaxon.h" 0036 #include "inattalker.h" 0037 0038 using namespace Digikam; 0039 0040 namespace DigikamGenericINatPlugin 0041 { 0042 0043 class INatWindow : public WSToolDialog 0044 { 0045 Q_OBJECT 0046 0047 public: 0048 0049 explicit INatWindow(DInfoInterface* const iface, 0050 QWidget* const parent, 0051 const QString& serviceName = QLatin1String("iNaturalist")); 0052 ~INatWindow() override; 0053 0054 /** 0055 * Use this method to (re-)activate the dialog after it has been created 0056 * to display it. This also loads the currently selected images. 0057 */ 0058 void reactivate(); 0059 0060 void setItemsList(const QList<QUrl>& urls); 0061 0062 private Q_SLOTS: 0063 0064 void slotLinkingSucceeded(const QString& login, const QString& name, 0065 const QUrl& iconUrl); 0066 void slotLinkingFailed(const QString& error); 0067 void slotLoadUrlSucceeded(const QUrl&, const QByteArray&); 0068 void slotApiTokenExpires(); 0069 void slotBusy(bool val); 0070 void slotError(const QString& msg); 0071 void slotFinished(); 0072 void slotUser1(); 0073 void slotCancelClicked(); 0074 0075 void slotTaxonSelected(const Taxon&, bool fromVision); 0076 void slotTaxonDeselected(); 0077 void slotComputerVision(); 0078 void slotObservationCreated(const INatTalker::PhotoUploadRequest&); 0079 void slotPhotoUploaded(const INatTalker::PhotoUploadResult&); 0080 void cancelUpload(const INatTalker::PhotoUploadRequest&); 0081 void slotObservationDeleted(int id); 0082 void slotUserChangeRequest(); 0083 void slotRemoveAccount(); 0084 void slotAuthCancel(); 0085 void slotImageListChanged(); 0086 void slotValueChanged(int); 0087 void slotClosestChanged(int); 0088 void slotMoreOptionsButton(bool); 0089 void slotNearbyPlaces(const QStringList&); 0090 void slotNearbyObservation(const INatTalker::NearbyObservation&); 0091 0092 private: 0093 0094 void closeEvent(QCloseEvent*) override; 0095 void readSettings(const QString& uname); 0096 void writeSettings(); 0097 0098 void setUiInProgressState(bool inProgress); 0099 void updateProgressBarValue(unsigned); 0100 void updateProgressBarMaximum(unsigned); 0101 void switchUser(bool restoreToken = true); 0102 void saveEditedPlaceName(const QString&); 0103 0104 private: 0105 0106 class Private; 0107 Private* const d; 0108 }; 0109 0110 } // namespace DigikamGenericINatPlugin 0111 0112 #endif // DIGIKAM_INAT_WINDOW_H