2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-11-08 12:33:29 +00:00
|
|
|
#ifndef FACEBOOKCONNECTWIDGET_H
|
|
|
|
#define FACEBOOKCONNECTWIDGET_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2017-09-29 19:45:28 +00:00
|
|
|
#include <QUrl>
|
2016-08-08 22:12:12 +00:00
|
|
|
#ifdef USE_WEBENGINE
|
|
|
|
class QWebEngineView;
|
|
|
|
#else
|
2015-11-08 12:33:29 +00:00
|
|
|
class QWebView;
|
2016-08-08 22:12:12 +00:00
|
|
|
#endif
|
2017-09-29 09:14:40 +00:00
|
|
|
class QNetworkReply;
|
2017-09-29 09:54:12 +00:00
|
|
|
class QNetworkAccessManager;
|
2017-09-29 09:14:40 +00:00
|
|
|
|
2015-11-08 12:33:29 +00:00
|
|
|
namespace Ui {
|
2017-09-29 19:45:28 +00:00
|
|
|
class FacebookConnectWidget;
|
|
|
|
class SocialnetworksDialog;
|
2015-11-08 12:33:29 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 10:50:40 +00:00
|
|
|
struct FacebookInfo {
|
2017-10-02 12:54:00 +00:00
|
|
|
enum Size {SMALL, MEDIUM, BIG};
|
2017-10-02 10:50:40 +00:00
|
|
|
|
2017-10-02 12:54:00 +00:00
|
|
|
QString bodyText;
|
|
|
|
QString albumId;
|
|
|
|
QString albumName;
|
|
|
|
Size profileSize;
|
|
|
|
QPixmap profileData;
|
2017-10-02 10:50:40 +00:00
|
|
|
};
|
|
|
|
|
2015-11-08 12:33:29 +00:00
|
|
|
class FacebookManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static FacebookManager *instance();
|
|
|
|
void requestAlbumId();
|
|
|
|
void requestUserId();
|
|
|
|
QUrl connectUrl();
|
2017-09-29 09:54:12 +00:00
|
|
|
QUrl albumListUrl();
|
2015-11-08 12:33:29 +00:00
|
|
|
bool loggedIn();
|
2017-10-02 10:55:13 +00:00
|
|
|
QPixmap grabProfilePixmap();
|
2017-10-02 13:25:44 +00:00
|
|
|
|
2015-11-08 12:33:29 +00:00
|
|
|
signals:
|
|
|
|
void justLoggedIn(bool triggererd);
|
|
|
|
void justLoggedOut(bool triggered);
|
2017-10-02 12:20:37 +00:00
|
|
|
void albumIdReceived(const QString& albumId);
|
2017-10-02 12:35:36 +00:00
|
|
|
void sendDiveFinished();
|
2017-10-02 13:25:44 +00:00
|
|
|
void sendMessage(const QString& message);
|
2015-11-08 12:33:29 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void tryLogin(const QUrl& loginResponse);
|
|
|
|
void logout();
|
2017-10-02 12:35:36 +00:00
|
|
|
void sendDiveInit();
|
|
|
|
void sendDiveToAlbum(const QString& album);
|
|
|
|
|
2017-09-29 19:45:28 +00:00
|
|
|
void uploadFinished();
|
|
|
|
void albumListReceived();
|
2017-09-29 10:21:35 +00:00
|
|
|
void userIdReceived();
|
2017-09-29 19:45:28 +00:00
|
|
|
void createFacebookAlbum();
|
|
|
|
void facebookAlbumCreated();
|
2015-11-08 12:33:29 +00:00
|
|
|
private:
|
|
|
|
explicit FacebookManager(QObject *parent = 0);
|
2017-10-02 10:55:13 +00:00
|
|
|
FacebookInfo fbInfo;
|
2017-09-29 09:54:12 +00:00
|
|
|
QNetworkAccessManager *manager;
|
2015-11-08 12:33:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class FacebookConnectWidget : public QDialog {
|
2017-09-29 09:54:12 +00:00
|
|
|
Q_OBJECT
|
2015-11-08 12:33:29 +00:00
|
|
|
public:
|
|
|
|
explicit FacebookConnectWidget(QWidget* parent = 0);
|
|
|
|
void facebookLoggedIn();
|
|
|
|
void facebookDisconnect();
|
|
|
|
private:
|
|
|
|
Ui::FacebookConnectWidget *ui;
|
2016-08-08 22:12:12 +00:00
|
|
|
#ifdef USE_WEBENGINE
|
|
|
|
QWebEngineView *facebookWebView;
|
|
|
|
#else
|
2015-11-08 12:33:29 +00:00
|
|
|
QWebView *facebookWebView;
|
2016-08-08 22:12:12 +00:00
|
|
|
#endif
|
2015-11-08 12:33:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SocialNetworkDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-09-29 12:33:20 +00:00
|
|
|
|
2015-11-08 14:10:13 +00:00
|
|
|
SocialNetworkDialog(QWidget *parent = 0);
|
2015-11-08 12:33:29 +00:00
|
|
|
QString text() const;
|
2015-11-08 14:10:13 +00:00
|
|
|
QString album() const;
|
2017-10-02 10:50:40 +00:00
|
|
|
FacebookInfo::Size profileSize() const;
|
2017-09-29 12:33:20 +00:00
|
|
|
|
2015-11-08 14:10:13 +00:00
|
|
|
public slots:
|
|
|
|
void selectionChanged();
|
|
|
|
void albumChanged();
|
2015-11-08 12:33:29 +00:00
|
|
|
private:
|
2015-11-08 14:10:13 +00:00
|
|
|
Ui::SocialnetworksDialog *ui;
|
2015-11-08 12:33:29 +00:00
|
|
|
};
|
|
|
|
|
2016-08-26 18:17:49 +00:00
|
|
|
#endif
|