mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Display dive sites with same gps as the current
So we can merge them later - currently we are showing only the ID, ugly - fixing next. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
dcda950202
commit
a3d6098c8c
3 changed files with 16 additions and 3 deletions
|
@ -188,8 +188,13 @@ bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelI
|
||||||
{
|
{
|
||||||
int ref_lat = displayed_dive_site.latitude.udeg;
|
int ref_lat = displayed_dive_site.latitude.udeg;
|
||||||
int ref_lon = displayed_dive_site.longitude.udeg;
|
int ref_lon = displayed_dive_site.longitude.udeg;
|
||||||
QModelIndex curr = model->index(sourceRow, LocationInformationModel::UUID, parent.isValid() ? parent : QModelIndex());
|
QSortFilterProxyModel *self = (QSortFilterProxyModel*) model;
|
||||||
|
|
||||||
|
int ds_uuid = self->sourceModel()->index(sourceRow, LocationInformationModel::UUID, parent).data().toInt();
|
||||||
|
struct dive_site *ds = get_dive_site_by_uuid(ds_uuid);
|
||||||
|
|
||||||
|
if (!ds)
|
||||||
|
return false;
|
||||||
|
|
||||||
struct dive_site *ds = get_dive_site_by_uuid(curr.data().toInt());
|
|
||||||
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon);
|
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon);
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ class QLineEdit;
|
||||||
|
|
||||||
#define RECENTLY_ADDED_DIVESITE 1
|
#define RECENTLY_ADDED_DIVESITE 1
|
||||||
|
|
||||||
bool filter_same_gps_cb (int sourceRow, const QModelIndex& parent);
|
bool filter_same_gps_cb (QAbstractItemModel *m, int sourceRow, const QModelIndex& parent);
|
||||||
|
|
||||||
class LocationInformationModel : public QAbstractTableModel {
|
class LocationInformationModel : public QAbstractTableModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -30,6 +30,11 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
||||||
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
|
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
|
||||||
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
||||||
|
|
||||||
|
SsrfSortFilterProxyModel *filter_model = new SsrfSortFilterProxyModel(this);
|
||||||
|
filter_model->setSourceModel(LocationInformationModel::instance());
|
||||||
|
filter_model->setFilterRow(filter_same_gps_cb);
|
||||||
|
ui.diveSiteListView->setModel(filter_model);
|
||||||
|
|
||||||
#ifndef NO_MARBLE
|
#ifndef NO_MARBLE
|
||||||
// Globe Management Code.
|
// Globe Management Code.
|
||||||
connect(this, &LocationInformationWidget::requestCoordinates,
|
connect(this, &LocationInformationWidget::requestCoordinates,
|
||||||
|
@ -133,7 +138,10 @@ void LocationInformationWidget::showEvent(QShowEvent *ev)
|
||||||
{
|
{
|
||||||
if (displayed_dive_site.uuid) {
|
if (displayed_dive_site.uuid) {
|
||||||
updateLabels();
|
updateLabels();
|
||||||
|
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(ui.diveSiteListView->model());
|
||||||
emit startFilterDiveSite(displayed_dive_site.uuid);
|
emit startFilterDiveSite(displayed_dive_site.uuid);
|
||||||
|
if (m)
|
||||||
|
m->invalidate();
|
||||||
}
|
}
|
||||||
emit requestCoordinates();
|
emit requestCoordinates();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue