mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
undo: pass divecomputer number to EditProfile command
Don't access the global variable dc_number, which might not make sense on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
297befc6f8
commit
d057af43b4
5 changed files with 9 additions and 9 deletions
|
@ -277,9 +277,9 @@ void replanDive(dive *d)
|
|||
execute(new ReplanDive(d));
|
||||
}
|
||||
|
||||
void editProfile(const dive *d, EditProfileType type, int count)
|
||||
void editProfile(const dive *d, int dcNr, EditProfileType type, int count)
|
||||
{
|
||||
execute(new EditProfile(d, type, count));
|
||||
execute(new EditProfile(d, dcNr, type, count));
|
||||
}
|
||||
|
||||
int addWeight(bool currentDiveOnly)
|
||||
|
|
|
@ -102,7 +102,7 @@ enum class EditProfileType {
|
|||
MOVE,
|
||||
};
|
||||
void replanDive(dive *d); // dive computer(s) and cylinder(s) of first argument will be consumed!
|
||||
void editProfile(const dive *d, EditProfileType type, int count);
|
||||
void editProfile(const dive *d, int dcNr, EditProfileType type, int count);
|
||||
int addWeight(bool currentDiveOnly);
|
||||
int removeWeight(int index, bool currentDiveOnly);
|
||||
int editWeight(int index, weightsystem_t ws, bool currentDiveOnly);
|
||||
|
|
|
@ -882,8 +882,8 @@ QString editProfileTypeToString(EditProfileType type, int count)
|
|||
}
|
||||
}
|
||||
|
||||
EditProfile::EditProfile(const dive *source, EditProfileType type, int count) : d(current_dive),
|
||||
dcNr(dc_number),
|
||||
EditProfile::EditProfile(const dive *source, int dcNr, EditProfileType type, int count) : d(current_dive),
|
||||
dcNr(dcNr),
|
||||
maxdepth({0}),
|
||||
meandepth({0}),
|
||||
dcmaxdepth({0}),
|
||||
|
|
|
@ -352,7 +352,7 @@ class EditProfile : public Base {
|
|||
struct divecomputer dc;
|
||||
public:
|
||||
// Note: source must be clean (i.e. fixup_dive must have been called on it).
|
||||
EditProfile(const dive *source, EditProfileType type, int count);
|
||||
EditProfile(const dive *source, int dcNr, EditProfileType type, int count);
|
||||
~EditProfile();
|
||||
private:
|
||||
void undo() override;
|
||||
|
|
|
@ -297,7 +297,7 @@ void ProfileWidget::stopAdded()
|
|||
return;
|
||||
calcDepth(*editedDive, editedDc);
|
||||
Setter s(placingCommand, true);
|
||||
Command::editProfile(editedDive.get(), Command::EditProfileType::ADD, 0);
|
||||
Command::editProfile(editedDive.get(), editedDc, Command::EditProfileType::ADD, 0);
|
||||
}
|
||||
|
||||
void ProfileWidget::stopRemoved(int count)
|
||||
|
@ -306,7 +306,7 @@ void ProfileWidget::stopRemoved(int count)
|
|||
return;
|
||||
calcDepth(*editedDive, editedDc);
|
||||
Setter s(placingCommand, true);
|
||||
Command::editProfile(editedDive.get(), Command::EditProfileType::REMOVE, count);
|
||||
Command::editProfile(editedDive.get(), editedDc, Command::EditProfileType::REMOVE, count);
|
||||
}
|
||||
|
||||
void ProfileWidget::stopMoved(int count)
|
||||
|
@ -315,5 +315,5 @@ void ProfileWidget::stopMoved(int count)
|
|||
return;
|
||||
calcDepth(*editedDive, editedDc);
|
||||
Setter s(placingCommand, true);
|
||||
Command::editProfile(editedDive.get(), Command::EditProfileType::MOVE, count);
|
||||
Command::editProfile(editedDive.get(), editedDc, Command::EditProfileType::MOVE, count);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue