mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:06:15 +00:00
Only enable Bluetooth support if building against Qt5.4 or newer
Also remove the quick hack from commit 947fda14c5
("Bluetooth support:
quick build fix for Qt5.2"). I should have thought this through before
pushing that commit, but oh well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
947fda14c5
commit
43798702ff
4 changed files with 34 additions and 6 deletions
|
@ -19,6 +19,7 @@ option(USE_LIBGIT23_API "allow building with libgit2 master" OFF)
|
||||||
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
option(FORCE_LIBSSH "force linking with libssh to workaround libgit2 bug" ON)
|
||||||
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
|
option(SUBSURFACE_MOBILE "build the QtQuick version for mobile device" OFF)
|
||||||
option(FBSUPPORT "allow posting to Facebook" ON)
|
option(FBSUPPORT "allow posting to Facebook" ON)
|
||||||
|
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH
|
||||||
${CMAKE_MODULE_PATH}
|
${CMAKE_MODULE_PATH}
|
||||||
|
@ -177,6 +178,11 @@ find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PK
|
||||||
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} Qt5::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)
|
||||||
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
|
||||||
|
|
||||||
|
if ("${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")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Generate the ssrf-config.h every 'make'
|
# Generate the ssrf-config.h every 'make'
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
|
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
|
||||||
"#define VERSION_STRING \"@VERSION_STRING@\"
|
"#define VERSION_STRING \"@VERSION_STRING@\"
|
||||||
|
@ -331,6 +337,11 @@ if(FBSUPPORT)
|
||||||
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
|
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BTSUPPORT)
|
||||||
|
add_definitions(-DBT_SUPPORT)
|
||||||
|
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
# the data models that will interface
|
# the data models that will interface
|
||||||
# with the views.
|
# with the views.
|
||||||
set(SUBSURFACE_MODELS_LIB_SRCS
|
set(SUBSURFACE_MODELS_LIB_SRCS
|
||||||
|
@ -360,7 +371,6 @@ source_group("Subsurface Models" FILES ${SUBSURFACE_MODELS})
|
||||||
set(SUBSURFACE_INTERFACE
|
set(SUBSURFACE_INTERFACE
|
||||||
qt-ui/updatemanager.cpp
|
qt-ui/updatemanager.cpp
|
||||||
qt-ui/about.cpp
|
qt-ui/about.cpp
|
||||||
qt-ui/btdeviceselectiondialog.cpp
|
|
||||||
qt-ui/divecomputermanagementdialog.cpp
|
qt-ui/divecomputermanagementdialog.cpp
|
||||||
qt-ui/divelistview.cpp
|
qt-ui/divelistview.cpp
|
||||||
qt-ui/diveplanner.cpp
|
qt-ui/diveplanner.cpp
|
||||||
|
@ -392,6 +402,7 @@ set(SUBSURFACE_INTERFACE
|
||||||
qt-ui/qtwaitingspinner.cpp
|
qt-ui/qtwaitingspinner.cpp
|
||||||
${SUBSURFACE_PRINTING_SRCS}
|
${SUBSURFACE_PRINTING_SRCS}
|
||||||
${SOCIALNETWORKS}
|
${SOCIALNETWORKS}
|
||||||
|
${BT_SRC_FILES}
|
||||||
)
|
)
|
||||||
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
|
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,6 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
|
||||||
// Intialize the discovery agent
|
// Intialize the discovery agent
|
||||||
remoteDeviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(localDevice->address());
|
remoteDeviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(localDevice->address());
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050300
|
|
||||||
// Test if the discovery agent was successfully created
|
// Test if the discovery agent was successfully created
|
||||||
if (remoteDeviceDiscoveryAgent->error() == QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError) {
|
if (remoteDeviceDiscoveryAgent->error() == QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError) {
|
||||||
ui->dialogStatus->setText(QString("The device discovery agent was not created because the %1 address does not "
|
ui->dialogStatus->setText(QString("The device discovery agent was not created because the %1 address does not "
|
||||||
|
@ -372,7 +371,6 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
|
||||||
ui->clear->setEnabled(false);
|
ui->clear->setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(remoteDeviceDiscoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
|
connect(remoteDeviceDiscoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
|
||||||
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
|
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
|
||||||
|
|
|
@ -100,10 +100,15 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) :
|
||||||
ui.downloadCancelRetryButton->setEnabled(true);
|
ui.downloadCancelRetryButton->setEnabled(true);
|
||||||
ui.downloadCancelRetryButton->setText(tr("Download"));
|
ui.downloadCancelRetryButton->setText(tr("Download"));
|
||||||
|
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
btDeviceSelectionDialog = 0;
|
btDeviceSelectionDialog = 0;
|
||||||
ui.chooseBluetoothDevice->setEnabled(ui.bluetoothMode->isChecked());
|
ui.chooseBluetoothDevice->setEnabled(ui.bluetoothMode->isChecked());
|
||||||
connect(ui.bluetoothMode, SIGNAL(stateChanged(int)), this, SLOT(enableBluetoothMode(int)));
|
connect(ui.bluetoothMode, SIGNAL(stateChanged(int)), this, SLOT(enableBluetoothMode(int)));
|
||||||
connect(ui.chooseBluetoothDevice, SIGNAL(clicked()), this, SLOT(selectRemoteBluetoothDevice()));
|
connect(ui.chooseBluetoothDevice, SIGNAL(clicked()), this, SLOT(selectRemoteBluetoothDevice()));
|
||||||
|
#else
|
||||||
|
ui.bluetoothMode->hide();
|
||||||
|
ui.chooseBluetoothDevice->hide();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadFromDCWidget::updateProgressBar()
|
void DownloadFromDCWidget::updateProgressBar()
|
||||||
|
@ -313,11 +318,15 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
|
||||||
|
|
||||||
data.vendor = strdup(ui.vendor->currentText().toUtf8().data());
|
data.vendor = strdup(ui.vendor->currentText().toUtf8().data());
|
||||||
data.product = strdup(ui.product->currentText().toUtf8().data());
|
data.product = strdup(ui.product->currentText().toUtf8().data());
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
data.bluetooth_mode = ui.bluetoothMode->isChecked();
|
data.bluetooth_mode = ui.bluetoothMode->isChecked();
|
||||||
if (data.bluetooth_mode) {
|
if (data.bluetooth_mode) {
|
||||||
// Get the selected device address
|
// Get the selected device address
|
||||||
data.devname = strdup(btDeviceSelectionDialog->getSelectedDeviceAddress().toUtf8().data());
|
data.devname = strdup(btDeviceSelectionDialog->getSelectedDeviceAddress().toUtf8().data());
|
||||||
} else if (same_string(data.vendor, "Uemis")) {
|
} else
|
||||||
|
// this breaks an "else if" across lines... not happy...
|
||||||
|
#endif
|
||||||
|
if (same_string(data.vendor, "Uemis")) {
|
||||||
char *colon;
|
char *colon;
|
||||||
char *devname = strdup(ui.device->currentText().toUtf8().data());
|
char *devname = strdup(ui.device->currentText().toUtf8().data());
|
||||||
|
|
||||||
|
@ -523,10 +532,13 @@ void DownloadFromDCWidget::markChildrenAsEnabled()
|
||||||
ui.chooseDumpFile->setEnabled(true);
|
ui.chooseDumpFile->setEnabled(true);
|
||||||
ui.selectAllButton->setEnabled(true);
|
ui.selectAllButton->setEnabled(true);
|
||||||
ui.unselectAllButton->setEnabled(true);
|
ui.unselectAllButton->setEnabled(true);
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
ui.bluetoothMode->setEnabled(true);
|
ui.bluetoothMode->setEnabled(true);
|
||||||
ui.chooseBluetoothDevice->setEnabled(true);
|
ui.chooseBluetoothDevice->setEnabled(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
void DownloadFromDCWidget::selectRemoteBluetoothDevice()
|
void DownloadFromDCWidget::selectRemoteBluetoothDevice()
|
||||||
{
|
{
|
||||||
if (!btDeviceSelectionDialog) {
|
if (!btDeviceSelectionDialog) {
|
||||||
|
@ -555,6 +567,7 @@ void DownloadFromDCWidget::enableBluetoothMode(int state)
|
||||||
if (state == Qt::Checked)
|
if (state == Qt::Checked)
|
||||||
selectRemoteBluetoothDevice();
|
selectRemoteBluetoothDevice();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void fillDeviceList(const char *name, void *data)
|
static void fillDeviceList(const char *name, void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,10 @@
|
||||||
#include "libdivecomputer.h"
|
#include "libdivecomputer.h"
|
||||||
#include "configuredivecomputerdialog.h"
|
#include "configuredivecomputerdialog.h"
|
||||||
#include "ui_downloadfromdivecomputer.h"
|
#include "ui_downloadfromdivecomputer.h"
|
||||||
|
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
#include "btdeviceselectiondialog.h"
|
#include "btdeviceselectiondialog.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QStringListModel;
|
class QStringListModel;
|
||||||
|
|
||||||
|
@ -78,12 +81,13 @@ slots:
|
||||||
void updateProgressBar();
|
void updateProgressBar();
|
||||||
void checkLogFile(int state);
|
void checkLogFile(int state);
|
||||||
void checkDumpFile(int state);
|
void checkDumpFile(int state);
|
||||||
void enableBluetoothMode(int state);
|
|
||||||
void pickDumpFile();
|
void pickDumpFile();
|
||||||
void pickLogFile();
|
void pickLogFile();
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
|
void enableBluetoothMode(int state);
|
||||||
void selectRemoteBluetoothDevice();
|
void selectRemoteBluetoothDevice();
|
||||||
void bluetoothSelectionDialogIsFinished(int result);
|
void bluetoothSelectionDialogIsFinished(int result);
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
void markChildrenAsDisabled();
|
void markChildrenAsDisabled();
|
||||||
void markChildrenAsEnabled();
|
void markChildrenAsEnabled();
|
||||||
|
@ -108,7 +112,9 @@ private:
|
||||||
bool dumpWarningShown;
|
bool dumpWarningShown;
|
||||||
OstcFirmwareCheck *ostcFirmwareCheck;
|
OstcFirmwareCheck *ostcFirmwareCheck;
|
||||||
DiveImportedModel *diveImportedModel;
|
DiveImportedModel *diveImportedModel;
|
||||||
|
#if defined(BT_SUPPORT)
|
||||||
BtDeviceSelectionDialog *btDeviceSelectionDialog;
|
BtDeviceSelectionDialog *btDeviceSelectionDialog;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool preferDownloaded();
|
bool preferDownloaded();
|
||||||
|
|
Loading…
Add table
Reference in a new issue