diff options
author | 2013-06-18 00:33:03 -0700 | |
---|---|---|
committer | 2013-06-18 00:33:03 -0700 | |
commit | 0773172f66ef3cd73a88e3297c8b5ae28cfe2a8f (patch) | |
tree | f0afadcacdb22dfe4781cd9891a95c302edcfcb6 /qt-ui/divecomputermanagementdialog.cpp | |
parent | 87e380c7a28b467705b470323275db3812e0fa90 (diff) | |
parent | 29b242c70349cbd67aacc3e4f1206630d22c54eb (diff) | |
download | subsurface-0773172f66ef3cd73a88e3297c8b5ae28cfe2a8f.tar.gz |
Merge branch 'qtHelper'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divecomputermanagementdialog.cpp')
-rw-r--r-- | qt-ui/divecomputermanagementdialog.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/qt-ui/divecomputermanagementdialog.cpp b/qt-ui/divecomputermanagementdialog.cpp index 4d9770a4d..2a1bb8bff 100644 --- a/qt-ui/divecomputermanagementdialog.cpp +++ b/qt-ui/divecomputermanagementdialog.cpp @@ -3,16 +3,26 @@ #include "ui_divecomputermanagementdialog.h" #include "mainwindow.h" #include <QMessageBox> +#include "../qthelper.h" +#include "../helpers.h" -DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f) -, ui( new Ui::DiveComputerManagementDialog()) +DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f), + ui( new Ui::DiveComputerManagementDialog()), + model(0) { ui->setupUi(this); - model = new DiveComputerModel(); - ui->tableView->setModel(model); + init(); connect(ui->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex))); } +void DiveComputerManagementDialog::init() +{ + if (model) + delete model; + model = new DiveComputerModel(dcList.dcMap); + ui->tableView->setModel(model); +} + DiveComputerManagementDialog* DiveComputerManagementDialog::instance() { static DiveComputerManagementDialog *self = new DiveComputerManagementDialog(); @@ -44,3 +54,17 @@ void DiveComputerManagementDialog::tryRemove(const QModelIndex& index) model->remove(index); } } + +void DiveComputerManagementDialog::accept() +{ + model->keepWorkingList(); + hide(); + close(); +} + +void DiveComputerManagementDialog::reject() +{ + model->dropWorkingList(); + hide(); + close(); +} |