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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-06-15 23:51:28 +02:00 committed by Dirk Hohndel
parent f54764cdbc
commit b0cc416954
3 changed files with 4 additions and 10 deletions

View file

@ -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)

View file

@ -12,7 +12,6 @@ class DiveComputerManagementDialog : public QDialog {
public:
static DiveComputerManagementDialog *instance();
void update();
void init();
public

View file

@ -892,7 +892,6 @@ void MainWindow::on_actionDivelogs_de_triggered()
void MainWindow::on_actionEditDeviceNames_triggered()
{
DiveComputerManagementDialog::instance()->init();
DiveComputerManagementDialog::instance()->update();
DiveComputerManagementDialog::instance()->show();
}