2018-07-23 23:41:23 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
#include "command_divelist.h"
|
2019-03-12 22:35:43 +01:00
|
|
|
#include "command_divesite.h"
|
2019-01-25 18:27:31 +01:00
|
|
|
#include "command_edit.h"
|
2018-07-23 23:41:23 +02:00
|
|
|
|
|
|
|
namespace Command {
|
|
|
|
|
|
|
|
// Dive-list related commands
|
2019-03-03 17:10:09 +01:00
|
|
|
void addDive(dive *d, const QString &newDS, bool autogroup, bool newNumber)
|
2018-07-23 23:41:23 +02:00
|
|
|
{
|
2019-03-03 17:10:09 +01:00
|
|
|
execute(new AddDive(d, newDS, autogroup, newNumber));
|
2018-07-23 23:41:23 +02:00
|
|
|
}
|
|
|
|
|
2019-03-03 15:12:22 +01:00
|
|
|
void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites, int flags, const QString &source)
|
2018-12-23 23:45:12 +01:00
|
|
|
{
|
2019-03-03 15:12:22 +01:00
|
|
|
execute(new ImportDives(dives, trips, sites, flags, source));
|
2018-12-23 23:45:12 +01:00
|
|
|
}
|
|
|
|
|
2018-07-23 23:41:23 +02: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 15:55:29 +02:00
|
|
|
void renumberDives(const QVector<QPair<dive *, int>> &divesToRenumber)
|
2018-07-23 23:41:23 +02: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 10:20:13 +02:00
|
|
|
void splitDiveComputer(dive *d, int dc_num)
|
|
|
|
{
|
|
|
|
execute(new SplitDiveComputer(d, dc_num));
|
|
|
|
}
|
|
|
|
|
2018-07-23 23:41:23 +02:00
|
|
|
void mergeDives(const QVector <dive *> &dives)
|
|
|
|
{
|
|
|
|
execute(new MergeDives(dives));
|
|
|
|
}
|
|
|
|
|
2019-03-12 22:35:43 +01:00
|
|
|
// Dive site related commands
|
|
|
|
void deleteDiveSites(const QVector <dive_site *> &sites)
|
|
|
|
{
|
|
|
|
execute(new DeleteDiveSites(sites));
|
|
|
|
}
|
|
|
|
|
2019-03-12 23:51:39 +01:00
|
|
|
void editDiveSiteName(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteName(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-13 20:10:22 +01:00
|
|
|
void editDiveSiteDescription(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteDescription(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-14 00:00:54 +01:00
|
|
|
void editDiveSiteNotes(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteNotes(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-14 08:26:50 +01:00
|
|
|
void editDiveSiteCountry(dive_site *ds, const QString &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteCountry(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-14 23:28:45 +01:00
|
|
|
void editDiveSiteLocation(dive_site *ds, location_t value)
|
2019-03-14 22:07:48 +01:00
|
|
|
{
|
|
|
|
execute(new EditDiveSiteLocation(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-15 14:32:55 +01:00
|
|
|
void editDiveSiteTaxonomy(dive_site *ds, taxonomy_data &value)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteTaxonomy(ds, value));
|
|
|
|
}
|
|
|
|
|
2019-03-13 20:58:25 +01:00
|
|
|
void addDiveSite(const QString &name)
|
|
|
|
{
|
|
|
|
execute(new AddDiveSite(name));
|
|
|
|
}
|
|
|
|
|
2019-03-15 17:41:31 +01:00
|
|
|
void mergeDiveSites(dive_site *ds, const QVector<dive_site *> &sites)
|
|
|
|
{
|
|
|
|
execute(new MergeDiveSites(ds, sites));
|
|
|
|
}
|
|
|
|
|
2019-03-19 19:52:54 +01:00
|
|
|
void purgeUnusedDiveSites()
|
|
|
|
{
|
|
|
|
execute(new PurgeUnusedDiveSites);
|
|
|
|
}
|
|
|
|
|
2019-01-25 18:27:31 +01:00
|
|
|
// Dive editing related commands
|
|
|
|
void editNotes(const QVector<dive *> dives, const QString &newValue, const QString &oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditNotes(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-01-28 18:35:27 +01:00
|
|
|
void editMode(const QVector<dive *> dives, int index, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditMode(dives, index, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-01-28 21:42:59 +01:00
|
|
|
void editSuit(const QVector<dive *> dives, const QString &newValue, const QString &oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditSuit(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-01-28 22:35:07 +01:00
|
|
|
void editRating(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditRating(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
void editVisibility(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditVisibility(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-01-30 22:13:24 +01:00
|
|
|
void editAirTemp(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditAirTemp(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
void editWaterTemp(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditWaterTemp(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-02-10 17:37:06 +01:00
|
|
|
void editDepth(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditDepth(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
void editDuration(const QVector<dive *> dives, int newValue, int oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditDuration(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-03-20 21:46:58 +01:00
|
|
|
void editDiveSite(const QVector<dive *> dives, struct dive_site *newValue, struct dive_site *oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSite(dives, newValue, oldValue));
|
|
|
|
}
|
|
|
|
|
|
|
|
void editDiveSiteNew(const QVector<dive *> dives, const QString &newName, struct dive_site *oldValue)
|
|
|
|
{
|
|
|
|
execute(new EditDiveSiteNew(dives, newName, oldValue));
|
|
|
|
}
|
|
|
|
|
2019-02-07 19:59:34 +01:00
|
|
|
void editTags(const QVector<dive *> &dives, const QStringList &newList, struct dive *d)
|
|
|
|
{
|
|
|
|
execute(new EditTags(dives, newList, d));
|
|
|
|
}
|
|
|
|
|
2019-02-07 21:00:09 +01:00
|
|
|
void editBuddies(const QVector<dive *> &dives, const QStringList &newList, struct dive *d)
|
|
|
|
{
|
|
|
|
execute(new EditBuddies(dives, newList, d));
|
|
|
|
}
|
|
|
|
|
2019-02-07 21:23:00 +01:00
|
|
|
void editDiveMaster(const QVector<dive *> &dives, const QStringList &newList, struct dive *d)
|
|
|
|
{
|
|
|
|
execute(new EditDiveMaster(dives, newList, d));
|
|
|
|
}
|
|
|
|
|
2018-07-23 23:41:23 +02:00
|
|
|
} // namespace Command
|