mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: switch SetpointDialog from divecomputer to dive + dc-number
Since pointers to divecomputers may not be stable, the undo commands take a dive + a divecomputer number. Update the SetpointDialog accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
adb53f9c18
commit
9a4718b46f
3 changed files with 8 additions and 7 deletions
|
@ -176,8 +176,8 @@ RenumberDialog::RenumberDialog(QWidget *parent) : QDialog(parent), selectedOnly(
|
||||||
|
|
||||||
void SetpointDialog::buttonClicked(QAbstractButton *button)
|
void SetpointDialog::buttonClicked(QAbstractButton *button)
|
||||||
{
|
{
|
||||||
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole && dc) {
|
if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
|
||||||
add_event(dc, time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()),
|
add_event(get_dive_dc(d, dcNr), time, SAMPLE_EVENT_PO2, 0, (int)(1000.0 * ui.spinbox->value()),
|
||||||
QT_TRANSLATE_NOOP("gettextFromC", "SP change"));
|
QT_TRANSLATE_NOOP("gettextFromC", "SP change"));
|
||||||
invalidate_dive_cache(current_dive);
|
invalidate_dive_cache(current_dive);
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,8 @@ void SetpointDialog::buttonClicked(QAbstractButton *button)
|
||||||
MainWindow::instance()->graphics->replot();
|
MainWindow::instance()->graphics->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetpointDialog::SetpointDialog(struct divecomputer *dcIn, int seconds) : QDialog(MainWindow::instance()),
|
SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDialog(MainWindow::instance()),
|
||||||
dc(dcIn), time(seconds < 0 ? 0 : seconds)
|
d(dIn), dcNr(dcNrIn), time(seconds < 0 ? 0 : seconds)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked);
|
connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked);
|
||||||
|
|
|
@ -65,14 +65,15 @@ private:
|
||||||
class SetpointDialog : public QDialog {
|
class SetpointDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SetpointDialog(struct divecomputer *divecomputer, int time);
|
SetpointDialog(struct dive *d, int dcNr, int time);
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void buttonClicked(QAbstractButton *button);
|
void buttonClicked(QAbstractButton *button);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SetpointDialog ui;
|
Ui::SetpointDialog ui;
|
||||||
struct divecomputer *dc;
|
struct dive *d;
|
||||||
|
int dcNr;
|
||||||
int time;
|
int time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1611,7 +1611,7 @@ void ProfileWidget2::addDivemodeSwitch(int seconds, int divemode)
|
||||||
|
|
||||||
void ProfileWidget2::addSetpointChange(int seconds)
|
void ProfileWidget2::addSetpointChange(int seconds)
|
||||||
{
|
{
|
||||||
SetpointDialog dialog(current_dc, seconds);
|
SetpointDialog dialog(current_dive, dc_number, seconds);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue