2018-07-23 21:41:23 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
#include "command_divelist.h"
|
2019-03-12 21:35:43 +00:00
|
|
|
#include "command_divesite.h"
|
2019-01-25 17:27:31 +00:00
|
|
|
#include "command_edit.h"
|
2019-02-24 20:22:33 +00:00
|
|
|
#include "command_edit_trip.h"
|
2018-07-23 21:41:23 +00:00
|
|
|
|
|
|
|
namespace Command {
|
|
|
|
|
|
|
|
// Dive-list related commands
|
2019-03-28 16:23:35 +00:00
|
|
|
void addDive(dive *d, bool autogroup, bool newNumber)
|
2018-07-23 21:41:23 +00:00
|
|
|
{
|
2019-03-28 16:23:35 +00:00
|
|
|
execute(new AddDive(d, autogroup, newNumber));
|
2018-07-23 21:41:23 +00:00
|
|
|
}
|
|
|
|
|
2019-03-03 14:12:22 +00:00
|
|
|
void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites, int flags, const QString &source)
|
2018-12-23 22:45:12 +00:00
|
|
|
{
|
2019-03-03 14:12:22 +00:00
|
|
|
execute(new ImportDives(dives, trips, sites, flags, source));
|
2018-12-23 22:45:12 +00:00
|
|
|
}
|
|
|
|
|
2018-07-23 21:41:23 +00:00
|
|
|
void deleteDive(const QVector<struct dive*> &divesToDelete)
|
|
|
|
{
|
|
|
|
execute(new DeleteDive(divesToDelete));
|
|
|
|
}
|
|
|
|
|
|
|
|
void shiftTime(const QVector<dive *> &changedDives, int amount)
|
|
|
|
{
|
|
|
|
execute(new ShiftTime(changedDives, amount));
|
|
|
|
}
|
|
|
|
|
2018-07-30 13:55:29 +00:00
|
|
|
void renumberDives(const QVector<QPair<dive *, int>> &divesToRenumber)
|
2018-07-23 21:41:23 +00:00
|
|
|
{
|
|
|
|
execute(new RenumberDives(divesToRenumber));
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeDivesFromTrip(const QVector<dive *> &divesToRemove)
|
|
|
|
{
|
|
|
|
execute(new RemoveDivesFromTrip(divesToRemove));
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeAutogenTrips()
|
|
|
|
{
|
|
|
|
execute(new RemoveAutogenTrips);
|
|
|
|
}
|
|
|
|
|
|
|
|
void addDivesToTrip(const QVector<dive *> &divesToAddIn, dive_trip *trip)
|
|
|
|
{
|
|
|
|
execute(new AddDivesToTrip(divesToAddIn, trip));
|
|
|
|
}
|
|
|
|
|
|
|
|
void createTrip(const QVector<dive *> &divesToAddIn)
|
|
|
|
{
|
|
|
|
execute(new CreateTrip(divesToAddIn));
|
|
|
|
}
|
|
|
|
|
|
|
|
void autogroupDives()
|
|
|
|
{
|
|
|
|
execute(new AutogroupDives);
|
|
|
|
}
|
|
|
|
|
|
|
|
void mergeTrips(dive_trip *trip1, dive_trip *trip2)
|
|
|
|
{
|
|
|
|
execute(new MergeTrips(trip1, trip2));
|
|
|
|
}
|
|
|
|
|
|
|
|
void splitDives(dive *d, duration_t time)
|
|
|
|
{
|
|
|
|
execute(new SplitDives(d, time));
|
|
|
|
}
|
|
|
|
|
2019-03-31 08:20:13 +00:00
|
|
|
void splitDiveComputer(dive *d, int dc_num)
|
|
|
|
{
|
|
|
|
execute(new SplitDiveComputer(d, dc_num));
|
|
|
|
}
|
|
|
|
|
2019-05-17 20:22:55 +00:00
|
|
|
void moveDiveComputerToFront(dive *d, int dc_num)
|
|
|
|
{
|
|
|
|
execute(new MoveDiveComputerToFront(d, dc_num));
|
|
|
|
}
|
|
|
|
|
2019-05-19 12:27:10 +00:00
|
|
|
void deleteDiveComputer(dive *d, int dc_num)
|
|
|
|
{
|
|
|
|
execute(new DeleteDiveComputer(d, dc_num));
|
|
|
|
}
|
|
|
|
|
2018-07-23 21:41:23 +00:00
|
|
|
void mergeDives(const QVector <dive *> &dives)
|
|
|
|
{
|
|
|
|
execute(new MergeDives(dives));
|
|
|
|
}
|
|
|
|
|
2019-03-12 21:35:43 +00:00
|
|
|
// Dive site related commands
|
|
|
|
void deleteDiveSites(const QVector <dive_site *> &sites)
|
|
|
|
{
|
|
|
|
execute(new DeleteDiveSites(sites));
|
|
|
|
}
|
|
|
|
|
2019-03-12 22:51:39 +00:00
|
|
|
void editDiveSiteName(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteName(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-13 19:10:22 +00:00
|
|
|
void editDiveSiteDescription(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteDescription(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-13 23:00:54 +00:00
|
|
|
void editDiveSiteNotes(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteNotes(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-14 07:26:50 +00:00
|
|
|
void editDiveSiteCountry(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteCountry(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-14 22:28:45 +00:00
|
|
|
void editDiveSiteLocation(dive_site *ds, location_t value)
|
2019-03-14 21:07:48 +00:00
|
|
|
{
|
|
|
|
execute(new EditDiveSiteLocation(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-15 13:32:55 +00:00
|
|
|
void editDiveSiteTaxonomy(dive_site *ds, taxonomy_data &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteTaxonomy(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-13 19:58:25 +00:00
|
|
|
void addDiveSite(const QString &name)
|
|
|
|
{
|
|
|
|
execute(new AddDiveSite(name));
|
|
|
|
}
|
|
|
|
|
2019-05-05 03:40:27 +00:00
|
|
|
void importDiveSites(struct dive_site_table *sites, const QString &source)
|
|
|
|
{
|
|
|
|
execute(new ImportDiveSites(sites, source));
|
|
|
|
}
|
|
|
|
|
2019-03-15 16:41:31 +00:00
|
|
|
void mergeDiveSites(dive_site *ds, const QVector<dive_site *> &sites)
|
|
|
|
{
|
|
|
|
execute(new MergeDiveSites(ds, sites));
|
|
|
|
}
|
|
|
|
|
2019-03-19 18:52:54 +00:00
|
|
|
void purgeUnusedDiveSites()
|
|
|
|
{
|
|
|
|
execute(new PurgeUnusedDiveSites);
|
|
|
|
}
|
|
|
|
|
2019-01-25 17:27:31 +00:00
|
|
|
// Dive editing related commands
|
2019-02-14 22:07:12 +00:00
|
|
|
void editNotes(const QString &newValue, bool currentDiveOnly)
|
2019-01-25 17:27:31 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditNotes(newValue, currentDiveOnly));
|
2019-01-25 17:27:31 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editMode(int index, int newValue, bool currentDiveOnly)
|
2019-01-28 17:35:27 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditMode(index, newValue, currentDiveOnly));
|
2019-01-28 17:35:27 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editSuit(const QString &newValue, bool currentDiveOnly)
|
2019-01-28 20:42:59 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditSuit(newValue, currentDiveOnly));
|
2019-01-28 20:42:59 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editRating(int newValue, bool currentDiveOnly)
|
2019-01-28 21:35:07 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditRating(newValue, currentDiveOnly));
|
2019-01-28 21:35:07 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editVisibility(int newValue, bool currentDiveOnly)
|
2019-01-28 21:35:07 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditVisibility(newValue, currentDiveOnly));
|
2019-01-28 21:35:07 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editAirTemp(int newValue, bool currentDiveOnly)
|
2019-01-30 21:13:24 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditAirTemp(newValue, currentDiveOnly));
|
2019-01-30 21:13:24 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editWaterTemp(int newValue, bool currentDiveOnly)
|
2019-01-30 21:13:24 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditWaterTemp(newValue, currentDiveOnly));
|
2019-01-30 21:13:24 +00:00
|
|
|
}
|
|
|
|
|
2019-04-30 10:42:33 +00:00
|
|
|
void editAtmPress(int newValue, bool currentDiveOnly)
|
|
|
|
{
|
|
|
|
execute(new EditAtmPress(newValue, currentDiveOnly));
|
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editDepth(int newValue, bool currentDiveOnly)
|
2019-02-10 16:37:06 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditDepth(newValue, currentDiveOnly));
|
2019-02-10 16:37:06 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editDuration(int newValue, bool currentDiveOnly)
|
2019-02-10 16:37:06 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditDuration(newValue, currentDiveOnly));
|
2019-02-10 16:37:06 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editDiveSite(struct dive_site *newValue, bool currentDiveOnly)
|
2019-03-20 20:46:58 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditDiveSite(newValue, currentDiveOnly));
|
2019-03-20 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editDiveSiteNew(const QString &newName, bool currentDiveOnly)
|
2019-03-20 20:46:58 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditDiveSiteNew(newName, currentDiveOnly));
|
2019-03-20 20:46:58 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editTags(const QStringList &newList, bool currentDiveOnly)
|
2019-02-07 18:59:34 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditTags(newList, currentDiveOnly));
|
2019-02-07 18:59:34 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editBuddies(const QStringList &newList, bool currentDiveOnly)
|
2019-02-07 20:00:09 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditBuddies(newList, currentDiveOnly));
|
2019-02-07 20:00:09 +00:00
|
|
|
}
|
|
|
|
|
2019-02-14 22:07:12 +00:00
|
|
|
void editDiveMaster(const QStringList &newList, bool currentDiveOnly)
|
2019-02-07 20:23:00 +00:00
|
|
|
{
|
2019-02-14 22:07:12 +00:00
|
|
|
execute(new EditDiveMaster(newList, currentDiveOnly));
|
2019-02-07 20:23:00 +00:00
|
|
|
}
|
|
|
|
|
2019-02-23 17:17:20 +00:00
|
|
|
void pasteDives(const dive *d, dive_components what)
|
|
|
|
{
|
|
|
|
execute(new PasteDives(d, what));
|
|
|
|
}
|
|
|
|
|
2019-02-24 20:22:33 +00:00
|
|
|
void editTripLocation(dive_trip *trip, const QString &s)
|
|
|
|
{
|
|
|
|
execute(new EditTripLocation(trip, s));
|
|
|
|
}
|
|
|
|
|
|
|
|
void editTripNotes(dive_trip *trip, const QString &s)
|
|
|
|
{
|
|
|
|
execute(new EditTripNotes(trip, s));
|
|
|
|
}
|
|
|
|
|
2018-07-23 21:41:23 +00:00
|
|
|
} // namespace Command
|