From f9ceff009b35f73dec6d13f4037119172f6cf0de Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 17 Jan 2015 22:43:52 +1300 Subject: Clean up the header files Lots and lots and lots of header files were being included without being needed. This attempts to clean some of that crud up. Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 9186b7a0a..8835bb8e3 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -5,45 +5,20 @@ */ #include "mainwindow.h" -#include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include #include #include -#include -#include "divelistview.h" -#include "starwidget.h" #include "ssrf-version.h" -#include "dive.h" -#include "display.h" -#include "divelist.h" -#include "pref.h" -#include "helpers.h" -#include "modeldelegates.h" -#include "models.h" #include "downloadfromdivecomputer.h" #include "preferences.h" #include "subsurfacewebservices.h" #include "divecomputermanagementdialog.h" -#include "simplewidgets.h" -#include "diveplanner.h" #include "about.h" -#include "worldmap-save.h" #include "updatemanager.h" #include "planner.h" -#include "configuredivecomputerdialog.h" -#include "statistics/statisticswidget.h" #include "filtermodels.h" #ifndef NO_PRINTING #include -- cgit v1.2.3-70-g09d2 From df46b85ee1cc7a33fe35e69c19345a59c966fa41 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 19 Jan 2015 17:32:17 +1200 Subject: Don't just change the location when double clicking on the globe Instead be consistent with other parts of the code and put us in editing mode so the user can accept / reject the change. See #800 Fixes #801 Signed-off-by: Dirk Hohndel --- qt-ui/globe.cpp | 19 ++++++------------- qt-ui/globe.h | 3 +++ qt-ui/maintab.cpp | 3 +++ qt-ui/mainwindow.cpp | 2 ++ 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'qt-ui/mainwindow.cpp') diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index c2bbeb415..d8beff91d 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -307,21 +307,14 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U lon = lon * 180 / M_PI; lat = lat * 180 / M_PI; } - - // right now we try to only ever do this with one dive selected, - // but we keep the code here that changes the coordinates for each selected dive - int i; - struct dive *dive; - for_each_dive (i, dive) { - if (!dive->selected) - continue; - dive->latitude.udeg = lrint(lat * 1000000.0); - dive->longitude.udeg = lrint(lon * 1000000.0); - } centerOn(lon, lat, true); + + // change the location of the displayed_dive and put the UI in edit mode + displayed_dive.latitude.udeg = lrint(lat * 1000000.0); + displayed_dive.longitude.udeg = lrint(lon * 1000000.0); + emit(coordinatesChanged()); + repopulateLabels(); editingDiveLocation = false; - mark_divelist_changed(true); - MainWindow::instance()->refreshDisplay(); } void GlobeGPS::mousePressEvent(QMouseEvent *event) diff --git a/qt-ui/globe.h b/qt-ui/globe.h index 8124a4d57..b6a33bbbe 100644 --- a/qt-ui/globe.h +++ b/qt-ui/globe.h @@ -39,6 +39,9 @@ private: bool editingDiveLocation; bool doubleClick; +signals: + void coordinatesChanged(void); + public slots: void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 445ab2b5a..be55f6f29 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1246,6 +1246,9 @@ void MainTab::updateCoordinatesText(qreal lat, qreal lon) void MainTab::updateGpsCoordinates() { + if (editMode == NONE) + enableEdition(); + ui.coordinates->setText(printGPSCoords(displayed_dive.latitude.udeg, displayed_dive.longitude.udeg)); ui.coordinates->setModified(displayed_dive.latitude.udeg || displayed_dive.longitude.udeg); } diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 8835bb8e3..5d5a442f4 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -96,6 +96,8 @@ MainWindow::MainWindow() : QMainWindow(), #ifdef NO_MARBLE ui.globePane->hide(); ui.menuView->removeAction(ui.actionViewGlobe); +#else + connect(ui.globe, SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates())); #endif #ifdef NO_USERMANUAL ui.menuHelp->removeAction(ui.actionUserManual); -- cgit v1.2.3-70-g09d2