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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-02-12 22:24:12 -08:00
parent 616cb18b29
commit 4e95beabc2
6 changed files with 83 additions and 101 deletions

View file

@ -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, &current_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()
{