mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement undo of geo lookup
Simply copy code of the other edit dive site functions. Here though introduce a destructor in the undo command to free the taxonomy data. Remove the taxonomy member of the LocationInformationWidget class, because it is not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b5d4d88fe5
commit
7c63956ee4
6 changed files with 57 additions and 9 deletions
|
@ -235,4 +235,35 @@ void EditDiveSiteLocation::undo()
|
|||
redo();
|
||||
}
|
||||
|
||||
EditDiveSiteTaxonomy::EditDiveSiteTaxonomy(dive_site *dsIn, taxonomy_data &taxonomy) : ds(dsIn),
|
||||
value(taxonomy)
|
||||
{
|
||||
// We did a dumb copy. Erase the source to remove double references to strings.
|
||||
memset(&taxonomy, 0, sizeof(taxonomy));
|
||||
setText(tr("Edit dive site taxonomy"));
|
||||
}
|
||||
|
||||
EditDiveSiteTaxonomy::~EditDiveSiteTaxonomy()
|
||||
{
|
||||
free_taxonomy(&value);
|
||||
}
|
||||
|
||||
bool EditDiveSiteTaxonomy::workToBeDone()
|
||||
{
|
||||
// TODO: Apparently we have no way of comparing taxonomies?
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditDiveSiteTaxonomy::redo()
|
||||
{
|
||||
std::swap(value, ds->taxonomy);
|
||||
emit diveListNotifier.diveSiteChanged(ds, LocationInformationModel::TAXONOMY); // Inform frontend of changed dive site.
|
||||
}
|
||||
|
||||
void EditDiveSiteTaxonomy::undo()
|
||||
{
|
||||
// Undo and redo do the same
|
||||
redo();
|
||||
}
|
||||
|
||||
} // namespace Command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue