From 5436f9b8590e6022ce2dabefb23ffb037020784a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 14 Feb 2019 23:07:12 +0100 Subject: Undo: move dive-list logic into edit commands The edit-commands were called with a list of selected dives and the original value. Move the creation of the list and extraction of the original value into the edit-commmands. This removes the "current is last" rule and allows for more flexibility. Since the depth- and duration editing applies only to the current dive and not all selected dives, add a parameter to the edit-commands controlling whether only the current or all selected dives are edited. Signed-off-by: Berthold Stoeger --- desktop-widgets/command.cpp | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'desktop-widgets/command.cpp') diff --git a/desktop-widgets/command.cpp b/desktop-widgets/command.cpp index 2f73477fe..0486b2bce 100644 --- a/desktop-widgets/command.cpp +++ b/desktop-widgets/command.cpp @@ -130,74 +130,74 @@ void purgeUnusedDiveSites() } // Dive editing related commands -void editNotes(const QVector dives, const QString &newValue, const QString &oldValue) +void editNotes(const QString &newValue, bool currentDiveOnly) { - execute(new EditNotes(dives, newValue, oldValue)); + execute(new EditNotes(newValue, currentDiveOnly)); } -void editMode(const QVector dives, int index, int newValue, int oldValue) +void editMode(int index, int newValue, bool currentDiveOnly) { - execute(new EditMode(dives, index, newValue, oldValue)); + execute(new EditMode(index, newValue, currentDiveOnly)); } -void editSuit(const QVector dives, const QString &newValue, const QString &oldValue) +void editSuit(const QString &newValue, bool currentDiveOnly) { - execute(new EditSuit(dives, newValue, oldValue)); + execute(new EditSuit(newValue, currentDiveOnly)); } -void editRating(const QVector dives, int newValue, int oldValue) +void editRating(int newValue, bool currentDiveOnly) { - execute(new EditRating(dives, newValue, oldValue)); + execute(new EditRating(newValue, currentDiveOnly)); } -void editVisibility(const QVector dives, int newValue, int oldValue) +void editVisibility(int newValue, bool currentDiveOnly) { - execute(new EditVisibility(dives, newValue, oldValue)); + execute(new EditVisibility(newValue, currentDiveOnly)); } -void editAirTemp(const QVector dives, int newValue, int oldValue) +void editAirTemp(int newValue, bool currentDiveOnly) { - execute(new EditAirTemp(dives, newValue, oldValue)); + execute(new EditAirTemp(newValue, currentDiveOnly)); } -void editWaterTemp(const QVector dives, int newValue, int oldValue) +void editWaterTemp(int newValue, bool currentDiveOnly) { - execute(new EditWaterTemp(dives, newValue, oldValue)); + execute(new EditWaterTemp(newValue, currentDiveOnly)); } -void editDepth(const QVector dives, int newValue, int oldValue) +void editDepth(int newValue, bool currentDiveOnly) { - execute(new EditDepth(dives, newValue, oldValue)); + execute(new EditDepth(newValue, currentDiveOnly)); } -void editDuration(const QVector dives, int newValue, int oldValue) +void editDuration(int newValue, bool currentDiveOnly) { - execute(new EditDuration(dives, newValue, oldValue)); + execute(new EditDuration(newValue, currentDiveOnly)); } -void editDiveSite(const QVector dives, struct dive_site *newValue, struct dive_site *oldValue) +void editDiveSite(struct dive_site *newValue, bool currentDiveOnly) { - execute(new EditDiveSite(dives, newValue, oldValue)); + execute(new EditDiveSite(newValue, currentDiveOnly)); } -void editDiveSiteNew(const QVector dives, const QString &newName, struct dive_site *oldValue) +void editDiveSiteNew(const QString &newName, bool currentDiveOnly) { - execute(new EditDiveSiteNew(dives, newName, oldValue)); + execute(new EditDiveSiteNew(newName, currentDiveOnly)); } -void editTags(const QVector &dives, const QStringList &newList, struct dive *d) +void editTags(const QStringList &newList, bool currentDiveOnly) { - execute(new EditTags(dives, newList, d)); + execute(new EditTags(newList, currentDiveOnly)); } -void editBuddies(const QVector &dives, const QStringList &newList, struct dive *d) +void editBuddies(const QStringList &newList, bool currentDiveOnly) { - execute(new EditBuddies(dives, newList, d)); + execute(new EditBuddies(newList, currentDiveOnly)); } -void editDiveMaster(const QVector &dives, const QStringList &newList, struct dive *d) +void editDiveMaster(const QStringList &newList, bool currentDiveOnly) { - execute(new EditDiveMaster(dives, newList, d)); + execute(new EditDiveMaster(newList, currentDiveOnly)); } } // namespace Command -- cgit v1.2.3-70-g09d2