aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-03 23:31:46 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commit1971cfad547792ba961f804605ccb12780e17de0 (patch)
tree54819d974f20b13721afddba3c87b835bed8814f /desktop-widgets
parent9a4718b46f5fa74c7c67a92d0c09ab805f364e12 (diff)
downloadsubsurface-1971cfad547792ba961f804605ccb12780e17de0.tar.gz
undo: implement set point change undo command
This is a simple copy of the other add-event commands. It could be made more friendly by stating the pO2 value in the text. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/simplewidgets.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index c31c93676..423f4b68f 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -23,7 +23,6 @@
#include "commands/command.h"
#include "core/metadata.h"
#include "core/tag.h"
-#include "core/divelist.h" // for mark_divelist_changed
double MinMaxAvgWidget::average() const
{
@@ -176,13 +175,8 @@ RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly(
void SetpointDialog::buttonClicked(QAbstractButton *button)
{
- 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);
- }
- mark_divelist_changed(true);
- MainWindow::instance()->graphics->replot();
+ if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
+ Command::addEventSetpointChange(d, dcNr, time, pressure_t { (int)(1000.0 * ui.spinbox->value()) });
}
SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDialog(MainWindow::instance()),