mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make dive-import undoable
On desktop, replace all add_imported_dives() calls by a new undo-command. This was rather straight forward, as all the preparation work was done in previous commits. By using an undo-command, a full UI-reset can be avoided, making the UI react smoother. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0249e12589
commit
82c47bdd79
9 changed files with 122 additions and 25 deletions
|
@ -104,6 +104,26 @@ private:
|
|||
dive * currentDive;
|
||||
};
|
||||
|
||||
class ImportDives : public DiveListBase {
|
||||
public:
|
||||
// Note: dives and trips are consumed - after the call they will be empty.
|
||||
ImportDives(struct dive_table *dives, struct trip_table *trips,
|
||||
bool prefer_imported, bool downloaded, bool merge_all_trips,
|
||||
const QString &source);
|
||||
private:
|
||||
void undoit() override;
|
||||
void redoit() override;
|
||||
bool workToBeDone() override;
|
||||
|
||||
// For redo and undo
|
||||
DivesAndTripsToAdd divesToAdd;
|
||||
std::vector<dive *> divesToRemove;
|
||||
|
||||
// For undo
|
||||
std::vector<dive *> selection;
|
||||
dive * currentDive;
|
||||
};
|
||||
|
||||
class DeleteDive : public DiveListBase {
|
||||
public:
|
||||
DeleteDive(const QVector<dive *> &divesToDelete);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue