mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: Implement undo of dive site name editing
Implement an undo command that edits the name of a dive site. Connect it to the dive site table, so that names can be edited directly in the table. Send signals on undo / redo so that the dive site table and the dive site edit widget can be updated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8e1f736d2b
commit
0e1b0cf1da
9 changed files with 97 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "qt-models/filtermodels.h"
|
||||
#include "core/divesitehelpers.h"
|
||||
#include "desktop-widgets/modeldelegates.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QShowEvent>
|
||||
|
@ -38,6 +39,8 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
|||
connect(ui.diveSiteCoordinates, SIGNAL(returnPressed()), this, SLOT(updateLocationOnMap()));
|
||||
ui.diveSiteCoordinates->installEventFilter(this);
|
||||
|
||||
connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &LocationInformationWidget::diveSiteChanged);
|
||||
|
||||
ui.diveSiteListView->setModel(&filter_model);
|
||||
ui.diveSiteListView->setModelColumn(LocationInformationModel::NAME);
|
||||
ui.diveSiteListView->installEventFilter(this);
|
||||
|
@ -121,6 +124,18 @@ void LocationInformationWidget::updateLabels()
|
|||
ui.locationTags->setText(constructLocationTags(&taxonomy, false));
|
||||
}
|
||||
|
||||
void LocationInformationWidget::diveSiteChanged(struct dive_site *ds, int field)
|
||||
{
|
||||
if (diveSite != ds)
|
||||
return; // A different dive site was changed -> do nothing.
|
||||
switch (field) {
|
||||
case LocationInformationModel::NAME:
|
||||
ui.diveSiteName->setText(diveSite->name);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void LocationInformationWidget::clearLabels()
|
||||
{
|
||||
ui.diveSiteName->clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue