summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-09-12 22:37:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-12 14:02:32 -0700
commit547203693193ab1428cb7e1e8c4704d7e68ed3bd (patch)
treee86f27e9d0c8038c3d667d425dd6a3916fe3c44e /qt-ui/configuredivecomputerdialog.cpp
parenta42df06dbfc9d55d74ee416d14ab79a8606f34f7 (diff)
downloadsubsurface-547203693193ab1428cb7e1e8c4704d7e68ed3bd.tar.gz
Connect up custom serial in dc configuration
This connects up the custom serial code in the configure dive computer dialogs. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/configuredivecomputerdialog.cpp')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 537b23121..acebcfa33 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -115,7 +115,8 @@ void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemMod
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
config(0),
- deviceDetails(0)
+ deviceDetails(0),
+ btDeviceSelectionDialog(0)
{
ui.setupUi(this);
@@ -133,6 +134,11 @@ 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
+ connect(ui.bluetoothMode, SIGNAL(clicked(bool)), this, SLOT(selectRemoteBluetoothDevice()));
+#else
+ ui.bluetoothMode->setVisible(false);
+#endif
memset(&device_data, 0, sizeof(device_data));
fill_computer_list();
@@ -1173,6 +1179,30 @@ void ConfigureDiveComputerDialog::pickLogFile()
}
}
+#ifdef BT_SUPPORT
+void ConfigureDiveComputerDialog::selectRemoteBluetoothDevice()
+{
+ if (!btDeviceSelectionDialog) {
+ btDeviceSelectionDialog = new BtDeviceSelectionDialog(this);
+ connect(btDeviceSelectionDialog, SIGNAL(finished(int)),
+ this, SLOT(bluetoothSelectionDialogIsFinished(int)));
+ }
+
+ btDeviceSelectionDialog->show();
+}
+
+void ConfigureDiveComputerDialog::bluetoothSelectionDialogIsFinished(int result)
+{
+ if (result == QDialog::Accepted) {
+ ui.device->setCurrentText(btDeviceSelectionDialog->getSelectedDeviceAddress());
+ device_data.bluetooth_mode = true;
+
+ ui.progressBar->setFormat("Connecting to device...");
+ dc_open();
+ }
+}
+#endif
+
void ConfigureDiveComputerDialog::dc_open()
{
getDeviceData();
@@ -1188,6 +1218,7 @@ void ConfigureDiveComputerDialog::dc_open()
ui.disconnectButton->setEnabled(true);
ui.restoreBackupButton->setEnabled(true);
ui.connectButton->setEnabled(false);
+ ui.bluetoothMode->setEnabled(false);
ui.DiveComputerList->setEnabled(false);
ui.logToFile->setEnabled(false);
if (fw_upgrade_possible)
@@ -1204,6 +1235,7 @@ void ConfigureDiveComputerDialog::dc_close()
ui.updateFirmwareButton->setEnabled(false);
ui.disconnectButton->setEnabled(false);
ui.connectButton->setEnabled(true);
+ ui.bluetoothMode->setEnabled(true);
ui.backupButton->setEnabled(false);
ui.saveSettingsPushButton->setEnabled(false);
ui.restoreBackupButton->setEnabled(false);