Create a new DiveSite when user clicks on add

Also reorganized a bit of the code, and renamed a few misleading methods.

[Dirk Hohndel: remove some C++11 code]

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-06-01 16:58:23 -03:00 committed by Dirk Hohndel
parent 82d3f088a4
commit b8092c07a4
7 changed files with 44 additions and 23 deletions

View file

@ -49,3 +49,14 @@ void LocationInformationModel::update()
endInsertRows();
}
}
int32_t LocationInformationModel::addDiveSite(const QString& name, int lon, int lat)
{
degrees_t latitude, longitude;
latitude.udeg = lat;
longitude.udeg = lon;
int32_t uuid = create_dive_site_with_gps(name.toUtf8().data(), latitude, longitude);
update();
return uuid;
}

View file

@ -10,6 +10,8 @@ public:
static LocationInformationModel *instance();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index = QModelIndex(), int role = Qt::DisplayRole) const;
int32_t addDiveSite(const QString& name, int lat = 0, int lon = 0);
public slots:
void update();
private: