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"
|
2018-07-23 21:41:23 +00:00
|
|
|
|
|
|
|
namespace Command {
|
|
|
|
|
|
|
|
// Dive-list related commands
|
2019-03-03 16:10:09 +00:00
|
|
|
void addDive(dive *d, const QString &newDS, bool autogroup, bool newNumber)
|
2018-07-23 21:41:23 +00:00
|
|
|
{
|
2019-03-03 16:10:09 +00:00
|
|
|
execute(new AddDive(d, newDS, 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));
|
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2018-07-23 21:41:23 +00:00
|
|
|
} // namespace Command
|