From b8092c07a4b4d7715d825641e458be5fa56972d6 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 1 Jun 2015 16:58:23 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2ecfb6c6d..cc09ed723 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -21,6 +21,8 @@ #include "divepicturemodel.h" #include "divecomputerextradatamodel.h" #include "divelocationmodel.h" +#include "divesite.h" + #if defined(FBSUPPORT) #include "socialnetworks.h" #endif @@ -55,7 +57,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.extraData->setModel(extraDataModel); closeMessage(); - connect(ui.manageDiveSite, SIGNAL(clicked()), this, SLOT(prepareDiveSiteEdit())); + connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(prepareDiveSiteEdit())); QAction *action = new QAction(tr("Apply changes"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges())); @@ -231,17 +233,19 @@ void MainTab::setCurrentLocationIndex() void MainTab::enableGeoLookupEdition() { ui.waitingSpinner->stop(); - ui.manageDiveSite->show(); + ui.addDiveSite->show(); } void MainTab::disableGeoLookupEdition() { ui.waitingSpinner->start(); - ui.manageDiveSite->hide(); + ui.addDiveSite->hide(); } void MainTab::prepareDiveSiteEdit() { - emit requestDiveSiteEdit(displayed_dive.dive_site_uuid); + uint32_t dive_site_uuid = LocationInformationModel::instance()->addDiveSite(tr("Unnamed")); + displayed_dive.dive_site_uuid = dive_site_uuid; + emit requestDiveSiteEdit(dive_site_uuid); } void MainTab::toggleTriggeredColumn() -- cgit v1.2.3-70-g09d2