From 06f52f5c5d4e984b58dc72f76ebfdcb4e7397f02 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tomaz.canabr...@intel.com> Date: Mon, 9 Nov 2015 18:05:30 -0200 Subject: [PATCH 1/4] Remove Facebook from Plugins
Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com> --- CMakeLists.txt | 1 + desktop-widgets/mainwindow.cpp | 51 +++++++++++++------------ desktop-widgets/mainwindow.h | 1 + desktop-widgets/plugins/facebook/CMakeLists.txt | 6 +-- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf7eb7..17a6831 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -384,6 +384,7 @@ else() ${SUBSURFACE_TARGET} subsurface_generated_ui subsurface_interface + facebook_integration subsurface_profile subsurface_statistics subsurface_models diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b532b85..58778f3 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -55,6 +55,8 @@ #include "subsurface-core/isocialnetworkintegration.h" #include "subsurface-core/pluginmanager.h" +#include "plugins/facebook/facebook_integration.h" + #if defined(FBSUPPORT) #include "socialnetworks.h" #endif @@ -243,30 +245,7 @@ MainWindow::MainWindow() : QMainWindow(), find_all_templates(); #endif - if(PluginManager::instance().socialNetworkIntegrationPlugins().count()) { - QMenu *connections = new QMenu(tr("Connect to")); - Q_FOREACH(ISocialNetworkIntegration *plugin, PluginManager::instance().socialNetworkIntegrationPlugins()){ - QAction *toggle_connection = new QAction(this); - toggle_connection->setText(plugin->socialNetworkName()); - toggle_connection->setIcon(QIcon(plugin->socialNetworkIcon())); - toggle_connection->setData(QVariant::fromValue(plugin)); - connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); - - QAction *share_on = new QAction(this); - share_on->setText(plugin->socialNetworkName()); - share_on->setIcon(QIcon(plugin->socialNetworkIcon())); - share_on->setData(QVariant::fromValue(plugin)); - ui.menuShare_on->addAction(share_on); - connections->addAction(toggle_connection); - connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); - } - ui.menuShare_on->addSeparator(); - ui.menuShare_on->addMenu(connections); - } else { - ui.menubar->removeAction(ui.menuShare_on->menuAction()); - } - - ui.menubar->show(); + setupSocialNetworkMenu(); set_git_update_cb(&updateProgress); } @@ -276,10 +255,32 @@ MainWindow::~MainWindow() m_Instance = NULL; } +void MainWindow::setupSocialNetworkMenu() +{ + QMenu *connections = new QMenu(tr("Connect to")); + FacebookPlugin *facebookPlugin = new FacebookPlugin(); + QAction *toggle_connection = new QAction(this); + toggle_connection->setText(facebookPlugin->socialNetworkName()); + toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); + toggle_connection->setData(QVariant::fromValue(facebookPlugin)); + connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); + + QAction *share_on = new QAction(this); + share_on->setText(facebookPlugin->socialNetworkName()); + share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); + share_on->setData(QVariant::fromValue(facebookPlugin)); + ui.menuShare_on->addAction(share_on); + connections->addAction(toggle_connection); + connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); + ui.menuShare_on->addSeparator(); + ui.menuShare_on->addMenu(connections); + ui.menubar->show(); +} + void MainWindow::socialNetworkRequestConnect() { QAction *action = qobject_cast<QAction*>(sender()); - ISocialNetworkIntegration *plugin = action->data().value<ISocialNetworkIntegration*>(); + FacebookPlugin *plugin = action->data().value<FacebookPlugin*>(); if (plugin->isConnected()) plugin->requestLogoff(); else diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index fc63c57..adf3568 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -225,6 +225,7 @@ private: bool plannerStateClean(); void setupForAddAndPlan(const char *model); void configureToolbar(); + void setupSocialNetworkMenu(); QDialog *survey; struct dive copyPasteDive; struct dive_components what; diff --git a/desktop-widgets/plugins/facebook/CMakeLists.txt b/desktop-widgets/plugins/facebook/CMakeLists.txt index 3f63a8f..c0175a2 100644 --- a/desktop-widgets/plugins/facebook/CMakeLists.txt +++ b/desktop-widgets/plugins/facebook/CMakeLists.txt @@ -1,7 +1,7 @@ set(FACEBOOK_PLUGIN_SRCS facebook_integration.cpp facebookconnectwidget.cpp) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(facebook_integration SHARED ${FACEBOOK_PLUGIN_SRCS}) +add_library(facebook_integration STATIC ${FACEBOOK_PLUGIN_SRCS}) -target_link_libraries(facebook_integration subsurface_corelib subsurface_interface ${QT_LIBRARIES}) -add_dependencies(facebook_integration subsurface_corelib subsurface_interface) \ No newline at end of file +target_link_libraries(facebook_integration ${QT_LIBRARIES}) +add_dependencies(facebook_integration subsurface_corelib) \ No newline at end of file -- 2.6.2
From f032c081cb76738fc31f6b95fad82d600743d9a2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tomaz.canabr...@intel.com> Date: Mon, 9 Nov 2015 18:14:20 -0200 Subject: [PATCH 2/4] Remove the PluginSystem But keep the Interface so it's still userfull to create a new SocialNetwork when needed, but it will be part of the code, and not a plugin. Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com> --- desktop-widgets/mainwindow.cpp | 7 ++++--- desktop-widgets/plugins/facebook/facebook_integration.cpp | 2 +- desktop-widgets/plugins/facebook/facebook_integration.h | 4 +--- subsurface-core/CMakeLists.txt | 1 + subsurface-core/isocialnetworkintegration.h | 7 ++++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 58778f3..41d0fd5 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -260,15 +260,16 @@ void MainWindow::setupSocialNetworkMenu() QMenu *connections = new QMenu(tr("Connect to")); FacebookPlugin *facebookPlugin = new FacebookPlugin(); QAction *toggle_connection = new QAction(this); + QObject *obj = qobject_cast<QObject*>(facebookPlugin); toggle_connection->setText(facebookPlugin->socialNetworkName()); toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); - toggle_connection->setData(QVariant::fromValue(facebookPlugin)); + toggle_connection->setData(QVariant::fromValue(obj)); connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); QAction *share_on = new QAction(this); share_on->setText(facebookPlugin->socialNetworkName()); share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); - share_on->setData(QVariant::fromValue(facebookPlugin)); + share_on->setData(QVariant::fromValue(obj)); ui.menuShare_on->addAction(share_on); connections->addAction(toggle_connection); connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); @@ -280,7 +281,7 @@ void MainWindow::setupSocialNetworkMenu() void MainWindow::socialNetworkRequestConnect() { QAction *action = qobject_cast<QAction*>(sender()); - FacebookPlugin *plugin = action->data().value<FacebookPlugin*>(); + ISocialNetworkIntegration *plugin = qobject_cast<ISocialNetworkIntegration*>(action->data().value<QObject*>()); if (plugin->isConnected()) plugin->requestLogoff(); else diff --git a/desktop-widgets/plugins/facebook/facebook_integration.cpp b/desktop-widgets/plugins/facebook/facebook_integration.cpp index f817f9d..21ad6f7 100644 --- a/desktop-widgets/plugins/facebook/facebook_integration.cpp +++ b/desktop-widgets/plugins/facebook/facebook_integration.cpp @@ -3,7 +3,7 @@ #include <QDebug> -FacebookPlugin::FacebookPlugin(QObject* parent): QObject(parent), +FacebookPlugin::FacebookPlugin(QObject* parent) : fbConnectWidget(new FacebookConnectWidget()), fbUploadDialog(new SocialNetworkDialog()) { diff --git a/desktop-widgets/plugins/facebook/facebook_integration.h b/desktop-widgets/plugins/facebook/facebook_integration.h index 714f636..40b1691 100644 --- a/desktop-widgets/plugins/facebook/facebook_integration.h +++ b/desktop-widgets/plugins/facebook/facebook_integration.h @@ -8,10 +8,8 @@ class FacebookConnectWidget; class SocialNetworkDialog; class FacebookManager; -class FacebookPlugin : public QObject, public ISocialNetworkIntegration { +class FacebookPlugin : public ISocialNetworkIntegration { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.subsurface.plugins.ISocialNetworkIntegration") - Q_INTERFACES(ISocialNetworkIntegration) public: explicit FacebookPlugin(QObject* parent = 0); virtual bool isConnected(); diff --git a/subsurface-core/CMakeLists.txt b/subsurface-core/CMakeLists.txt index b05dbe0..6b2eac9 100644 --- a/subsurface-core/CMakeLists.txt +++ b/subsurface-core/CMakeLists.txt @@ -79,6 +79,7 @@ set(SUBSURFACE_CORE_LIB_SRCS color.cpp pluginmanager.cpp imagedownloader.cpp + isocialnetworkintegration.cpp ${SERIAL_FTDI} ${PLATFORM_SRC} ${BT_CORE_SRC_FILES} diff --git a/subsurface-core/isocialnetworkintegration.h b/subsurface-core/isocialnetworkintegration.h index 0a38f95..70ea3d9 100644 --- a/subsurface-core/isocialnetworkintegration.h +++ b/subsurface-core/isocialnetworkintegration.h @@ -10,8 +10,11 @@ * We bundle facebook integration as an example. */ -class ISocialNetworkIntegration { +class ISocialNetworkIntegration : public QObject { + Q_OBJECT public: + ISocialNetworkIntegration(QObject* parent = 0); + /*! * @name socialNetworkName * @brief The name of this social network @@ -67,6 +70,4 @@ public: virtual void requestUpload() = 0; }; -Q_DECLARE_INTERFACE(ISocialNetworkIntegration, "org.subsurface.ISocialNetworkIntegration.v1") -Q_DECLARE_METATYPE(ISocialNetworkIntegration*); #endif \ No newline at end of file -- 2.6.2
From 4d5efdc4c2301e32335969818d603763cce774ed Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tomaz.canabr...@intel.com> Date: Mon, 9 Nov 2015 18:19:04 -0200 Subject: [PATCH 3/4] Removed unused files Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com> --- desktop-widgets/preferences.cpp | 173 ------------------ desktop-widgets/preferences.ui | 241 -------------------------- subsurface-core/isocialnetworkintegration.cpp | 6 + 3 files changed, 6 insertions(+), 414 deletions(-) delete mode 100644 desktop-widgets/preferences.cpp delete mode 100644 desktop-widgets/preferences.ui create mode 100644 subsurface-core/isocialnetworkintegration.cpp diff --git a/desktop-widgets/preferences.cpp b/desktop-widgets/preferences.cpp deleted file mode 100644 index 29e9d24..0000000 --- a/desktop-widgets/preferences.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "preferences.h" -#include "mainwindow.h" -#include "models.h" -#include "divelocationmodel.h" -#include "prefs-macros.h" -#include "qthelper.h" -#include "subsurfacestartup.h" - -#include <QSettings> -#include <QFileDialog> -#include <QMessageBox> -#include <QShortcut> -#include <QNetworkProxy> -#include <QNetworkCookieJar> - -#include "subsurfacewebservices.h" - -#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) -#include "socialnetworks.h" -#include <QWebView> -#endif - -PreferencesDialog *PreferencesDialog::instance() -{ - static PreferencesDialog *dialog = new PreferencesDialog(MainWindow::instance()); - return dialog; -} - -PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) -{ - ui.setupUi(this); - setAttribute(Qt::WA_QuitOnClose, false); - -#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 { - facebookDisconnect(); - } - connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin); - connect(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn); - connect(ui.fbDisconnect, &QPushButton::clicked, fb, &FacebookManager::logout); - connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect); -#endif - - connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); - - // connect(ui.defaultSetpoint, SIGNAL(valueChanged(double)), this, SLOT(defaultSetpointChanged(double))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); - connect(quit, SIGNAL(activated()), parent, SLOT(close())); - loadSettings(); - setUiFromPrefs(); - rememberPrefs(); -} - -void PreferencesDialog::facebookLoggedIn() -{ -#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) - 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")); -#endif -} - -void PreferencesDialog::facebookDisconnect() -{ -#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) - // remove the connect/disconnect button - // and instead add the login view - 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()); - } -#endif -} - -void PreferencesDialog::showEvent(QShowEvent *event) -{ - setUiFromPrefs(); - rememberPrefs(); - QDialog::showEvent(event); -} - -void PreferencesDialog::setUiFromPrefs() -{ - -} - -void PreferencesDialog::restorePrefs() -{ - prefs = oldPrefs; - setUiFromPrefs(); -} - -void PreferencesDialog::rememberPrefs() -{ - oldPrefs = prefs; -} - -void PreferencesDialog::syncSettings() -{ -} - -void PreferencesDialog::loadSettings() -{ - // This code was on the mainwindow, it should belong nowhere, but since we didn't - // correctly fixed this code yet ( too much stuff on the code calling preferences ) - // force this here. - loadPreferences(); - QSettings s; - QVariant v; -} - -void PreferencesDialog::buttonClicked(QAbstractButton *button) -{ - switch (ui.buttonBox->standardButton(button)) { - case QDialogButtonBox::Discard: - restorePrefs(); - syncSettings(); - close(); - break; - case QDialogButtonBox::Apply: - syncSettings(); - break; - case QDialogButtonBox::FirstButton: - syncSettings(); - close(); - break; - default: - break; // ignore warnings. - } -} -#undef SB - -#if 0 -// TODO: Copy this later. -void PreferencesDialog::on_resetSettings_clicked() -{ - QSettings s; - QMessageBox response(this); - response.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - response.setDefaultButton(QMessageBox::Cancel); - response.setWindowTitle(tr("Warning")); - response.setText(tr("If you click OK, all settings of Subsurface will be reset to their default values. This will be applied immediately.")); - response.setWindowModality(Qt::WindowModal); - - int result = response.exec(); - if (result == QMessageBox::Ok) { - copy_prefs(&default_prefs, &prefs); - setUiFromPrefs(); - Q_FOREACH (QString key, s.allKeys()) { - s.remove(key); - } - syncSettings(); - close(); - } -} -#endif - -void PreferencesDialog::emitSettingsChanged() -{ - emit settingsChanged(); -} diff --git a/desktop-widgets/preferences.ui b/desktop-widgets/preferences.ui deleted file mode 100644 index 8d0b189..0000000 --- a/desktop-widgets/preferences.ui +++ /dev/null @@ -1,241 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PreferencesDialog</class> - <widget class="QDialog" name="PreferencesDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>835</width> - <height>698</height> - </rect> - </property> - <property name="windowTitle"> - <string>Preferences</string> - </property> - <property name="windowIcon"> - <iconset> - <normalon>:/subsurface-icon</normalon> - </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"> - <number>5</number> - </property> - <item> - <layout class="QHBoxLayout" name="mainHorizontalLayout"> - <item> - <widget class="QListWidget" name="listWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>120</width> - <height>16777215</height> - </size> - </property> - <property name="iconSize"> - <size> - <width>24</width> - <height>24</height> - </size> - </property> - <property name="textElideMode"> - <enum>Qt::ElideNone</enum> - </property> - <property name="movement"> - <enum>QListView::Static</enum> - </property> - <property name="isWrapping" stdset="0"> - <bool>true</bool> - </property> - <property name="layoutMode"> - <enum>QListView::Batched</enum> - </property> - <property name="spacing"> - <number>0</number> - </property> - <property name="gridSize"> - <size> - <width>110</width> - <height>40</height> - </size> - </property> - <property name="viewMode"> - <enum>QListView::ListMode</enum> - </property> - <property name="uniformItemSizes"> - <bool>true</bool> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="currentRow"> - <number>-1</number> - </property> - <item> - <property name="text"> - <string>Facebook</string> - </property> - <property name="icon"> - <iconset> - <normalon>:/facebook</normalon> - </iconset> - </property> - </item> - </widget> - </item> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="facebook_page"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <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"> - <number>5</number> - </property> - <item> - <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> - </layout> - </widget> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Apply|QDialogButtonBox::Discard|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>PreferencesDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>264</x> - <y>720</y> - </hint> - <hint type="destinationlabel"> - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>PreferencesDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel"> - <x>332</x> - <y>720</y> - </hint> - <hint type="destinationlabel"> - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>listWidget</sender> - <signal>currentRowChanged(int)</signal> - <receiver>stackedWidget</receiver> - <slot>setCurrentIndex(int)</slot> - <hints> - <hint type="sourcelabel"> - <x>37</x> - <y>97</y> - </hint> - <hint type="destinationlabel"> - <x>282</x> - <y>18</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/subsurface-core/isocialnetworkintegration.cpp b/subsurface-core/isocialnetworkintegration.cpp new file mode 100644 index 0000000..4a2ccdf --- /dev/null +++ b/subsurface-core/isocialnetworkintegration.cpp @@ -0,0 +1,6 @@ +#include "isocialnetworkintegration.h" + +//Hack for moc. +ISocialNetworkIntegration::ISocialNetworkIntegration(QObject* parent) +{ +} -- 2.6.2
From fd11b3d2af4f094416c6dcf613d9a4179f528c73 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <tomaz.canabr...@intel.com> Date: Mon, 9 Nov 2015 18:57:47 -0200 Subject: [PATCH 4/4] Don't rely on CMAKE_AUTOUIC Some old CMakes that we use had problems with it, change to use the qt5_wrap_ui macro that's bundled with Qt. Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com> --- CMakeLists.txt | 2 +- desktop-widgets/CMakeLists.txt | 35 ++++++++++++++++++++++++- desktop-widgets/plugins/facebook/CMakeLists.txt | 14 ++++++++-- desktop-widgets/preferences/CMakeLists.txt | 10 ++++++- 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17a6831..e4bdbb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.8.11) # global settings set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) + option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF) option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF) option(LIBGRANTLEE_FROM_PKGCONFIG "use pkg-config to retrieve grantlee" OFF) diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index a2beffa..dc55035 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -17,6 +17,37 @@ if(NOT DISABLE_PLUGINS) add_subdirectory(plugins) endif() +set (SUBSURFACE_UI + about.ui + btdeviceselectiondialog.ui + configuredivecomputerdialog.ui + divecomponentselection.ui + divecomputermanagementdialog.ui + divelogexportdialog.ui + divelogimportdialog.ui + diveplanner.ui + diveshareexportdialog.ui + downloadfromdivecomputer.ui + filterwidget.ui + listfilter.ui + locationInformation.ui + maintab.ui + mainwindow.ui + plannerDetails.ui + plannerSettings.ui + printoptions.ui + renumber.ui + searchbar.ui + setpoint.ui + shiftimagetimes.ui + shifttimes.ui + tableview.ui + templateedit.ui + urldialog.ui + usersurvey.ui + webservices.ui +) + # the interface, in C++ set(SUBSURFACE_INTERFACE updatemanager.cpp @@ -81,9 +112,11 @@ set(SUBSURFACE_STATISTICS_LIB_SRCS ) source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS}) +qt5_wrap_ui(SUBSURFACE_UI_SRCS ${SUBSURFACE_UI}) + add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS}) target_link_libraries(subsurface_statistics ${QT_LIBRARIES}) add_library(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS}) target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES}) -add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE}) +add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE} ${SUBSURFACE_UI_SRCS}) target_link_libraries(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES} ${GRANTLEE_LIBRARIES} subsurface_desktop_preferences) diff --git a/desktop-widgets/plugins/facebook/CMakeLists.txt b/desktop-widgets/plugins/facebook/CMakeLists.txt index c0175a2..eb0da75 100644 --- a/desktop-widgets/plugins/facebook/CMakeLists.txt +++ b/desktop-widgets/plugins/facebook/CMakeLists.txt @@ -1,7 +1,17 @@ -set(FACEBOOK_PLUGIN_SRCS facebook_integration.cpp facebookconnectwidget.cpp) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(facebook_integration STATIC ${FACEBOOK_PLUGIN_SRCS}) +set(FACEBOOK_PLUGIN_UI + facebookconnectwidget.ui + socialnetworksdialog.ui +) + +set(FACEBOOK_PLUGIN_SRCS + facebook_integration.cpp + facebookconnectwidget.cpp +) +qt5_wrap_ui(FACEBOOK_PLUGIN_UI_SRCS ${FACEBOOK_PLUGIN_UI}) +add_library(facebook_integration STATIC ${FACEBOOK_PLUGIN_SRCS} ${FACEBOOK_PLUGIN_UI_SRCS}) target_link_libraries(facebook_integration ${QT_LIBRARIES}) add_dependencies(facebook_integration subsurface_corelib) \ No newline at end of file diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt index 4e506ed..ff3d37b 100644 --- a/desktop-widgets/preferences/CMakeLists.txt +++ b/desktop-widgets/preferences/CMakeLists.txt @@ -4,7 +4,15 @@ include_directories(. ${CMAKE_BINARY_DIR} ) -file(GLOB SUBSURFACE_PREFERENCES_UI *.ui) +set(SUBSURFACE_PREFERENCE_UI + preferences_defaults.ui + preferences_graph.ui + preferences_network.ui + preferences_units.ui + prefs_georeference.ui + prefs_language.ui +) + qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI}) source_group("Subsurface Interface Files" FILES ${SUBSURFACE_PREFERENCES_UI}) -- 2.6.2
_______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface