aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
AgeCommit message (Collapse)Author
2015-07-16Fix mouse interaction with the Location ListGravatar Tomaz Canabrava
paint methods should be used only to paint, not to trigger other widget behaviours ( we could got ourselves into a bad recursion bug from that ). Also, enabled mouse tracking to correctly track the mouse movement inside the widget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Change API signature to act on dive_site, not uuidGravatar Dirk Hohndel
This way in the future we can pass in a pointer to a dive site that isn't linked in our dive site list yet (i.e., while we are editing). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Dive edit: handle dive sites more sanely while editingGravatar Dirk Hohndel
While we edit things, displayed_dive_site is the authoratative source of data that should be displayed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Don't reset editMode when refreshing the displayGravatar Dirk Hohndel
Just because we want to update the latest information on the Notes tab doesn't mean we are done editing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Just call the member functionGravatar Dirk Hohndel
This code was embarrassingly indirect. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Dive site handling: make sure the data in displayed_dive is updatedGravatar Dirk Hohndel
After an edit when the dive is redisplayed we are not copying the data from current dive back over displayed dive (as the reasonable assumption is that we just edited the displayed dive and copied the information into the current dive)- so make sure that after the dive site handling the displayed dive does in fact have the correct dive site information. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-15Dive site handling: special case for auto generated divesGravatar Dirk Hohndel
When we download GPS data from the webservice we can end up with dive sites that are simply a place holder for the the GPS fix. If we replace the name of one of those sites we should just delete the site (assuming it isn't used in another dive, which is unlikely but theoretically possible). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-15Dive site handling: correctly handle the different scenariosGravatar Dirk Hohndel
- do not create dive sites unless the user has accepted the changes - all modification are tracked in the displayed_dive_site - when the user accepts the changes, the real dive site list (and the selected dives) are updated according to what is in the displayed_dive_site This adds quite verbose debugging messages and disables a section of code that has a special case for data created by the Subsurface web service. This code needs some re-thinking and should eventually go away. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Fix selecting the first indexGravatar Tomaz Canabrava
The way a QCompleter works is that it grabs whatever data it has in the completerRole and sets it back on the line edit. I Bypassed the QCompleter delegate to show something other than the completerRole (so, for instance, if you write 'B', you could get 'Blue Hole' as the returned text, but in fact the QCompleter has the 'B' as internal string (because of the weird - and wrong way in which we are dealing with completion - trying to complete for something that's not inside the model yet). So I hooked up a signal that will listen to the complete's index, and if it's the first row() it's surely the special case - then we bypass QCompleter return string and use our own. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Offer an option to just complete the textGravatar Tomaz Canabrava
Make the kids fight no more. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14Remove quick edit dive site widgetGravatar Tomaz Canabrava
Voted down by common consent. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Change Location Management to make Linus HappyGravatar Tomaz Canabrava
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 <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Move code that handles location to a sane placeGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Select right divesite on clickGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Get the selected dive site from the listGravatar Tomaz Canabrava
Hooked up an eventFilter on the QListView that displays our dive sites so it would filter the keys enter and space, storing the current dive_site uuid when that happens. Also it stores the uuid on clicks. Now we need to get that information when processing acceptedChanges() and check if the uuid stored there == displayed_dive_site.uuid and also if text != displayed_dive_site.name, because if the user didn't click on anything but only wrote stuff on the LineEdit no dive site would be selected and so uuid == displayed_dive_site.uuid (wich would mean 'no changes') Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-09Teach divemode editing about multiple dc'sGravatar Anton Lundin
This teaches the edit divemode about the fact that we can have multiple dc's with different divemodes. The previous code always just edited the first dc. This was reported by Ian Pitt in: https://groups.google.com/forum/#!category-topic/subsurface-divelog/4Zf47KS4Ifk Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Show the correct delegate on the completerGravatar Tomaz Canabrava
For some reason the completer wouldn't show the delegate if the line order of the code was different. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05Correct logicGravatar Robert C. Helling
At least my compiler warns about ! binding stronger than == and thus comparing a bool to an int. I guess this is what was meant. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Notes pane: don't show empty taxonomy tagsGravatar Dirk Hohndel
No point in searching for the right tag if the user picked no taxonomy to be shown. And no point in showing an empty value, either. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Rename enum values for taxonomyGravatar Dirk Hohndel
This avoids confusion and namespace collisions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Merge branch 'taxonomy'Gravatar Dirk Hohndel
2015-07-02Remove a few more debug messagesGravatar Dirk Hohndel
Yes, I could go back and try to fix the earlier commits. This is easier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Trigger reverse geo lookup by pressing the buttonGravatar Dirk Hohndel
This may not be the best UI, but for now it works. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Notes pane: don't show taxonomy info for trip locationGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02Notes pane: move the location taxonomy to a better spotGravatar Dirk Hohndel
And display it smaller, marked as "tags". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Correctly display the data on the delegateGravatar Tomaz Canabrava
A bit more complex than I tought it would be (and a ton of trial and error to find the right spot on the delegate to draw stuff) this delegate follows the current style (so it should be okaish on a dark and on a light theme) This is supposed to work on a QCompleter, but it doesn't (I really don't know why, so maybe I'll remove that completer. sigh.) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Added again a QCompleter to show the possibilitiesGravatar Tomaz Canabrava
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Remove location completion modelGravatar Tomaz Canabrava
This is a functional but hard to expand model for the dive sites. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01Geo taxonomy: show the chosen taxonomy entries in the notes paneGravatar Dirk Hohndel
This isn't perfect - I'd like to have them show behind the word Location instead as what we have now creates movement in the position of the fields on the screen which I think is distracting. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-27Dive site rewrite: be smarter when dealing with auto created sitesGravatar Dirk Hohndel
If we download dive site locations from the companion app we can be slightly smarter if the user overwrite the location feel on the Notes tab. We can be pretty sure that they wanted to keep the GPS location and just correct the dive site name (or possibly assign that location to an existing dive site). This tries to accomplish that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-27Dive site rewrite: mark location field as soon as editing startsGravatar Dirk Hohndel
Don't wait until the user switches focus to a different part of the tab to mark the location field. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: make trip location edit workGravatar Dirk Hohndel
Don't erase the trip information after the user started editing it. Don't act as if a dive was edited - it's trip information we are modifying. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: clearing the location field means no dive siteGravatar Dirk Hohndel
If the user wants to remove the dive site from a dive they need to be able to do that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: fix adding a new dive and chaning notes / descriptionGravatar Tomaz Canabrava
I had to create an event filter to deal with the missing callbacks from QPlainTextEdit (it doesn't support editingFinished()). Also we need to manually create a dive site on a newly added dive if the user entered one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: change the default sizes of the dialogGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: do not use Qt Model MatchGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: fix potential crashGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: copy the changed dive site to the originalGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: create a dive site if string doesn't existGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: mark location as changed when a dive site changesGravatar Tomaz Canabrava
Not sure this is the best approach. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: better member nameGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: try to fix a crashGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: copy the current dive to the displayed diveGravatar Tomaz Canabrava
This way we can actually edit something. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: correctly position the edit site widgetGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: create a dive site edit dialog without bordersGravatar Tomaz Canabrava
Plan is to make it pretty later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: add the taxonomy labels for the dive sitesGravatar Tomaz Canabrava
This doesn't work yet because we don't get the taxonomy from the geo referencing services yet - but it's ready to be populated. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: use a QCompleter to show the list of dive sitesGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Dive site rewrite: location edit on notes tab is again a LineEditGravatar Tomaz Canabrava
Hopefully we now have the UI semantics figured out. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Fix a number of resource leaksGravatar Dirk Hohndel
Free memory returned from parse_mkvi_value() Free memory returned from printGPSCoords() Free memory allocated in added_list and removed_list Free memory allocated when adding suffix to dive site name Free memory allocated in cache_deco_state() Free memory allocated in build_filename() Free memory allocated in get_utf8() Free memory allocated in alloc_dive() Free memory allocated as cache but never used Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16Remove all the no longer necessary code that aborts read of first V2 fileGravatar Dirk Hohndel
This was a poorly implemented hack when we executed the reverse geo lookup in the main thread and opening a V2 file could take a very long time. We need to do the "Welcome" message quite differently. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>