Commit graph

305 commits

Author SHA1 Message Date
Dirk Hohndel
43892e36fd Fix colum visibility selection in the divelist
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>
2013-05-26 10:16:01 -07:00
Dirk Hohndel
2896dbdaf1 Apply some CSS goodness to the Cylinders widget
Alternating color and some hover highlighting to make things prettier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26 10:05:41 -07:00
Dirk Hohndel
a8cdc30dbf We had an extra column in the model for the dive list
It doesn't appear to be used anywhere, but it shows up in the UI and
confuses things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 20:16:16 -07:00
Dirk Hohndel
81e27b6db9 Try to make the equipment tab more compact
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>
2013-05-25 20:07:36 -07:00
Dirk Hohndel
4409d61f7c Set a pleasant zoom level to start out with
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>
2013-05-25 11:13:15 -07:00
Dirk Hohndel
92ee374494 Find Google maps in Subsurface's source tree
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>
2013-05-25 08:58:37 -07:00
Sergey Starosek
dbb84188c2 Fix GPS coordinates rounding.
Better round the coordinates.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:18:13 -07:00
Dirk Hohndel
fe66fe5ff6 If we disable the compass, we don't need to place it, either
Just completing commit f1a4edc5497d ("Don't show the compass").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:18:06 -07:00
Henrik Brautaset Aronsen
bf7d61e74e Don't show the compass
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>
2013-05-25 08:18:01 -07:00
Dirk Hohndel
5ca3c11e60 Correct the code to enter dive locations
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>
2013-05-25 08:17:56 -07:00
Henrik Brautaset Aronsen
5d05bb1207 Avoid marble widget resize when switching dives
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>
2013-05-25 08:17:14 -07:00
Dirk Hohndel
884e1c3379 Merge branch 'prefsDialog' of https://github.com/tcanabrava/subsurface 2013-05-24 12:30:29 -07:00
Tomaz Canabrava
efb7f109e8 Added support for a preliminary Preferences Dialog
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>
2013-05-24 15:19:48 -03:00
Dirk Hohndel
5926f9d4df Merge branch 'googleEarth' of https://github.com/tcanabrava/subsurface 2013-05-24 07:16:37 -07:00
Tomaz Canabrava
dfa59f9878 Trying the googlemaps integration 2013-05-24 11:07:59 -03:00
Alberto Mardegan
5e0a3cdad8 Fix usage of temporary QByteArrays
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>
2013-05-24 06:18:27 -07:00
Henrik Brautaset Aronsen
57e7c3f5d0 Improve wording in askSaveChanges()
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>
2013-05-24 06:16:10 -07:00
Henrik Brautaset Aronsen
6fa670e612 Improve wording on buttons when editing a dive
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>
2013-05-24 06:15:28 -07:00
Dirk Hohndel
90a24255b2 Correctly add new weight / cylinder types, even when hitting 'tab'
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>
2013-05-23 23:26:17 -07:00
Dirk Hohndel
01a3bd2cc6 Add weightsystem delegate to enable editing of weightsystem
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>
2013-05-23 21:36:33 -07:00
Dirk Hohndel
ecbcd4db47 Enable the weightsystem info and move the declarations to dive.h
Having the tank_info declared in models.cpp seemed unintuitive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 21:33:19 -07:00
Dirk Hohndel
8d359f8e57 Remove obsolete slots
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>
2013-05-23 18:35:04 -07:00
Dirk Hohndel
d273694954 Allow the CylindersModel delegate to pass data in without unit conversions
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>
2013-05-23 13:31:46 -07:00
Tomaz Canabrava
87d3cd5234 Also changes the size and working pressure of the cylinders
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>
2013-05-23 15:59:12 -03:00
Tomaz Canabrava
babbfa9204 Added support for Completing on the Cylinder Type delegate
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>
2013-05-23 15:33:20 -03:00
Dirk Hohndel
c917a99eb2 Implement default dive computer and device
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>
2013-05-22 23:24:33 -07:00
Dirk Hohndel
115e5e5fbc The never ending, futile fight for whitespace consistency
I just need to write a tool that does this...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 21:31:45 -07:00
Dirk Hohndel
7757363953 Re-enable dive computer selectiom
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>
2013-05-22 20:59:50 -07:00
Dirk Hohndel
33135e37a5 Start editing Dive Notes when clicking on Rating or Visibility
Those widgets respond to MouseButtonPress and not FocusIn.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 20:00:26 -07:00
Dirk Hohndel
a5b14304f2 Merge branch 'fixResizeEvent' of https://github.com/tcanabrava/subsurface 2013-05-22 19:51:00 -07:00
Dirk Hohndel
7bf07b890a Small fixes to the model
Prevent a crash when no cylinder type description is set.

Correctly calculate the cylinder volume.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 16:22:21 -07:00
Dirk Hohndel
76903849de Get the math right for cylinder model setData function
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>
2013-05-22 14:51:41 -07:00
Tomaz Canabrava
fac8868903 Fixed update the plot as we resize the view.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 16:21:07 -03:00
Dirk Hohndel
63b6f7d5a2 Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurface 2013-05-22 12:14:06 -07:00
Tomaz Canabrava
134e20bdc2 Removed the unused add cylinder and add weigthsystem dialogs.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:52:38 -03:00
Tomaz Canabrava
3e51476d87 Removed unused debug, and set the correct data on the delegates.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:27:41 -03:00
Dirk Hohndel
9c3b512701 Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurface 2013-05-22 10:22:08 -07:00
Dirk Hohndel
56c58bdd24 Actually remove cylinders and weightsystems from the data structures
The UI had only stubbed this code out. This adds the implementation of the
helpers and calls them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 10:12:15 -07:00
Tomaz Canabrava
fc4243eef0 Added a Delegate for editing Cylinders
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>
2013-05-22 14:11:49 -03:00
Dirk Hohndel
d6bee060af Shorten the 'set location' text
The old text was quite verbose and caused issues on smaller screens

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 09:00:07 -07:00
Dirk Hohndel
9946fe97c0 Merge branch 'randomFixes' of https://github.com/tcanabrava/subsurface 2013-05-22 08:47:41 -07:00
Tomaz Canabrava
75956f0f91 Added basic editing functionality for Cylinders and Weigthsystems
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>
2013-05-22 12:20:00 -03:00
Tomaz Canabrava
8cfb2aa237 Extend a bit the skeleton 'removes' on cylinder and weigth to help dirk.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 11:40:57 -03:00
Dirk Hohndel
d8673f9867 Calm down the Globe widget
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>
2013-05-22 07:34:14 -07:00
Tomaz Canabrava
0b30c821ae Added a 'trash' icon on the Cylinders and Weigthsystem models
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>
2013-05-22 11:00:20 -03:00
Tomaz Canabrava
94ba79c0fe Only enable the add buttons when there's a dive loaded
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:42:35 -03:00
Tomaz Canabrava
28deb3e65d Re Enable the option to add cylinders / weigthsystems.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:40:26 -03:00
Tomaz Canabrava
df57b657fd Rework on the Equipment tab to make it look more Modern.
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>
2013-05-22 09:17:18 -03:00
Tomaz Canabrava
003729bde6 Fixed the 'click in close doesn't close' on KMessageWidget.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 08:10:02 -03:00
Dirk Hohndel
478baf1076 Replace GError handling with a kMessageWidget based approach
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>
2013-05-21 23:39:49 -07:00
Dirk Hohndel
238c80a708 Merge branch 'microFixes' of https://github.com/tcanabrava/subsurface 2013-05-21 19:34:03 -07:00
Tomaz Canabrava
3fdea49e70 Fixed the hide / show columns using the settings.
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>
2013-05-21 23:07:19 -03:00
Dirk Hohndel
1752257fbb Correctly restore the column sizes in the dive list
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>
2013-05-21 18:29:23 -07:00
Dirk Hohndel
ace8b4f2ea Merge branch 'microFixes' of https://github.com/tcanabrava/subsurface 2013-05-21 13:24:32 -07:00
Tomaz Canabrava
37ada91000 Added code for handling of show / hide of columns.
The code also remembers to save in the config file.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 16:51:49 -03:00
Dirk Hohndel
3009930aee Correctly format the values shown for cylinders and weights
Make use of all the nice helpers that we have...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 12:03:05 -07:00
Dirk Hohndel
19586081ed Correctly use the weightsystem_none / cylinder_none helpers
Plus a couple of minor formatting changes

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 11:29:21 -07:00
Tomaz Canabrava
e7b84233af Fixed memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 10:07:41 -03:00
Tomaz Canabrava
be31a53b0d Added support for visualization the Weigthssystems on the Equipment Tab.
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>
2013-05-21 09:59:41 -03:00
Tomaz Canabrava
126bc8cfa3 Added the code to show the cylinders from a dive.
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>
2013-05-21 09:33:55 -03:00
Dirk Hohndel
246fbd0333 Implement rudimentary divecomputer download
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>
2013-05-20 21:55:56 -07:00
Tomaz Canabrava
f4acbb02e4 Populate the Vendor && Dive computer information.
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>
2013-05-20 17:58:06 -03:00
Tomaz Canabrava
a542b25bde Added code to cancel the thread.
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>
2013-05-20 17:02:17 -03:00
Tomaz Canabrava
c7a5d0490f Skeleton code for a non-blocking UI thread for downloading dives from the DC
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>
2013-05-20 16:43:33 -03:00
Dirk Hohndel
0d370ba108 Integrate visibility Star widget into editing flow
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>
2013-05-20 06:25:16 -07:00
Dirk Hohndel
f548195761 Move visibility Star widget to the DiveNotes tab
This looks much better and seems much more contextual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:15:30 -07:00
Dirk Hohndel
11a6b18690 Display the statistics
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>
2013-05-19 22:48:31 -07:00
Dirk Hohndel
e818f0352b Try to add a StarWidget for visibility
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>
2013-05-19 21:44:21 -07:00
Dirk Hohndel
1d10289796 Close needs to clear the Globe and the DiveNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 20:47:10 -07:00
Dirk Hohndel
adc7654816 When no dive is displayed, the DiveNotes field should not be editable
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>
2013-05-19 17:38:20 -07:00
Dirk Hohndel
f67d3d4bbc Replace glib file/directory handling with equivalent Qt code
I hope this is indeed equivalent...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:18:44 -07:00
Dirk Hohndel
25b8092c03 Implenent file_save and file_save_as
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>
2013-05-19 15:29:54 -07:00
Dirk Hohndel
af2354c1f3 Show the correct question at exit when there are unsaved changes
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>
2013-05-19 14:48:25 -07:00
Dirk Hohndel
920a2069b0 Figure out if the user changed anything when editing
And mark the divelist changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 14:13:04 -07:00
Dirk Hohndel
9ffa37ab6f Rename buttons for dive edit
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>
2013-05-19 12:59:36 -07:00
Dirk Hohndel
a4f243dfac Make direct edit the style of choice
Plus minor coding style fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 09:00:57 -07:00
Dirk Hohndel
9b1a3e09d1 Fix edit behavior
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>
2013-05-19 08:42:58 -07:00
Dirk Hohndel
ae05498d94 Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface 2013-05-19 08:09:48 -07:00
Dirk Hohndel
1298aa87e5 Continue populating the DiveInfo tab
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>
2013-05-19 08:08:29 -07:00
Tomaz Canabrava
55b998d528 Improve the Dirk edit mode.
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>
2013-05-19 11:45:01 -03:00
Tomaz Canabrava
206a148e07 Made possible to choose the edit style on compile time
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>
2013-05-19 11:19:57 -03:00
Tomaz Canabrava
0cb9b9ccfb Removed unused GTK calls onto the Qt version
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 07:19:20 -07:00
Tomaz Canabrava
d853e9bcff Make the Text on the DiveList be 30% smaller than other text
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>
2013-05-19 10:46:49 -03:00
Dirk Hohndel
ba30d070c9 While editing the left button is renamed to "OK" to accept the changes
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>
2013-05-18 21:33:04 -07:00
Tomaz Canabrava
046eacabe5 Make impossible to change dives while editing one.
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>
2013-05-18 21:30:54 -07:00
Tomaz Canabrava
c5e7a025e4 Added option to edit the selected dive.
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>
2013-05-18 17:06:48 -07:00
Dirk Hohndel
de50f66257 Work around broken Marble on Debian
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>
2013-05-18 09:49:37 -07:00
Dirk Hohndel
b9f0bc84c2 Compile fix
Forgot to add this before pushing the previous commits

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17 22:27:50 -07:00
Tomaz Canabrava
cffc66f45a Don't add a dive on the globe twice ( well, actually, different dives with same location )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:56:21 -03:00
Tomaz Canabrava
7509360173 Prettification of the map view.
Just some prettifications, better defaults, etc.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:52:04 -03:00
Tomaz Canabrava
86021b24d9 Borrowed the KMessageWidget code to better show passive information.
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>
2013-05-17 21:58:49 -03:00
Tomaz Canabrava
56dbb7c2ff Added the possibility to change the coordinates of a dive.
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>
2013-05-17 16:12:55 -03:00
Tomaz Canabrava
b89265c7f0 Adds rotation while selecting a dive.
This adds rotation, a very, very shinny feature.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 14:09:10 -03:00
Tomaz Canabrava
3a1a4c1874 removed whitespace.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:30:47 -03:00
Tomaz Canabrava
9038b3aa6e Added real support for the marble widget
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>
2013-05-17 13:28:02 -03:00
Tomaz Canabrava
4098922b55 Adds preliminary support for Marble Widget
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>
2013-05-17 08:14:10 -03:00
Tomaz Canabrava
2f35c94026 Fix loading a dive via command line.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 21:25:31 -03:00
Thiago Macieira
3024b2b83c Don't deleteLater a null pointer
When the application launches, the oldModel is null.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16 14:13:22 -07:00
Tomaz Canabrava
d39b1aedcd Fix loading a second dive, after the first file was loaded.
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>
2013-05-16 12:23:38 -07:00
Tomaz Canabrava
e3cb36498d Fixed the loading of some maps
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>
2013-05-16 15:43:38 -03:00