Commit graph

257 commits

Author SHA1 Message Date
Giuseppe Bilotta
dfec501e7a Resolution-independent trash icon
Also, generate the corresponding pixmap only once, and distribute it to
all models that need it.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-19 07:23:36 -07:00
Giuseppe Bilotta
5a2db2db4b Define auxiliary functions for metrics
Collect font, font metrics and icon size functions in a separate module.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18 15:16:07 -07:00
Tomaz Canabrava
e0b60167f2 Add possibility to filter by more than one criteria at a time
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-10-02 07:35:23 -07:00
Tomaz Canabrava
a2f2751792 Show everything when nothing is checked.
This patch fixes a bit of the logic used. Now we show every
dive if nothing is chedked.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-20 18:35:02 -07:00
Anton Lundin
50adde828c Switch some columns to right alignment in divelist
Some columns in the dive list makes more sense to have right aligned
than left aligned. This switches the numeric columns to right alignment
so they is more easily compared visually.

But, we keep the NR-column left-aligned because we use its left
indentation as dive-in-a-trip marker.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18 06:42:18 -07:00
Dirk Hohndel
434e7a6a71 Fix crash at startup
Not sure this is the right fix, but at least it doesn't crash any more.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:48:57 -07:00
Dirk Hohndel
0d1da0563b Random whitespace update
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:39:49 -07:00
Tomaz Canabrava
db6126bc52 Show everything by default.
We should show all dives by default.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:32:15 -07:00
Tomaz Canabrava
06ebd0ea5e Better filtering of dives with no tags.
New rules for them, a new item on the model with the text
"Empty Tags" should be marked if the user wants it to be
displayed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:32:05 -07:00
Tomaz Canabrava
bef8dc6f4b Implement trip-filtering.
Trips will be filtered if it doesn't find any tags for
dives.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:28:49 -07:00
Tomaz Canabrava
f1e7c12e8a Correctly filter dives. (trips are always shown)
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-09-17 15:28:37 -07:00
Tomaz Canabrava
4e3689370d Create the sorting method.
This method should remove a row on the dive list model
visualization if none of the tags that it have are marked
as 'visible'.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:28:21 -07:00
Tomaz Canabrava
a6e9a1eab5 Implement the TagFilter model.
This model accepts check / unchedk. Now, I need to also
plug the result of the check / uncheck to the list model.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:28:04 -07:00
Dirk Hohndel
45ee3983b7 Use one consistent font size throughout the app
Let's see how much people notice it / hate it.

Fixes #712

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-27 15:46:29 -07:00
Dirk Hohndel
2760f295d2 Divelist: switch to better column headers
And move the units there.
This is a long going back and forth. What we want is narrow columns. But
what we need is something that's easy to understand for our users.

I'm open to other suggestions, but I think this moves us in the right
direction.

See #712

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-22 15:02:50 -07:00
Anton Lundin
d453d5cb37 Rename dive gas function and defines for clarity
This renames the dive gas functions to not talk about just nitrox, and
to instead talk about gas.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:41:57 -07:00
Anton Lundin
619c1b3ec9 Rename the model column from NITROX to GAS
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-11 08:41:36 -07:00
Anton Lundin
e07d23f806 Rename list column from O2% to Gas
In the dive list, calling the column O2% is kinda wrong, because in
at least my dive list there are both air and trimix showing up, so this
renames that column to Gas.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-11 08:40:18 -07:00
Dirk Hohndel
74e7b8e879 Don't show a SAC of 0.0l/min (or cuft/min)
When we have no data about the gas consumption it makes no sense to show a
SAC of 0. Instead we should show either "unknown" or nothing.

Fixes #693

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:39:19 -07:00
Dirk Hohndel
eb63ccfed5 Don't list gases that weren't used in profile print
If the divecomputer adds additional, unused cylinders to the dive, they
would be listed in the profile based printouts. Given that the field is
named "Gas used" that seems wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:08:31 -07:00
Dirk Hohndel
d85d08e14f Data validation
Instead of refusing cylinder pressure data let's just mark it as red when
the values don't seem to make sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 21:21:31 -07:00
Robert C. Helling
89622b0b51 Enforce end pressures to be not above starting pressures.
We don't blow into our cylinders under water.

Negative pressures should be allowed as they might arise from dive planning
without taking care of gas consumption.

fixes #644

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:12:42 -07:00
Anton Lundin
950638ec1c Replace cylinder_is_used with is_cylinder_used
is_cylinder_used uses get_cylinder_index as underlaying function that
does the right thing with with respect on how to find the closest
matching cylinder, and handles both types of gaschange events correctly.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 08:28:21 -07:00
Dirk Hohndel
10e66823b0 Improve handling of cylinders with identical gasmix
In reality we have no concept for handling those, yet. But the UI doesn't
prevent the user from entering multiple cylinders with the same gasmix, so
we need to help the user to get rid of them as well.

If the user attempts to remove a cylinder we check if there's a second
cylinder with the same gas. If that's the case then we can proceed and
remove the cylinder the user wants to get rid of without losing that gas
for the dive. The only tricky issue is that we need to make sure that if
we remove the first cylinder that one is actually replaced with one with
the same gas.

Fixes #622

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 20:36:49 -07:00
Dirk Hohndel
0cf55d7e39 Correctly track the 'changed' status of the equipment widgets
updateDive() cannot reset the changed status - this is called while the
dive is edited. Instead this status is reset when the user either accepts
or rejects the changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 20:36:25 -07:00
Dirk Hohndel
5440d0c39f Don't ignore equipment just because the dive list is empty
This was a fun little bug. Tomaz pointed me in the right direction. The UI
restructure with the displayed_dive had another unintended side effect
here. It is not valid not to set up the widgets just because the dive_list
is empty. The displayed_dive isn't on the dive_list until it is saved - so
while the user is adding or planning a dive, we still need to show the
equipment widgets.

Fixes #614
Fixes #601

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 19:52:05 -07:00
Tomaz Canabrava
e38595f684 Use QObject::tr instead of OurClasses::tr for functions
This will make more easy to move code around in the future.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:46 -07:00
Tomaz Canabrava
d993684fec Do not create a backup for Q_FOREACH container
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-15 16:55:10 -07:00
Dirk Hohndel
e1ae7ebab2 Printing: print depth unit in table
When adding the method that includes the depth unit to the DiveItem class
I realized that this was yet another implementation of our depth unit
conversion. We should just call the existing helper instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:59:21 -07:00
Dirk Hohndel
236ff5c89d Printing: make table more useful
Tweak font size and column widths.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:51:44 -07:00
Dirk Hohndel
0d9a1946fa Printing: change the header to show depth / duration
At least for my dives there wasn't enough space for depth and duration in
the header, most likely because I made the last two columns smaller to
create more space for tags and suit.

With this commit the depth and doration in the header now spans two
columns and easily fits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:40:22 -07:00
Dirk Hohndel
6699dab952 Printing: print tags instead of max CNS
And re-order / re-size the fields so more useful information is actually
shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:39:44 -07:00
Dirk Hohndel
2552b027ae Printing: use more appropriate font sizes
2-up and 6-up need different fonts.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 21:30:40 -07:00
Tomaz Canabrava
ece93107d9 Better default font for printing.
use setPointSize instead of setPixelSize to make it device independent,
also reduced a bit the size of the font.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:02:24 -07:00
Tim Wootton
38c402d9ad dive list context menu capitalisation
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:35 -07:00
Tim Wootton
3a16a64616 misc capitalisation and spelling
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:06:26 -07:00
Lubomir I. Ivanov
c1d63f32d6 Print: make the profile table font size 7px
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:48:16 -07:00
Dirk Hohndel
6b1b2bc919 UI restructure: get rid of "current" pointer in cylinders and weights
Instead always display the display_dive.

Now the only thing left to slay is the stagingDive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Tomaz Canabrava
4c7ea24921 Align the texts on the Left inside of Right for the DiveList
The Qt Framework adds a visual 'tab' on the children of a
node, but if we forced a right alignment on them, it will
lose that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:03:46 -07:00
Dirk Hohndel
7f3efbdc98 Make gas mod be reasonable for users of imperial units as well
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-25 21:41:58 +08:00
Robert C. Helling
65c5d6815c Make pO2 settings functional in planner
Spin boxes for pO2 are now hooked up to preference values. Adding new
cylinders (or changing their fo2) computes the MOD accordin to the current
value of decopo2. Note that chaning the limits for deco pO2 does _not_
automatically update the switch depth of all cylinders as those might have
been manually entered.

Furthermore, MOD has now to option of rounding to multiples of a given
depth. That is used for the automatic switch depth which are now always
multiples of 3m (so that EAN50 is switched to at 21m rather than 22m).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-25 21:07:10 +08:00
Henrik Brautaset Aronsen
630ec88dd4 Be more consistent in partial pressure naming
Lets just use pO₂ instead of PO2, ppO2, ppO₂, PO₂.
They all mean the same, but it's better to be
consistent

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-23 06:48:54 +08:00
Dirk Hohndel
bbe62f756a Change character for liter in SAC values as well
And fix the bug that in the info overlay SAC was always given in metric
values. And try to reduce the number of places in which we calculate the
unit conversions...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 21:00:56 -07:00
Dirk Hohndel
11380a5deb Really display liters with script el
In commit 125ddd955c ("Display liters with script el") Robert only fixed
the C routine we use to show units. Strangely, we had a separately
implemented C++ function as well. Instead of implementing this in two
spots I now simply have the C++ function use the C function to do the
actual work and then wrap this into an easier to use (from UI code)
QString output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 20:39:46 -07:00
Dirk Hohndel
fe773241ee Next step to using gasmix instead of o2/he
This changes the divedatapoints and functions that deal with them.

It changes plan_add_segment(), create_dp(), gasToStr(), and tankInUse() to
consume gasmix instead of o2/he.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:40:46 -07:00
Dirk Hohndel
c539c8f861 Remove the .used member of the cylinder structure
Instead calculate this information on the fly, taking into account all
dive computers on the dive in questions.

There is one wrinkle to this - previously we abused the '.used' member to
make sure that a manually added cylinder didn't disappear the moment it
was added (think of the workflow: you add a cylinder, then you add a gas
change to that cylinder -> right after you add it it is unused and would
not be shown).

I am thinking that we might have to add the "manually_added" property to
the properties that we store in XML / git.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 12:43:40 -07:00
Dirk Hohndel
3d90bd34b2 Planner: only update the plan after the cylinder data has been updated
This way we avoid trying to create a dive from the plan while the plan
references the cylinder that has just been changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29 17:46:26 -07:00
Dirk Hohndel
9cc8e39d42 Merge branch 'Planner' 2014-05-26 13:28:18 -07:00
Tomaz Canabrava
feff22c222 Planner: Re-enable using the new profile.
This correctly enables the planner on the new profile,
but it doesn't triggers the correct paint on the canvas.

[Dirk Hohndel: remove other remnants of the disabled planner as well]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:17:32 -07:00
Anton Lundin
f0f60e1f84 Use gas_mod and fix fpe
When removing o2 from a gas, eg setting it to "", air, this code would
raise a nice fpe. Fix that by using gas_mod instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-25 15:42:51 -07:00