mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: keep frontend informed of changes to dive site count
Add a new signal to DiveListNotifier. Send signal if dives are added or removed and therefore the dive count of a dive site changes. The dive sites are collected and the signal is sent at the end of the command. Add code to update the table view. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
dd12bdaf94
commit
8dcc33d8ab
6 changed files with 37 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "core/units.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/divesite.h"
|
||||
#include "core/metrics.h"
|
||||
|
@ -23,6 +24,7 @@ LocationInformationModel *LocationInformationModel::instance()
|
|||
|
||||
LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTableModel(obj)
|
||||
{
|
||||
connect(&diveListNotifier, &DiveListNotifier::diveSiteDiveCountChanged, this, &LocationInformationModel::diveSiteDiveCountChanged);
|
||||
}
|
||||
|
||||
int LocationInformationModel::columnCount(const QModelIndex &) const
|
||||
|
@ -154,6 +156,13 @@ bool LocationInformationModel::removeRows(int row, int, const QModelIndex&)
|
|||
return true;
|
||||
}
|
||||
|
||||
void LocationInformationModel::diveSiteDiveCountChanged(dive_site *ds)
|
||||
{
|
||||
int idx = get_divesite_idx(ds, &dive_site_table);
|
||||
if (idx >= 0)
|
||||
dataChanged(createIndex(idx, NUM_DIVES), createIndex(idx, NUM_DIVES));
|
||||
}
|
||||
|
||||
GeoReferencingOptionsModel *GeoReferencingOptionsModel::instance()
|
||||
{
|
||||
static GeoReferencingOptionsModel *self = new GeoReferencingOptionsModel();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue