Fix building without BT support

I guess no one had tried this in a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-26 06:05:27 -07:00
parent 1d10a56bdf
commit 3b0f38f24a
5 changed files with 29 additions and 11 deletions

View file

@ -203,13 +203,18 @@ if(ANDROID)
set(ANDROID_PKG AndroidExtras)
set(ANDROID_LIB Qt5::AndroidExtras)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} Bluetooth)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} Qt5::Bluetooth)
if(BTSUPPORT)
set(BLUETOOTH_PKG Bluetooth)
set(BLUETOOTH_LIB Qt5::Bluetooth)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} ${BLUETOOTH_PKG})
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} ${BLUETOOTH_LIB})
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
if ("${Qt5Core_VERSION_STRING}" STRLESS "5.4.0")
if (BTSUPPORT AND "${Qt5Core_VERSION_STRING}" STRLESS "5.4.0")
set(BTSUPPORT OFF)
message(STATUS "Turning off Bluetooth support as Qt version ${Qt5Core_VERSION_STRING} is insufficiant for that")
string(REPLACE "Qt5::Bluetooth" "" QT_LIBRARIES ${QT_LIBRARIES})
endif()
# Generate the ssrf-config.h every 'make'
@ -311,6 +316,12 @@ endif()
# include translations
add_subdirectory(translations)
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
endif()
# compile the core library, in C.
set(SUBSURFACE_CORE_LIB_SRCS
cochran.c
@ -361,7 +372,7 @@ set(SUBSURFACE_CORE_LIB_SRCS
windowtitleupdate.cpp
divelogexportlogic.cpp
qt-init.cpp
qtserialbluetooth.cpp
${BT_CORE_SRC_FILES}
${SERIAL_FTDI}
${PLATFORM_SRC}
)
@ -372,11 +383,6 @@ if(FBSUPPORT)
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
endif()
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
endif()
# the data models that will interface
# with the views.
set(SUBSURFACE_MODELS_LIB_SRCS

View file

@ -636,7 +636,9 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data)
dc_serial_t *serial_device = NULL;
if (data->bluetooth_mode) {
#ifdef BT_SUPPORT
rc = dc_serial_qt_open(&serial_device, data->context, data->devname);
#endif
#ifdef SERIAL_FTDI
} else if (!strcmp(data->devname, "ftdi")) {
rc = dc_serial_ftdi_open(&serial_device, data->context);

View file

@ -971,7 +971,9 @@ const char *do_libdivecomputer_import(device_data_t *data)
dc_serial_t *serial_device = NULL;
if (data->bluetooth_mode) {
#ifdef BT_SUPPORT
rc = dc_serial_qt_open(&serial_device, data->context, data->devname);
#endif
#ifdef SERIAL_FTDI
} else if (!strcmp(data->devname, "ftdi")) {
rc = dc_serial_ftdi_open(&serial_device, data->context);

View file

@ -115,8 +115,12 @@ void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemMod
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
config(0),
#ifdef BT_SUPPORT
deviceDetails(0),
btDeviceSelectionDialog(0)
#else
deviceDetails(0)
#endif
{
ui.setupUi(this);
@ -134,7 +138,7 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
connect(ui.logToFile, SIGNAL(stateChanged(int)), this, SLOT(checkLogFile(int)));
connect(ui.connectButton, SIGNAL(clicked()), this, SLOT(dc_open()));
connect(ui.disconnectButton, SIGNAL(clicked()), this, SLOT(dc_close()));
#if BT_SUPPORT
#ifdef BT_SUPPORT
connect(ui.bluetoothMode, SIGNAL(clicked(bool)), this, SLOT(selectRemoteBluetoothDevice()));
#else
ui.bluetoothMode->setVisible(false);

View file

@ -8,7 +8,9 @@
#include "configuredivecomputer.h"
#include <QStyledItemDelegate>
#include <QNetworkAccessManager>
#ifdef BT_SUPPORT
#include "btdeviceselectiondialog.h"
#endif
class GasSpinBoxItemDelegate : public QStyledItemDelegate {
Q_OBJECT
@ -85,7 +87,7 @@ slots:
void dc_open();
void dc_close();
#if BT_SUPPORT
#ifdef BT_SUPPORT
void bluetoothSelectionDialogIsFinished(int result);
void selectRemoteBluetoothDevice();
#endif
@ -119,7 +121,9 @@ private:
QString selected_product;
bool fw_upgrade_possible;
#ifdef BT_SUPPORT
BtDeviceSelectionDialog *btDeviceSelectionDialog;
#endif
};
class OstcFirmwareCheck : QObject {