diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2017-10-02 12:55:13 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-02 08:52:03 -0700 |
commit | a2734e6aaf4c7e10624342a69f127789ea22b5ab (patch) | |
tree | fe321aeb7294ac9a1475cd2a5b61b75e41c86ced | |
parent | 5778dceb5201544df7d89b27995b9ede6db1ae76 (diff) | |
download | subsurface-a2734e6aaf4c7e10624342a69f127789ea22b5ab.tar.gz |
[Facebook] New method, grabProfilePixmap
Just some code organization
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 33 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebookconnectwidget.h | 2 |
2 files changed, 22 insertions, 13 deletions
diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index f8e2d6b62..721179db6 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -171,6 +171,25 @@ void FacebookManager::setDesiredAlbumName(const QString& a) albumName = a; } +QPixmap FacebookManager::grabProfilePixmap() +{ + ProfileWidget2 *profile = MainWindow::instance()->graphics(); + + QSize size = fbInfo.profileSize == FacebookInfo::SMALL ? QSize(800,600) : + fbInfo.profileSize == FacebookInfo::MEDIUM ? QSize(1024,760) : + fbInfo.profileSize == FacebookInfo::BIG ? QSize(1280,1024) : QSize(); + + auto currSize = profile->size(); + profile->resize(size); + profile->setToolTipVisibile(false); + QPixmap pix = profile->grab(); + profile->setToolTipVisibile(true); + profile->resize(currSize); + + return pix; +} + + /* to be changed to export the currently selected dive as shown on the profile. * Much much easier, and its also good to people do not select all the dives * and send erroniously *all* of them to facebook. */ @@ -183,19 +202,7 @@ void FacebookManager::sendDive() setDesiredAlbumName(dialog.album()); requestAlbumId(); - ProfileWidget2 *profile = MainWindow::instance()->graphics(); - - QSize size = dialog.profileSize() == FacebookInfo::SMALL ? QSize(800,600) : - dialog.profileSize() == FacebookInfo::MEDIUM ? QSize(1024,760) : - dialog.profileSize() == FacebookInfo::BIG ? QSize(1280,1024) : QSize(); - - auto currSize = profile->size(); - profile->resize(size); - profile->setToolTipVisibile(false); - QPixmap pix = profile->grab(); - profile->setToolTipVisibile(true); - profile->resize(currSize); - + QPixmap pix = grabProfilePixmap(); QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.h b/desktop-widgets/plugins/facebook/facebookconnectwidget.h index 793cf4bee..adc84dda4 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.h +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.h @@ -36,6 +36,7 @@ public: QUrl connectUrl(); QUrl albumListUrl(); bool loggedIn(); + QPixmap grabProfilePixmap(); signals: void justLoggedIn(bool triggererd); void justLoggedOut(bool triggered); @@ -53,6 +54,7 @@ public slots: private: explicit FacebookManager(QObject *parent = 0); QString albumName; + FacebookInfo fbInfo; QNetworkAccessManager *manager; }; |