Correctly update the dive when the user edits dive_site

We didn't correctly update the dive site as soon as the
dive_site edit finished, and this time we are actually
correctly updating things using signals instead of calling
the mainwindow for everything.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-07-30 21:32:50 -03:00 committed by Dirk Hohndel
parent 7834341562
commit 9130ff8a97
3 changed files with 11 additions and 0 deletions

View file

@ -451,6 +451,13 @@ void MainTab::showLocation()
ui.location->clear(); ui.location->clear();
} }
// Seems wrong, since we can also call updateDiveInfo(), but since the updateDiveInfo
// has a parameter on it's definition it didn't worked on the signal slot connection.
void MainTab::refreshDiveInfo()
{
updateDiveInfo();
}
void MainTab::updateDiveInfo(bool clear) void MainTab::updateDiveInfo(bool clear)
{ {
// I don't like this code here - but globe() wasn't initialized on the constructor. // I don't like this code here - but globe() wasn't initialized on the constructor.

View file

@ -63,6 +63,7 @@ public
slots: slots:
void addCylinder_clicked(); void addCylinder_clicked();
void addWeight_clicked(); void addWeight_clicked();
void refreshDiveInfo();
void updateDiveInfo(bool clear = false); void updateDiveInfo(bool clear = false);
void acceptChanges(); void acceptChanges();
void rejectChanges(); void rejectChanges();

View file

@ -114,6 +114,9 @@ MainWindow::MainWindow() : QMainWindow(),
connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite, connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite,
this, &MainWindow::setDefaultState); this, &MainWindow::setDefaultState);
connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite,
mainTab, &MainTab::refreshDiveInfo);
QWidget *diveSitePictures = new QWidget(); // Placeholder QWidget *diveSitePictures = new QWidget(); // Placeholder
registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps ); registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps );