mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
Whitespace cleanup desktop-widget
Not entirely script based because of the broken 'else if'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
00c0f94d8c
commit
0e6c3db24c
2 changed files with 24 additions and 23 deletions
|
@ -1,18 +1,18 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "desktop-widgets/configuredivecomputerdialog.h"
|
#include "desktop-widgets/configuredivecomputerdialog.h"
|
||||||
|
|
||||||
#include "core/qthelper.h"
|
|
||||||
#include "desktop-widgets/mainwindow.h"
|
|
||||||
#include "core/display.h"
|
#include "core/display.h"
|
||||||
|
#include "core/qthelper.h"
|
||||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||||
|
#include "desktop-widgets/mainwindow.h"
|
||||||
// For fill_computer_list, descriptorLookup
|
// For fill_computer_list, descriptorLookup
|
||||||
#include "core/downloadfromdcthread.h"
|
#include "core/downloadfromdcthread.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type)
|
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ GasSpinBoxItemDelegate::~GasSpinBoxItemDelegate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
|
QWidget *GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
|
||||||
{
|
{
|
||||||
// Create the spinbox and give it it's settings
|
// Create the spinbox and give it it's settings
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
QSpinBox *sb = new QSpinBox(parent);
|
||||||
|
@ -65,7 +65,7 @@ GasTypeComboBoxItemDelegate::~GasTypeComboBoxItemDelegate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
|
QWidget *GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
|
||||||
{
|
{
|
||||||
// Create the combobox and populate it
|
// Create the combobox and populate it
|
||||||
QComboBox *cb = new QComboBox(parent);
|
QComboBox *cb = new QComboBox(parent);
|
||||||
|
@ -287,7 +287,7 @@ void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
||||||
Y = (firmwareOnDevice & 0x07C0) >> 6;
|
Y = (firmwareOnDevice & 0x07C0) >> 6;
|
||||||
Z = (firmwareOnDevice & 0x003E) >> 1;
|
Z = (firmwareOnDevice & 0x003E) >> 1;
|
||||||
beta = firmwareOnDevice & 0x0001;
|
beta = firmwareOnDevice & 0x0001;
|
||||||
firmwareOnDeviceString = QString("%1.%2.%3%4").arg(X).arg(Y).arg(Z).arg(beta?" beta":"");
|
firmwareOnDeviceString = QString("%1.%2.%3%4").arg(X).arg(Y).arg(Z).arg(beta ? " beta" : "");
|
||||||
latestFirmwareAvailableNumber = (fwParts[0].toInt() << 11) + (fwParts[1].toInt() << 6) + (fwParts[2].toInt() << 1);
|
latestFirmwareAvailableNumber = (fwParts[0].toInt() << 11) + (fwParts[1].toInt() << 6) + (fwParts[2].toInt() << 1);
|
||||||
} else { // OSTC 3, Sport, Cr
|
} else { // OSTC 3, Sport, Cr
|
||||||
firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
|
firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
|
||||||
|
@ -358,7 +358,7 @@ ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
|
||||||
delete config;
|
delete config;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::closeEvent(QCloseEvent*)
|
void ConfigureDiveComputerDialog::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
dc_close();
|
dc_close();
|
||||||
|
|
||||||
|
@ -900,7 +900,8 @@ void ConfigureDiveComputerDialog::getDeviceData()
|
||||||
{
|
{
|
||||||
#ifdef BT_SUPPORT
|
#ifdef BT_SUPPORT
|
||||||
QString device = ui.bluetoothMode && btDeviceSelectionDialog ?
|
QString device = ui.bluetoothMode && btDeviceSelectionDialog ?
|
||||||
btDeviceSelectionDialog->getSelectedDeviceAddress() : ui.device->currentText();
|
btDeviceSelectionDialog->getSelectedDeviceAddress() :
|
||||||
|
ui.device->currentText();
|
||||||
#else
|
#else
|
||||||
QString device = ui.device->currentText();
|
QString device = ui.device->currentText();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "desktop-widgets/downloadfromdivecomputer.h"
|
#include "desktop-widgets/downloadfromdivecomputer.h"
|
||||||
#include "core/qthelper.h"
|
|
||||||
#include "desktop-widgets/mainwindow.h"
|
|
||||||
#include "desktop-widgets/divelistview.h"
|
|
||||||
#include "core/display.h"
|
#include "core/display.h"
|
||||||
|
#include "core/qthelper.h"
|
||||||
|
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||||
#include "core/subsurface-string.h"
|
#include "core/subsurface-string.h"
|
||||||
#include "core/uemis.h"
|
#include "core/uemis.h"
|
||||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
#include "desktop-widgets/divelistview.h"
|
||||||
#include "qt-models/models.h"
|
#include "desktop-widgets/mainwindow.h"
|
||||||
#include "qt-models/diveimportedmodel.h"
|
#include "qt-models/diveimportedmodel.h"
|
||||||
|
#include "qt-models/models.h"
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f),
|
DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f),
|
||||||
downloading(false),
|
downloading(false),
|
||||||
|
@ -122,8 +122,8 @@ void DownloadFromDCWidget::updateProgressBar()
|
||||||
if (IS_FP_SAME(progress_bar_fraction, 0.0)) {
|
if (IS_FP_SAME(progress_bar_fraction, 0.0)) {
|
||||||
ui.progressBar->setFormat(tr("Connecting to dive computer"));
|
ui.progressBar->setFormat(tr("Connecting to dive computer"));
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
// on mac the progress bar doesn't show its text
|
// on mac the progress bar doesn't show its text
|
||||||
ui.progressText->setText(tr("Connecting to dive computer"));
|
ui.progressText->setText(tr("Connecting to dive computer"));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ui.progressBar->setFormat("%p%");
|
ui.progressBar->setFormat("%p%");
|
||||||
|
@ -241,7 +241,7 @@ void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor)
|
||||||
fill_device_list(dcType);
|
fill_device_list(dcType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadFromDCWidget::on_product_currentIndexChanged(const QString&)
|
void DownloadFromDCWidget::on_product_currentIndexChanged(const QString &)
|
||||||
{
|
{
|
||||||
updateDeviceEnabled();
|
updateDeviceEnabled();
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,8 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
|
||||||
//
|
//
|
||||||
// We shouldn't do this for memory dumps.
|
// We shouldn't do this for memory dumps.
|
||||||
if ((product == "OSTC 3" || product == "OSTC 3+" || product == "OSTC cR" ||
|
if ((product == "OSTC 3" || product == "OSTC 3+" || product == "OSTC cR" ||
|
||||||
product == "OSTC Sport" || product == "OSTC 4") && !data->saveDump()) {
|
product == "OSTC Sport" || product == "OSTC 4") &&
|
||||||
|
!data->saveDump()) {
|
||||||
ostcFirmwareCheck = new OstcFirmwareCheck(product);
|
ostcFirmwareCheck = new OstcFirmwareCheck(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +360,7 @@ void DownloadFromDCWidget::pickLogFile()
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
filename = fi.absolutePath().append(QDir::separator()).append("subsurface.log");
|
filename = fi.absolutePath().append(QDir::separator()).append("subsurface.log");
|
||||||
QString logFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer download logfile"),
|
QString logFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer download logfile"),
|
||||||
filename, tr("Log files") + " (*.log)");
|
filename, tr("Log files") + " (*.log)");
|
||||||
if (!logFile.isEmpty()) {
|
if (!logFile.isEmpty()) {
|
||||||
free(logfile_name);
|
free(logfile_name);
|
||||||
logfile_name = copy_qstring(logFile);
|
logfile_name = copy_qstring(logFile);
|
||||||
|
@ -385,7 +386,7 @@ void DownloadFromDCWidget::pickDumpFile()
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
filename = fi.absolutePath().append(QDir::separator()).append("subsurface.bin");
|
filename = fi.absolutePath().append(QDir::separator()).append("subsurface.bin");
|
||||||
QString dumpFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer binary dump file"),
|
QString dumpFile = QFileDialog::getSaveFileName(this, tr("Choose file for dive computer binary dump file"),
|
||||||
filename, tr("Dump files") + " (*.bin)");
|
filename, tr("Dump files") + " (*.bin)");
|
||||||
if (!dumpFile.isEmpty()) {
|
if (!dumpFile.isEmpty()) {
|
||||||
free(dumpfile_name);
|
free(dumpfile_name);
|
||||||
dumpfile_name = copy_qstring(dumpFile);
|
dumpfile_name = copy_qstring(dumpFile);
|
||||||
|
@ -437,7 +438,7 @@ void DownloadFromDCWidget::on_ok_clicked()
|
||||||
|
|
||||||
// record all the dives in the 'real' dive_table
|
// record all the dives in the 'real' dive_table
|
||||||
for (int i = 0; i < downloadTable.nr; i++) {
|
for (int i = 0; i < downloadTable.nr; i++) {
|
||||||
if (diveImportedModel->data(diveImportedModel->index(i, 0),Qt::CheckStateRole) == Qt::Checked)
|
if (diveImportedModel->data(diveImportedModel->index(i, 0), Qt::CheckStateRole) == Qt::Checked)
|
||||||
record_dive(downloadTable.dives[i]);
|
record_dive(downloadTable.dives[i]);
|
||||||
else
|
else
|
||||||
clear_dive(downloadTable.dives[i]);
|
clear_dive(downloadTable.dives[i]);
|
||||||
|
@ -546,7 +547,7 @@ void DownloadFromDCWidget::bluetoothSelectionDialogIsFinished(int result)
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
/* Make the selected Bluetooth device default */
|
/* Make the selected Bluetooth device default */
|
||||||
ui.device->setEditText(btDeviceSelectionDialog->getSelectedDeviceText());
|
ui.device->setEditText(btDeviceSelectionDialog->getSelectedDeviceText());
|
||||||
} else if (result == QDialog::Rejected){
|
} else if (result == QDialog::Rejected) {
|
||||||
/* Disable Bluetooth download mode */
|
/* Disable Bluetooth download mode */
|
||||||
ui.bluetoothMode->setChecked(false);
|
ui.bluetoothMode->setChecked(false);
|
||||||
}
|
}
|
||||||
|
@ -577,4 +578,3 @@ void DownloadFromDCWidget::fill_device_list(int dc_type)
|
||||||
if (deviceIndex >= 0)
|
if (deviceIndex >= 0)
|
||||||
ui.device->setCurrentIndex(deviceIndex);
|
ui.device->setCurrentIndex(deviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue