The css was done by me in the first days of subsurface for Qt, and it
was a code that I was never proud of. Mostly because I tougth at the
time that it was better to write it into CSS than to create a new class
just to take care of the size of the default cell height on a tree view.
Now I see that it was a biased approach since it created issues on
dark color schemes and it also didn't make a 'native' experience on
Gnome or OSX, only on KDE.
This fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Windows platform translation/ folder contains Qt translation
files as well. This results in extra languages in preferences.
From now we filter these translations and choose only those matching
^subsurface_*.qm$
Fixes#339
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Show language instead of country, sort the list.
Show country in brackets to avoid ambiguity for locales like
de_DE and de_CH.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt has a really strange API for directories. when you create a QDir
and set's the currentDir on *that* QDir you created, it's for the
whole application and not just for that variable. Then when the
variable is out of scope, the directory doesn't change back - ugh.
The solution is not to call setCurrentDir on the newly created QDir (which
was quite good since it's also a code cleanup. )
[Dirk Hohndel: modified to undo the far less elegant fix I had made in an
earlier commit]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These complete the ability to select languages from the preferences panel.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the user first opens the application the default language is
selected; this can be changed to a hardcoded one by going to system
preferences and choosing the one you want.
Restart required.
Fixes#136
[Dirk Hohndel: whitespace fixes, removed qDebug() call, rephrased the
message displayed prompting the user to restart.]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do not support rows larger than a single page as the
PrintLayout algorithm will enter an infinite loop,
therefore we put a limit of 15 lines for the location text.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Removed the "Visible:" header on the column selector. It doesn't
have to be there, and it's not in the similar equipment column selector
- PO2 --> pO₂ (and others)
- Use same initial case in the units selector in preferences
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the names that we have in our "default set" we need to store the
English name so Subsurface will "do the right thing" when opening the file
in a different locale.
With manually entered names in a local language there's not much we can
do.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Still trying to fix the same issue that I already tried to address in
commit e0b70b82ca ("Fix translation of weightsystem names") and before
in commit dc03b7e7d6 ("We need the correct context to translate event
names").
I missed the WeightModel. Hopefully this was indeed the real fix.
Fixes#312
(I know, I keep saying that)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very much the same as in commit dc03b7e7d6 ("We need the correct
context to translate event names"). I didn't pay enough attention when
reading the bug report and missed that the weight system names were also
not correctly translated.
Fixes#312
(I hope this time for real)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface creates a lot of singleton instances on demand, but nothing
ever deleted them. Since they are singletons, these memory allocations
are technically not leaks. However, they clutter the output in valgrind
and other memory analysers, hiding the real issues.
The solution is to delete these items at exit. For the models and for
gettextFromC, the solution is to use a QScopedPointer, which will delete
its payload when it gets destroyed. For the dialogs and other widgets,
we can't do that: they need to be deleted before QApplication exits, so
we just set the parent in all of them to the main window.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When there are no trips at all, we have to skip the Yearly statistics
alltogether, including the header line (that should display all the
dives added together).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We now only use a slightly large font for the "Dive #" entry.
All other font sizes remain at 9px.
Another change is that we now attempt to use 11px for
individual row height. This makes the table at least 12px bigger
(n_rows * increment), but does not cut letters like 'g',
which go slightly bellow the font baseline.
Perhaps this can be improved later by adjusting the font
and row sizes again.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Use the same case for the first letter in the dive table column headers,
use '%' for both gases in the planner, and show "Start time" instead of
"Starttime".
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We update the values for divemaster, buddy and etc...
Rating and visibility are currently displayed as "x / 5"
values.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Following the new layout for the profile print, we separate
the used gas like so:
AL80 / EAN33 / ...
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
ProfilePrintPmode::truncateString() was not really needed,
because long text *should* be trunctated by the table itself.
Also we now are going to have multiple lines for notes,
so the auto-trim should work.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Previous show and save code would have aborted at the first invalid
weight system. This makes sure we save and show all weight systems up
until and including the last valid.
If we had:
integrated: 1kg
belt: 2kg
ankle: 3kg
And changed belt to 0 kg, we would have only saved integrated 1kg, and
nothing about the belt or the ankle weights. This will save all of them,
and show all of them.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previous code aborted at the first invalid cylinder. This instead finds
the last valid and prints all the ones up until that one.
Fixes#295
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds trip based statistics to the Yearly Statistics
view.
Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I think we should actually fill the app with tooltips and
whatsthis hints. justsain ;p
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Better positioning of the text on the table cells. On KDE systems the
text got too near the line that divided the cells, this way the text is
placed on the middle of the cell.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a bit hacky and simply adds the title to the message text when
compiling on a Mac, but hopefully this will be enough.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Two errors fixed.
- With no location set, the summary line would start with a ','.
- When auto creating a trip for a manually added dive or when editing the
dates of dives in a trip, the timestamp for the trip was not updated
after editing the dive.
Fixes#293
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
O2 + He + N2 = 100%
(well, there are some other gases, but this is close enough)
Since N2 can't be negative that means we should refuse any change where
O2 + He > 100% (or o2.permille + he.permille > 1000).
Fixes#280
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The number 0 means "this dive has not been numbered". So manually
assigning this seems wrong.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user doubleclicks on the number of the dive in the dive list,
this will present to him a dialog to change that number. Pressing enter
will renumber the dive if there's no dive with the same number already.
Fixes#288
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch just reverts some wrong changes that I'v done on a
past commit ( sorry ) and correctly handles the selectDive,
by using a IDX instead of the dive pointer, as dirk told me
it's extremely error-prone since the pointer can change.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's very important when programming via Model/View, in gtk or qt,
to not mess with the model data outside of the model. We were
deleting stuff that the model controlled outside of the model, so
it thought that there was still data there. This fixes the deletion
part, but there are also lots of other parts that I'll tackle in
the next commits.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The air types model had a font bigger than the
other models, this patch creates a data() method
that correctly delivers the correct font.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
What happened before was that the AirTypes model was only being updated
when the user requested to change the air by clicking directly
on the Air, in the planner ( but not on the Air Table. ).
This fixes it by calling 'repopulate' whenever the cylinder model
changes ( by adding, removing and changing something.)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes the edition of alphanumeric input,
columns like depth accepted '23ft', '20m' or '30', with
an inplicit conversion to the unit. But the code ignored
that the input could have a 'ft' or 'm' ( ot anything else
for that matter.
Signed-off-by: Taiane Ramos <exhora.tat@gmail.com>
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- you can no longer delete a tank when its gas is in use
- therefore you can no longer delete the last tank
- when you change the gas mix of a tank, the corresponding segments in the
dive change as well
- when changing gas for a segment the correct available gases are offered
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>