From 9130ff8a97ea73e92dccd68f8107f441cb0a3f7e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 30 Jul 2015 21:32:50 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 7 +++++++ qt-ui/maintab.h | 1 + qt-ui/mainwindow.cpp | 3 +++ 3 files changed, 11 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index fd78a10d7..4b6f961c1 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -451,6 +451,13 @@ void MainTab::showLocation() 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) { // I don't like this code here - but globe() wasn't initialized on the constructor. diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index be38ecf61..4c64b0b15 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -63,6 +63,7 @@ public slots: void addCylinder_clicked(); void addWeight_clicked(); + void refreshDiveInfo(); void updateDiveInfo(bool clear = false); void acceptChanges(); void rejectChanges(); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index d6ad23584..e7d53e550 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -114,6 +114,9 @@ MainWindow::MainWindow() : QMainWindow(), connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite, this, &MainWindow::setDefaultState); + connect(diveSiteEdit, &LocationInformationWidget::endEditDiveSite, + mainTab, &MainTab::refreshDiveInfo); + QWidget *diveSitePictures = new QWidget(); // Placeholder registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps ); -- cgit v1.2.3-70-g09d2