summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2017-06-15 14:50:49 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-21 18:43:15 -0700
commit2fa7e86708860e31d9011364df00e0c92f487241 (patch)
tree30ecf8679f47e69d3455f454b0f66aef9c40b2df /desktop-widgets
parent996fda1fa1cfad097f7487b86b1c176b79db45db (diff)
downloadsubsurface-2fa7e86708860e31d9011364df00e0c92f487241.tar.gz
Remove old duplicated code
Way back in time this code was copied from downloadfromdcthread, so de-duplicate and call that code instead. Signed-off-by: Anton Lundin <glance@acc.umu.se>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/configuredivecomputerdialog.cpp48
-rw-r--r--desktop-widgets/configuredivecomputerdialog.h5
2 files changed, 2 insertions, 51 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp
index 2afdf38ce..1dfa27bb9 100644
--- a/desktop-widgets/configuredivecomputerdialog.cpp
+++ b/desktop-widgets/configuredivecomputerdialog.cpp
@@ -5,6 +5,8 @@
#include "desktop-widgets/mainwindow.h"
#include "core/display.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
+// For fill_computer_list, descriptorLookup
+#include "core/downloadfromdcthread.h"
#include <QFileDialog>
#include <QMessageBox>
@@ -12,13 +14,6 @@
#include <QNetworkReply>
#include <QProgressDialog>
-struct mydescriptor {
- const char *vendor;
- const char *product;
- dc_family_t type;
- unsigned int model;
-};
-
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type)
{
}
@@ -417,45 +412,6 @@ void ConfigureDiveComputerDialog::fill_device_list(int dc_type)
ui.device->setCurrentIndex(deviceIndex);
}
-void ConfigureDiveComputerDialog::fill_computer_list()
-{
- dc_iterator_t *iterator = NULL;
- dc_descriptor_t *descriptor = NULL;
-
- struct mydescriptor *mydescriptor;
-
- dc_descriptor_iterator(&iterator);
- while (dc_iterator_next(iterator, &descriptor) == DC_STATUS_SUCCESS) {
- const char *vendor = dc_descriptor_get_vendor(descriptor);
- const char *product = dc_descriptor_get_product(descriptor);
-
- if (!vendorList.contains(vendor))
- vendorList.append(vendor);
-
- if (!productList[vendor].contains(product))
- productList[vendor].push_back(product);
-
- descriptorLookup[QString(vendor) + QString(product)] = descriptor;
- }
- dc_iterator_free(iterator);
-
- mydescriptor = (struct mydescriptor *)malloc(sizeof(struct mydescriptor));
- mydescriptor->vendor = "Uemis";
- mydescriptor->product = "Zurich";
- mydescriptor->type = DC_FAMILY_NULL;
- mydescriptor->model = 0;
-
- if (!vendorList.contains("Uemis"))
- vendorList.append("Uemis");
-
- if (!productList["Uemis"].contains("Zurich"))
- productList["Uemis"].push_back("Zurich");
-
- descriptorLookup["UemisZurich"] = (dc_descriptor_t *)mydescriptor;
-
- qSort(vendorList);
-}
-
void ConfigureDiveComputerDialog::populateDeviceDetails()
{
switch (ui.dcStackedWidget->currentIndex()) {
diff --git a/desktop-widgets/configuredivecomputerdialog.h b/desktop-widgets/configuredivecomputerdialog.h
index d111b39a6..5451b9b9a 100644
--- a/desktop-widgets/configuredivecomputerdialog.h
+++ b/desktop-widgets/configuredivecomputerdialog.h
@@ -98,16 +98,11 @@ private:
QString logFile;
- QStringList vendorList;
- QHash<QString, QStringList> productList;
-
ConfigureDiveComputer *config;
device_data_t device_data;
void getDeviceData();
- QHash<QString, dc_descriptor_t *> descriptorLookup;
void fill_device_list(int dc_type);
- void fill_computer_list();
DeviceDetails *deviceDetails;
void populateDeviceDetails();