diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/maintab.cpp | 15 | ||||
-rw-r--r-- | qt-ui/maintab.ui | 177 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 14 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 26 | ||||
-rw-r--r-- | qt-ui/preferences.cpp | 19 | ||||
-rw-r--r-- | qt-ui/preferences.ui | 241 | ||||
-rw-r--r-- | qt-ui/socialnetworks.cpp | 4 | ||||
-rw-r--r-- | qt-ui/socialnetworks.h | 4 |
8 files changed, 110 insertions, 390 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index fb1a64c38..2e4d3fc9f 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -25,10 +25,6 @@ #include "locationinformation.h" #include "divesite.h" -#if defined(FBSUPPORT) -#include "socialnetworks.h" -#endif - #include <QCompleter> #include <QSettings> #include <QScrollBar> @@ -201,17 +197,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.photosView->setSelectionMode(QAbstractItemView::SingleSelection); connect(deletePhoto, SIGNAL(triggered(bool)), this, SLOT(removeSelectedPhotos())); -#if defined(FBSUPPORT) - FacebookManager *fb = FacebookManager::instance(); - connect(fb, &FacebookManager::justLoggedIn, ui.facebookPublish, &QPushButton::show); - connect(fb, &FacebookManager::justLoggedOut, ui.facebookPublish, &QPushButton::hide); - connect(ui.facebookPublish, &QPushButton::clicked, fb, &FacebookManager::sendDive); - ui.facebookPublish->setVisible(fb->loggedIn()); -#else - ui.facebookPublish->setVisible(false); - ui.socialNetworks->setVisible(false); -#endif - ui.waitingSpinner->setRoundness(70.0); ui.waitingSpinner->setMinimumTrailOpacity(15.0); ui.waitingSpinner->setTrailFadePercentage(70.0); diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 7ea895863..23bacbf85 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -21,16 +21,7 @@ <string>General notes about the current selection</string> </attribute> <layout class="QGridLayout" name="diveNotesLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <property name="spacing"> @@ -55,21 +46,12 @@ <rect> <x>0</x> <y>0</y> - <width>445</width> - <height>760</height> + <width>449</width> + <height>772</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <item> @@ -458,51 +440,9 @@ <property name="spacing"> <number>0</number> </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="facebookPublish"> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../subsurface.qrc"> - <normaloff>:/facebook</normaloff>:/facebook</iconset> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> </layout> </widget> </item> @@ -524,16 +464,7 @@ <string>Used equipment in the current selection</string> </attribute> <layout class="QGridLayout" name="equiptmentTabLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item row="0" column="0"> @@ -560,16 +491,7 @@ </rect> </property> <layout class="QGridLayout" name="equipmentTabScrollAreaLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <property name="spacing"> @@ -581,16 +503,7 @@ <property name="spacing"> <number>0</number> </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <item> @@ -619,16 +532,7 @@ <string>Dive information</string> </attribute> <layout class="QGridLayout" name="diveInfoLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item row="0" column="0"> @@ -650,21 +554,12 @@ <rect> <x>0</x> <y>0</y> - <width>287</width> - <height>320</height> + <width>211</width> + <height>250</height> </rect> </property> <layout class="QGridLayout" name="diveInfoScrollAreaLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <property name="spacing"> @@ -963,16 +858,7 @@ <string>Simple statistics about the selection</string> </attribute> <layout class="QGridLayout" name="statsLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item row="1" column="1"> @@ -991,21 +877,12 @@ <rect> <x>0</x> <y>0</y> - <width>297</width> - <height>187</height> + <width>225</width> + <height>166</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <item> @@ -1181,16 +1058,7 @@ <string>All photos from the current selection</string> </attribute> <layout class="QVBoxLayout" name="photosLayout"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -1213,16 +1081,7 @@ <property name="spacing"> <number>0</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index d26ad2a3b..43bc4d3fb 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -51,6 +51,10 @@ #include <qthelper.h> #include <QtConcurrentRun> +#if defined(FBSUPPORT) +#include "socialnetworks.h" +#endif + QProgressDialog *progressDialog = NULL; bool progressDialogCanceled = false; @@ -235,6 +239,16 @@ MainWindow::MainWindow() : QMainWindow(), find_all_templates(); #endif +#if defined(FBSUPPORT) + FacebookManager *fb = FacebookManager::instance(); + connect(fb, SIGNAL(justLoggedIn(bool)), ui.actionFacebook, SLOT(setEnabled(bool))); + connect(fb, SIGNAL(justLoggedOut(bool)), ui.actionFacebook, SLOT(setEnabled(bool))); + connect(ui.actionFacebook, SIGNAL(triggered(bool)), fb, SLOT(sendDive())); + ui.actionFacebook->setEnabled(fb->loggedIn()); +#else + ui.actionFacebook->setEnabled(false); +#endif + ui.menubar->show(); set_git_update_cb(&updateProgress); } diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 8ecdc13ac..5e3200cfc 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -15,16 +15,7 @@ <property name="spacing"> <number>0</number> </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>0</number> </property> <item> @@ -62,7 +53,7 @@ <x>0</x> <y>0</y> <width>861</width> - <height>29</height> + <height>23</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -146,11 +137,19 @@ <string>&Edit</string> </property> </widget> + <widget class="QMenu" name="menuShare_on"> + <property name="title"> + <string>Share on</string> + </property> + <addaction name="separator"/> + <addaction name="actionFacebook"/> + </widget> <addaction name="menuFile"/> <addaction name="menu_Edit"/> <addaction name="menuImport"/> <addaction name="menuLog"/> <addaction name="menuView"/> + <addaction name="menuShare_on"/> <addaction name="menuHelp"/> </widget> <action name="actionNew"> @@ -735,6 +734,11 @@ <string>Dive Site &Edit</string> </property> </action> + <action name="actionFacebook"> + <property name="text"> + <string>Facebook</string> + </property> + </action> </widget> <customwidgets> <customwidget> 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 } diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index dc0d04a5a..a45734d01 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -19,16 +19,7 @@ </iconset> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -168,7 +159,7 @@ </sizepolicy> </property> <property name="currentIndex"> - <number>0</number> + <number>5</number> </property> <widget class="QWidget" name="defaults_page"> <property name="sizePolicy"> @@ -181,16 +172,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -199,16 +181,7 @@ <string>Lists and tables</string> </property> <layout class="QHBoxLayout" name="horizontalLayout_11"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -246,16 +219,7 @@ <property name="verticalSpacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item row="0" column="0"> @@ -359,16 +323,7 @@ <property name="verticalSpacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item row="0" column="0"> @@ -394,16 +349,7 @@ <string>Animations</string> </property> <layout class="QHBoxLayout" name="horizontalLayout_7"> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -442,16 +388,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -490,16 +427,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -800,16 +728,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -1103,16 +1022,7 @@ <property name="sizeConstraint"> <enum>QLayout::SetNoConstraint</enum> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -1196,16 +1106,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -1399,8 +1300,7 @@ </widget> </item> <item row="1" column="3"> - <widget class="QLineEdit" name="cloud_storage_new_passwd"> - </widget> + <widget class="QLineEdit" name="cloud_storage_new_passwd"/> </item> <item row="2" column="0"> <widget class="QCheckBox" name="cloud_background_sync"> @@ -1428,16 +1328,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -1482,65 +1373,44 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <layout class="QVBoxLayout" name="fbLayout" stretch="0,1,1"> + <layout class="QVBoxLayout" name="fbLayout" stretch="0"> <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> - <widget class="QLabel" name="FBLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="fbConnected" native="true"> - <widget class="QPushButton" name="btnDisconnectFacebook"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>229</width> - <height>28</height> - </rect> - </property> - <property name="text"> - <string>Disconnect from Facebook</string> - </property> - </widget> + <widget class="QWidget" name="widget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QLabel" name="FBLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Connect to facebook text placeholder</string> + </property> + </widget> + </item> + <item> + <widget class="QWidget" name="fbWebviewContainer" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_10"/> + </widget> + </item> + <item> + <widget class="QPushButton" name="fbDisconnect"> + <property name="text"> + <string>Disconnect</string> + </property> + </widget> + </item> + </layout> </widget> </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="geolookup_page"> @@ -1554,16 +1424,7 @@ <property name="spacing"> <number>5</number> </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> + <property name="margin"> <number>5</number> </property> <item> @@ -2026,14 +1887,14 @@ </connection> </connections> <buttongroups> - <buttongroup name="buttonGroup_6"/> - <buttongroup name="buttonGroup_2"/> - <buttongroup name="buttonGroup"/> <buttongroup name="verticalSpeed"/> - <buttongroup name="buttonGroup_7"/> - <buttongroup name="defaultFileGroup"/> - <buttongroup name="buttonGroup_5"/> + <buttongroup name="buttonGroup_2"/> <buttongroup name="buttonGroup_3"/> <buttongroup name="buttonGroup_4"/> + <buttongroup name="defaultFileGroup"/> + <buttongroup name="buttonGroup_5"/> + <buttongroup name="buttonGroup_6"/> + <buttongroup name="buttonGroup_7"/> + <buttongroup name="buttonGroup"/> </buttongroups> </ui> diff --git a/qt-ui/socialnetworks.cpp b/qt-ui/socialnetworks.cpp index c165043b6..6e191267a 100644 --- a/qt-ui/socialnetworks.cpp +++ b/qt-ui/socialnetworks.cpp @@ -94,7 +94,7 @@ void FacebookManager::tryLogin(const QUrl& loginResponse) #endif requestUserId(); sync(); - emit justLoggedIn(); + emit justLoggedIn(true); } void FacebookManager::logout() @@ -115,7 +115,7 @@ void FacebookManager::logout() prefs.facebook.album_id = NULL; prefs.facebook.user_id = NULL; #endif - emit justLoggedOut(); + emit justLoggedOut(true); } void FacebookManager::requestAlbumId() diff --git a/qt-ui/socialnetworks.h b/qt-ui/socialnetworks.h index 04d1996b5..2f63915ca 100644 --- a/qt-ui/socialnetworks.h +++ b/qt-ui/socialnetworks.h @@ -16,8 +16,8 @@ public: QUrl connectUrl(); bool loggedIn(); signals: - void justLoggedIn(); - void justLoggedOut(); + void justLoggedIn(bool triggererd); + void justLoggedOut(bool triggered); public slots: void tryLogin(const QUrl& loginResponse); |