diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-07-25 18:43:55 -0700 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-07-26 16:32:51 +0300 |
commit | c7f0e65b12ec99804db60ea9c2439a0a6ade4367 (patch) | |
tree | db9cb2b810924011aba3886dafa37ae2f8bf6082 /core | |
parent | 0e6c3db24c77331f52d17fd22494565dbafc6f84 (diff) | |
download | subsurface-c7f0e65b12ec99804db60ea9c2439a0a6ade4367.tar.gz |
Whitespace cleanup core divecomputer handling
Not entirely script based because of two odd issues where the script creates
bogus indentation.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/divecomputer.cpp | 21 | ||||
-rw-r--r-- | core/downloadfromdcthread.cpp | 18 |
2 files changed, 19 insertions, 20 deletions
diff --git a/core/divecomputer.cpp b/core/divecomputer.cpp index 5a6353f1f..978074e62 100644 --- a/core/divecomputer.cpp +++ b/core/divecomputer.cpp @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 #include "divecomputer.h" #include "dive.h" -#include "subsurface-string.h" #include "subsurface-qt/SettingsObjectWrapper.h" +#include "subsurface-string.h" DiveComputerList dcList; @@ -38,13 +38,13 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const const DiveComputerNode *DiveComputerList::getExact(const QString &m, uint32_t d) { - auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, d , {}, {}, {} } ); + auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, d, {}, {}, {}}); return it != dcs.end() && it->model == m && it->deviceId == d ? &*it : NULL; } const DiveComputerNode *DiveComputerList::get(const QString &m) { - auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, 0 , {}, {}, {} } ); + auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, 0, {}, {}, {}}); return it != dcs.end() && it->model == m ? &*it : NULL; } @@ -62,7 +62,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin { if (m.isEmpty() || d == 0) return; - auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, d , {}, {}, {} } ); + auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, d, {}, {}, {}}); if (it != dcs.end() && it->model == m && it->deviceId == d) { // debugging: show changes if (verbose) @@ -75,7 +75,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin if (!f.isEmpty()) it->firmware = f; } else { - dcs.insert(it, DiveComputerNode { m, d, s, f, n }); + dcs.insert(it, DiveComputerNode{m, d, s, f, n}); } } @@ -89,13 +89,12 @@ static bool compareDCById(const DiveComputerNode &a, const DiveComputerNode &b) return a.deviceId < b.deviceId; } -extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t, - const char *, const char *, const char *), - bool select_only) +extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t, const char *, const char *, const char *), + bool select_only) { QVector<DiveComputerNode> values = dcList.dcs; std::sort(values.begin(), values.end(), compareDCById); - for (const DiveComputerNode &node: values) { + for (const DiveComputerNode &node : values) { bool found = false; if (select_only) { int j; @@ -104,7 +103,7 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char * struct divecomputer *dc; if (!d->selected) continue; - for_each_dc(d, dc) { + for_each_dc (d, dc) { if (dc->deviceid == node.deviceId) { found = true; break; @@ -117,7 +116,7 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char * found = true; } if (found) - callback(f, qPrintable(node.model), node.deviceId, qPrintable(node.nickName), + callback(f, qPrintable(node.model), node.deviceId, qPrintable(node.nickName), qPrintable(node.serialNumber), qPrintable(node.firmware)); } } diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index 17bcb9647..250405f2f 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -7,7 +7,7 @@ QStringList vendorList; QHash<QString, QStringList> productList; -static QHash<QString, QStringList> mobileProductList; // BT, BLE or FTDI supported DCs for mobile +static QHash<QString, QStringList> mobileProductList; // BT, BLE or FTDI supported DCs for mobile QMap<QString, dc_descriptor_t *> descriptorLookup; ConnectionListModel connectionListModel; @@ -30,7 +30,7 @@ void DownloadThread::run() { auto internalData = m_data->internalData(); internalData->descriptor = descriptorLookup[m_data->vendor() + m_data->product()]; - internalData->download_table = &downloadTable; + internalData->download_table = &downloadTable; #if defined(Q_OS_ANDROID) // on Android we either use BT or we download via FTDI cable if (!internalData->bluetooth_mode) @@ -201,7 +201,7 @@ void show_computer_list() dc_descriptor_t *descriptor = descriptorLookup[vendor + product]; unsigned int transport = dc_descriptor_get_transports(descriptor) & transportMask; QString transportString = getTransportString(transport); - msg += product + " (" + transportString +"), "; + msg += product + " (" + transportString + "), "; } msg.chop(2); qDebug() << msg; @@ -265,7 +265,7 @@ int DCDeviceData::getMatchingAddress(const QString &vendor, const QString &produ return -1; } -DCDeviceData * DownloadThread::data() +DCDeviceData *DownloadThread::data() { return m_data; } @@ -320,17 +320,17 @@ int DCDeviceData::diveId() const return data.diveid; } -void DCDeviceData::setVendor(const QString& vendor) +void DCDeviceData::setVendor(const QString &vendor) { data.vendor = copy_qstring(vendor); } -void DCDeviceData::setProduct(const QString& product) +void DCDeviceData::setProduct(const QString &product) { data.product = copy_qstring(product); } -void DCDeviceData::setDevName(const QString& devName) +void DCDeviceData::setDevName(const QString &devName) { // This is a workaround for bug #1002. A string of the form "devicename (deviceaddress)" // or "deviceaddress (devicename)" may have found its way into the preferences. @@ -351,7 +351,7 @@ void DCDeviceData::setDevName(const QString& devName) data.devname = copy_qstring(devName); } -void DCDeviceData::setDevBluetoothName(const QString& name) +void DCDeviceData::setDevBluetoothName(const QString &name) { m_devBluetoothName = name; } @@ -402,7 +402,7 @@ bool DCDeviceData::saveLog() const } -device_data_t* DCDeviceData::internalData() +device_data_t *DCDeviceData::internalData() { return &data; } |