aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
AgeCommit message (Collapse)Author
2014-12-29Move the Facebook send profile buttonGravatar Tomaz Canabrava
Move from the Dive List context menu to the Dive Info tab, it will only appear when connected to Facebook. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-25Send an experimental file to the experimental album on FacebookGravatar Tomaz Canabrava
And I had to create the Http header by hand because I couldn't figure out how to do using HttpMultiPart from Qt. not fun. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-24Changed Facebook stuff to socialnetworks.h/cppGravatar Tomaz Canabrava
All Facebook related stuff now is on SocialNetworks.h/cpp this makes it much easier to implement things and looking for bugs. working: - logging in - getting user id - getting album id ( or creating it ) *much* more testing is needed, of course. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-24Create a Facebook album for SubsurfaceGravatar Tomaz Canabrava
We still need to do a lot of stuff on that part. Currently when asking for sending a profile, it will just create a private album. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-13Move the filters code to it's own file.Gravatar Tomaz Canabrava
We already have a bunch of filters, let's pack them together Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-12Deselect dives that are no longer shown as the dive list is filteredGravatar Dirk Hohndel
This cleans up the way we ensure that all dives are handled as the dive list is filtered. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-10Be more careful when restoring a selection in the presence of filtersGravatar Dirk Hohndel
Try really hard to ensure there remains a valid selection. Only if none of the dives are selectable should we give up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-09Don't crash when restoring the selectionGravatar Dirk Hohndel
If we end up trying to restore the selection where the selected dive is no longer visible (i.e., it's now filtered away), this code caused a crash by falling first() on an empty list. Let's not do that. Fixes #758
2014-11-03Correctly unselect trips when dive list filters changeGravatar Dirk Hohndel
Oddly Qt left the trips selected (but all dives where unselected in the UI). This got our internal state rather confused. With this change we clean up that mess and go back to just having those dives that were originally selected and are still visible show up as selected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31TagFilter -> MultiFilterGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31Ctrl+F now opens the Tag FilterGravatar Tomaz Canabrava
And old code for the old searchbar removed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27divelistview.cpp: move a variable in a Q_OS_MAC branchGravatar Lubomir I. Ivanov
Not used on other OS and triggers a warning. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18Dynamic dive trip list column widthsGravatar Giuseppe Bilotta
Compute the default widths for the columns in the dive trip list from their header and (expected) content length rather than some fixed pixel sizes. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-02Add possibility to filter by more than one criteria at a timeGravatar Tomaz Canabrava
This new version of the TagFilterSortModel actually accepts *any* new MultiFilterInterface. So, how to use it to create a new filter: Implement a class that inherits from MultiFilterInterface Implement the filterRow method TagFilterSortModel::instance->add( myClass ); and you are done. [Dirk Hohndel: removed some debug code and did whitespace cleanup] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17Random whitespace updateGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17Correctly filter dives. (trips are always shown)Gravatar Tomaz Canabrava
This patch correctly filter dives based on tags, but it will also keep showing all the empty trips. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-26Small whitespace cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-26DiveList: don't save default column widthGravatar Dirk Hohndel
This is an elegant way around our problem with people who have the horrible old "100px" column width in their settings. The first time they run Subsurface after this fix things won't get better, but the offending keys will be deleted at exit. And the second time they run, they'll get the much more sensible new default widths. Thanks to Thiago for this idea. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-22Divelist: Use more sensible default column widthsGravatar Dirk Hohndel
Having 100px wide columns was simplistic and stupid. It was never intended to stay that way. See #712 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21Fix selection logic when manually adding a diveGravatar Dirk Hohndel
This was an interesting bug. When adding a dive that would end up in the middle of the dive list, the newest dive in the dive list would end up marked in the dive structure as selected - even though it wasn't visualized as selected by Qt. Bad things happen if the user then made changes to that dive without selecting something else first, for example by either editing the dive or doing things to it like removing it from or adding it to a trip. The same operation would also be applied to the newest dive in the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21Dive list: seriously simplify the "add to trip" codeGravatar Dirk Hohndel
The existing code seemed way complicated, made way too many assumptions and apparently was broken in certain cases. This code seems very simple, looks correct and should fail gracefully (i.e. simply do nothing) if things get confused. Fixes #706 (I hope) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11Rename the model column from NITROX to GASGravatar Anton Lundin
The column isn't just about NITROX, there might be air and trimix in there too. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Do not recreate all the dive just because a picture was added.Gravatar Tomaz Canabrava
If we add a picture to the dive, this will not change anything else, so there's no need to recalculate the profile_plot info. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Only repopulate the dive info once ( we were repopulating 4 times )Gravatar Tomaz Canabrava
This makes the screen repopulate itself after a dive change only one time instead of the old 4. we were repopulateing when we removed the actual selection to reset the old selection previously stored, sigh. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15Do not create a backup for Q_FOREACH containerGravatar Tomaz Canabrava
Q_FOREACH will expand and already creates a copy of the contained container, so this is just a waste of cpu cycles and also increases a tiny bit the memory consumption. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11divelistview capitalisation consitencyGravatar Tim Wootton
affects mainly capitalisation on the dive list context menu Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08Picture handling: make sure pictures are shown after they were addedGravatar Dirk Hohndel
We need to first replot() to get displayed_dive updated, then call refreshDisplay() so the picture model gets repopulated which triggers the pictures to show up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26Fix crash when trying to add a dive or plan when a filter is active.Gravatar Tomaz Canabrava
The planner used the selected dive on the dive list, and when there's a filtering in action it can be in a state where there's no dive selected. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03Fix linked list corruption, move code to C.Gravatar Tomaz Canabrava
The picture list is a single linked list where the pictures have a node to their next element. When adding the same picture to two dives, things got way way wrong and crashes were appearing. This will replicate the information (filename, latitude and longitude) for each dive that has the picture, BUT it still tries to save as much as possible on the actual pixmap. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02Break picture handling code from C++ to C.Gravatar Tomaz Canabrava
This commit breaks the loading of images that were done in the divelist into smaller bits. A bit of code refactor was done in order to correct the placement of a few methods. ShiftTimesDialog::EpochFromExiv got moved to Exif::epoch dive_add_picture is now used instead of add_event picture_load_exif_data got implemented using the old listview code. dive_set_geodata_from_picture got implemented using the old listview code. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Do not replot for each picture added to dive.Gravatar Tomaz Canabrava
Instead wait until all pictures have been set and plot that. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Fix crash on adding / removing a dives from add menuGravatar Tomaz Canabrava
This patch removes some inconsistencies that were happening on the add dive / cancel actions. a bit of legacy code from the old system was still in, which made things quite... EXPLOSIVE. This fixes restoring the selection only if we have a selection and not deleting the temporary dive twice. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive list: use helper function when restoring selectionGravatar Dirk Hohndel
Looping over the individual dives will be very slow if there are many of them, as the profile will try to render each of them in succession. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Minor cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25Dive list: make saving / restoring column widths actually workGravatar Dirk Hohndel
It's a testament to how much I mess around with things that I hadn't noticed that saving the column width doesn't actually work. Or actually, saving them worked, loading them back failed as it was done too early and the setColumnWidth() calls had no effect - and so the next time we quit subsurface, the default width of 100 was written over all the saved values. This seems like an incredible hack but it has the advantage of actually working. I look forward to someone with better insides into the inner workings of Qt to properly fix this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25Dive list: don't reset column width when reloadingGravatar Dirk Hohndel
We set the column width in the dive list widget when we create that widget, based on what is in the settings. And we save the current column width back to the settings when we destroy that widget (so if Subsurface is shut down correctly and Qt actually gets to run the destructor but not when someone kills the program). That means that if we recreate the dive list at any point while Subsurface is running (and we do that a lot when you manipulate your dive list in any way shape or form), any changes to the column widths are lost. DiveListView::reload() explicitly calls setupUi() which reads the column widths back from the settings - but changes made to the columns aren't saved to the settings until we destroy the widget... I see no reason why reload() should call setupUi(), so I'm removing that call. Let's hope this doesn't break anything else. Fixes #518 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25Dive list: remember the current sort columGravatar Dirk Hohndel
Silly bug. We never actually remembered our current sort column when changing the sort order. See #518 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Speed up the multi dive selectionGravatar Tomaz Canabrava
Dirk's code in commit a3d300ca919d ("Correctly implement multi dive selection") had a major flaw - it kept redrawing the selected dives one after another. Not what we need. So this fixes this up so that it doesn't take more than a sec to select all the dives that are on the same part of the click on the globe. I've achieved this by creating a boolean ' dontEmitDiveChanged and sending the signal only if this flag is false. The reason that we can't simply remove the emit from the selectionChanged is because the selectionChanged is what we have when we click on the diveList, if we removed this from there, nothing will happen upon selection. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Correctly implement multi dive selectionGravatar Dirk Hohndel
The old code had several issues. It broke the synchronization between dive->select and Qt selected status and worse, it would partially unselect previously selected dives when called. This patch, however, causes the selection via the map to be glacially slow because it forces a redraw of every single selected profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Dive list: move trip merging logic into divelist.cGravatar Dirk Hohndel
This also fixes a couple of issues with the existing code: - removes a memory leak - treats null and "" the same Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Dive list: work around odd problem with selectionsGravatar Dirk Hohndel
According to the documentation clearSelection() should emit selectionChanged() - but I can verify in the debugger that sometimes this doesn't appear to happen - consequently our notion of what's selected gets confused. To work around this, after calling clearSelection() we simply manuall deselect all dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Dive list: move trip selection / deselection logic to divelist.cGravatar Dirk Hohndel
This is core logic, not UI code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Dive list: more consistent handling of "add to trip"Gravatar Dirk Hohndel
When multiple dives are selected, we need to be smarter about when to show "add to trip immediately above" or "... below". This code is quite readable, I think, and does the trick. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Add some helper functionsGravatar Dirk Hohndel
First step towards getting the "add to trip" logic in the divelist context menu to be consistent and correct. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24Remove export and save as from dive list context menuGravatar Dirk Hohndel
The context menu is getting way too big and confusing. This is now much more cleanly done from the File->Export dialog. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Implementing export dialogGravatar Miika Turkia
As our menus are getting many export entries, it is better to create a single export dialog where user is able to select the export type and whether to export selected dives or all of them. This should also be more intuitive than the current way when export from file menu export all dives and right click menu on divelist exports only selected dives. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Migrate code to for_each_dive and for_each_dcGravatar Anton Lundin
[Dirk Hohndel: this overlapped with my commit 09e7c61feeea ("Consistently use for_each_dive (and use it correctly)") so I took the pieces that I had missed] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Consistently use for_each_dive (and use it correctly)Gravatar Dirk Hohndel
The way the macro is written there is no need to test the dive against NULL before dereferencing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Dive list: add context menu function to renumber dive(s)Gravatar Dirk Hohndel
No attempt is made to ensure that what the user does is sane. So this can result in duplicate numbers, non-consecutive numbers, non-monotonous numbers, whatever floats the users boat. You can renumber a single dive or all selected dives (with a starting number given that is applied to the oldest selected dive and then for each newer selected dive that number is incremented by one). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>