mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
[Facebook] New method, grabProfilePixmap
Just some code organization Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5778dceb52
commit
a2734e6aaf
2 changed files with 22 additions and 13 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue