Give the export dialog a better name than just dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
[Dirk Hohndel: combined two commits into one and cleaned up some
whitespace issues]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new profile code handles the resizing of the profile area in order to
accomodate the depth and time of the dive much more intuitively - the old
manual buttons to do so are no longer needed.
This also removes a few other unused methods.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes mouse dragging work as it should, a tiny
bit different than the old version, but I think it's a better
way. What's missing: Keyboard actions.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code is not ported to the new profile, but from what I
can understand from it, it doesn't need to be. The purpose
of this code was to setup the correct colors and strings
for the current mouse position, we already do this on the
Profile in a different way, on the Notification Area.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The QGraphicsView system moves every selected item when the user
clicks and drags one. This patch makes a cache of all selected
items and removes the selection on them. When the user stops dragging
the Notification, the selection is restored.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a itemChange method, that emits a 'changed'
signal when the handler is moved. I'll use that signal on
the profile to call the correct method.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The UI design looked too tight in my screen.
The explanation texts were a bit inconsistent (and in one case simply
wrong).
The explanation for the initial selection wasn't shown.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When choosing a format from the export dialog a two line description of
the format appears. This is helpful and prevents confusion.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All code that was removed already is working on the New Profile,
The code that's behind #if 0 means that it still needs to be ported and
because of some removal, it was not possible to keep it compiling (mostly
the removal of the Ruler class, that is the Axis, on the new profile).
The rest of the code that's untouched - most probably will keep that way.
The DivePlannerPointsModel is correct and well done, no need to change
that, only the Graphics part.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But it doesn't move the handlers yet, and when you confirm it you also
must click on the dive to select it or the profile will show garbage.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A signal can connect to another signal, so I removed a slot that had the
sole purpose to call another signal and replaced that with a direct call.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code adds the disconnections of temporaries. A temporary connection
is a connection that should be active only on a certain state, and we need
to clean that for the new state that will enter after.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Those two functions are important and necessary for the Planner, they
create and remove the little balls that act as handlers so the profile
can be edited with the mouse.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a signal to MainTab, that should be removed from there
when we finish the rework on the edit part, to go to the edit classes,
but in the meantime, let's keep it there.
The signal is connected to the ProfileWidget in a way that the end of the
edit will also trigger the profile to go back to ProfileState (show the
dive, if there's any) or empty Profile (if there's none).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is highly broken in many ways - but it's the right first step.
I ported two of the most important methods from the old profile and now if
you are in add dive mode, double clicking on the new profile will
correctly add a handler on the planned dive. To see and move the handler
around, however, you need to activate the old planner.
Next step: add the handlers on the new profile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a temporary measure to help me port the planner to
the new profile. it will be removed when I finish the port,
but it makes the software still usable, so there's no worris.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code checked if dest and source existed before trying to call an
method on them, but dest and source are created on the constructor,
and thus, the if is dummy.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As with any other graphics object, the settings for the ruler
should be managed by the ruler, clearing up the Profile logic
and making the code easier to read.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We used both preferencesChanged and settingsChanged in different
methods and classes to mean the same thing, this adds consistency.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The list of preferences that should trigger a full repaint are at the top
of this method, *if* this introduces a bug it is because some of the
preferences are not being correctly triaged yet and that needs to be
fixed. Regardless of that, now the profile will only enable / disable
the *ruler* instead of replotting everything.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The QSettings is a bit bloated on its use, so we are trying to narrow
down the amount of calls to it. We have a preferences struct, use that
instead.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By moving the Hide/Show of the ruler to an internal method, we gain a bit
of codecleanuperism by removing a lot of unnecessary calls to their dest
and source drag-handlers.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The logic of removing the event was in the UI, and this makes
the code harder to test because we need to take into account
also the events that the interface is receiving, instead of
only relying on the algorithm to test.
so, now it lives in dive.h/.c and a unittest is easyer to make.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the ability to close the exporting window, also Quit Subsurface with
this window in front, for consistency.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the ability to export selected dives only in the worldmap
exporter. After Miika added the export dialog in commit 7dc642860d
("Implementing export dialog") and exporting only selected dives became a
choice while exporting.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
The old code replotted the whole dive, while what we really wanted was to
show the events. so just ->show() them.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The 'Hide Similar Events' function asked the Profile to replot eveything,
only because some events were hidden from the interface. Instead of that
we can simply hide the events since the graph will be the same.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That macro was useless, I should have been drunk when I wrote it, and I
don't drink.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[Dirk Hohndel: this overlapped with my commit 09e7c61fee ("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>
Commit fb82da58a2 ("Globe: assume that we are looking at the
current_dive") changed the prototype for
GlobeGPS::prepareForGetDiveCoordinates. This patches the dummy in
NO_MARBLE.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 2bc76beb65 ("Globe: we always center on the current dive") changed
GlobeGPS::centerOn to GlobeGPS::centerOnCurrentDive. This patches the
dummy in NO_MARBLE, too.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
If a dive has multiple dive computers we enable a special context menu
when the user right-clicks on the dive computer name AND is not already
showing the first dive computer. In that case we offer to make the
currently shown dive computer the first one.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For most users this is no change at all. For the few who download from
multiple dive computers this now shows them which of them is the primary
dive computer.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses the new helper function from commit fc4f133f19d0 ("Add new
helper function that looks up the index of a dive by its uniq ID") to make
the logic implemented in commit 122593a63a46 ("Fix selection after
downloading dives from the dive computer") much saner to read.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we successfully download dives, the old selection should be cleared and
the one of the newly downloaded dives should be selected. I decided to
pick the last dive downloaded, which for most dive computers (but for
example not for the Uemis SDA) will be the first or earliest of the dives.
That seems much more intuitive than keeping the previous selection around.
Of course this is harder than it should be because of the way we track
selections and because we need a consistent dive list model in order to
change the selection.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The original name was a really bad choice as we have a 'diveid' as part of
struct divecomputer - and that is not the diveid that is being used here.
Instead we use the 'id' member of struct dive which holds the "unique ID"
for this dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old code was completely bogus - it's confused about what the variable
'i' is counting.
This also let's us select the Uemis mount point by default if that's the
only valid "device" that we found.
Compile tested on Windows, untested on Mac.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user selects a Uemis divecomputer, don't show serial devices.
If the user selects a serial divecomputer, don't show the Uemis
filesystem.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the last key that went in ended a tag and the next key is a tab -
deliver that to the TabWidget instead so we can navigate between input
fields.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may sound counterintuitive but it actually makes sense.
If you have a default filename that's the name of you "normal working
file". If you want "Save as" something, that by definition is NOT your
normal working file but a subset or an experiment or something. And you
most definitely do NOT want to overwrite your default file with that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
C specs says that we can safelly free a NULL pointer, so there's no reason
to check if it's null before freeing it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit renames getDiveById to get_dive_by_id, and it also removes the
Q_ASSERTS and if(!dive) return that the callers of this function were
calling. If it has a Q_ASSERT this means that the dive must exist,
so checking for nullness was bogus too. I've changed the assert (done
in a silly C-Way.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The DiveList classes were a partial mess (and some of it is still in a
messy state). The classes that deal with it where done in 'qtHelpers.h',
the extern global variable in dive.h, a few methods here and there. This
concentrates most - but not all - functions in their own file. The reason
for that is to make the new developer faster when looking for things: if
it's a divecomputer related method, it should be in a single file, not
scattered around.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Last time I touched this I got a scream from dirk, but then I
looked at the code again and the problem that I faced was that
I broke translations in a sad way, well, now I broke it again.
However, this method shouldn't belong to MainTab ( because of
that thingy that I said before and also many others: Separate
the logic of your application from the UI specific code )
This generates a string that's going to be used on the Interface,
it doesn't display it on the interface. Move it down below makes
it easier to test ( I don't need to create an Widget and worry
about the parent-relationship with the mainwindow just to test
this function, for instance. )
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QStrings shouldn't be == "" to check for empty string, use .isEmpty()
QStrings shouldn't be != "" to check for non empty, use .size()
std::string shouldn't be cleared with = "", use .clear()
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
4243fcb915 ("Dont set coordinates when two or more dives are selected")
Changed how the prototypes in GlobeGPS looks. This aligns NO_MARBLE
version of GlobeGPS with that.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Upon pressing Ctrl-Q or the window close button a modal dialog was shown
to remind the user that the planned dive is not saved. This patch
triggers the "cancel plan" action before trying to quit.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For deco stops show the gas of the next segment in the table. In
recalculation remove old deco stops earlier.
In struct diveplan, the items are "segments" with a beginning, a duration,
and a gas. In contrast, the UI of the planner uses "waypoints" which are
the boundaries between segments. It is conventional at least for deco
stops to display the gas of the _next_ segment in the runtime table (i.e.
the gas possibly to be switched to).
Furthermore, in addStop, the old deco stops have to be removed earlier as
otherwise a new waypoint later than a previous generated gas switch
inherits the gas of the old switch.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Same problem as the previous commit: toStdString() returns a temporary,
and c_str() will return a pointer to internal data, freed at the end of
the statement. So get the pointer to be strcpy'ed in the same statement.
Changed to toUtf8() to be more explicit about the encoding and to avoid
std::string
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QList::first() returns a reference to an item, but that list was a
temporary. The list gets destroyed at the end of the statement (the
semi-colon), so we ended up keeping a reference to freed data (i.e., a
dangling pointer)
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This re-adds this code that got removed in a209dfbfd5 ("Multi dive
edit: don't change location texts until user saves the change")
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise the code loading a dive into the field would mark it as
changed.
This re-adds this code that got removed in a209dfbfd5 ("Multi dive
edit: don't change location texts until user saves the change")
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This still gets it wrong (i.e. marks things as edited when they are not or
not edited when they are) but at least they are no longer incorrectly
marked as incorrectly parsed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I cannot figure out how to get the hemisphere letters translated correctly
in qthelper.cpp. Short term hack for now - someone who understands how
this is supposed to work really needs to take a look.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As in commit 3870bdafee53 ("Globe: we always center on the current dive")
passing in a specific dive here makes no sense - it's always about the
current dive.
Fixes#513
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simplify the API (we'll take advantage of this in the next commit).
We always center the globe on the current dive, so no point in passing
that dive in.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we keep updating the location text of all selected dives we can lose
the status of which dives had the same text of the original dive and which
did not (this happens if the location we are adding is identical to a
selected location but adds text to the end of it).
Now we only edit the other dives after we accepted the change.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't understand why we wouldn't set the percentage if we displayed text
there as well. This looks much better.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is based on Linus' idea on the mailing list.
Treat NULL strings and empty strings as identical.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This time for values that aren't simply text.
For normal integers this is rather straight forward. For the 'when'
timestamp we simply assume that this is a shift in time.
What is still missing is consistent handling of the three fields that are
implemented as tags: tags, buddy and divemaster. We have special code for
tags that makes no sense in a multi-edit scenario. And we treat divemaster
and buddy as a single string - which kinda works but treats "Bill, Joe"
and "Joe, Bill" as different.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was broken when porting to Qt - we used to do this correctly in the
Gtk version.
When editing multiple dives we show the current dive to the user and allow
them to edit that and then apply those edits to all selected dives. The
way this is SUPPOSED to work is that we only change those selected dives
that had the same value for the edited field as the current_dive had for
that field.
Let's say you select ten dives. The current dive shows divemaster Joe. You
change that to divemaster Jim. Then only the selected dives that had
divemaster Joe should change to Jim. All other dives should stay
unchanged.
This seems to implement that logic.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The way this is implemented is broken in several ways.
This fixes the first issue.
For the invocations where we are in the 'WHAT' checking to see if the
value we are changing in the selected dive was previously the same as in
the current dive (which is the one shown to the user for editing), then we
need to make sure we change the current dive last, otherwise the
comparison will fail.
Of course, right now we only do this check for gps location, which is a
massive bug as far as I am concerned.
Fixes#515
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I we are showing a calculated ceiling, then we have to replot the profile
after a preferences change as the gradient factors could have changed
which might change a calculated ceiling.
Also use the rulergraph preference instead of checking the settings
directly.
Fixes#511
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QVariant does the right thing, regardless of whether the value is stored
as int or as string - so let's just use that instead of manually checking
for integers (and failing if the values are stored as "true" and "false").
Fixes#511
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit bcdd6192fe ("Show translated event names in tooltip") I was
too aggressive in replacing the checking for event names with checking for
event types. It turns out that we are abusing an existing event type in
the planner (and use a different event name to mark the difference). By
just checking for the type this now caused incorrect information to be
displayed in the info box (a simply "PO2 warning" on a Suunto D9 could
turn into a "Bailing out to OC" notice).
The correct fix is to get our own range of SAMPLE_EVENT_xxx numbers from
libdivecomputer. Once we have those, we can do this the right way. For now
we just fall back to also checking the event name (which is what I wanted
to get away from so translated names don't trip us up).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 7f3b487c77 ("Restore the previous globe zoom level after
showing dive without GPS") I was a bit too aggressive in replacing a
deprecated API function - people still need to be able to compile against
Marble versions older than 4.10.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user changes the coordinates for a dive but then cancels the dive
edit, the globe would stay at the location that was temporarily set and
not rotate back to the still active coordinates.
This fixes it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently this only happens on Windows, but there we would change the
dive coordinates on a SINGLE click when editing a dive. With this change
we simply bail if the event isn't a double click.
Fixes#505
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a trip is selected (or for other reasons more than one dive), this
would change the GPS coordinates of the whole selection which almost
certainly isn't what the user wanted.
Instead, only allow changes of the coordinates on the globe if exactly one
dive is selected.
[Dirk Hohndel: massively rewritten and extended - but I didn't want to
simply "steal" the commit from Tomaz...
This now maintains the "zoom out mode" for dives without
GPS coordinates and deals with edits of multiple dives that
are initiated the "normal way" by starting to edit other
data as well.]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Thanks to commit 83c5ab5871 ("Zoom out when dive has no coords.") we
show more of the globe when displaying dives without GPS data - but that
caused us to forget the zoom level we used before and so the experience
when switching back to a dive with GPS data was disappointing.
This makes sure we track the last valid zoom level and restore it when
needed.
I also replaced the deprecated zoomView() calls with setZoom() calls.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Mouse activity on the globe should not select dives when one or more dives
are being edited. This improves the detection of that state.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes the globe zoom out to show it complete when
the dive has no coordinates.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "is_air()" test works when we have the gases in permille, but not in
percent. In that case we can just check for He == 0 and O2 == 21.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order for this to work we need to compare against the event type
instead of the event name - which makes much more sense to do, anyway.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The behavior at startup is actually very annoying: we select the latest
dive, and expand the trip it is in, but since we use "scrollTo()" on
just the dive, and it's not initially visible, the startup will make the
first dive be at the top of the list view.
Which means that the actual _trip_ detail is not visible at all, since
it will have been scrolled off the list view entirely.
Fix this by first scrolling to the trip, and only then scrolling to the
actual dive (using the default "EnsureVisible" policy). Obviously, if
it's a trip with lots of dives, scrolling to the dive may end up
scrolling away from the trip header again, but at least that never
happens at startup, and at that point you have to scroll away from the
trip just to show the dive.
Do this same dance when changing the dive selection (mainly noticeable
when picking dives on the globe view).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having all the grid lines in the same color made things visually
confusing. To clean this up a little make the heartrate lines a light gray
color.
Fixes#484
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing the location string we try to be smart and automatically add
the correct coordinates (assuming we have a location of this name already
in the dive list). So if you return to the same dive spot you'll get the
correct coordinates by default. But this creates bogus result if we allow
an empty location to be matched, as it makes no sense to assume that all
dives without a location name were at the same coordinates.
Fixes#498
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
DateTimeOriginal should be used as first option when loading images.
When images are modified, the original time should be retained, but the
DateTime will change to the edit time.
See #495
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds option to export selected dives into a CSV file to the right
click menu on dive list.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds an item to File menu to export all dives in CSV format.
Naturally this includes also the code to perform the export.
Fixes#434
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When exporting UDDF logs the file name selection dialog should talk
about export, not save. This patch changes that text
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fixing the Hotkeys inconsistencies in subsurface, All the popups should
react to 'esc' and 'ctrl-w'/'cmd-w' as 'cancel'. also 'ctrl-q'/'cmd-q'
should quit subsurface.
Fixes#489
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adding the ability to close the shift times window, also Quit subsurface
with this window in front.
See #489
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds the ability to close the about window with the ctrl + w
shortcut.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add ability to quit Subsurface with a Ctrl-Q shortcut even if the yearly
statistics window is active.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This enables closing the yearly statistics window with esc or ctrl+w
keys.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add ability to close the user manual window with a Ctrl-W shortcut.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds more handling of missing actions for the mouse on
the equipment edition. It complements the stuff talked about
on bug 359, but it's a different issue. 359 seems already fixed.
See #359
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a download is canceled, discard the partially downloaded dives.
Fixes#341
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Using the auto-completer while the tags widget is 'empty', always picked
the first choice.
Write some letters and remove them in an empty tags widget, the complete
list of tags will appear - now if you try to choose any tag with the
keyboard arrows it will choose the first one. also if you tried choosing
it by mouse it will be inserted twice.
This is fixed by removing the unneeded else part.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a manually added dive is saved we cancel the plan. In that process
we throw away the cylinders which triggers a redraw of the profile. Which
tries to access the diveplan and its data points that have already been
freed. BOOM.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When changing the values of air/water temp after the first time and save,
it will be reset the intial value.
This is fixed by removing the "select_dc" (which makes the change to the
dive struct instead).
Fixes#457
Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a preferences setting, it should belong to the preferences
structure.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This marks a lot of todo's where I think there's core stuff being mangled
on the interface - we should remove this from the interface to make
testing and maintenability easier.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rewrite of the actual planner logic. Now ascend to the next potential stop
depth. There the state is cached and we try to ascend to the next stop
depth. If we hit the ceiling while doing that we go back to the cached
state and wait there for a minute. Then we try again. Then loop.
Converted all depth related variables from unsigned int to int. During
planning, in a time step the current depth can temporarily be negative and
comparisons of a negative int with an unsigned it have not the result I
expected ( (int) -2 < (unsigned int) 3 turns out to be false). And we
don’t really need the 32nd bit that unsigned buys us for depths.
Deco stops are now shown in the same table as manually entered stops in
boldface (I removed the second table to save screen estate).
The gas shown in the table is still misleading as it means the gas used on
the segment leading up to that event.
The update of the profile only works partially upon changes in the list of
available gases.
Treatment of various gases is basically there but needs some more love.
The ascent velocity is now provided by a function that takes the current
depth as argument. Currently it always returns 10m/min but that will later
be variable (and hopefully user configurable).
The profile is not redrawn while deco is computed (avoiding an infinite
recursion).
The table got a new column for the duration of a segment while the old
“duration” column was renamed “Runtime” to reflect what it actually shows.
Currently, only the run time but not the duration are editable.
All deco gases are used from the depth where their pO2 is 1.4bar. This
should become more flexible.
Calculation of the pressure drop in cylinders without configured volumes
is suppressed. This solves a problem with the planner crashing when saving
a dive where not all cylinders had been manually given a volume.
[Short rant break: Treating 0/0 as air bites back at so many places. E.g.
Cylinder data is initialized with memsetting the whole structures to 0.
Then later suddenly this totally unconfigured cylinder is being treated as
it would contain air. Maybe at some point this was a feature. But it lead
to a naughty bug which took me over an hour to resolve. We should
seriously reconsider this choice and better move to 209/0 being air if
changing this everywhere is not too much trouble]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-Renaming prefs members for consistency.
-Changing references of QSettings to the prefs structure instead.
-Removing unused functions in pref.h were left over from an old version.
-Changing the data-type of bool members to short for consistency with other members.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- move buttons to the bottom of the window
- use QDialogButtonBox that allows to follow platform-dependent button layout
- enlarge window size to not to crop content
- change "Close" button action from "accept" to "reject"
Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move the heart rate graph icon up in the toolbox with the cluster of
buttons that control graphs
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existing code for toggling the DC reported ceiling in red or "surface
color" clearly had never been tested.
This seems to create a reasonably attractive implementation - not exactly
what we had in the past, but good enough.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The userid of Subsurface Webservice can be included in locally saved xml
files and git repository.
For xml files, it is stored in userid tag. For git repo, it is stored
in 00-Subsurface file present in the repo.
Preference dialog and webservice dialog modified to include option
for saving userid locally.
In case of difference in default userid and userid in local file,
some semantics are followed. These can be referred to here:
http://lists.hohndel.org/pipermail/subsurface/2014-April/011422.htmlFixes#473
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As a warining for the user mark the field red.
If the user inputs invalid input that will be ignored
while parsing.
But with adding a one character error margin to prevent it from toggling
between Red and Yellow while editing existing values, for example "After
Deleting unit and last number after '.'"
Signed-off-by: Yousef Hamza <jo.adam.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The include path is set up correctly so we don't need these explicit paths
in includes.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After adding the animation member in the preference struct, it is
very resonable to change these references of QSettings to the
preference structure instead.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adds new push button "HR" to the button bar on the dive profile to
toggle display of heart rate.
TODO: New icon for the heart rate button is needed.
Fixes#485
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The lettering of the heart rate numbers on the lefthand exis "fall off"
the left hand of the profile panel when the panel is a bit narrow. This
minute change moves the letters a bit closer to the Y-axis so that their
left-hand extreme is more or less in line with those of the depth-labels
on the Y-axis. This is a partial response to Ticket # 484.
See #484
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When doing some changes in the preference window and clicking "Apply", the
'Close without saving' button is supposed to restore the previous values.
However some fields were not restored correctly.
- The Animations Slider was never restored to its initial value.
(A new member in the pref struct was added - pref.animation)
- The 'Font' and 'Font size' were restored correctly to the previous
values but their effects weren't restored to the UI and that required to
open the prefrences window again and press ok.
Fixes#481
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The present text for configuring the display of unused cylinders simply reads:
"unused cylinders". This is now changed to "Show non-used cylinders in
Equipment Tab". The latter wording is much clearer to the average user.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The removal of the planner menu entry was erroneously commented out.
Other parts of the code rely on ENABLE_PLANNER to know if the planner is
enabled or not so rely on it here to.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The order of arguments to fread was incorrect.
In case of arguments "streamsize, 1" the returning value is 1, and
hence due to membuf[streamsize] = 0; line, membuf ends up being one
character long.
Fixed it by exchanging arguments to "1, streamsize". This way,
streamsize has the correct value.
Fixes#483
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently the feature to show temperature units while adding dive is
provided through checkbox in preferences->units section. This patch
disables this checkbox and always enables this feature.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the option to edit the name of a bookmark to be more meaningful for
the user they prefer.
It works just as simple bookmarks and can be removed and hidden.
It won't accept names longer than 22 characters because longer names will
display as garbage text.
Also changed the code from displaying flag depending on event name to
depending on event type.
Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's a tricky problem as we need to remember this across a divelist sort
(as the user might have edited the date / time). The old code made not one
but two incorrect assumptions.
a) it assumed that the added or edited (but previously manually added)
dive was the last one in the dive list (clearly wrong when adding a dive
that has an earlier date)
b) it ignored the fact that refreshDisplay() would select the top dive in
the list if no dive was selected
This patch addresses both of them and makes the code easier to understand.
Fixes#480
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Adding Shortcut (Ctrl+H) to the worldmap exporter for consistency with
the other commands in the file menu
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of unconditionally creating the object at program start let's
create it the first time we need it. That should avoid adding more and
more delays at program start (not to mention the usually unnecessary
memory use).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I know the plan is to do much better OS detection - but at least Linux in
general should be called out and not be treated as "unknown".
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a check for updates feature.
It connects to http://subsurface.hohndel.org/updatecheck.html to check for
any new versions. It then prompts the user with a download link if an
update is available.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The +10 pixels fix was introduced to fix some layout issue on Mac ways
back, but it breaks things on Android. This makes sure this only gets
applied when build for mac.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Model derived from tableview is expected to have remove slot,
which is missing in DivePlannerDisplay currently. This patch fixes
the annoying warning message while starting Subsurface because of
not including remove slot.
Currently there is lot of work to do, that either requires modifying
the model to skip 'remove' slot or find a way to make them inactive.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently user can edit content in compute waypoints table
(in PLAN mode), ofcourse this does not trigger any calculations in
the code, but user cannot see the content he needs to see after edit.
This patch makes the content uneditable.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The terms tank and cylinder are used interchangably both in
diving and in the code, but in the UI we should be consistant in
what we display to the user.
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Recently Robert Helling provided a patch "Distinguish between entered and
calculated waypoints" in an attempt to distinguish between entered and
calculated stops.
This patch is an independent (content wise) extension of the above
patch and is built relative to it which adds new table to display
computed waypoints in plan mode.
Currently table includes only two columns "Comp. Depth" and "Comp.
Duration", which can extended to show further information.
This is only a start to the UI interaction in PLAN mode.
In addition to this there are many TODO things that diveplan feature
demands
TODO:
1. Show more details through "Computed Waypoints" table.
2. Remove tooltip from "Computed Waypoints" table widget.
3. Make contents in "Computed Waypoints" table widget non-editable.
4. Fix error when trying to save dive plan without using cylinder data.
5. Make dive plan editable after saving it.
6. Improvise dive planner graphics window.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the world map exporter.
- add worldmap-save.c that writes the html to the file
- use Google maps v3 API to put the place marks on the map
- add worldmap-options.h to contain some settings for the JS which will
make it easier for those to be changed
- add save HTML action in the mainwindow user interface
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add additional check box in "preferences->graph" section that allows
users to hide average depth on dive profile.
By default this option is checked to show average depth.
Fixes#475
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove redundant spaces from dive master and buddy list fields.
Ticket also mentions about similar space behaviour in tag field, which I
couldn't reproduce.
Fixes#476
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some weird things happen if we use a local instance of the
ProfileWidget2 class in printProfileDives(). Once we
exit the printing dialog the profile crashes, which could
hint of singleton issues.
Instead we are going to use the already active instance of
the class which we can retrieve from MainWindow. This should
also be faster because the class is pretty heavy.
In such a case the cleanup at the end of printProfileDives()
is still relevant (removed in ac9a23ef3b). First we
resize the widget for printing purposes and then resize it
back to the original values and re-plot the current selected
dive in the dive list.
Fixes#477, #478
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
getColor() has a default argument for grayscale set to false.
With this patch we pass it the local isGrayscale flag, which
can only be set during printing.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some flags like printMode and isGrayscale are missing yet needed.
The flag printMode is required so that we know *when* to hide
certain elements such as the ruler and tool tip (e.g. not needed
while printing).
isGrayscale should be passed to all getColor() calls, so that
the greyscale color table is respected.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The ruler text's white background scales badly. This patch
adds the ItemIgnoresTransformations for the textItemBack
object and matches the dimensions and position of the
textItem object in front of it.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Our usermanual is based on webkit, and thats not supported in Qt for
Android. We should probably replace it with a Android native webview
somehow.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some users have requested a way to build subsurface without marble.
This hides all traces in the ui and creates a GlobeGPS-dummy thats
just a QLabel saying that marble is disabled, in case its shown
somehow. The dummy is there so we can just ignore the fact that marble
is disabled in the rest of the code.
Fixes#394
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Not including stdint leaves 'int64_t when' without a type and undefined when
compiling for Windows with mingw
Signed-off-by: Alberto Corona <albcoron@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Manipulating cylinders, especially changing the exact gas content (o2,
he), changes the pp02, ppHe graphs. This patch simply replots the profile
in case of cylinder change at time of saving.
Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In bf205726 DEPTH/Switch at was disabled by commenting out that code.
This puts it back behind ifdefs
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The added characters by auto-completion "for the last item"
isn't saved when using Return to save it "works well with
tab"
Fixes#469
Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We didn't care about system default fonts and sizes, we just used the Qt
default font.
Due to how QFont is constructed, there was need to split font and font
size.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changeset a90818671 introduces a small inconvenience. The pp graphs at
startup are not shown according to the visibility settings. Requiring to
toggle the icons to show the desired pp graph.
Trivial fix.
Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the current dive time and the adjusted time to the time
shift window. I added a function to dive.c to get the timestamp of the
first selected dive.
This will view the time of the first selected dive only even when multi
dives are selected but it does change the times for multiple dives
properly.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The handling of keyboard is broken on Qt inside QComboBoxes.
I'm trying ( and losing ) to make it less broken. This patch makes the
code work reasonably well if you press Key_down or Key_up after having
displayed the filter popup, which is different from the combobox popup for
some reason.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should make the layout work better on smaller screens.
Fixes#458
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The only place on the code that the y() position didn't accompanied the
dive-depth was this one, so let's see if this patch fixes it.
See #455
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we create, then set the value of a variable, we are wasting cycles
and making the code more verbose.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let's not be evil by creating "" as empty strings inside of the code,
really.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch removed the use of copy-constructors on the QString to use the
const-references. Even knowing that the QString is a refcounted class,
let's not get that bad habit.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The offending code is line-by-line equal to the completion highlited
method, so why make it duplicated? Call that method instead.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When I'm on a dive trip i usually download dives multiple times to start
logging them while i still remember them. When i have already created a
trip and downloads new dives they needs to be able to be added to the
already existing trip, without relying on autogroup.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes the git object save logic also check out the changes in the
working tree and index if the branch we save to is checked out. It used
to be that we would just update the object store (and the branch ref, of
course), but leave any checked-out state untouched.
Note that if the working directory is dirty (ie you have made changes by
hand and not committed them), the checkout will skip any dirty files and
report it as a warning to the user. However, the save still succeeds
(since the _real_ save goes to the backing store).
NOTE NOTE NOTE! Both loading and saving very fundamentally work on the
git object store level, and if you are working with a checked-out branch
and make modifications to the working tree, saving will not touch those
dirty files (so that you can try to recover your edits manually in the
working tree), but it's worth pointing out that subsufrace loading state
will totally ignore the working tree.
So the only way to make subsurface *see* your changes is to commit them.
Having edited state checked out in the working tree will only confuse
you when subsurface first ignores it on reading, and then refuses to
touch the checked-out state on writing.
Put another way: working with a checked-out branch is now _possible_,
but you need to be aware of the limitations.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt5 uses different widths for some of the poly. lines
in the profile. Setting an explicit value fixes that.
Tested-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When using Up/Down arrows to scroll the tag list it always selected the
first item in the list and doesn't scroll.
Fixes#468
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After editing values in cylinders or weights hitting save will not save
the changes to save the edit one must move the focus to a different
field first this is fixed by losing the focus before saving the changes
Fixes#412
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
display.h: dc_number is unsigned int, thus a couple of warnings
may pop-out.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After the dive log has been closed, the ProfileWidget2 does not clear
the pn2 po2 and ph2 gas line.
This patch cleared the three lines after dive log closed.
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Hugle <wulong@comp.nus.edu.sg>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are no utf8 in those strings, and we can translate them as
everything else with tr() instead.
QApplication::UnicodeUTF8-part is deprecated and removed in Qt5.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The selection logic was a bit random: some places would return NULL if
the dive computer index was out of range, others would return the
primary dive computer, and actually moving between dive computers would
just blindly increment and decrement the number.
This always selects the primary computer if the index is out of bounds,
and makes sure we stay in bound when switching beteen dive computers
(but switching between dives can then turn an in-bound number into an
out-of-bounds one)
Fixes#464
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I had intended to amend the previous commit with this before pushing it
out. This changes the comment that pointed out the bug that the previous
commit fixed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user tries to delete a cylinder that is in use and that action is
rejected, the cylinder widget (and the whole dive) should not be put into
edit mode. After all, nothing changed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We always checked if the tank was in use by the planner / dive editor -
even if we were not in dive edit mode.
With this patch, when not in dive edit mode, we check our cylinder "used"
flag instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Especially in O2 decompression parts of a dive, the pp02 is typically very
close to the threshold value (normally 1.60 bar). The old implementation
of the pp profile graphs assumes that there is exacty 1 consecutive set of
samples that needs to be in the "warning color". This results in an
erroneous display of the mentioned graphs, connecting multiple episodes of
too high pp with bogus lines in between.
This fix generalizes the pp graph logic to allow for multiple segments of
high pp, each to been drawn seperately in the "warning color".
Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "report_error()" interface is a lot simpler, although some of the
C++ code uses QStrings which make them a bit annoying, especially for
the varargs model. Still, even with the explicit conversion to UTF8 and
"char *", the report_error() model is much nicer.
This also just makes refreshDisplay() do the error reporting in the UI
automatically, so a number of error paths don't even have to worry. And
the multi-line model of error reporting means that it all automatically
does the right thing, and reports errors for each file rather than just
for the last file that failed to open.
So this removes closer to a hundred lines of cruft, while being a
simpler interface and doing better error reporting.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes the error string just be an internal "membuffer", which the
GUI can fetch and show when errors occur. The error string keeps
accumulating until somebody retrieves it with "get_error_string()".
This should make any write errors actually show up to the user.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This at least avoids marking the dive list as unchanged on a failed
write, and propagates the error further up the stack.
We still don't show the error string in the GUI, though. I'll start
doing that next, I think.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes subsurface remember the git source commit of the dive data.
If you save to an existing branch, subsurface will now complain and
refuse to save if you try to save if the existing branch is not related
to the original source. That would destroy the history of the dive
data, which in turn would make it impossible to do sane merging of the
data.
If you save to a new branch, it will see if the previous parent commit
is known in the repository you are saving to, and will save parenthood
information if so. Otherwise it will save it as a new parentless commit
("root commit" in git parlance).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By simply storing the coordinates based on the scene (instead of trying to
map them to real coordinates) the overlay position is correctly restored.
Also remove the redundant positioning before readPos is called.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a bit tricky because we are using a plain widget for
a window and don't have a class for it (req. more source files).
Also for the table model to update we need to create a new
YearlyStatisticsModel instance each time. At least, in that regard
we can re-create the model each time refreshDisplay() is called.
This patch adds a couple of private variables that are used
to manage the memory of the yearly statistics model and window
and also close that same window on MainWindow::closeEvent().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The topmost Z order of items in the profile should be:
- background (poster / logo)
- toolTipItem
- rulerItem
...
This mostly fixes the ruler being under other elements.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A couple of problems with the ruler:
- the rotated text doesn't look very well at all and interpolation doesn't
help it much
- measuring towards the right most part of the profile makes the text go
out of the screen
To solve these issues and attempt to improve the ruler this patch does the
following:
- place the text at the bottom of the lowest of the start and end points.
this way the line will never intersect with the text
- clamp the x position, so that the text doesn't ever leave the screen
horizontally
- place a white background behind the text so that it will cover text and
graphics under the ruler item
(TODO: place the ruler on top of everything else)
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For most dialogs it would be much safer to make them Qt::WindowModal to
the parent (MainWindow).
For now we are not doing this for the preferences dialog as there are
situations where the user might want to be able to move it around and even
interact with the main window.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The animation appeared when the user started subsurface with a default
file, wich was a little annoying since it didn't had a 'from' position
to go and it was also increasing it's size on some window managers
that do subtle windows animations when a program starts. This patch
treats the first dive opened when the program loads with a divelog pa
rameter differently as the following ones storing the velocity value
on a temporary, and reassigning it later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
User can now fine-tune the animation speed on the preferences,
a value of zero disables it completely.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very userfull for a ( yet to be implemented )
preference dialog about the animation speed, so the
user can enable / disable the animations or make it a bit
faster for it's taste.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Once the poster is displayed when there are no dives in the list,
we may also want to disable the QToolButtons (PO2, SAC, etc..),
until a new dive is loaded and the profile is redrawn.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is useful if we have more non-modal windows and we want
them simply to close with the main one without explicitly
creating class member variables to point to such instances.
A practical example would be the debug window created in
ProfileWidget2() (diveDepthTableView) which holds
the depth profile values.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently when user wants to add a new dive information,
the ways to know what unit system is being used are
- Through preferences panel.
- Save the dive information, which displays units in
the text field.
This patch provides an option to the user to show current
unit system by displaying the unit on the side of the label
when the user is editing the fields.
This feature can be enabled or disabled by using the new
checkbox option i.e. `Show units in text labels` included
in `preferences->units` section.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So this is totally unrelated to the git repository format, except for
the fact that I noticed it while writing the git saving code.
The subsurface divetag list handling is being stupid, and has a
initial dummy entry at the head of the list for no good reason.
I say "no good reason", because there *is* a reason for it: it allows
code to avoid the special case of empty list and adding entries to
before the first entry etc etc. But that reason is a really *bad*
reason, because it's valid only because people don't understand basic
list manipulation and pointers to pointers.
So get rid of the dummy element, and do things right instead - by
passing a *pointer* to the list, instead of the list. And then when
traversing the list and looking for a place to insert things, don't go
to the next entry - just update the "pointer to pointer" to point to
the address of the next entry. Each entry in a C linked list is no
different than the list itself, so you can use the pointer to the
pointer to the next entry as a pointer to the list.
This is a pet peeve of mine. The real beauty of pointers can never be
understood unless you understand the indirection they allow. People
who grew up with Pascal and were corrupted by that mindset are
mentally stunted. Niklaus Wirth has a lot to answer for!
But never fear. You too can overcome that mental limitation, it just
needs some brain exercise. Reading this patch may help. In particular,
contemplate the new "taglist_add_divetag()".
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user has zoomed in but then changes to a new dive,
we may want to reset the scale back to the original value (1.0)
based on the current zoomLevel, so that the profile is not stuck
in zoomed mode.
This patch adds a snippet that resets the QGraphicsView scale,
zoomLevel variable and also the toolTip position.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.
It also removes the grid lines, while the poster is visible.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Such can be disabled with -Wno-reorder and are clearly
more of a nuisance, but C++98 12.6.2.5 says the order should be
the same as in the class declaration.
On theory this would only speed the compile times a tiny amount.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We had all in place, all that was missing was to actually load
the position stored on the settings for the tooltips.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes the colors on the new profile, the init of the colors map
was not being done. This fixes it.
A few problems were spotted on the new profile dealing with the ruler
graph and a newly added dive, when using the dive add dialog.
I'll be on it later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is just removal of dead code from the old profile, probably there's
still a bit more to remove, but this is a very good cleanup already.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is simply a code removal, nothing was touched besides the
profilegraphics.h/cpp files.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.
A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.
Now to the real code-cleanup
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.
When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.
This patch updates all plot_info's before calling anything else.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We can't keep the cache around (even though it's tempting) as the next
iteration might change the start time of the planned dive or other
parameters which would make the cached data invalid.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
clang-format doesn't appear to reindent multi line #define statements
correctly - so this hopefully will clean those up.
The included whitespace corrections to the code should stay in place when
using the updated tool.
This includes cleaning up some multi-line comments that were messed up the
last time around as well as a few other minor changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Move the buttons of the profile window around to have more sane positions.
- All the buttons affecting the ceiling(s) are now grouped together.
- All the buttons affecting the Information Box are now grouped together.
- The previous icon for "Show calculated ceiling" has been reassigned to
"Show all tissues"
- A new stand-in button hav been included for "Show calculated ceiling"
Signed-off-by: Willem Ferguson <willem@willem-Precision-M4700.(none)>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm not sure about this one. It's possible that there's something
happening behind the scenes that I don't understand. But let's just
initialize this to 0 and be sure.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
tissue_tolerance wasn't used after it was assigned.
type was overwritten after it was assigned.
serial was overwritten after the last /= 100.
event is assigned in the for loop.
clear isn't used after the assignment
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Decrease depth by tapping left part of widget. Icon is showing "up" (i.e. closer to surface).
Increase depth by tapping right part of widget. Icon is showing "down" (i.e. deeper).
Fixes#354
Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Minor change to the perl postprocessing script and resulting changes to
the affected source files.
This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
a rather unatractive manner
In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Non-stop Dive Limit (or No Deco Limit) abbreviation is not NTL but NDL
Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Partial pressures abbreviations should have capitalized chemical element
symbols e.g. pn2 -> pN2
Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit c84ef319a2 ("Create a toolbox on the left side of the new
profile") Tomaz invented a new TLA: EED.
No one noticed. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previous code just set the button-"status" based on what we stored on
the settings. This sets the corresponding value in our prefs-struct.
This fixes the same issue as in 63f7f3, without the side effect of
magically hiding the mean depth line.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reverts commit 63f7f37e46.
For odd reasons this appears to make the mean depth line disappear. This
will require some further analysis, but for now I'll just revert it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>