aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/plugins/facebook/facebookconnectwidget.cpp33
-rw-r--r--desktop-widgets/plugins/facebook/facebookconnectwidget.h2
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;
};