digiKam
rajcetalker.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 : 2011-04-12
7  * Description : A tool to export items to Rajce web service
8  *
9  * Copyright (C) 2011 by Lukas Krejci <krejci.l at centrum dot cz>
10  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_RAJCE_TALKER_H
25 #define DIGIKAM_RAJCE_TALKER_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QString>
31 #include <QSharedPointer>
32 
33 // Local includes
34 
35 #include "rajcesession.h"
36 
37 class QWidget;
38 class QNetworkReply;
39 
41 {
42 
43 class RajceCommand;
44 
45 class RajceTalker : public QObject
46 {
47  Q_OBJECT
48 
49 public:
50 
51  explicit RajceTalker(QWidget* const parent);
52  ~RajceTalker() override;
53 
54 public:
55 
56  void init(const RajceSession& initialState);
57  const RajceSession& session() const;
58  void login(const QString& username, const QString& password);
59  void logout();
60 
61  void loadAlbums();
62  void createAlbum(const QString& name, const QString& description, bool visible);
63  void openAlbum(const RajceAlbum& album);
64  void closeAlbum();
65 
66  void uploadPhoto(const QString& path, unsigned dimension, int jpgQuality);
67 
68  void clearLastError();
69  void cancelCurrentCommand();
70 
71 Q_SIGNALS:
72 
73  void signalBusyStarted(unsigned);
74  void signalBusyFinished(unsigned);
75  void signalBusyProgress(unsigned, unsigned percent);
76 
77 private Q_SLOTS:
78 
79  void slotFinished(QNetworkReply* reply);
80  void slotUploadProgress(qint64 bytesSent, qint64 bytesTotal);
81 
82 private:
83 
84  void startCommand(const QSharedPointer<RajceCommand>&);
85  void enqueueCommand(const QSharedPointer<RajceCommand>&);
86 
87 private:
88 
89  class Private;
90  Private* const d;
91 };
92 
93 } // namespace DigikamGenericRajcePlugin
94 
95 #endif // DIGIKAM_RAJCE_TALKER_H
Definition: rajcesession.h:78
Definition: rajcetalker.h:46
void closeAlbum()
Definition: rajcetalker.cpp:195
void createAlbum(const QString &name, const QString &description, bool visible)
Definition: rajcetalker.cpp:130
void init(const RajceSession &initialState)
Definition: rajcetalker.cpp:263
void login(const QString &username, const QString &password)
Definition: rajcetalker.cpp:118
~RajceTalker() override
Definition: rajcetalker.cpp:89
void signalBusyProgress(unsigned, unsigned percent)
void openAlbum(const RajceAlbum &album)
Definition: rajcetalker.cpp:189
void logout()
Definition: rajcetalker.cpp:184
const RajceSession & session() const
Definition: rajcetalker.cpp:96
void uploadPhoto(const QString &path, unsigned dimension, int jpgQuality)
Definition: rajcetalker.cpp:208
void cancelCurrentCommand()
Definition: rajcetalker.cpp:253
void loadAlbums()
Definition: rajcetalker.cpp:124
void clearLastError()
Definition: rajcetalker.cpp:214
RajceTalker(QWidget *const parent)
Definition: rajcetalker.cpp:78
Definition: rajcealbum.h:35
Definition: rajcealbum.h:38