From 1f654050fa7e461166ee4d8b46d66b4ca91f31d4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 16 Jun 2018 14:06:35 +0200 Subject: Dive computers: turn QMultiMap into sorted vector The list of known dive computers was stored in a multi-map indexed by the device name. Turn this into a sorted QVector. Thus, no map-to-list conversion is needed in the device editing dialog, which distinctly simplifies the code. Signed-off-by: Berthold Stoeger --- desktop-widgets/divecomputermanagementdialog.cpp | 4 +--- desktop-widgets/mainwindow.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/divecomputermanagementdialog.cpp b/desktop-widgets/divecomputermanagementdialog.cpp index 179a69cfb..f060e3715 100644 --- a/desktop-widgets/divecomputermanagementdialog.cpp +++ b/desktop-widgets/divecomputermanagementdialog.cpp @@ -19,8 +19,7 @@ DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt:: void DiveComputerManagementDialog::init() { - model.reset(new DiveComputerModel(dcList.dcMap)); - model->update(); + model.reset(new DiveComputerModel); ui.tableView->setModel(model.data()); ui.tableView->resizeColumnsToContents(); ui.tableView->setColumnWidth(DiveComputerModel::REMOVE, 22); @@ -57,7 +56,6 @@ void DiveComputerManagementDialog::accept() void DiveComputerManagementDialog::reject() { - model->dropWorkingList(); hide(); close(); } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1e7b28ab0..95efcca63 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -770,7 +770,7 @@ void MainWindow::closeCurrentFile() clear_events(); - dcList.dcMap.clear(); + dcList.dcs.clear(); } void MainWindow::updateCloudOnlineStatus() -- cgit v1.2.3-70-g09d2