This class will surely be used on the mobile version, and it was very
tangled inside divepicturewidget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I`m now clearing the code for all use of Qt < 5, since Qt 5 was released
for quite a while and making two versions of Qt to work together is a bit
painfull.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The initial selection change signal seems to potentially be sent
before the listview is even visible when we do the first "scrollTo()"
to the currently selected dive.
That, in turn, seems to result in that when the listview is actually
shown, it will be scroll the trip description off the visible area,
and force the current dive to be shown at the very top of the
divelist. Which is not very nice: we do want to scroll to the current
dive, but we don't want to hide the current trip in the process.
Ignoring the selection change if the listview isn't even visible seems
to fix things for me.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes Collapse All only visible when its needed, and it
also fixes a crash when invocking collapse all when there was
nothing to collapse.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch unclutter the menu by hidding collapse all
when all dives are collapsed, and expand all when all
dives are expanded.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Dive context menu:
After the addition of the item "Add image(s) from web" the item
immediately above is "Add images". It is proper to specify now:
"Add image(s) from file(s)" to make the distinction clear. I also
change "Shift times" to "Shift dive times".
Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>