diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-09-16 16:43:01 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-16 21:16:58 -0700 |
commit | d59e89e569b732661633424fcf19f09e95b936fe (patch) | |
tree | 738d09dfd413ba279ada2a05a88eba5a031efcdf /qt-ui/preferences.cpp | |
parent | e945134cc48315dfbe462051d9facd1543779e2c (diff) | |
download | subsurface-d59e89e569b732661633424fcf19f09e95b936fe.tar.gz |
Make Facebook more user friendly
The current way that facebook works is terrible: it's scattered
around tons of files ( at least 4 different files and classes )
this moves things around a bit, add a disconnect button that
was missing, cleans tons of code and fix inconsistencies.
I will also redo this part for 5.0, but it's too late for 4.5
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r-- | qt-ui/preferences.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 73d9c7024..fcddb618c 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -52,6 +52,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) FacebookManager *fb = FacebookManager::instance(); facebookWebView = new QWebView(this); + ui.fbWebviewContainer->layout()->addWidget(facebookWebView); if (fb->loggedIn()) { facebookLoggedIn(); } else { @@ -59,7 +60,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial } connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin); connect(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn); - connect(ui.btnDisconnectFacebook, &QPushButton::clicked, fb, &FacebookManager::logout); + connect(ui.fbDisconnect, &QPushButton::clicked, fb, &FacebookManager::logout); connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect); #endif connect(ui.proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyType_changed(int))); @@ -79,13 +80,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial void PreferencesDialog::facebookLoggedIn() { #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) - // remove the login view and add the disconnect button - ui.fbLayout->removeItem(ui.fbLayout->itemAt(1)); - ui.fbLayout->insertWidget(1, ui.fbConnected, 0); - ui.fbConnected->show(); + ui.fbDisconnect->show(); + ui.fbWebviewContainer->hide(); + ui.fbWebviewContainer->setEnabled(false); ui.FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below")); - if (facebookWebView) - facebookWebView->hide(); #endif } @@ -94,14 +92,13 @@ void PreferencesDialog::facebookDisconnect() #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) // remove the connect/disconnect button // and instead add the login view - ui.fbLayout->removeItem(ui.fbLayout->itemAt(1)); - ui.fbLayout->insertWidget(1, facebookWebView, 1); - ui.fbConnected->hide(); + ui.fbDisconnect->hide(); + ui.fbWebviewContainer->show(); + ui.fbWebviewContainer->setEnabled(true); ui.FBLabel->setText(tr("To connect to Facebook, please log in. This enables Subsurface to publish dives to your timeline")); if (facebookWebView) { facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar()); facebookWebView->setUrl(FacebookManager::instance()->connectUrl()); - facebookWebView->show(); } #endif } |