Commit graph

50 commits

Author SHA1 Message Date
Oliver Schwaneberg
eb38a64149 Do not remove seconds from duration input field
This change deals with issue #554.
If you enter a dive duration manually, the cell renderer cuts the seconds
away when the changes are saved. I added the helper "render_seconds_to_string"
as a counterpart to "parseDurationToSeconds". The helper keeps the seconds,
if not null. The rendering of the cell is done at two places in the code,
so I think it is cleaner to add a dedicated method for it.

Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-02-04 13:40:02 -08:00
Jan Mulder
ac505600f3 desktop: clear tags when hitting new logbook
A very simple commit to start 2018. When hitting new logbook from
a currently open logbook, and the current dive has tags filled in,
they stayed around in the UI. Just clear them. Further, delete
an unused variable.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-01 10:26:13 +01:00
Berthold Stoeger
1c1ca8c1c7 Fix order of initilization list in MainTab constructor.
Besides being the right thing to do (code reflects reality), it
silences a compiler warning.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-21 00:04:30 +01:00
Berthold Stoeger
05a1626c7e Implement different zoom levels for dive photos tab
This implements different zoom levels for the dive photos tab as
suggested by Stefan Fuchs <sfuchs@gmx.de> in #898.
The zoom level can be changed using a slider or CTRL+mousewheel.
Zoom levels range from a third of the standard thumbnail size to
thrice the standard thumbnail size.

Thumbnails are cached in maximum resolution and scaled down on
the fly. Because the profile widget took its pictures from the
photo list model, an extra picture copy with a fixed size had
to be introduced.

The UI is still a bit crude.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18 12:07:10 -08:00
Stefan Fuchs
003e490dd2 Reenable picture tab when dive trip is selected
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Stefan Fuchs
1b7ee876ac Dive picture widget: Allow pictures to use available space on resize
Small change to allow the dive pictures list to use the available
space if one resizes the window or switches to different mainwindow
view.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01 09:44:34 +01:00
Stefan Fuchs
fb008120e1 Use correct selection mode for dive picture view
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01 09:44:34 +01:00
Martin Měřinský
8ef87e618a Use better aliases for icons.
Icon aliases were complete mess.
Some icons had alias some didn't.
Named with underscores vs. hyphens vs. camelCase.
Lower vs. upper case.
"ICON" prefix vs. suffix vs. nothing.
With vs. without filename suffix.
Some didn't make sence. Eg. mapwidget-marker-gray
(I can see, it's grey, but what does it represent?)
Some were duplicated, eg warning vs. warning-icon.
Some were name after widget, which is wrong.

Do not reinvent wheel. Use widely used naming scheme
close to Freedesktop Icon Naming Specification. This
will enable usage of common icons from current set in
the future. Thus Subsurface will fit nicely to GUI.

This changes icon aliases to one, easy grep-able style.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-30 23:14:46 -08:00
Martin Měřinský
0855f6f315 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-30 23:14:46 -08:00
Stefan Fuchs
0fc4bd8976 Disable specific tabs when dive trip selected
Disable tabs for equipment, info, pictures and extra info if a
dive trip is selected.

Remember specific tab selection for dives and dive trip to recover
selection when browsing dive list.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01 03:45:59 +01:00
Stefan Fuchs
ba83ce34e0 In maintab fix change of text between "notes" and "trip notes"
Old code was not functional.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01 03:45:59 +01:00
Dirk Hohndel
fd9c905ba3 Revert "Use icons relative path."
This reverts commit b0d98f6e26.
2017-11-29 14:05:07 -08:00
Dirk Hohndel
2747056889 Revert "Use consistent aliases for all icons."
This reverts commit 92e9c6606f.
2017-11-29 14:05:07 -08:00
Martin Měřinský
92e9c6606f Use consistent aliases for all icons.
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase.
With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs.
prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some
icons didn't have alias at all.

This changes all icon aliases to one, easy grep-able style which complies
to Freedesktop Icon Naming Specification (Guidelines).

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29 11:46:35 +01:00
Martin Měřinský
b0d98f6e26 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29 11:46:35 +01:00
Stefan Fuchs
006a0ebb39 Don't change visibility of depth and duration UI field when no dive
After one selected a dive and then selects NO dive don't touch
the visibility of UI fields for depth and duration.
So if previously selected dive was a manually added dive, keep them
visible. If it was no manually added dive keep them invisible.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-29 01:22:01 +01:00
Stefan Fuchs
b7806d1b94 Correctly handle dive notes in maintab.cpp
Remove duplicate and incorrect setPlainText call via macro for dive notes.
Deal correctly with ASCII line breaks "\n" in dive notes with html
markup (replace them with <br>).

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-28 23:58:35 +01:00
Stefan Fuchs
07bd8e6455 After edit the cylinders of a dive copy the full samples
After editing the cylinder table (e.g. deleting a cylinder) and
accepting the changes copy the whole dc samples for the dive edited.
This is important because the sensor idx in the samples may have changed.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-27 22:40:16 +01:00
Stefan Fuchs
8212a923b2 Use MAX_CYLINDERS consistently
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-27 22:40:16 +01:00
Berthold Stoeger
24c72cb359 Inform LocationFilterModel of added dive site name
If the user implicitly adds a dive site by editing a dive, and
a location filter is active, check the new dive site in the
location filter.

This is done by informing the LocationFilterModel of the new
dive site name prior to repopulation. The LocationFilterModel
then adds a corresponding entry and marks it as checked.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-26 18:50:40 -08:00
Berthold Stoeger
2a0520d57d Simplify signal handling after dive site editing
Since commit 01d961086c, MainWindow::refreshDisplay()
is called in the refreshDiveInfo() signal of maintab after editing a
dive site. Since this was the only use of the refreshDiveInfo signal,
remove this signal and instead connect to MainWindow::refreshDisplay directly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-26 18:50:40 -08:00
Stefan Fuchs
3649963bc4 In maintab clear location tags when selecting a dive w/o dive site
Until now when selecting a dive w/o dive site after having a previous
dive with dive site and location tags displayed, the location tags of the
previously selected dive where still displayed.

This fixes this behavior.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-26 14:17:38 +01:00
Berthold Stoeger
01d961086c Refresh display if a dive site was edited
Calls MainWindow::refreshDisplay() if a dive site was edited so that
the filter lists are updated. The old call to updateDiveInfo() was
removed because it is call implicitly in MainWindow::refreshDisplay()
anyway.

Fixes #675.

Requested-by: Stefan Fuchs <sfuchs@gmx.de>

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25 15:34:51 -08:00
Stefan Fuchs
010f5f2abc In maintab disable correct label when dive trip selected
Until now accidentally the dateLabel was disabled and the timeLabel
was enabled. Changed this the other (correct) way round.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-16 11:34:12 -08:00
Dirk Hohndel
27c49fe3ad Silence random warnings
None of these seem to point to actual issues, so let's quiet them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-20 17:25:18 -04:00
Robert C. Helling
a422957cd6 Use displayed_dc instead of current_dc
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-19 14:57:02 -04:00
Stefan Fuchs
884e690049 Tags for geo references: Nicer look, translations and warning message
For the geo references tags update the following:
- Nicer look w/o "Tags:" text and brackets when inside location UI
- Translation for "Tags:"
- Warning message when no dive site layout categories are set

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-17 06:12:07 -04:00
Dirk Hohndel
0799d046ba Disable editDiveSiteButton without dive site name
Entering a name first creates and hooks up a dive site which we can then
use in the edit dive site dialog to store modifications.

This doesn't really fix these two bugs, but it might impact whether they
can still be recreated

See #633
See #636

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00
Dirk Hohndel
ed78aeade0 Change the signature of constructLocationTags
We actually want to be able to pass a specific divesite structure
and not have it look that up by uuid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 08:05:09 -07:00
Stefan Fuchs
7713c7e607 Use helper function dive_endtime() where apropriate
Calculating dive.when + dive.duration doesn't always give the correct
endtime of a dive especially when a dive has surface interval(s) in
the middle.
Using the helper function dive_endtime() fixes this issue.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-01 23:55:37 +03:00
Lubomir I. Ivanov
4bb180b117 remove Marble from the source tree
In desktop-widgets, remove globe.cpp, globe.h and also remove
the NO_MARBLE macro usage.

At this point the MapWidget will always be created and there will
always be a map in the application.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-09-04 07:46:35 -07:00
Lubomir I. Ivanov
ae52e2a272 maintab: use GlobeGPS / MapWidget abstraction
Based on NO_MARBLE, call the same methods in the two different classes.
Later the dummy Marble GlobeGPS (for NO_MARBLE) should be removed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Dirk Hohndel
1b8b112048 Fix slot handling in Photos tab
This clearly has never been tested, never worked.
Oh well.

Fixes #478

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-12 08:25:58 -07:00
Lubomir I. Ivanov
1ddda0755b TabDiveInformation.cpp: use lrint() for sac.mliter in updateData()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11 15:57:29 -07:00
Stefan Fuchs
e6d884cf26 Creation of dive duration string and surface interval string
Update the function to create the dive duration string in a way that
it can be used also in info and stats tab and added some more flexibility.

Changed layout for <1h freedives to "0:05:35" (w/o units) or "5:35min"
(with units and :) or "5min 35sec" (with units with space).

Add a new function to create the surface interval string.

Completely remove old function get_time_string() and get_time_string_s().

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-26 15:50:52 -07:00
Dirk Hohndel
ad5819c42e Save tags when manually adding dive
Tags are handled differently from other fields, we need to call
the special handling after the new dive was added and marked as
the current dive.

Fixes: #369

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 12:47:04 -07:00
Stefan Fuchs
a784b15cb8 Update translation and strings for gas usage in stats
Giving the string " and " to transiflex seems to fail and/or
it's highly possible that the translators make a mistake by
translating it into "and" or " and" or "and ".
Change the string to "and" and hard code the whitespaces before and after.

Change O2 to O₂ in statistics.

Translate "He" and "O2" in statistics.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-01 21:24:02 -07:00
Stefan Fuchs
257f7c082d Show min/max SAC in statistics only if different to average...
...and don't show a minimum depth in stats if there is only a single dive.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-01 21:24:02 -07:00
Stefan Fuchs
9c91264f84 Change layout of information and statistics tab...
... to make it look more similar. This includes:
- Same spacings between the boxes
- Same way how to use the available space

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-01 21:24:02 -07:00
Dirk Hohndel
9021a44ccc Add SPDX header to desktop widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Anton Lundin
cd27c1cd44 Hide avg max depth thingie
We don't set it so just hide it.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-04-26 21:27:37 -07:00
Anton Lundin
1ec0d43e63 Always set min/max sac in statistics tab
It just looks weird when they aren't set, just because you only selected
one dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-04-26 21:27:37 -07:00
Anton Lundin
0f80d07e4b Rework statistics tab to use a grid layout
This makes everything line up better

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-04-26 21:27:37 -07:00
Tomaz Canabrava
7aac3852c1 Fix saving table size
We need to make sure the model is avaliable for the table
until it hits the destructor.

Fixes #347

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-26 17:45:34 +02:00
Stefan Fuchs
bea1217f7b Move extra info tab in main window to the very right side again
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-21 11:27:15 -07:00
Jan Mulder
b809019c7a Also translate tab headers
After the restyle of the maintab code, the translation of some tab titles went
missing. Corrected here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-14 09:50:38 -07:00
Dirk Hohndel
86a98867f1 Fix build against older Qt versions
While the new syntax is nicer and faster, this isn't supported prior
to Qt 5.6 and we still support 5.5 on older OSs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-12 20:24:24 -07:00
Tomaz Canabrava
385816be2e Aparently, remove a QXB warning.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-06 18:25:53 -07:00
Tomaz Canabrava
2f86cbdc36 Clean up some widgets
Simplify logic of handling the Message that this
dive is being modified.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-06 18:25:15 -07:00
Tomaz Canabrava
1fc4fba69f Break down MainTab into smaller classes
Maintab is one of our most complex classes, and it's
something I'm not actually proud of. But it currently
works and the idea of splitting it was in my head for
quite a while.

This is the third or fourth tentative of splitting it,
and this time I let the most complex part of it untouched,
the Notes and Equipment tab are way too complex to untangle
right now on my limited time.

A new class 'TabBase' should be used for any new tab that
we may create, and added on the MainTab (see the new lines
on the MainTab constructor).

Also, Extra Info, Information, Photos and Statistics where
ported to this new way helping reduce the number of
lines and functions on the MainTab quite a bit.

Overall this is a step in the right direction for the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-06 18:23:25 -07:00