Changeset 39e68c7 in subsurface


Ignore:
Timestamp:
Jan 30, 2015, 10:36:49 PM (3 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.4-branch, v4.5-branch
Children:
bc6569f
Parents:
13e2be58
git-author:
Dirk Hohndel <dirk@…> (01/30/15 22:10:21)
git-committer:
Dirk Hohndel <dirk@…> (01/30/15 22:36:49)
Message:

Try to make the Facebook interaction be more pleasant

Show either the login screen or the disconnect button, plus some text that
explains what the user is expected to do.

Signed-off-by: Dirk Hohndel <dirk@…>

Location:
qt-ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qt-ui/preferences.cpp

    rcb6bda4 r39e68c7  
    3333                        delete ui.listWidget->item(i);
    3434        }
    35 #else
    36         facebookWebView = new QWebView(this);
    37         QVBoxLayout fbLayout(ui.facebook_page);
    38         fbLayout.addWidget(facebookWebView);
    39         fbLayout.addWidget(ui.fbConnected);
    40         ui.facebook_page->setLayout(&fbLayout);
    4135#endif
    4236
     
    5145#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
    5246        FacebookManager *fb = FacebookManager::instance();
    53         if(fb->loggedIn()){
    54                 facebookWebView->setHtml("You are connected on Facebook, yey.");
     47        facebookWebView = new QWebView(this);
     48        if (fb->loggedIn()) {
     49                facebookLoggedIn();
    5550        } else {
    56                 facebookWebView->setUrl(fb->connectUrl());
     51                facebookDisconnect();
    5752        }
    5853        connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin);
     
    7974{
    8075#ifndef Q_OS_ANDROID
    81         facebookWebView->setHtml("We need a better 'you re connected' page. but, YEY. ");
     76        // remove the login view and add the disconnect button
     77        ui.fbLayout->removeItem(ui.fbLayout->itemAt(1));
     78        ui.fbLayout->addWidget(ui.fbConnected);
    8279        ui.fbConnected->show();
     80        ui.FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below"));
     81        if (facebookWebView)
     82                facebookWebView->hide();
    8383#endif
    8484}
     
    8787{
    8888#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
    89         facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
    90         facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
     89        // remove the disconnect button
     90        // and instead add the login view
     91        ui.fbLayout->removeItem(ui.fbLayout->itemAt(1));
     92        ui.fbLayout->addWidget(facebookWebView);
    9193        ui.fbConnected->hide();
     94        ui.FBLabel->setText(tr("To connect to Facebook, please log in. This enables Subsurface to publish dives to your timeline"));
     95        if (facebookWebView) {
     96                facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
     97                facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
     98                facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
     99                facebookWebView->show();
     100        }
    92101#endif
    93102}
  • qt-ui/preferences.ui

    r5c3d957 r39e68c7  
    152152       </property>
    153153       <property name="currentIndex">
    154         <number>2</number>
     154        <number>0</number>
    155155       </property>
    156156       <widget class="QWidget" name="defaults_page">
     
    789789              </property>
    790790             </widget>
    791      </item>
     791            </item>
    792792            <item row="5" column="0">
    793793             <widget class="QCheckBox" name="show_ccr_setpoint">
     
    797797             </widget>
    798798            </item>
    799              <item row="6" column="0">
     799            <item row="6" column="0">
    800800             <widget class="QCheckBox" name="show_ccr_sensors">
    801801              <property name="text">
     
    10491049       </widget>
    10501050       <widget class="QWidget" name="facebook_page">
    1051         <widget class="QWidget" name="fbConnected" native="true">
    1052          <property name="geometry">
    1053           <rect>
    1054            <x>9</x>
    1055            <y>355</y>
    1056            <width>265</width>
    1057            <height>47</height>
    1058           </rect>
    1059          </property>
    1060          <layout class="QVBoxLayout" name="verticalLayout_9">
    1061           <item>
    1062            <layout class="QHBoxLayout" name="connectedLayout">
    1063             <item>
    1064              <spacer name="horizontalSpacer_2">
    1065               <property name="orientation">
    1066                <enum>Qt::Horizontal</enum>
    1067               </property>
    1068               <property name="sizeHint" stdset="0">
    1069                <size>
    1070                 <width>40</width>
    1071                 <height>20</height>
    1072                </size>
    1073               </property>
    1074              </spacer>
    1075             </item>
    1076             <item>
    1077              <widget class="QPushButton" name="btnDisconnectFacebook">
    1078               <property name="text">
    1079                <string>Disconnect from Facebook</string>
    1080               </property>
    1081              </widget>
    1082             </item>
    1083            </layout>
    1084           </item>
    1085          </layout>
    1086         </widget>
     1051        <layout class="QVBoxLayout" name="fbLayout">
     1052         <item>
     1053          <widget class="QLabel" name="FBLabel">
     1054           <property name="wordWrap">
     1055            <bool>true</bool>
     1056           </property>
     1057          </widget>
     1058         </item>
     1059         <item>
     1060          <widget class="QWidget" name="fbConnected" native="true">
     1061           <widget class="QPushButton" name="btnDisconnectFacebook">
     1062            <property name="geometry">
     1063             <rect>
     1064              <x>0</x>
     1065              <y>0</y>
     1066              <width>229</width>
     1067              <height>28</height>
     1068             </rect>
     1069            </property>
     1070            <property name="text">
     1071             <string>Disconnect from Facebook</string>
     1072            </property>
     1073           </widget>
     1074          </widget>
     1075         </item>
     1076        </layout>
    10871077       </widget>
    10881078      </widget>
     
    14421432 </connections>
    14431433 <buttongroups>
    1444   <buttongroup name="verticalSpeed"/>
     1434  <buttongroup name="buttonGroup"/>
    14451435  <buttongroup name="buttonGroup_2"/>
    14461436  <buttongroup name="buttonGroup_3"/>
    1447   <buttongroup name="buttonGroup"/>
    14481437  <buttongroup name="buttonGroup_4"/>
    14491438  <buttongroup name="buttonGroup_5"/>
    14501439  <buttongroup name="buttonGroup_6"/>
     1440  <buttongroup name="verticalSpeed"/>
    14511441 </buttongroups>
    14521442</ui>
Note: See TracChangeset for help on using the changeset viewer.