From b0cc4169549e34781e63b25a016b05f1334f33cd Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 15 Jun 2018 23:51:28 +0200 Subject: [PATCH] Cleanup: fold DiveComputerManagementDialog::update() into init() update() was only called in conjunction with init(). No point in having two functions. The separation between both functions seemed arbitrary anyway. Signed-off-by: Berthold Stoeger --- desktop-widgets/divecomputermanagementdialog.cpp | 12 ++++-------- desktop-widgets/divecomputermanagementdialog.h | 1 - desktop-widgets/mainwindow.cpp | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/desktop-widgets/divecomputermanagementdialog.cpp b/desktop-widgets/divecomputermanagementdialog.cpp index 0ff358c22..179a69cfb 100644 --- a/desktop-widgets/divecomputermanagementdialog.cpp +++ b/desktop-widgets/divecomputermanagementdialog.cpp @@ -20,7 +20,11 @@ DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt:: void DiveComputerManagementDialog::init() { model.reset(new DiveComputerModel(dcList.dcMap)); + model->update(); ui.tableView->setModel(model.data()); + ui.tableView->resizeColumnsToContents(); + ui.tableView->setColumnWidth(DiveComputerModel::REMOVE, 22); + layout()->activate(); } DiveComputerManagementDialog *DiveComputerManagementDialog::instance() @@ -29,14 +33,6 @@ DiveComputerManagementDialog *DiveComputerManagementDialog::instance() return self; } -void DiveComputerManagementDialog::update() -{ - model->update(); - ui.tableView->resizeColumnsToContents(); - ui.tableView->setColumnWidth(DiveComputerModel::REMOVE, 22); - layout()->activate(); -} - void DiveComputerManagementDialog::tryRemove(const QModelIndex &index) { if (index.column() != DiveComputerModel::REMOVE) diff --git a/desktop-widgets/divecomputermanagementdialog.h b/desktop-widgets/divecomputermanagementdialog.h index 365a685d4..806ec8073 100644 --- a/desktop-widgets/divecomputermanagementdialog.h +++ b/desktop-widgets/divecomputermanagementdialog.h @@ -12,7 +12,6 @@ class DiveComputerManagementDialog : public QDialog { public: static DiveComputerManagementDialog *instance(); - void update(); void init(); public diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 644c6bfe4..1e7b28ab0 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -892,7 +892,6 @@ void MainWindow::on_actionDivelogs_de_triggered() void MainWindow::on_actionEditDeviceNames_triggered() { DiveComputerManagementDialog::instance()->init(); - DiveComputerManagementDialog::instance()->update(); DiveComputerManagementDialog::instance()->show(); }