aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
AgeCommit message (Collapse)Author
2015-04-24Allow images to be added via the webGravatar Robert C. Helling
This adds a new divelist context menu entry which asks for a URL. The file is retrieved and if it is an image it is added to the cache and the url is associated to dives as with local files. NB this currently only works with URLs pointing directly to images. But it should not be too hard to add the possibility to add a direction via an html file and its image tags. To test: open dives/test43.xml and delete the image and then add the URL http://euve10195.vserver.de/~robert/wreck.jpg Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-22When remembering the selection, don't try to be too smart with tripsGravatar Dirk Hohndel
We assumed that a trip was selected when all of its dives were selected instead of just remembering if the trip itself was selected. I'm sure there was a reason for that but I cannot think of any. But a side effect is that if you have a trip with only one dive in it and have that one dive selected and edit it, after saving your changes you end up on the trip (which is now also selected) and are no longer on the dive. And that seems quite wrong. The new code simply remembers that the trip was selected. And selects it again if it was. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14Add ability to undo removing of dives from tripsGravatar Grace Karanja
Add the functionality to undo/redo removing of dives from trips. The code calling remove_dive_from_trip has moved to the UndoCommands class. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-21GUI fix for OSX. Reduce the padding of the divelist header so that we don't ↵Gravatar Joakim Bygdell
obscure the first dive in the list. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-15Added warning when not all images can be added.Gravatar Jan Darowski
Added label in the ShiftImageTimesDialog which appears when not all of the selected images have timestamp in the checked range. Made cancel button in this widget actually work. Signed-off-by: Jan Darowski <jan.darowski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11Add option to undo deleted divesGravatar Grace Karanja
Add ability to undo deleted dives by storing a list of the deleted dives in a QUndoCommand. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11Reverse undo bufferGravatar Grace Karanja
Reverse all the code using the UndoBuffer class so that we can use the QUndoStack and QUndoCommand classes. These are Qt's own inbuild undo framework classes, offering a better undo/redo process. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Fix a regression on selection caused by the new interface codeGravatar Tomaz Canabrava
In the designer we set the selection type to extendedSelection but since I removed the widget from the designer, I also had to set it in the code. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove the ProfileWidget from mainwindow.uiGravatar Tomaz Canabrava
It is now in mainwindo.cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove information panel from mainwindow.uiGravatar Tomaz Canabrava
Now it's created in the mainwindow.cpp as part of the new way to configure the interface. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-09Add ability to undo deleted divesGravatar Grace Karanja
Before the dive is deleted, a copy is made and passed to the undo buffer. When edit->undo is clicked, this dive is restored to the dive list. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-06Delete dives using delete keyGravatar Grace Karanja
Allow users to delete dives using the delete key. [Dirk Hohndel: small whitespace fix; removed an unnecessary include file] Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17Clean up the header filesGravatar Dirk Hohndel
Lots and lots and lots of header files were being included without being needed. This attempts to clean some of that crud up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>