We'll want to enhance this: better logic for which dives are near the
selection, and it's probably best to have a "control-click" that adds
the dives to the selection rather than deselecting all the old ones.
But it's already useful.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Not showing them at all was a little too blunt of an instrument. There
likely are dive spots with the same name at different resorts. And even
at the same resort you could have multiple morings for the same dive
site.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The check to only update the dive if there were already dives selected
before seems bogus. I'm sure I put it there for a reason but it seems
flat out wrong.
This gets triggered when you select a trip by clicking on the trip
header. In that case all dives get unselected (amount_selected = 0) and
then we try to select the first dive in the trip - which fails because
of this check.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a new widget, MinMaxAvgWidget, a simple widget
that displays values in 'min, max, avg' fashion.
it has a setMaximum, setAverage and setMinimum
methods, that is userful for setting the minimum,
maximum and average of stuff. Ah, it also shows
the minimum, maximum and average of things.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This function was supposed to take the default_prefs into account but
clearly wasn't.
Now it should be much more readable and maintainable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This helper wasn't called as intended - but because of the syncSettings
call which emits settingsChanged this only became visible for the
default_filename.
Next I need to clean up what is called for the settingsChanged signal.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Things got broken. Again. We no longer kept track of the selected dives in
our structures which broke statistics.
This attempts to fix that, but appears to still have a bug when selecting
trips. Sometimes this results in 0 dives being selected according to our
data structures, while Qt happily shows all dives of the trip as seected.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code so far had completely ignored Metric / Imperial. Turning this
into a three way radio box seemed to make much more sense.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a feature that had been requested a few times in the past and when
debugging my "show only used gases" commit I realized that this would have
been extremely useful to have...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The keyboard movement wouldn't scroll to the newly changed selection.
Similarly, when sorting the dive list, we'd end up losing the currently
selected dive (and generally collapsing the currently exposed trips).
This adds the scrolling/exposing logic for those cases.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The hardcoded position we previously had would make the text invisible
if a ceiling was drawn during the middle of the dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The equipment tab will still show all defined gases, but the info for
the dive should only list the ones used.
Also change the name of the two gas related boxes to better reflect the
data that is shown.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply renaming all the elements with name conflict. None of these names
appear to be referenced anywhere so this seems like a rather odd thing to
happen - why doesn't the tool just rename them for me when I open and
close the file in designer? Or at least warn about it?
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a helper function to determine the Subsurface data directory
(are we running from build directory? installed on Linux? installed on
Mac? - still need to add support for Windows). This same function is
then used by both the setup for Marble and for the help browser.
This assumes that the user-manual.html file has actually been built and
installed (which we don't do by default with the current Makefile).
Right now there are rendering issues with our manual in the help browser
widget - I'm sure this can be fixed...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a preliminary support for a manual display widget,
it's a very basic HTML text-browser, so it can have
hyperlinks, images and everything that a 1995 browser
has.
The long term plan is to subsittute this manual by
a more modern 'help' using QGraphicsView, that will
interact on the application level.
See #121
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
In commit b8d31d8534b ("Show ceilings for individual tissues") Robert
inadvertently broke the connection from dc_ceilings to red_ceilings and
also didn't correctly enable the checkbox for all_tissues when
calc_ceilings was already set in the preferences before the dialog was
created (and therefore the connection in the .ui file isn't run).
There's also a simplification / cleanup to the code deciding whether to
show all the tissues.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I think that displaying tissue loadings either as pressure or as
percentages is not very intuitive but that it makes much more sense when
translated to ceiling depths.
This change enables just that for the 16 tissues in our calculated ceiling
and visualizes this in the profile graph.
There is a checkbox in the preferences to turn this on. If enabled, all
tissues having non-trivial ceilings are also shown in the info box.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since I already put the center-allign label on the interface designer,
this was just dead code. getting rid of it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This moves the contents of the statistics tab to groupboxes,
so it's similar to what we had in GTK, but a bit prettier.
it's not what I plan to do in the final form, since I think
that a few 'min max avg' can be in it's own widget ( and maybe
a cute graph showing the values would also be nice. ) but its
an improvement from what we had.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
There was already a code for that on the maintab.cpp, but
since I moved all labels to groupboxes, the code stopped
working, and I tougth it'd better to kill the code since
it's faster and safer to use the interface builder for that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is a redesign-tryout of the info panel, it's not the way
that I want to do, actually - I think that textual representations
are quite boring, and we can do much better if we use better widgets,
for instance, a Calendar to show the date, a Termometer to show
the temperatures and so on. This version has a fixed layout, but
I'll most probably try to make it more dynamic in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Press CTRL+F and a line edit will appear, whenever you write on that will
be used as a filter against all columns. The results are maybe somewhat
surprising in trip mode, but when sorting by another column this shows
some potential.
Hit ESC to remove the filtering.
I need to find a better position to put the Widget, but it's a proof of
concept.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This small patch enable maintab to be in 'Document Mode', this means
basically that it size is smaller and there's not a line separating
the widget anymore, giving the user a more smooth experience.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Following Dirk's commit ae2c132, add support for custom google sat
data in a MacOSX app bundle
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The download already worked, but we didn't display the new dives. This
introduces a new slot for MainWindow that updates what is displayed in
Subsurface after files were imported.
With this change we can successfully download ONCE - but when trying to
download a second dive the dialog doesn't appear to get refreshed the
right way - the OK button doesn't appear to work anymore (Cancel however
does).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First try if Google Sat is already installed as a provider (and just use
it if it is). Then use the executable path to make an educated guess where
these files might be found as part of Subsurface.
We now install the necessary directory tree under
$(DESTDIR)/usr/share/subsurface/marbledata
Still far from perfect - but this should work at least on Linux. MacOS
will need a different modifier for the path and Windows I haven't even
thought about, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When (de)selecting columns, a the list of columns have a "show"
in front of every entry. We don't need that.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit beb4ed38f264 ("Add a "sort role" for sorting the dive list")
Linus forgot to add a case for the rating value.
Now all columns sort correctly.
With this I think we can close the bug...
Fixes#111
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Tomaz convinced me (with help from Linus) that it might be a good idea
to go with the compacter "single line" case statements in some specific
instances where this makes the code much more compact and easier to
read.
While doing that I changed Linus' code to do 'retVal = ...; break;'
instead of just 'return ...;' - this is more consistent and makes
debugging a little easier.
And while doing all that, I also cleaned up divelistview.cpp a little bit.
And removed an unused variable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the regression that I caused in the last commit,
where the selection was being correctly reestored from tree-to-table,
but it was incorrectly being restored from table-to-tree.
I also added a bit of speedup on the view while changing columns.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Sorting is now working as it should, changing
from table to tree, keeping the selection from
table to tree ( but there's a regression on
tree to table conversion, I'll try to fix it
in the following commit. ).
this commit also cleans a lot of boilerplate
code that I wrote to bypass a graphics bug,
that I seem to have correctly fixed in this
version.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Things are working as they should, but I hit on -probably- a Qt bug
that makes painting on the table view a bit weird ( it only updates
the painting by moving the mouse around ). I'll try to fake the
mouse movements in a couple of commits after this one.
There's also a few columns that are not being correctly sorted,
probably something to do with the SortRole.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
By default, sorting is done by the display role, but then we end up
sorting by the string we display, which is almost always the wrong thing.
So this adds a new "SORT_ROLE" that is used for sorting, and then the
data lookup can return the raw data we want to sort by.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Set default zoom level only when at least one dive selected
and user have not changed it.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the red dc ceiling as preference option.
Hooked them all up together so the sub-preferences are enabled when the
master preference is set (for 3m and red ceiling).
Use the options in the profile plotting functions.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The initial state needs to reflect the value of the checkbox. Once the
dialog is run, there is a signal/slot connection in the .ui file that
keeps things in sync.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The biggest problem here was that bool has different sizes in C and C++
code. So using this in a structure shared between the two sides wasn't a
smart idea.
Instead I went with 'short', but that caused problems with Qt being to
smart for its own good and not doing the right thing when dealing with
'boolean' settings and a short value. This may be something in the way I
implemented things (as I doubt that something this fundamental would be
broken) but the workaround implemented here (explicitly using 0 or 1
depending on the value of the boolean) seems to work.
I also decided to get rid of the confusion of where gflow/gfhigh are
floating point (0..1) and when they are integers (0..100). We now use
integers anywhere outside of deco.c.
I also applied some serious spelling corrections to the preferences
dialog's ui file.
Finally, this enables the code that selects which partial pressure graph
to show.
Still to do: font size, metric/imperial logic
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds support for switching Tree / List
while clicking on a column header. This triggers
a sad-painting bug on the list - I guess I'll have
to fix it too. I'd apreciate some help on it, tougth.
next: keep the selection.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This code adds the possibility to make the DiveList behave
like a Tree or a List, depending on what layout is set.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This had been bugging me for a while - the label texts were all not
quite where I expected them to be. I think this looks much better now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The imperial/metric super setting doesn't have any effect. But changing
the individual units now works and is tracked. And causes the display to
change after clicking "OK" (but not yet when clicking "Apply").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Several changes:
- split the reload of the DiveListView from the reload of the header
- don't include the column title in the name of the setting; the title
will change depending on the units and localization chosen by the user
- rename the slot that toggles visibility to make the code more readable
- use setCollumHidden() method to simplify the code
- don't save the width of hidden columns (as they would be saved as zero
width and can then no longer be enabled)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
My attempts to actually set the width of the columns with the
SizeHintRole all failed - so I gave up on that and am forcing things to
work by making the texts in the header somewhat longer and then resizing
to that. Definitely not what I wanted to do - but that plus reducing the
font size gives us a much more reasonable / compact look.
I really hope that someone else can explain to me how to get the
SizeHintRole to affect the width (and not just the height - that part
worked just fine) of a the cells in a column. Then we can replace this
hack by a much better solution (that won't fail if the translated strings
look different).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the user very quickly switches between dives the zoom level sometimes
gets reset to be much more "zoomed out" (basically if you change dives
before Marble had time to zoom all the way in to the previous dive it will
keep whatever was the last zoom level of the animation - I'd consider that
a Marble bug).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way the user doesn't need to move the two folders googlemaps and
googlesat around in the filesystem.
This only works if Subsurface is started from the build directory - it
doesn't work when Subsurface is installed (and it doesn't at all address
the need to install these files and bundle them as well).
I'd consider this a hack to show how the real solution should work.
There is one more part of this that is a hack: Marble no longer searches
its default data directory; the path we set replaces the Marble system
search path. Sadly, Marble doesn't support paths the way Unix thinks of
them with multiple directories, separated by ':'. So this means that
Marble no longer finds any of its default icons. For most of them that
seems fine as I don't think lacking the icons for "manned_landing",
"robotic_rover", "unmanned_hard_landing" or the various types of places of
worship that Marble supports is necessarily a big issues for Subsurface,
but at least the default_location icon seemed important. And since we now
need to carry our own, I replaced the boring circle with a tiny dive flag.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
North is always up anyway. At least that's the way we've done it so far.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existing code converted the lat/lon to int before multiplying with
1,000,000 (in order to create udeg). Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "no dive location" message box was displayed above the marble
widget, which made the layout splitter move horizontally.
Made the message box as an overlay on the map instead.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Dirk asked me to try to make it more modern, so I
used as a base, the Firefox preferences. currently
it saves / loads the preferences, and also smits
a signal 'preferencesChanged' that should be connected
to anything that uses preferenes, via the PreferencesDialog::intance()
object. In the future, I plan to make it have a signal / slot for each
member that changes.
I also moved the icons to a new folder this time, because the
amount of icons is now more than just two, and it was
becoming messy.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit fixes three different things:
- a memory leak in WeightModel::setData()
- getSetting() calling strdup() on a QByteArray
- a possible usage of memory after deallocation
Here's an explanation of the last issue (taken from the mailing list, slightly
adapted):
toByteArray(), as well as others "toSomething()" methods, returns
a new object which the compiler allocates on the stack. The compiler
will consider it a temporary data, and destroy it on the next line. So,
when one does
char *text= value.toByteArray().data(); // line 1
if (strcmp(description, text)) { // line 2
the compiler creates a QByteArray on line 1, calls ::data() on it, which
returns a valid char *, and assigns its value to "text". So far, so
good. But before jumping to line 2, the compiler destroys the temporary
QByteArray, and this will in turn invoke the QByteArray destructor,
which will destroy the internal data. The result is that on line 2,
"text" will point to some memory which has already been freed.
One solution is to store a copy of the temporary QByteArray into a local
variable: the compiler will still destroy the temporary QByteArray it created,
but (thanks to the reference-counted data sharing built in QByteArray) now the
destructor will see that the data is referenced by another instance of
QByteArray (the local variable "ba") and will not free the internal data.
In this way, the internal data will be available until the local variable is
destroyed, which will happen at the end of the {} block where it is defined.
Please note that when one uses the data in the same line, one doesn't need to
worry about this issue. In fact,
text = strdup(value.toString().toUtf8().data());
works just fine.
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't Save/Cancel/Save is less ambiguous than OK/Cancel/Save. Also
being slightly more verbose when creating the QMessageBox.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use the more familiar Save/Undo instead of OK/reset
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
This uses the QStringListModel to populate the items
of the QComboBoxes. I used a QHash to hold every Computer
of a particular Vendor. so, products[vendor] gives me
the full list of products from each vendor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I think it's self explanatory - When user clicks on
'Cancel', the interface will wait for the trhead to quit
then will close itself.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is the skeleton code for a non-blocking ui-thread
It already creates the first-thread ( 'do not block the ui' )
and the second thread ('download from the dive computer')
We can in the future merge both in the same place - I didn't
want to do that now because the download function is written
in the libdivecomputer.c code, and I cant just transform that
to a QThread and use signals, so I used two threads for that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This also removes some incorrect code from the clear() function for the
DiveInfo tab. Putting the readOnly() calls for the DiveNotes tab there was
wrong.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This would be correct if the current selection code wasn't broken. Right
now we only add to our internal notion of what is selected - we never
deselect anything.
Once that is fixed, thestatistics should be correctly displayed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's not editable. And of course it continues to look like utter crap -
even more so now since this is left aligned and everything else is
centered.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This also fixes a potential crash if no dives were loaded and the user
started editing the fields and clicked OK.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This allows us to do the right thing at exit (and also connects to more of
the menu actions to actually do something).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want to give the user the option to 'cancel' and not exit the program,
to 'save' the file, or to say I'm 'OK' with losing the unsaved data.
This does NOT implement the actual save / save-as, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old names made sense in the initial model (where you'd click on the
edit button to start an edit). The new names seem much more natural given
what we do now.
Also a tiny code cleanup removing a redundant if statement.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 7b00668b400b ("Improve the Dirk edit mode.") had what looks like an
"autocomplete" typo. This also stops us from changing the text on the
button that in this edit mode is always just the "OK" button.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Pulled one more helper from statistics-gtk.c (but didn't modify the code
there to use it as that code is no longer being compiled).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dirk edit mode will be triggered as soon as the user
clicks on the field that he wants to edit. then he can
edit all fields, till he press ok / reset.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is just a for choosing the default edit style in the
future. I prefer the new edit style as the user is sure
what the hell is going on ( ie - if he chooses to edit,
he is editing, there's a message warning him that he is
editing and everything else is blocked till he finishes
editing. ) and the GTK version is 'edit whenever I feel like',
wich I think is more unsafe but dirk asked me to put an option
and let the others choose.
e
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This makes the DiveList be similiar to the GTK one, comparing
the size of the text. The current code makes text on the
table be 30% smaller.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This seemed more logical than keeping it as "edit" and basically having to
hit "edit" a second time in order to save a change.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is to prevent loss of data, so if the user is editing something,
either cancel the edition or save it, to continue moving around on
the Dive List. - Only the dive list is affected, user can still
play with the globe and the profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added option to edit the selected dive.
Now the user can click on 'Edit', and a nice box will
appear stating that the dive is in edit mode, and the user
can edit all of the 'Notes' tab fields, including the
rating. When the edition is finished, the user needs to
click on 'edit' again to mark as accepted, or in
reset to reset the fields to it's original state
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a major hack. Debian appears to be missing a necessary header file
for Marble to work correctly. We include this header file for now and hack
the Configure process to recognize that we are on Debian and force using
our local copy of the header file in that case.
This may be needed on Ubuntu as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs,
to better show passive information and notifications. instead of a
popup blowing in the user's face, a nice, animated and well designed
widget will gracefully fade-in, show the notes, and fade out when
not needed anymore.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the possibility to change the coordinates of a dive.
it's too intrusive in the moment, but it was a proof
of concept. so I'll commit as is and try to find a better
way to warn the user what's going on in the future, using
something less terrible than a popup exploding in his face.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The marble widget now shows the dive locations
and also will center on the dive that the user clicked
in the dive list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Adds preliminary support for marble widget, alongside with the
dive list. my idea is to let the view stay there at the left of the
dive list since we got a lot of unused space and a globe is something
nice to have - so you can look around where did you dived, the
dives near the one that's currectly selected, and so on.
I'm not using OpenStreetMaps right now, but a good thing about
marble is that it is skinnable - so for instance, a dive school
could present a dive lesson using subsurface with a globe from the
1600, to make it feel like 'history'.
This version will only compile to Qt4.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
When the application launches, the oldModel is null.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes loading a second dive-file after the first
one had been loaded. it simply clears some information and
makes sure that the current selected dive is invalid when
the file closes. I also did a bit of code cleanup on this one
to make things simpler in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On some maps, the lack of setting up the dc before plotting
the dive-computer nick caused a division by zero, breaking
the correct visualization of the dive.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The selected dive was being set to zero when the program
started, but zero is actually the first dive. There
were workarounds on the gtk code for that probably
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The weight management widget added 500 grams / 0.5 lbs
when a new entry was added.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A nonexisting temperature (mkelvin==0) was displayed as -273°C.
Weight was always displayed with an extra 500 grams/0.5 lbs.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Cosmetic commit to clean up some of the annoying typos in qt-ui
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And rip out all the code that Dirk put there to do that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Figure out what is our first selected element (in case we start out from a
multiple selection) and then move to the next logical element. So the code
traverses an expanded tree (from a trip 'down' to its first dive or 'up'
to the last dive of the previous trip - and similar from a first dive in a
trip 'up' to its trip and from a last dive in a trip 'down' to the next
trip.
This does not take 'shift-cursor-up/down' into account (i.e. manual
selection extension). Instead with just cursor up and down a single dive
(or single trip) is selected.
My guess is that the code will make someone's eyes bleed. Be warned.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a user clicks on a trip, all the dives in a trip should be selected.
But if a user selects a range of dives that happens to have a trip header
in it, then only the range of dives should be selected (the trip header is
marked as 'selected' for visual consistency, even though not all dives in
this trip are selected).
This also changes the code to scrollTo the first selected dive instead of
just expanding the parent. This seems to give us a more pleasant visual
appearance (trying to keep the selected dive centered in the dive list)
and as a side effect no longer hides the first dive trip at program start
(before this change the first dive in the first trip would be the top
entry in the dive list, with its trip just out of sight above).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That threshold is of course ridiculous and arbitrary - but it seems like a
good assumption to make that anything below that is DEFINITELY not valid
data.
Because of the way the scene grows automatically in Qt, printing these
texts would squish the profile into one thin line.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The string we print is lame, but it keeps things consistent (and prevents
us from dereferencing functions in uninitialized objects).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A left click in the treeview header leads to a call to createIndex which
results in a null pointer dereference.
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Align statistics tab labels as per infotab.
Amend helper function to show degree symbol for temp measurements.
Change order of member initialisation list to match order of decl
(ProfileGraphicsView::ProfileGraphicsView)
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The items are still being placed far from each other when
zooming in - I need a bit of help with the math for that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't have a UI to set it, yet, so you have to manually set it in the
config file, but once you do that it works...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code enables Zoom in / Out with the Wheel,
and it also enables panning by moving the mouse around.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Created a default pen that has 'cosmetic' enabled,
A cosmetic line doesn't change it's width no matter
what zoom level we apply.
Also , changed everything that used a line to have
that as default pen instead.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Plot the numbers on the left of the profile.
It seems that everythign is being plotted -
But I can see that there are coordinate-errors on the
code. ( the GTK one plots some curves below of the
dive, but the Qt one is overlapping - probably the
way that I'm using the gc information)
Need to investigate a bit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch plots the PP text, but when I plotted I realized
that the gc.pi.mapp is being calculated wrong, probably
something went wrong on the calculations - it's comming
zered always. So, only one line & text is plotted.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>