Correctly use gettextFromC::instance()->tr(); instead of a simple
tr(); to translate the dive mode names.
This goes on top of 0bc9edf855
and finally makes the whole thing work.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
helpers.h included qthelper.h and all functions declared in helpers.h
were defined in qthelper.h. Therefore fold the former into the latter,
since the split seems completely arbitrary.
While doing so, change the return-type of get_dc_nichname from
"const QString" to "QString".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The former should be translated but not those that
go to xml/git.
... and fix capitalization of pSCR.
Suggested-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Even though hashes of image contents are calculated, the hashes are
not compared to actual file contents in routine-operation. Therefore
give the user the option to recalculate thumbnails, should they have
edited the picture.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The function removePicture() had a flag "last", which would indicate
that the called had finished removing pictures. Only then would
the model be recalculated.
This is a strange interface and, matter of fact, the caller was buggy:
if the last picture to be removed didn't have a proper url, removePicture()
was never called with "last" being set.
Change the interface to take a list of pictures to be deleted. This
will allow us to make picture deletion smarter in follow-up commits.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
...as the usuage is not anymore about a computer but
a momentary dive mode. Rename the end indicator as well.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Connect the thumbnailer signal to the dive picture model slot.
This needs some code-reshuffling in the dive picture model.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
If "Edit dive" is selected from the dive list or the map view, switch
to a new mode, which shows the dive infos and the profile.
After the edit, switch back to the previous state.
Fixes#1213
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Previous taglist_get_tagstring signature/implementation did not allow
handling of cases where inputted buffer could not contain all tags.
New implementation allocates buffer based on pre-computed size allowing to
insert all tags in the returned string.
Added get_taglist_string in qthelper to handle conversion to QString
Added TestTagList with tests for taglist_get_tagstring
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common
occurrences that they seem worthy of a short helper-function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Replace constructs of the kind
s.toUtf8().data(),
s.toUtf8().constData(),
s.toLocal8Bit().data(),
s.toLocal8Bit.constData() or
qUtf8Printable(s)
by
qPrintable(s).
This is concise, consistent and - in principle - more performant than
the .data() versions.
Sadly, owing to a suboptimal implementation, qPrintable(s) currently
is a pessimization compared to s.toUtf8().data(). A fix is scheduled for
new Qt versions: https://codereview.qt-project.org/#/c/221331/
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add a combo box for water types with defaults for fresh water, sea water
and the EN 13319. All values taken from units.h, where EN 13319 was added
beforehand.
Custom values can be entered through a spinbox.
Also changed "Salinity" in TapDiveInformation.ui to "Water type".
Translation required!
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Use struct temperature_t for temperatures in struct stats_t and
use get_temperature_string() when printing these temperatures for
statistics and HTML export.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>