Undo: move selection function into command_private.cpp file

Undo of editing should probably also restore the old selection and
current dive. Therefore, move the functions that set and restore the
selection and the current dive from the command_divelist.cpp into the
command_private.cpp translation unit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-17 10:18:00 +01:00 committed by Dirk Hohndel
parent 5436f9b859
commit ebfa366826
4 changed files with 144 additions and 116 deletions

View file

@ -4,13 +4,12 @@
#ifndef COMMAND_PRIVATE_H
#define COMMAND_PRIVATE_H
#include "core/dive.h"
#include <vector>
#include <utility>
#include <QVector>
struct dive;
struct dive_trip;
namespace Command {
// Generally, signals are sent in batches per trip. To avoid writing the same loop
@ -56,6 +55,14 @@ void processByTrip(Vector &divesIn, Function action)
}
// Reset the selection to the dives of the "selection" vector and send the appropriate signals.
// Set the current dive to "currentDive". "currentDive" must be an element of "selection" (or
// null if "seletion" is empty). Return true if the selection or current dive changed.
bool setSelection(const std::vector<dive *> &selection, dive *currentDive);
// Get currently selectd dives
std::vector<dive *> getDiveSelection();
} // namespace Command
#endif // COMMAND_PRIVATE_H