diff options
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 8 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.h | 5 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 4b85a8b50..c31c93676 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -176,8 +176,8 @@ RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly( void SetpointDialog::buttonClicked(QAbstractButton *button) { - if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole && dc) { - add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()), + if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { + add_event(get_dive_dc(d, dcNr), time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()), QT_TRANSLATE_NOOP("gettextFromC", "SP change")); invalidate_dive_cache(current_dive); } @@ -185,8 +185,8 @@ void SetpointDialog::buttonClicked(QAbstractButton *button) MainWindow::instance()->graphics->replot(); } -SetpointDialog::SetpointDialog(struct divecomputer *dcIn, int seconds) : QDialog(MainWindow::instance()), - dc(dcIn), time(seconds < 0 ? 0 : seconds) +SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDialog(MainWindow::instance()), + d(dIn), dcNr(dcNrIn), time(seconds < 0 ? 0 : seconds) { ui.setupUi(this); connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked); diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index e293f352c..421695815 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -65,14 +65,15 @@ private: class SetpointDialog : public QDialog { Q_OBJECT public: - SetpointDialog(struct divecomputer *divecomputer, int time); + SetpointDialog(struct dive *d, int dcNr, int time); private slots: void buttonClicked(QAbstractButton *button); private: Ui::SetpointDialog ui; - struct divecomputer *dc; + struct dive *d; + int dcNr; int time; }; diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 555305817..76b3c9afb 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1611,7 +1611,7 @@ void ProfileWidget2::addDivemodeSwitch(int seconds, int divemode) void ProfileWidget2::addSetpointChange(int seconds) { - SetpointDialog dialog(current_dc, seconds); + SetpointDialog dialog(current_dive, dc_number, seconds); dialog.exec(); } |