From 4e95beabc2fd7cdd2efcceb226417f84a903861f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 12 Feb 2015 22:24:12 -0800 Subject: Remove coordinates from main tab It seems to make sense to only have them on the dive site screen. For the main UI they were redundant (we have the map) and not all that useful. The only time people would want them is if they wanted to manually add GPS coordinates for a dive, but that should now be done via the dive site UI. There are a couple of FIXMEs in the code and a few code blocks that have been commented out as they will be needed in one form or another once this GPS handling is done on the dive site UI, which right now it is NOT. Signed-off-by: Dirk Hohndel --- qt-ui/globe.cpp | 7 ++- qt-ui/maintab.cpp | 38 ++++++--------- qt-ui/maintab.h | 2 - qt-ui/maintab.ui | 130 ++++++++++++++++++++++----------------------------- qt-ui/mainwindow.cpp | 5 +- 5 files changed, 81 insertions(+), 101 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 58e7dc620..256eff175 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -347,7 +347,12 @@ void GlobeGPS::mousePressEvent(QMouseEvent *event) // there could be two scenarios that got us here; let's check if we are editing a dive if (MainWindow::instance()->information()->isEditing() && clickOnGlobe) { - MainWindow::instance()->information()->updateCoordinatesText(lat, lon); + // + // FIXME + // TODO + // + // this needs to do this on the dive site screen + // MainWindow::instance()->information()->updateCoordinatesText(lat, lon); repopulateLabels(); } else if (clickOnGlobe) { changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index e2ccd44de..1fbb32fa8 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -72,7 +72,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), setEnabled(false); ui.location->installEventFilter(this); - ui.coordinates->installEventFilter(this); ui.divemaster->installEventFilter(this); ui.buddy->installEventFilter(this); ui.suit->installEventFilter(this); @@ -443,7 +442,6 @@ void MainTab::updateDiveInfo(bool clear) ui.location->setText(ds->name); else ui.location->clear(); - updateGpsCoordinates(); // Subsurface always uses "local time" as in "whatever was the local time at the location" // so all time stamps have no time zone information and are in UTC QDateTime localTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when)); @@ -454,8 +452,6 @@ void MainTab::updateDiveInfo(bool clear) setTabText(0, tr("Trip notes")); currentTrip = *MainWindow::instance()->dive_list()->selectedTrips().begin(); // only use trip relevant fields - ui.coordinates->setVisible(false); - ui.CoordinatedLabel->setVisible(false); ui.divemaster->setVisible(false); ui.DivemasterLabel->setVisible(false); ui.buddy->setVisible(false); @@ -485,8 +481,6 @@ void MainTab::updateDiveInfo(bool clear) setTabText(0, tr("Dive notes")); currentTrip = NULL; // make all the fields visible writeable - ui.coordinates->setVisible(true); - ui.CoordinatedLabel->setVisible(true); ui.divemaster->setVisible(true); ui.buddy->setVisible(true); ui.suit->setVisible(true); @@ -655,7 +649,6 @@ void MainTab::updateDiveInfo(bool clear) clearStats(); clearEquipment(); ui.rating->setCurrentStars(0); - ui.coordinates->clear(); ui.visibility->setCurrentStars(0); ui.location->clear(); } @@ -765,8 +758,6 @@ void MainTab::acceptChanges() copy_samples(&displayed_dive.dc, ¤t_dive->dc); } struct dive *cd = current_dive; - //Reset coordinates field, in case it contains garbage. - updateGpsCoordinates(); // now check if something has changed and if yes, edit the selected dives that // were identical with the master dive shown (and mark the divelist as changed) if (!same_string(displayed_dive.buddy, cd->buddy)) @@ -794,17 +785,6 @@ void MainTab::acceptChanges() time_t offset = cd->when - displayed_dive.when; MODIFY_SELECTED_DIVES(mydive->when -= offset;); } - if (displayed_dive.latitude.udeg != cd->latitude.udeg || - displayed_dive.longitude.udeg != cd->longitude.udeg) - MODIFY_SELECTED_DIVES( - if (copyPaste || - (same_string(mydive->location, cd->location) && - mydive->latitude.udeg == cd->latitude.udeg && - mydive->longitude.udeg == cd->longitude.udeg)) - gpsHasChanged(mydive, cd, ui.coordinates->text(), 0); - ); - if (!same_string(displayed_dive.location, cd->location)) - MODIFY_SELECTED_DIVES(EDIT_TEXT(location)); saveTags(); @@ -910,7 +890,6 @@ void MainTab::resetPallete() ui.buddy->setPalette(p); ui.notes->setPalette(p); ui.location->setPalette(p); - ui.coordinates->setPalette(p); ui.divemaster->setPalette(p); ui.suit->setPalette(p); ui.airtemp->setPalette(p); @@ -1148,8 +1127,17 @@ void MainTab::on_location_textChanged(const QString &text) free(displayedTrip.location); displayedTrip.location = strdup(ui.location->text().toUtf8().data()); } else { - free(displayed_dive.location); - displayed_dive.location = strdup(ui.location->text().toUtf8().data()); + // this means we switched dive sites... this requires a lot more thinking + // + // + // FIXME + // + // TODO + // + // + // + // free(displayed_dive.location); + // displayed_dive.location = strdup(ui.location->text().toUtf8().data()); } markChangedWidget(ui.location); } @@ -1195,6 +1183,7 @@ void MainTab::on_notes_textChanged() markChangedWidget(ui.notes); } +#if 0 // we'll need something like this for the dive site management void MainTab::on_coordinates_textChanged(const QString &text) { if (editMode == IGNORE || acceptingEdit == true) @@ -1211,6 +1200,7 @@ void MainTab::on_coordinates_textChanged(const QString &text) ui.coordinates->setPalette(p); // marks things red } } +#endif void MainTab::on_rating_valueChanged(int value) { @@ -1262,6 +1252,7 @@ void MainTab::editWeightWidget(const QModelIndex &index) ui.weights->edit(index); } +#if 0 // we'll need this for dive sites void MainTab::updateCoordinatesText(qreal lat, qreal lon) { int ulat = rint(lat * 1000000); @@ -1283,6 +1274,7 @@ void MainTab::updateGpsCoordinates() ui.coordinates->clear(); } } +#endif void MainTab::escDetected() { diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 505fa6f21..aebd51073 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -66,7 +66,6 @@ slots: void rejectChanges(); void on_location_textChanged(const QString &text); void on_location_editingFinished(); - void on_coordinates_textChanged(const QString &text); void on_divemaster_textChanged(); void on_buddy_textChanged(); void on_suit_textChanged(const QString &text); @@ -93,7 +92,6 @@ slots: void escDetected(void); void photoDoubleClicked(const QString filePath); void removeSelectedPhotos(); - void updateGpsCoordinates(); void prepareDiveSiteEdit(); private: Ui::MainTab ui; diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index cdaab8386..659e790ef 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -22,7 +22,9 @@ 0 - + + scrollArea + @@ -40,8 +42,8 @@ 0 0 - 443 - 758 + 441 + 753 @@ -139,40 +141,6 @@ - - - - - - - 0 - 0 - - - - Coordinates - - - - - - - Dive mode - - - - - - - false - - - - - - - - @@ -251,6 +219,7 @@ Qt::StrongFocus + tagWidget @@ -276,36 +245,50 @@ - - - Tags - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QPlainTextEdit::NoWrap - - + + + + + + + + Tags + + + + + + + Dive mode + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QPlainTextEdit::NoWrap + + + + @@ -400,8 +383,8 @@ 0 0 - 443 - 752 + 68 + 40 @@ -456,8 +439,8 @@ 0 0 - 443 - 752 + 441 + 363 @@ -773,8 +756,8 @@ 0 0 - 443 - 752 + 446 + 215 @@ -1036,7 +1019,6 @@ rating visibility suit - tagWidget notes diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 30ab5e5df..7776f312e 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -133,7 +133,10 @@ MainWindow::MainWindow() : QMainWindow(), #ifdef NO_MARBLE ui.menuView->removeAction(ui.actionViewGlobe); #else - connect(globe(), SIGNAL(coordinatesChanged()), information(), SLOT(updateGpsCoordinates())); + // FIXME + // TODO + // we need this on the dive sites + //connect(globe(), SIGNAL(coordinatesChanged()), information(), SLOT(updateGpsCoordinates())); #endif #ifdef NO_USERMANUAL ui.menuHelp->removeAction(ui.actionUserManual); -- cgit v1.2.3-70-g09d2