digiKam
flickrtalker.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 : 2005-07-07
7  * Description : a tool to export images to Flickr web service
8  *
9  * Copyright (C) 2005-2009 by Vardhman Jain <vardhman at gmail dot com>
10  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2017-2019 by Maik Qualmann <metzpinguin at gmail dot com>
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) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FLICKR_TALKER_H
26 #define DIGIKAM_FLICKR_TALKER_H
27 
28 // Qt includes
29 
30 #include <QUrl>
31 #include <QList>
32 #include <QPair>
33 #include <QString>
34 #include <QObject>
35 #include <QNetworkReply>
36 
37 // Local includes
38 
39 #include "dinfointerface.h"
40 #include "flickritem.h"
41 
42 class QProgressDialog;
43 
44 using namespace Digikam;
45 
47 {
48 
49 class FPhotoInfo;
50 class FPhotoSet;
51 
52 class FlickrTalker : public QObject
53 {
54  Q_OBJECT
55 
56 public:
57 
58  enum State
59  {
60  FE_LOGOUT = -1,
61  FE_LOGIN = 0,
69  FE_SETGEO
70  };
71 
72 public:
73 
74  explicit FlickrTalker(QWidget* const parent, const QString& serviceName,
75  DInfoInterface* const iface);
76  ~FlickrTalker() override;
77 
78  void link(const QString& userName);
79  void unLink();
80  void removeUserName(const QString& userName);
81  QString getUserName() const;
82  QString getUserId() const;
83  void maxAllowedFileSize();
84  QString getMaxAllowedFileSize();
85  void getPhotoProperty(const QString& method, const QStringList& argList);
86  void cancel();
87 
88  void listPhotoSets();
89  void listPhotos(const QString& albumName);
90  void createPhotoSet(const QString& name,
91  const QString& title,
92  const QString& desc,
93  const QString& primaryPhotoId);
94 
95  void addPhotoToPhotoSet(const QString& photoId, const QString& photoSetId);
96  bool addPhoto(const QString& photoPath, const FPhotoInfo& info,
97  bool original = false, bool rescale = false,
98  int maxDim = 600, int imageQuality = 85);
99  void setGeoLocation(const QString& photoId, const QString& lat, const QString& lon);
100 
101 public:
102 
103  QProgressDialog* m_authProgressDlg;
106 
107 Q_SIGNALS:
108 
109  void signalError(const QString& msg);
110  void signalBusy(bool val);
111  void signalAddPhotoSucceeded(const QString&);
114  void signalListPhotoSetsFailed(QString& msg);
115  void signalAddPhotoFailed(const QString& msg);
116  void signalListPhotoSetsFailed(const QString& msg);
118 
119 private:
120 
121 /*
122  void parseResponseLogin(const QByteArray& data);
123 */
124  void parseResponseMaxSize(const QByteArray& data);
125  void parseResponseListPhotoSets(const QByteArray& data);
126  void parseResponseListPhotos(const QByteArray& data);
127  void parseResponseCreateAlbum(const QByteArray& data);
128  void parseResponseAddPhoto(const QByteArray& data);
129  void parseResponsePhotoProperty(const QByteArray& data);
130  void parseResponseCreatePhotoSet(const QByteArray& data);
131  void parseResponseAddPhotoToPhotoSet(const QByteArray& data);
132  void parseResponseSetGeoLocation(const QByteArray& data);
133 
134 private Q_SLOTS:
135 
136  void slotLinkingFailed();
137  void slotLinkingSucceeded();
138  void slotCatchUrl(const QUrl& url);
139  void slotOpenBrowser(const QUrl& url);
140  void slotError(const QString& msg);
141  void slotFinished(QNetworkReply* reply);
142 
143 private:
144 
145  class Private;
146  Private* const d;
147 };
148 
149 } // namespace DigikamGenericFlickrPlugin
150 
151 #endif // DIGIKAM_FLICKR_TALKER_H
Definition: flickritem.h:40
Definition: flickritem.h:70
Definition: flickrtalker.h:53
void signalListPhotoSetsFailed(const QString &msg)
void signalError(const QString &msg)
QProgressDialog * m_authProgressDlg
Definition: flickrtalker.h:103
State
Definition: flickrtalker.h:59
@ FE_ADDPHOTO
Definition: flickrtalker.h:65
@ FE_ADDPHOTOTOPHOTOSET
Definition: flickrtalker.h:67
@ FE_GETMAXSIZE
Definition: flickrtalker.h:68
@ FE_LISTPHOTOS
Definition: flickrtalker.h:63
@ FE_GETPHOTOPROPERTY
Definition: flickrtalker.h:64
@ FE_LISTPHOTOSETS
Definition: flickrtalker.h:62
@ FE_CREATEPHOTOSET
Definition: flickrtalker.h:66
FPhotoSet m_selectedPhotoSet
Definition: flickrtalker.h:105
void signalAddPhotoSucceeded(const QString &)
void signalAddPhotoFailed(const QString &msg)
QList< FPhotoSet > * m_photoSetsList
Definition: flickrtalker.h:104
Definition: dinfointerface.h:56
Definition: piwigotalker.h:48
Definition: flickritem.h:37
Definition: datefolderview.cpp:43