We now detect if a weight / cylinder with this description exists and if
not add it on the fly. We also remember the additional values (weight and
size / workingpressure) for new entries and take the values for these
fields into account when autocompleting.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very much analogous to the way cylinders are implemented.
That means that just like with cylinders, if the user enters a new type
and hits 'tab' before hitting 'enter', Subsurface will crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The .ui components were removed in commit 0c7a575f7b3b ("Rework on the
Equipment tab to make it look more Modern.") but the "automagic" slots
were still here.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this we should have tank editing mostly done.
See #122
(it's not quite fixed, we need the equivalent code for weight systems)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
this is more a 'Well, this is how we do it' than an actuall
good commit. I'm probably using the wrong conversion paradigm
( none ) to convert the data from psi / bar and such, it
changes the model with wrong data.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I had to immprove the TankInfoModel with two new methods,
insertRows and setData, because the delegate used this
model to show what kind of Tanks we are offering.
Since the user can enter a new type of Tank, it's important
to add this tank to all lists using the delegates.
I Also added two new methods on the delegate itself,
to correctly shows the data, and set the data on the
model. This also will help dirk with a working example
on how to edit things while using a delegate.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The data is saved in the settings and the correct dive computer (vendor
and product) and device are picked when the download dialog is openend.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This had been disabled by some redraw optimizations in commit
81406b80c6ec ("Fix loading a second dive, after the first file was
loaded."). We need to redraw the plot not only if the dive changed but
also if the selected divecomputer changed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a fun one.
We only want to mark the divelist changed if the user actually changed
something. So we try really hard to compare what was entered with what was
there and only if it is different do we overwrite existing values and
record this as a change to the divelist.
An additional challenge here is the fact that the user needs to enter a
working pressure before they can enter a size (when in cuft mode). That is
not really intuitive. We work around this by assuming working pressure is
3000psi if a size is given in cuft - but then if the user changes the
working pressure, that changes the volume. Now going back and changing the
volume again does the trick. Or enter the working pressure FIRST and then
the volume...
This also changes the incorrect MAXPRESSURE to WORKINGPRESSURE and uses
the text WorkPress in English (Gtk code used MaxPress which was simply
wrong - this is just the design pressure or working pressure, not some
hard maximum. In fact, people quite commonly "overfill" these tanks.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now when you edit 'Type', a drop-down list will appear
and will enable you to choose from it's contents.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch adds basic editing functionality for Cylinders and Weigthsystems,
it still doesn't use delegates to show the data to the user in a better
way, and it does not take in consideration user preferences yet, but
it's a starting point.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This addresses two issues:
- the kMessageWidget did not word wrap, so if it was wider then the Globe
widget the Globe would expand (and divelist shrink) when the user
switched from a dive with location to a dive without location
- the code was also too aggressive removing and redrawing the message
widget when switching from dive to dive. with this change we only hide
the widget if the next dive has a location (and only show it if it isn't
shown already). We also hide the message if no dive is selected.
Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So, the Cylinders and Weigthsystems got a new Trash icon,
and the interface already intercepts the clicks ( on all
columns ) and send this to the 'remove' method on boch
models. On the model I'm just filtering the indexes that
are not 'DELETE' and creating a stub method to be filled
later.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Now it's actually possible to build the Qt variant on MacOSX
with MacPorts and marble support.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Note that this is a WIP and it does break functionality
- ie, not possible to add Equipments, but this will be
fixed in the next commit. Removed add / edit / remove
buttons, only a single '+' icon appears on the widget
now. the edit / delete will be done in place.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Instead of passing pointers to GError around we pass just pointers to
error message texts around and use kMessageWidget to show those. Problem
is that right now the close button on that doesn't do a thing - so the
error stays around indefinitely. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The DEBUGFILE logic isn't needed anymore. Nor are helpers dealing with
model / datastructure updates. Nor conditional compiles to use Gtk instead
of Qt.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The first change allows the default_filename to be found again.
The second change switches us to .config/Subsurface/Subsurface.conf which
I find much more useful.
QtCreator also fixed a few indentation issues for me. How helpful.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This also changed a bit the behavior on how the QSettings are managed,
till now, we used the QSettings constructor passing the name of the
software and the 'company', but this is now default - so there's no
need to pass anything by the QSettings contructor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Ordering here is important - we can't resize the columns before they are
created. On the other hand this now means that we explicitly need to
expand to the first dive shown.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds support showing and for editing weigthsystems in the equipment tab,
so, now the two things that are missing are 'edit' and 'delete', wich are quite easy to do.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
i
Added the code to show the cylinders from a dive,
this code also already permits additions from the
interface, so the user can click 'add' and insert
what he wants there.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Small changes to the names of elements the divecomputer download UI and
very simplistic first stab at populating the device_data_t structure.
This is lacking lots of things
- it should remember the last vendor / product used
- it should figure out which device (mount point) to offer
- it needs proper error handling
But it's a step in the right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>