Add function to filter same-gps dive sites

This should be userfull to show dive sites that are
mergeable.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-08-31 20:37:49 -03:00 committed by Dirk Hohndel
parent ab32295f89
commit 71e366a6e4
2 changed files with 14 additions and 0 deletions

View file

@ -183,3 +183,13 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin
list << taxonomy_category_names[i];
setStringList(list);
}
bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelIndex& parent)
{
int ref_lat = displayed_dive_site.latitude.udeg;
int ref_lon = displayed_dive_site.longitude.udeg;
QModelIndex curr = model->index(sourceRow, LocationInformationModel::UUID, parent.isValid() ? parent : QModelIndex());
struct dive_site *ds = get_dive_site_by_uuid(curr.data().toInt());
return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon);
}

View file

@ -5,10 +5,14 @@
#include <QStringListModel>
#include <stdint.h>
#include "ssrfsortfilterproxymodel.h"
class QLineEdit;
#define RECENTLY_ADDED_DIVESITE 1
bool filter_same_gps_cb (int sourceRow, const QModelIndex& parent);
class LocationInformationModel : public QAbstractTableModel {
Q_OBJECT
public: