This is the code that does (1) please check if I got it right. On Mon, Jul 13, 2015 at 4:24 PM, Tomaz Canabrava <[email protected]> wrote:
> > > On Mon, Jul 13, 2015 at 4:14 PM, Linus Torvalds < > [email protected]> wrote: > >> On Mon, Jul 13, 2015 at 12:00 PM, Tomaz Canabrava <[email protected]> >> wrote: >> > >> > Just to be sure: >> > If I have a dive with divesite "Yellow House" with gps coords >> > then I write on it's dive site the name "Leeds", it should reject >> because I >> > have gps coords? >> >> So what I _think_ should happen is that you just create a new >> dive-site. You have a completely new dive site with a new name, and >> whatever GPS it had from before. Of course, if that "new name and GPS" >> then happens to match another dive site, at that point the two >> matching ones would be the same. >> >> But I think this depends on the interface. I think there are two very >> different models at play, and both are valid: >> >> (a) when you are editing a dive (or multiple dives) I really think >> that you need to automatically (and silently) just create new >> divesites when somebody edits things (and this would be true whether >> the name changed or the GPS location changed, or both changed). >> >> So this would be the "quick-edit" thing as part of the dive location. >> > > I'll focus on this part since it's what I'm doing now - there's no Dive > Site Management Mode yet. > > Imagine that you have a dive with dive_site.name = "Blue Hole" with > coords, but it was a mistake and you wanna change to "Turtle Reef" > > If the user types the name of a dive site, let's say "Turtle Reef", it > should list on the dropdown > the list of all Turtle Reefs that it currently has ( plus the taxonomy or > the gps coords if taxonomy is not found ) > ( now I also think I should add the coords even if the taxonomy is found > because we can have two 'blue holes' in > the same country / place and such ) > > If the user clicks on a particular Turtle Reef from the drop down, it will > select *that* dive_site to be the dive's dive site, replacing coords. > > If the user clicks in nothing ( but changed the name of the dive site to > Turtle Reef), > the user will have yet another Turtle Reef dive site created for him with > no GPS coords. > > now here I can: > 1 - copy the coords from the old dive site > 2 - leave without no gps coords and ask him to enter it again. > 3 - Change the name of the the dive_site to be 'turtle reef' > 4 - Select the first Turtle Reef from the dive_table ans set it ( this is > what my last patch does ) > > I'll create the code for 1. > > And - I wanna make something that will make you happy and not hatred, so > that's why I'm asking a lot of questions here. > > > >> (b) there's a separate issue of some "dive site management mode" which >> is independent of the actual dives. >> >> So this would be some totally different mode, where you are *not* >> editing a dive, but you are doing things like "oh, let's clean up the >> name of that divesite that I've been to many times", or "Ugh, I have >> ten copies of this dive site, and they differ in minimal ways in >> spelling or are 10m apart in the GPS location, I want to merge these >> into one single dive site". >> >> I think (a) and (b) are completely different things, and have to work >> very differently. When I'm editing a dive and filling in the >> information for that dive, doing "dive site management" is absolutely >> the *last* thing the interface should do for me. It's why I absolutely >> *hated* how subsurface worked when you typed and auto-completed a >> dive-site name: it ended up then throwing out the GPS location you >> already had, and replacing it with some old dive site data. Which is >> really seriously buggered, especially since dive sites with the same >> name really are not unusual at all ("blue hole" being the classic >> example, but one I know well is "turtle reef", which is something >> Lahaina divers uses as a generic name encompassing many different dive >> sites, and if you didn't write up the actual specific name, you really >> can have "Turtle reef" with GPS locations ten _miles_ apart, rather >> than ten _meters_. >> >> And when you have two dives that are ten miles apart, the fact that >> they happen to share a name absolutely does *not* mean that they are >> the same divesite. It just means that maybe later you might want to >> specify the name better. Or maybe you'll never get around to it. >> >> Linus >> > >
From e2460acddcfb87d6fb9291184fcd0c3fa475004b Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Mon, 13 Jul 2015 17:11:03 -0300 Subject: [PATCH 5/5] Change Location Management to make Linus Happy Do not overwrite a dive site if the name is the same as any other dive site, create a new one and duplicate the information. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 66e42e3..2efaa52 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -841,8 +841,15 @@ void MainTab::updateDisplayedDiveSite() displayed_dive.dive_site_uuid = new_uuid; copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site); } else if (new_name.count() && orig_name != new_name) { - displayed_dive.dive_site_uuid = find_or_create_dive_site_with_name(qPrintable(new_name)); - copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site); + // As per linus request.: If I enter the name of a dive site, + // do not select a new one, but "clone" the old one and copy + // the information of it, just changing it's name. + uint32_t new_ds_uuid = create_dive_site(NULL); + struct dive_site *new_ds = get_dive_site_by_uuid(new_ds_uuid); + copy_dive_site(&displayed_dive_site, new_ds); + new_ds->name = copy_string(qPrintable(new_name)); + displayed_dive.dive_site_uuid = new_ds->uuid; + copy_dive_site(new_ds, &displayed_dive_site); } else { qDebug() << "Current divesite is the same as informed"; } -- 2.4.5
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
