summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-04 21:44:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-06 10:38:45 -0700
commit6e6705fb6ec325f2ea8f22a9349079d57bc668fa (patch)
treef409a47fb791ce457b4a28110a94986960150f54 /desktop-widgets
parent8af40025b02152586aeaeeba166ff9e597a2702d (diff)
downloadsubsurface-6e6705fb6ec325f2ea8f22a9349079d57bc668fa.tar.gz
cleanup: use safe connect() in ConfigureDiveComputerDialog
The pointer-to-member-function version is compile-time checked and therefore less risky with respect to refactoring. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/configuredivecomputerdialog.cpp37
-rw-r--r--desktop-widgets/configuredivecomputerdialog.h2
2 files changed, 19 insertions, 20 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp
index d7d6fb8ba..6434f8c05 100644
--- a/desktop-widgets/configuredivecomputerdialog.cpp
+++ b/desktop-widgets/configuredivecomputerdialog.cpp
@@ -111,21 +111,20 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
deviceDetails = new DeviceDetails(this);
config = new ConfigureDiveComputer();
- connect(config, SIGNAL(progress(int)), ui.progressBar, SLOT(setValue(int)));
- connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
- connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
- connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails *)),
- this, SLOT(deviceDetailsReceived(DeviceDetails *)));
- connect(ui.retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
- connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
- connect(ui.resetButton_4, SIGNAL(clicked()), this, SLOT(resetSettings()));
+ connect(config, &ConfigureDiveComputer::progress, ui.progressBar, &QProgressBar::setValue);
+ connect(config, &ConfigureDiveComputer::error, this, &ConfigureDiveComputerDialog::configError);
+ connect(config, &ConfigureDiveComputer::message, this, &ConfigureDiveComputerDialog::configMessage);
+ connect(config, &ConfigureDiveComputer::deviceDetailsChanged, this, &ConfigureDiveComputerDialog::deviceDetailsReceived);
+ connect(ui.retrieveDetails, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::readSettings);
+ connect(ui.resetButton, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::resetSettings);
+ connect(ui.resetButton_4, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::resetSettings);
ui.chooseLogFile->setEnabled(ui.logToFile->isChecked());
- connect(ui.chooseLogFile, SIGNAL(clicked()), this, SLOT(pickLogFile()));
- 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()));
+ connect(ui.chooseLogFile, &QToolButton::clicked, this, &ConfigureDiveComputerDialog::pickLogFile);
+ connect(ui.logToFile, &QCheckBox::stateChanged, this, &ConfigureDiveComputerDialog::checkLogFile);
+ connect(ui.connectButton, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::dc_open);
+ connect(ui.disconnectButton, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::dc_close);
#ifdef BT_SUPPORT
- connect(ui.bluetoothMode, SIGNAL(clicked(bool)), this, SLOT(selectRemoteBluetoothDevice()));
+ connect(ui.bluetoothMode, &QPushButton::clicked, this, &ConfigureDiveComputerDialog::selectRemoteBluetoothDevice);
#else
ui.bluetoothMode->setVisible(false);
#endif
@@ -248,7 +247,7 @@ OstcFirmwareCheck::OstcFirmwareCheck(QString product) : parent(0)
} else { // not one of the known dive computers
return;
}
- connect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(parseOstcFwVersion(QNetworkReply *)));
+ connect(&manager, &QNetworkAccessManager::finished, this, &OstcFirmwareCheck::parseOstcFwVersion);
QNetworkRequest download(url);
manager.get(download);
}
@@ -259,7 +258,7 @@ void OstcFirmwareCheck::parseOstcFwVersion(QNetworkReply *reply)
int firstOpenBracket = parse.indexOf('[');
int firstCloseBracket = parse.indexOf(']');
latestFirmwareAvailable = parse.mid(firstOpenBracket + 1, firstCloseBracket - firstOpenBracket - 1);
- disconnect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(parseOstcFwVersion(QNetworkReply *)));
+ disconnect(&manager, &QNetworkAccessManager::finished, this, &OstcFirmwareCheck::parseOstcFwVersion);
}
void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
@@ -325,7 +324,7 @@ void OstcFirmwareCheck::upgradeFirmware()
if (storeFirmware.isEmpty())
return;
- connect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(saveOstcFirmware(QNetworkReply *)));
+ connect(&manager, &QNetworkAccessManager::finished, this, &OstcFirmwareCheck::saveOstcFirmware);
QNetworkRequest download(latestFirmwareHexFile);
manager.get(download);
}
@@ -344,9 +343,9 @@ void OstcFirmwareCheck::saveOstcFirmware(QNetworkReply *reply)
dialog->setCancelButton(0);
dialog->setAutoClose(true);
ConfigureDiveComputer *config = new ConfigureDiveComputer();
- connect(config, SIGNAL(message(QString)), dialog, SLOT(setLabelText(QString)));
- connect(config, SIGNAL(error(QString)), dialog, SLOT(setLabelText(QString)));
- connect(config, SIGNAL(progress(int)), dialog, SLOT(setValue(int)));
+ connect(config, &ConfigureDiveComputer::message, dialog, &QProgressDialog::setLabelText);
+ connect(config, &ConfigureDiveComputer::error, dialog, &QProgressDialog::setLabelText);
+ connect(config, &ConfigureDiveComputer::progress, dialog, &QProgressDialog::setValue);
config->dc_open(&devData);
config->startFirmwareUpdate(storeFirmware, &devData);
}
diff --git a/desktop-widgets/configuredivecomputerdialog.h b/desktop-widgets/configuredivecomputerdialog.h
index fe617b0ba..6411b42d0 100644
--- a/desktop-widgets/configuredivecomputerdialog.h
+++ b/desktop-widgets/configuredivecomputerdialog.h
@@ -124,7 +124,7 @@ private:
#endif
};
-class OstcFirmwareCheck : QObject {
+class OstcFirmwareCheck : public QObject {
Q_OBJECT
public:
explicit OstcFirmwareCheck(QString product);