diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-05-29 22:22:24 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-29 20:59:11 -0700 |
commit | ac6a7ab24e087cc150a7eff0ff6e7e4f8c52ce9a (patch) | |
tree | 4aa3130a235a11f5fb6b39c1f791e643ae524a18 /qt-ui/maintab.cpp | |
parent | d6e61b74fc140ca5a6cb1de3c6b6435b3701aa5b (diff) | |
download | subsurface-ac6a7ab24e087cc150a7eff0ff6e7e4f8c52ce9a.tar.gz |
Update DiveLocationModel when thread finishes
This patch updates the DiveLocationModel when the
GeoLoockupInformationThread finishes, and also selects
the correct index for the displayed dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index e6cf8bc13..5b5c10115 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -20,7 +20,7 @@ #include "weightmodel.h" #include "divepicturemodel.h" #include "divecomputerextradatamodel.h" - +#include "divelocationmodel.h" #if defined(FBSUPPORT) #include "socialnetworks.h" #endif @@ -97,6 +97,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex))); connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(QModelIndex))); + ui.location->setModel(LocationInformationModel::instance()); ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this)); ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::USE, new TankUseDelegate(this)); ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate(this)); @@ -199,6 +200,12 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.waitingSpinner->setInnerRadius(5); ui.waitingSpinner->setRevolutionsPerSecond(1); + connect(ReverseGeoLookupThread::instance(), SIGNAL(finished()), + LocationInformationModel::instance(), SLOT(update())); + + connect(ReverseGeoLookupThread::instance(), &QThread::finished, + this, &MainTab::setCurrentLocationIndex); + acceptingEdit = false; } @@ -213,6 +220,12 @@ MainTab::~MainTab() } } +void MainTab::setCurrentLocationIndex() +{ + if (current_dive) + ui.location->setCurrentText(get_dive_site_by_uuid(current_dive->dive_site_uuid)->name); +} + void MainTab::enableGeoLookupEdition() { ui.waitingSpinner->stop(); |