Commit graph

369 commits

Author SHA1 Message Date
Dirk Hohndel
cb41f34826 Don't put cylinder widget in edit mode if deletion of cylinder failed
If the user tries to delete a cylinder that is in use and that action is
rejected, the cylinder widget (and the whole dive) should not be put into
edit mode. After all, nothing changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 15:38:10 -07:00
Lakshman
6e4466aa0a Show temperature units in the label when editing dive
Currently when user wants to add a new dive information,
the ways to know what unit system is being used are

 - Through preferences panel.
 - Save the dive information, which displays units in
   the text field.

This patch provides an option to the user to show current
unit system by displaying the unit on the side of the label
when the user is editing the fields.

This feature can be enabled or disabled by using the new
checkbox option i.e. `Show units in text labels` included
in `preferences->units` section.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 21:10:27 -07:00
Linus Torvalds
eb47b2a8d8 Get rid of crazy empty tag_list element at the start
So this is totally unrelated to the git repository format, except for
the fact that I noticed it while writing the git saving code.

The subsurface divetag list handling is being stupid, and has a
initial dummy entry at the head of the list for no good reason.

I say "no good reason", because there *is* a reason for it: it allows
code to avoid the special case of empty list and adding entries to
before the first entry etc etc.  But that reason is a really *bad*
reason, because it's valid only because people don't understand basic
list manipulation and pointers to pointers.

So get rid of the dummy element, and do things right instead - by
passing a *pointer* to the list, instead of the list. And then when
traversing the list and looking for a place to insert things, don't go
to the next entry - just update the "pointer to pointer" to point to
the address of the next entry. Each entry in a C linked list is no
different than the list itself, so you can use the pointer to the
pointer to the next entry as a pointer to the list.

This is a pet peeve of mine. The real beauty of pointers can never be
understood unless you understand the indirection they allow. People
who grew up with Pascal and were corrupted by that mindset are
mentally stunted. Niklaus Wirth has a lot to answer for!

But never fear. You too can overcome that mental limitation, it just
needs some brain exercise. Reading this patch may help. In particular,
contemplate the new "taglist_add_divetag()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 11:36:17 -07:00
Tomaz Canabrava
24c5b2e3c1 Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
ac9a23ef3b Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.

A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.

Now to the real code-cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:54:20 -08:00
Dirk Hohndel
7c535452f9 Whitespace cleanup
Minor change to the perl postprocessing script and resulting changes to
the affected source files.

This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
  a rather unatractive manner

In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:29:22 -08:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Miika Turkia
78c68518f8 Clear edit mode for manually added dives
Edit mode must be cleared for manually added dives as well when one hits
cancel or save.

Fixes #437

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-20 09:22:43 -08:00
Boris Barbulovski
c86822c2f4 Replace mainWindow() with MainWindow::instance()
C++ style of accessing single instance class object.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 11:42:59 -08:00
Dirk Hohndel
9c9867dec5 More variable scope confusions
Don't have nested loops with the same loop variable. Really. Even if it is
legal C++.
And don't declare local variables more than once. This will only cause
issues later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 06:07:32 -08:00
Linus Torvalds
e58f54cac1 Fix ATM-vs-bar confusion
SAC should be calculated in relationship to surface pressure, not "1 bar".

I also realize that we have a few other cases where we do the same
mistake: the partial pressure calculations do things like

    po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);

which is wrong as well - the partial pressure is also relative to
standard atmospheric pressures.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 14:05:54 -08:00
Boris Barbulovski
507a929a27 Migrate MainTab models(QStringListModel)
Migrate MainTab models
  from static xxxCompletioModel::instance()
  to private MainTab variable members.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:45 -08:00
Boris Barbulovski
359ea75516 maintab.cpp improvements.
* Initialize(lazy) MainTab::multiEditEquipmentPlaceholder struct

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Dirk Hohndel
bf20572630 Disable the switching depth column for cylinders
Since the planner is disabled this column isn't needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-26 07:37:11 -08:00
Robert Helling
f22428b345 Allow manually added dives to have their location changed
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22 08:35:57 -08:00
Sergey Starosek
6a58712270 Enter dive edit mode on divemaster field focus
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 13:57:40 -08:00
Sergey Starosek
b8c746d975 Expand tags approach to divemaster field
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 13:57:40 -08:00
Sergey Starosek
c8807c2ad2 Use focus policy setting from widget constructor
Since we use tags widget for several input fields (tags, buddy,
divemaster), it makes sense to keep focus policy setting in one place.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 13:56:11 -08:00
Sergey Starosek
ec1088f2cc Ignore mouse wheel events on tags widget
This prevents tags widgets (dive tags and buddy) from grabbing
focus on mouse wheel events but allows entering dive edit mode
on mouse click.

It was attempted earlier by Dirk (commit d117beca), but edit mode
did not work properly.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 13:56:06 -08:00
Sergey Starosek
d9c23bb622 Remove duplicate method call
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 05:56:45 +07:00
Boris Barbulovski
6cc65f5e1c Fix some memory leaks.
Memory leaks were caused by broken parent/child relations.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 12:15:47 +07:00
Dirk Hohndel
a27f67c026 Whitespace and coding style updates
Another futile attempt to cleanup the code and make coding style and
whitespace consistent. I tried to add a file that describes the key points
of our coding style. I have no illusions that this will help the least
bit...

This commit should ONLY change whitespace

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 11:50:56 +07:00
Sergey Starosek
dca59f06d7 Enter dive edit mode on buddy field focus
Seems it's related to bug #390. Not sure whether this fix is correct.

See #390

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 09:34:45 +07:00
Sergey Starosek
88f3df5c79 Extend tags model to Buddy field
This doesn't change storage format. Instead it  parses buddy strings and
converts them to string list which is supplied to tags widget.

This feature  was requested in ticket #311

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 09:12:56 +07:00
Anton Lundin
1c0c516b42 Don't downgrade tags to Ascii
Use Utf8 everywhere, and toAscii is depricated in Qt5

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:45 +07:00
Anton Lundin
7e9582631d Convert to TRUE/FALSE to stdbools true/false
I had problems with this one on Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:31 +07:00
Tomaz Canabrava
ddecc3b56a Add CaseInsensitivity to all of the completers.
Just one of the completers had Qt::CaseInsentitive set,
setting for all of them.

Fixes #400

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07 06:19:04 +08:00
Lubomir I. Ivanov
a30a0910b4 Maintab: prevent a segfault in the 'Equipment' tab
When a dive contains no cylinders, clicking the '+'
button could SIGSEGV if current_dive->dc.model is NULL.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03 10:56:29 -08:00
Tim Wootton
65eb86f854 MainTab location coordinates displayed in ISO6709 format
changes the location coordinates display in the main tab
 to use ISO6709(2008) Annex D suggested format.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03 09:18:45 -08:00
Dirk Hohndel
9bff4eda35 Clear equipment tab for trips display
And prevent the user from editing equipment in trip edit mode (those edits
are both meaningless and of course will be ignored once we save the
changes to the trip).

Also moved some code for setting up tanks, weights, tags, etc, into the
"this is not a trip-edit" part of the updateDiveInfo() function.

Fixes #392

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27 17:31:23 -08:00
Dirk Hohndel
74faca5d43 Handle editing a manually added dive consistently
Regardless of whether the user clicks in the info tab, makes a change to
equipment or starts by editing the profile (i.e., clicking on the little
penguin), we should get into the same state and behave the same way.

This means that when editing a manually added dive we are always in
editMode == MANUALLY_ADDED_DIVE - and editMode == DIVE means we are
editing a dive that came from another source.

Fixes #379

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27 17:12:38 -08:00
Dirk Hohndel
3fb3bd60b6 Don't reset panels while editing a dive
MANUALLY_ADDED_DIVE is a different flavor of ADD mode (in both cases we
are in "planner mode"), so bail out for that as well.

See #379

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-25 13:06:29 -08:00
Tomaz Canabrava
231fd2e6e0 Fix subsurface on dark themes.
This patch fixes my last annoyances with dark themes
on subsurface. It changes the background color of the
edited info tab to a darker yellow if the theme is
dark, and a light yellow if the theme is light.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 07:23:10 -08:00
Dirk Hohndel
9405895285 Improve GPS string handling
This adds support for two more GPS coordinate formats and also fixes a
couple of issues with the previous implementation.

We used to only support full degrees and decimal minutes. We now also
support fully decimal and degrees, minutes and decimal seconds.

The previous implementation would color the input field red if either it
couldn't parse the string, or if it was able to parse it but it was the
same as the previous location. That's misleading.

The previous implementation also changed all gps coordinates to the new
coordinates in a multi-dive edit - instead of just changing the ones that
are the same as the master dive.

Fixes #387

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-23 14:59:38 -08:00
Tomaz Canabrava
029522880f When saving / canceling edition, focus back to the Dive List
When saving / canceling the edition, focus was still being kept on the
current selected widget. not good. :) this patch makes the DiveList
keep the focus after a edit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20 09:53:05 -08:00
Tomaz Canabrava
29a19e2e84 Fix the cursor problem on the TagWidget
The problem was the Focus Prevention system on the
EventFilter. Instead of that we can pass the setFocusPolicy (
strongFocus ) that ignores the mousewheel. simpler and cleaner.

Fixes #376

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20 09:53:05 -08:00
Tomaz Canabrava
890d60ff9e Simplify the code by removing a few options from the if.
There was some options on the 'if' that didn't
really belonged there, so I create a if before those
to quit earlier if the condition is true.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20 09:53:04 -08:00
Lubomir I. Ivanov
69ed0d8393 Fix a missing parentheses warning
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-19 07:28:24 -08:00
Michael Andreen
5f12660870 Use UTF-8 for text strings.
Fixes #371

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-16 16:14:50 -08:00
Dirk Hohndel
4b98efb39c When editing multiple dives, only copy the cylinder type
Previously we would overwrite the gasmix as well as start and end
pressure even when editing multiple dives, which clearly is wrong.

Fixes #364

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-14 09:32:24 -08:00
Dirk Hohndel
d117becad8 Improve MainTab behavior when using the scroll wheel
This gets the behavior close to what we really want.
- scroll wheel no longer enters edit mode when over the tabWidget
- scroll wheel doesn't modify dateTimeEdit, nor does it enter edit mode
- scroll wheel still scrolls both the notes and the full widget

The only oddity is that when clicking on either the dateTimeEdit or the
tabWidget we don't immediately turn on the 'being edited' warning (as we
do for all the other widgets). For those two widgets the user has to press
a key before edit mode starts.

I think this Fixes #176

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Ideas-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-13 21:18:54 -08:00
Tomaz Canabrava
5ac29bbe74 Save and reestore scrollbar position on editing the items.
Save and restore scrollbar position on editing the dives.
I think this is not the best place for it, but I'll leave
it here for a while untill I find a better place.

Fixes: #343
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12 03:26:39 +01:00
Dirk Hohndel
e5561d7668 Fix selection tracking bug
When trying to remember a newly manually created dive across the
sort_table() call I abused the dive->selected flag and didn't clear it out
afterwards (most likely thinking "hey, I'm calling selectDive() on this
anyway").

This caused the UI code to correctly mark the dive as selected, but when
it called down to the C code to keep the internal data structures in sync,
that code didn't update amount_selected as it thought this dive had
already been selected. And that caused other parts of the code to get
confused, which manifested for example in the failed upload to
divelogs.de.

So this clears out the flag after abusing it to remember a dive. Maybe we
should add a 'remembered' flag instead, but for now this fixes the issue.

Fixes #351

Initial-fix-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-10 06:25:30 +01:00
Anton Lundin
a3f3e85246 Use implicit zero initialize for the whole array.
Clang yelled about it, and it looks prettier. It also felt kinda strange
to explicit initialize the first element to zero and the rest to zero
implicit.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-09 22:47:12 +01:00
Dirk Hohndel
b144e64b9b Fix typo in color
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07 08:13:55 -08:00
Tomaz Canabrava
66716b5297 Make Gnome3 be bearable
The layout of Subsurface on Gnome 3 had a few flaws, since Qt and Gtk
are not really compatible. This implements a CSS that makes the use
of Gnome 3 more pleasant to the eyes.

Fixes #318

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04 12:41:07 -08:00
Tomaz Canabrava
9190c97a3c Attempt to fix the 'click goes to 0,0' thing on the globe.
This patch attempts to fix the 'click goes to 0,0' bug on the
globe. it moves a bit of code around and I particulary don't
like the way that we are dealing with 'EditMode', I think I'll
refactor that for 4.1. We are alredy dealing with a bunch
of states, maybe a State Machine will help on removing code-complexity.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 18:48:17 -08:00
Tomaz Canabrava
d128b74a8a Select the newly added dive after adding it.
Selects the newly added dive after adding it, it uses a
rather ugly hack that forced a unselected dive to be
marked as 'selected' so we can remember what was the
newly added dive, and select it after.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 18:48:17 -08:00
Dirk Hohndel
25bfcf5f6d Don't call fixup_dive when editing a trip
When editing a trip the key for the notesBackup is NULL. Don't call
fixup_dive() on that...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 15:17:38 -08:00
Henrik Brautaset Aronsen
b1febf17b1 Make sure the save/cancel message is always shown
An addition to the "Move dive notes edit message above the
scrollable widget" commit:  Make sure the save/cancel message is
always displayed on top, regardless of which tab is selected.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 13:01:16 -08:00
Dirk Hohndel
a529285e9e Make dive edit message box tex more concise
commit 3c064d5857 ("Make the message when editing a dive fit better")
kinda fixed the wrong problem. A better solution was suggested - just drop
the instructions regarding Cancel / Safe. It's quite obvious what to do
mow that the buttons are part of the message.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 15:48:01 -08:00
Dirk Hohndel
3c064d5857 Make the message when editing a dive fit better
This should keep the message widget visible without horizontal scroll bar,
even on fairly small screens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 09:55:18 -08:00
Tomaz Canabrava
7ce12f1e8b Removed The button box from mainwindow, buttons are now on the message.
The button box on the bottom of the window made it a bit cluttered
on small screens, this patch uses the window of the MessageWidget
to show the butons - this way less space is used and things are better
spaced on screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 09:55:04 -08:00
Tomaz Canabrava
d26f109fba Fixes Setting the dive-location via the map.
This patch adds a context menu to set the dive location
via the globe, being the dive with a coordinate or not.

It also fixes setting the dive location on edit mode.

Fixes: #315

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 09:44:55 -08:00
Dirk Hohndel
502a514e91 Reflect air and water temperature changes in dive info
When editing air or water temperature, you are actually editing the
information in the active divecomputer structure. But the Dive Info shows
the summary data created from the temperature data in all dive computers.
For most people who will only ever have one divecomputer per dive this may
seem like an artificial distinction, but it's very important if you track
more than one computer.

So in order to have an edit reflected in what's shown, we must redo the
"summary creation" for data from the different divecomputers into the
summary fields of the dive.

Fixes #313

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-01 20:17:17 -08:00
Henrik Brautaset Aronsen
51d298c8d5 Separate text labels for air and water temperatures
The "air / water Temperatures" label didn't look to good.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30 07:18:39 -08:00
Michael Andreen
648f02c669 Avoid using manual timezone offsets.
Since some early bird thought it was a good idea to force the rest of us
to get up early by changing our clocks during summer, we can not use the
currentDateTime() to determine the timezone offset for all dives.

Instead, we just pretend that everything is in UTC and avoid doing the
offset calculations.

If only that early bird knew that if clocks stayed consistent throughout
the year then I could be asleep instead of fixing this in the middle of
the night..

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-29 20:31:51 -08:00
Dirk Hohndel
d668f5dc8e Turn off dive location edit hint when cancelling dive edit
Simply clear the edited dive (regardless of whether it's set) and hide the
message if visible. The previous code was a little too convoluted...

Fixes #305

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-29 13:12:44 -08:00
Dirk Hohndel
ff5fa70a88 Editing air or water temperature should modify dive computer, not dive
The dive fields are summary fields, the actual data needs to be in the
divecomputer specific fields.

Fixes #307
2013-11-29 12:05:21 -08:00
Tomaz Canabrava
3264255a7a Make it possible to hide some columns on the Cylinders Equipment pane.
This patch makes it possible to hide some columns on the Cylinders
Equipment pane. The 'remove' and 'type' are impossible to hide,
since they are the most important ones for a non-tech diver.

Fixes #281

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-28 15:28:15 -08:00
Dirk Hohndel
cc91cad890 Make sure we keep our notion of what's selected in sync with the UI
When editing a dive, a group of dives or a trip we need to make sure that
we don't lose track of which dives and trips were selected. Otherwise we
might act on dives that DON'T appear selected in the UI but that we think
are still selected.

Fixes #304

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-27 08:39:47 -08:00
Tomaz Canabrava
e175b1d1ab Remember Trip Selection.
This patch remembers the trip selection across the Dive Tree Model.
It's a tiny bit big because we used to have a variable 'selected
trips' that's now calculed dynamically - this is more future proof.

This is a start of Un-cluttering the view ( for 4.1 I hope to reduce the
code in this class to nearly a half. )

Fixes #303

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 11:25:50 -08:00
Dirk Hohndel
eec732548b Switch tab title to Trip Notes when handling a trip
And switch back to Dive Notes when back to looking at a dive. This makes
things more consistent...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-25 11:05:09 -08:00
Dirk Hohndel
60a5d1d070 Fix a couple of warnings
Removing unused variables.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:50:56 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Dirk Hohndel
0ca12c3601 Collect per tank SAC rate
This is a bit painful, but we basically walk the samples and pick the
valid tank from the events. And then we do a simple discrete integration
to figure out the mean depth per tank and duration per tank. And then we
assemble all that into per tank statistics.

Strangely the value calculated here seems slightly higher than one would
expect from the overall SAC rate. This inconsistency should be
investigated a bit further, but my guess it it's based on the assumption
that the DC provided mean depth is possibly more accurate than what we can
calculate from the profile.

Fixes #284

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 23:07:04 -08:00
Anton Lundin
eb027f2a4b Do per cylinder statistics
This shows how much gas form each cylinder was used. I would like to add
SAC to that list too but it became a mess trying to calculate average
depth per cylinder.

Design based on idea in #284

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:46:19 -08:00
Dirk Hohndel
6acff53735 Fix trip summary line in dive list
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>
2013-11-19 14:20:18 -08:00
Dirk Hohndel
4619bfd9ca Immediately update the dive flag label when editing location text
This seems like a much nicer user experience. Editing a location's name is
immediately reflected on the globe label, the moment it happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:32:24 -08:00
Dirk Hohndel
7886719443 Handle double clicks on globe during dive edit mode
When we are editing or adding a dive, the globe widget needs to act
differently. Instead of directly changing the lat/lon of selected dives,
it needs populate the coordinate text field as if this information was
entered by the user (effectively all it is is a way to more conveniently
enter coordinates).

As a side effect, this also allows us to change the location once it has
been added (you just need to go into dive edit mode to do so).

There is one weird issue that occasionally (and I can't quite reproduce
this) I get lat/lon very close to 0/0 (as if the globe widget was centered
on 0/0 and not on whatever it is actually showing). That still needs to be
addressed.

Fixes #239
Fixes #131

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:12:31 -08:00
Dirk Hohndel
8ae8c81d3d Fix various issues with the dive add / edit manual dive code
- get_gas_from_events does NOT always set o2/he. It only updates them IFF
  a matching event is found; so we need to make sure we start out with a
  valid gas mix
- the way we tried to restore the edited dive in case of an edit to a
  manually added that is cancelled was completely bogus. Way too complex
  when we can simply and reliably simply store the dive and then copy it
  back

Fixes #270

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-18 11:55:56 -08:00
Dirk Hohndel
962abba1f7 Remove ununsed variables
The warnings are distracting - and the variables are truly obsolete by
now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 14:36:37 -08:00
Tim Wootton
0e9cd09442 Make editing message consistent with button labels
Changes Ok button to a Save button Modifies editing messages to reference
buttons Save and Cancel.

Fixes #245

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 13:44:52 -08:00
Anton Lundin
2b1c75a584 Use date format from system locale
Instead of hard coding a American date format, let qt use whatever the
locale suggests.

Fixes #248

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 07:08:53 -08:00
Tomaz Canabrava
4f9526ef81 Fix wrong handling of Dive Table, and revert some wrong changes.
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>
2013-11-16 20:19:55 -08:00
Maximilian Güntner
3302ee11c1 changed tag completition to case-insensitive
When completing tags, the case of the completion prefix
should not matter.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:14:39 +09:00
Dirk Hohndel
ed41d5a744 Sort the dive table after adding a dive
This commit scares me. Any pointers to dives or indices into the dive
table... anything like that is invalid after we resort the table. Well,
not technically "invalid" (as in bad pointers), but after re-sorting the
table these will possibly not be pointing at what we expected.

This starts with the selection being "wrong" after we add a dive that
isn't the last dive (once we click OK the chronologically last dive will
be selected).

But of course without doing this, our #1 assumption about the dive_table
is broken. The dive_table is supposed to be in chronological order.

Best advice of course would be "don't enter dives out of order" - but of
course that's not realistic.

Fixes #234

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 19:36:41 +09:00
Dirk Hohndel
f6eb26dbae Handle tank data correctly in profile editing mode for manually added dive
This is subtle. Normally you would expect someone to edit the tank data by
simply clicking on it in the equipment tab. But a user could conceivably
edit the tank data after clicking on the profile editing button instead.
This works now as well.

This also addresses the issue that start and end pressure were not shown
in profile editing mode.

Fixes #235

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 18:36:21 +09:00
Dirk Hohndel
dfd17c7a7f Maintain the selection when aborting "dive add"
We remember what was selected before and restore it. Maybe there's a more
"Qt way" of doing this, but my implementation appears to work :-)

Also remove unconditional debug output that snuck into an earlier commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 17:58:14 +09:00
Dirk Hohndel
c18464b44f Don't overwrite the new cylinders when adding a dive
We carefully assembled the correct data in the cylinders - don't replace
that data when manually editing a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:27:03 +09:00
Dirk Hohndel
dee1645de0 Correct behavior when adding a dive to an empty list and canceling the add
We need to leave the widget disabled and the date / time and coordinates
cleared.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:23:59 +09:00
Tomaz Canabrava
b98157a519 Partially revert d72c69db7a and fix its errors
In the offending commit a QWidget was changed to QTableView, but
only in the header - and thus making avaliable all method calls,
but the initialization of the widgets was still a QWidget, and
nothing of QTableView was used besides an incorrect call to
setColumnHidden.

This commit fixes that by using the view() method provided by the
TableView implementation which returns the true QTableView that should be
used for specific nitpicking, like hidding columns. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 11:58:47 +09:00
Michael Andreen
c7ea7426f7 Only auto-complete gps information when empty.
Previously gps information was always overwritten, unless the user had
modified it in the current editing session. This causes problem with
some use cases, like when coordinates are provided before the location
name by the companion app.

Now gps information is only overwritten when it is:
  - Empty
  - Auto-completed in the current editing session. (When the user hits
    accept it is considered hand-edited.)

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 16:46:17 +09:00
Dirk Hohndel
3c8155880a Make gas selection for add dive work
This now offers the correct gases for which we have cylinders defined.

For both the planner and add dive we still don't end up with the correct
cylinders in the resulting dive. But that's for another commit to fix.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 16:33:27 +09:00
Dirk Hohndel
662b1061f0 Handle add dive cancel correctly
This should leave the program in a consistent state after add dive was
cancelled (and do the right thing in case the dive list was empty).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 14:41:29 +09:00
Dirk Hohndel
a683a217b9 First steps to make add dive work with the correct infrastructure
This just makes sure that we do the right thing with the staging drive,
that we don't mess up the selection, the we are smart about using our
helper functions, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 14:21:50 +09:00
Dirk Hohndel
d72c69db7a Add depth colum to cylinder model
To make the planner work this adds a new column to the Cylinder widget
(depth - for the depth at which we want to change to a certain gas
during deco).

This also tries to hide that column in the equipment view and hide the
start/end pressure columns in the planner view. Oddly that fails :-(

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 11:17:40 +09:00
Dirk Hohndel
9ead871d64 Stop clicks on the globe from changing dive list selection while editing
This caused us to get royally confused when manually adding a dive and
trying to set the location through the marble widget.

Fixes # 229

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11 06:23:18 +09:00
Dirk Hohndel
aa4931e8c6 Show a cylinder widget in the dive planner
This is intended to allow the user to provide the gases / cylinders that
she will be diving with. With that information the planner can warn the
user about insufficient gases, but more importantly it can show relevant
gases in the gas select drop down.

Right now the add cylinder button doesn't add a cylinder - that's a
problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10 07:07:59 +09:00
Dirk Hohndel
487efb1ee9 Merge branch 'addDiveGasFix' 2013-11-09 20:35:09 +09:00
Tomaz Canabrava
8a970c64c2 Removed inconsistency when user tried to add dive while planning.
The user could add a dive, and in the middle click on the 'plan'
button. Since we didn't cared about that on the widget, a lot of
inconsistencies could occour. this fixes that by setting a flag
on the Planner, that has now three modes: nothing, plan and add.
(maybe in the future an edit mode will be valid too.)

If in 'NOTHING' mode, user can enter the addition, edition and
planning. If in any other mode, user can't do a thing. The mode
gets back to NOTHING when user accepts or cancels a plan / add
/ edition.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09 15:35:29 +09:00
Dirk Hohndel
1578c1edb2 Be consistent when passing around gas data in the planner
We need to make sure that the correct segment has the correct gas assigned
to it - and that those gases are correctly tracked when editing a manually
added dive as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08 18:15:04 +09:00
Taiane Ramos
abd54cad61 Fix for equipment tab cancel button bug
On equipment tab, when editing a cell and then clicking on cancel button,
it would delete all the cylinders table. Now it performs the original
behaviour of recovering the original value of the cell and don't delete
the table.

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07 12:40:39 +09:00
Dirk Hohndel
1c3a1a9592 Hide temperature fields when displaying / editing trip data
And show them again when displaying a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07 12:38:35 +09:00
Maximilian Güntner
6ee2d88896 Hide TadWidget and Label when editing a trip
Also hide ui.CoordinatedLabel when editing a trip,
since ui.coordinates is hidden.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 17:05:29 +09:00
Dirk Hohndel
0f66e7a025 Show a different message when editing more than one dive
I still wonder if we have all the semantics correct for multi dive
editing. This will need more testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 15:57:24 +09:00
Maximilian Güntner
04cdfce782 Added a custom widget for tagging dives
A custom tag widget has been added to MainTab.
Tags are seperated by a comma ",". The implementation
supports escaping a comma by using "\,".
While typing, the widget supports the user by suggesting
tags using a QCompleter.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 03:37:31 +01:00
Tomaz Canabrava
0e96c9f62e Enable undo for the Edit mode on Added Dives.
This enables undo for the edit mode on added dives, it uses the
premade backup to fill the old dive with data. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 14:06:03 -04:00
Tomaz Canabrava
f7cd3e780c Enable editing a dive that was manually entered.
This patch enables editing a dive that was manually entered,
it doesn't cover dive plans yet because on the plan I need to
figure out what are the 'user-entered' points, and what are
the algorithm point. and I feel lazy. =p

One last thing that's missing is to revert the dive to the
previous condition if the user cancels the edition, currently
canceling and applying ok is the same thing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 11:48:34 -04:00
Michael Andreen
695f64a23a Subject: [PATCH] No need to center on dive after editing coordinates.
This is done automatically now.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-24 16:58:05 +01:00
Tomaz Canabrava
1b9a4f2bf8 Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 10:21:04 -03:00
Patrick Valsecchi
1dccf84c67 Added salinity to the Dive Info tab.
Took the opportunity to remove some copy&paste.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-10 07:11:32 -07:00
Dirk Hohndel
8e8a631cbc Fix crash when cancelling 'Add Dive'
If selected_dive is -1 get_dive(selected_dive) will return NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 23:24:44 -07:00
Dirk Hohndel
90b0f75d40 Remove info.c/info.h
The one remaining helper function in there was moved to maintab.cpp (which
was the one remaining user).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 11:48:14 -07:00
Benjamin
47ca630cc2 Maximum depth of a dive/a series of dives is not show correctly
After selecting a dive or a series of dives, the "Stats" tab shows the
minimum, average and maximum stats for the selected dives. The "Depth"
section does not display the correct value for the maximum depth.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 09:22:16 -07:00
Dirk Hohndel
2c4ccc04bd Parse GPS text in C++ and re-implement GPS changed check
This is SO MUCH easier then the convoluted and fragile C / glib code it
replaces.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:42:32 -07:00
Dirk Hohndel
4b12f28ca4 First steps towards removing glib dependencies
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)

This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:41:44 -07:00
Benjamin
fb5ae28865 Correct spelling of "weight" throughout the code.
"Weight" was misspelled "weigth" in several places in the code
and comments.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:40:56 -07:00
Thiago Macieira
8e81d3f100 Make the classes generated by uic be real members of our classes
This means we don't have to new/delete them, which is a waste of
overhead.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:48 -07:00
Thiago Macieira
f0f76056ac Include the ui_*.h headers in the main headers.
This means we can also remove the forward declarations.

This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:15 -07:00
Patrick Valsecchi
f02b5e5d90 Fix weight adding in the Qt UI & fix the header height for tables
Fixes #203

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-01 09:49:41 -07:00
Tomaz Canabrava
e81bbc1dab Hack to make the subsurface work on Gnome3 shell
The Gtk+ style on the Gnome shell is somewhat broken on Qt for
some reason. This hack pokes the system, checks if it's running
gnome-shell, and if the current style is gtk+ ( I couldn't just
check for gtk+ since it worked on XFCE and other Gtk based enviro
ments. so a double check is needed. ) then I changed the Pallete
of the affected widgets by hand.
not a pretty hack but worked.

[Dirk Hohndel: redid the patch to be simpler and more consistent]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27 09:22:19 -07:00
Tomaz Canabrava
098aa6343b Fixed the display of Subsurface in Smaller Screens
This patch fixes the display of subsurface in smaller
screens by creating ScrollArea containers that are
now englobbing each of the Tab-pages and the Planner
Widget. Some of those widgets were pretty big by the
amount of things on it and it was too big for small
( 14" and 15" ) screens.

This seems to fix it, and looks good both on Gtk+ and
Oxygen styles.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26 18:14:09 -03:00
Tomaz Canabrava
57ebed9dd0 Only set documentMode on tab if in Oxygen style.
This is much better looking in the Oxygen style, and
on the other styles it looks like crap - so let`s not
use that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26 17:02:27 -03:00
Tomaz Canabrava
8f94b904dd Cleanup the prettyness of subsurface on Gtk+ style.
Fix some stuff concerning the pretyness of subsurface while running
on Gnome and XFCE enviroments. This is the kind of stuff that I
really didn`t want to put on the code but sometimes it`s for the
best. this makes the MainTab much more bearable. There are still
things to fix, like the size and positioning of some of the icons.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26 16:51:11 -03:00
Tomaz Canabrava
bc837163f5 Hook 'Add' from cylinders and weigths to enable Edition
This code hooks the plus button on both cylinders and
weigthsystem tables to trigger the enableEdition() and
thus the work done when you click on + will be saved /
discarted when the user cancels the plan or accepts it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 12:48:24 -07:00
Tomaz Canabrava
2819ee6510 Code cleanup
Fixes a couple of whitespace issues.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 12:48:17 -07:00
Tomaz Canabrava
d9067582a9 Set the Cylinders and Weigths to all selected dives after pressing 'Accept'
This bit of magic actually performs the save on the
dive list for the changed weigths and cylinders,
it will set the cylinders only if there's a change
on the cylinder model, and it will set the weight
only if there's a change in the weigth model.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 14:57:41 -03:00
Tomaz Canabrava
8ce5d91dfe Code cleanup - create a method for cleaning the Palette.
Code cleanup, create a method for cleaning the palette,
less code is better in this case. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 14:36:59 -03:00
Tomaz Canabrava
94c8f64316 Only mark dive list as changed if 'Accepted' was clicked.
The old code marked the dive list as changed on any
of the changes in the model, this was incorrect since
the user could just cancel the edition, wich means
that the divelist shouldn't be marked as changed at all.

when the user clicks on'accept', and the item is indeed
changed on the dive list, then we mark_divelist_changed
to TRUE

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 14:30:03 -03:00
Tomaz Canabrava
c805e2c941 Enable Edition by clicking anywhere on the Cylinders and Weigths.
This patch enables edition on the selected dives as soon
the user press delete or any other column on the Cylinder
/ weigthsystem.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 14:11:38 -03:00
Tomaz Canabrava
26cec576ee Revert to the old values of Cylinders and Weigthsystems on cancel
This patch enables canceling the edition of cylinders and weigth
systems, as soon as the user press cancel, the old values are
re-populated on all selected entries.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 14:10:15 -03:00
Tomaz Canabrava
4f0112c420 Created a placeholder for the Equipment Edition.
This creates a placeholder for the equipment edition,
it will ease the 'revert' and 'apply' when editing
multi dives.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-25 13:30:51 -03:00
Dirk Hohndel
72f0516f6d Disable info widget when canceling 'add dive' for a first dive
One more corner case that we cover correctly.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-24 12:32:18 -07:00
Dirk Hohndel
c6140c6e21 Call refreshDisplay() after editing a dive
We now can change the dive date and the order of dives could have changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-23 21:14:40 -07:00
Dirk Hohndel
3335f083bf Disable the info widget when no dive is selected
This solves the odd case when closing the data file that clicking in the
info widget caused the input fields to respond and the little warning icon
to show up.

Also some minor whitespace cleanup for readability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 08:20:03 -07:00
Dirk Hohndel
88fb82411e Hack to clear the date when no dive is displayed
This mostly happens with no XML file or when closing the current XML file.
Sadly the user still can click on the empty date field (even if nothing
else is active on the screen) and a date reappears.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 07:33:09 -07:00
Dirk Hohndel
765e5b76e6 Fix crash when closing the data file
Only dereference the dive pointer if there actually is a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 07:05:03 -07:00
Dirk Hohndel
21b7ebbaf0 Fix crash when adding dive to empty dive list
Only look up the dive number of a previous dive if there is a previous
dive.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 07:00:14 -07:00
Alexandre Dupas
5935f372ab Fix enabling info widget when closing a dive
If the close action is triggered while there is no current dive (empty
history), the info widget is enabled. To avoid this behavior, we only
enable the info widget during update if the dive index is valid.

Signed-off-by: Alexandre Dupas <alexandre.dupas@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 06:54:34 -07:00
Dirk Hohndel
a8888eaf26 Allow editing of date & time and air & water temperatures
Add two more rows to the widget - this is getting quite busy.
There still is some weirdness where the focus isn't returned where it
should be and a few other details, but overall getting there.

Added helper functions to parse a temperature and to deal with the
timezone offset - with that latter one I also fixed the time offset bug in
the planner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21 08:30:32 -07:00
Dirk Hohndel
acd3599548 Adding a dive changes the dive list
Duh.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20 07:53:06 -05:00
Dirk Hohndel
e04acd4189 Simplistic solution to add dive number to dive added
If this is the last dive and if the previous dive had a number, give this
dive the next number.

Of course there are a couple of issues with the current implementation. We
have no way of changing the date / time of the added dive, so we KNOW that
it will be the last one. But I put that check there so that once we add
the ability to change the date / time (and hopefully remember to then move
the dive to the correct spot in the dive_table), we only assign a number
if it is the last dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20 07:17:35 -05:00
Dirk Hohndel
46c23c53a1 Merge branch 'addDive'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 23:05:17 -05:00
Dirk Hohndel
6881f52739 Hook up cancelling out of adding a dive
This was surprisingly easy - which of course has me worried that I'm
missing something that I should do when cancelling out of this dialog.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 22:58:53 -05:00
Dirk Hohndel
46b125782e Hook up adding a dive
This gets things mostly right.

It creates a dive and uses the planner widget to create samples which are
copied into the dive. It fills in some reasonable defaults (DC model,
timestamp), but doesn't allow editing the timestamp (or the temperatures
and air pressure).

On accept the planner gets reset and the dive appears correctly in the
dive list.

Cancel still needs to be handled.

And I bet there are many subtle bugs lurking here and there. But it's a
start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 22:54:00 -05:00
Michael Andreen
583cea0e2c Fixes for gps coordinates handling.
Reset coordinates properly when clicking undo.

When auto-completing location, only copy coordinates if they have not
been manually edited.

Set the background to red if the gps coordinates won't change, e.g.
there is a parse error, the change is too small or only whitespace
changes.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 11:56:12 -05:00
Dirk Hohndel
5a96389cd3 Fix updateDiveInfo to clear coordinates when called with invalid dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18 23:08:39 -05:00
Tomaz Canabrava
df63bcd8b7 Added the Message and the Buttons on the Equipment Tab
Added the Message and the ok/cancel buttons on the Equipment
Tab, they don't control the Equipment edition yet, but already
does the same as the Notes one, Now I need to merge the other
part - the actuall Equipment Edition.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-18 23:23:04 -03:00
Tomaz Canabrava
506b133875 Add a Warning icon on the changed tabs, for edition of dives.
Adds a Warning icon on the changed tabs, this is important as
usability, for you could change something on the 'notes' tab,
change the tab and did't realized that something was changed
( by forgotting or something ), then clicking on the cancel
button. so now there's a friendly reminder that you actually
changed something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-18 22:38:38 -03:00
Tomaz Canabrava
bcefa4baff Good deal of Code Cleanup for the maintab
Some cleanup was needed in the MainTab code for ages,
now the Edition / Cancel / Ok of the Notes tab is
way more intuitive on the code level.

This is needed to support multidive edition on the
Cylinders and Weigths too, since it's a bit more
complicated, I didn't want to start with a Spaguetti
Code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-18 21:56:53 -03:00
Michael Andreen
1d76ccb8b9 Improved handling of latitude and longitude.
Coordinates are copied when auto-completing location, they are also
displayed and editable in maintab.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-17 16:48:36 -04:00
Dirk Hohndel
396d73705e Merge branch 'multiDiveEdition' of https://github.com/tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	qt-ui/maintab.h
2013-09-16 20:52:01 -04:00
Tomaz Canabrava
5666f6573e Code Cleanup: Merged the three TableViews shared code
Merged the shared code for the three table views into
one code, this way less code is needed if we need to
construct another tableview in the future.
I still need to clean some of the models too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-02 16:21:08 -03:00
Tomaz Canabrava
bb59202812 Made the TableViews share a bit of code, code cleanup.
Made the tableviews share a bit of code, and code cleanup.
The tableviews for Cylinders, Weigth and Dive Planner Points
now shares the CSS and I also implemented the save / load
methods for the dive planner points, so the functionality
is mostly done on the vieualization side. - since we are
now using three tables maybe it's a better idea to create
one class SubSurfaceTable that knows how to handle saving
/ loading of the columns... TODO for the future. ;)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-28 07:48:46 -03:00
Tomaz Canabrava
2b6c3b4c0c Good deal of code cleanup.
This is a bit of code cleanup that I'm not sure that will
pass, since it's all macro-based, but I don't have a thing
against macros at all. Sometimes they helps us keep a better
and cleaner code base. I think I managed to remove around 120
lines of code, wich isn't much, but I replaced it by 14. and the
code is now easyer to maintain, so hooray.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16 15:52:40 -03:00
Tomaz Canabrava
b7fe4087a6 Change bg of edited parts of the dive on the interface
Change the background color of edited parts of the dive
on the interface. Specially util if you are editing multi
dives in a single step, and went to eat something or did
anything else for five minutes, then come back and don't
quite remember what did you changed. now it's in a cute
yellowish background.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16 15:38:18 -03:00
Tomaz Canabrava
225b13a22d Enable Multi Dive Editing.
This patch enables multi dive editing on the selected
dives. It's a bit of big patch where I reworked how it
worked since it was written just for a single dive.
this means that this can introduce bugs - I'v tested it
quite a bit but a thing could slip thru my fingers. :)

How this is supposed to work:

Select a few dives that you want ( one or more ) then
click on the field that you wanna edit / multi edit, and
press 'accept'. *only* the edited field will be modified
thru all dives.

Next patch - I'll change the bg color of the edited fields.A

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-16 13:31:52 -03:00
Tomaz Canabrava
41ada82a04 Fixed a bug where the auto-completion would not work via commandline.
Fixed a bug where the auto-completion would not work via command
line, I fixed it by reloading the information of dives when a
dive file is open via command line or via UI.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13 11:53:48 -03:00
Tomaz Canabrava
6da2d40d3c Added completion for buddy, divemaster, location and suit.
Added completion for buddy, divemaster, location and suit.
The completions uses some models that I created in the last
commit - everytime that a divelog file is loaded, it creates
a list of completion items.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13 10:49:59 -03:00
Tomaz Canabrava
663ab6e23e Fixes showing the labels of divemaster and buddy after a trip selection
This patches fixes showing back the labels 'Dive master' and 'Buddy'
after a trip selection  was done, then back to single dive selection.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13 08:58:52 -03:00
Tomaz Canabrava
3464bcf6ef Makes the 'auto' edition behave in a better way.
This patch makes the auto editon behave in a better way,
now you can scroll the notes widget without marking it as
editable, and also adds a bit of code cleanup, and a better
logic for editing the other widgets.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13 08:34:04 -03:00
Tomaz Canabrava
29b92e2fc5 Adds Single-Click editions on the TableView
This is a linus request, adds a Single-click edition
on the tableview to make it more consistent with the
rest of the interface where edition is permitted.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-17 12:13:04 -03:00
Lubomir I. Ivanov
bdd89f0e7a Coordinate some mark_divelist_changed() calls
1) Make a call mark_divelist_changed(TRUE) when the user adds new
cylinder or weight entries.

2) Call mark_divelist_changed(FALSE) in
MainWindow::on_actionClose_triggered() so that each time after
a file is closed or a new one is created it does not ask immediately
the user for a save confirmation for the blank file/divelist.

3) Call mark_divelist_changed(TRUE) once a dive's geo location
has changed in GlobeGPS::changeDiveGeoPosition().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:57:11 +08:00
Lubomir I. Ivanov
8678e2d57c Better positioning of the plus sign icons in the Equip. tab
There are a couple of problems with said icons:
- When the Equip. tab is first seen, no relative event is monitored
so that the correct position is updated and the icons are positioned.

To solve that we connect the signal MainTab::currentChanged(int)
and call MainTab::equipmentPlusUpdate().

- When the info-profile QSplitter resizes with a snap towards/from
the edges of the main window, no resize handler is called such as
MainTab::resizeEvent().

A solution is to monitor the resize of the info-profile splitter
with MainWindow::on_infoProfileSplitter_splitterMoved() and again
call MainTab::equipmentPlusUpdate()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:57:10 +08:00
Tomaz Canabrava
c917b29701 Save / Restore the sizes of the columns in Cylinders / Weigth widgets
This patch saves / restores the sizes of the columns in the cylinders
and weigth table widgets, so everything is now properly behaved. There
's still other things to do - but I'm tired. i's sunday and there's a
protest against the brazilian government to go.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 14:36:23 -03:00
Tomaz Canabrava
20849f014e Make the columns have a sane default width for 'type'
Make the columns on Cylinders edit and Wheight Edit to
have sane values for 'type', this is needed because the
old behavior was to set it fixed size, and the default fixed
size was silly. this calculates a good predefined value
taking the font size in consideration.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 13:28:59 -03:00
Tomaz Canabrava
f9b4c6b889 Better handling of default sizes on the Cylinder and Weight widgets
Better handling of default sizes on the Cylinder and weight widgets,
the weigth widget didn't had a CSS applied so it looked odd compared
to the cylinder one, also the default behavior for the combobox delegate
didn't worked very well with the css applied, being too small.
this patch fixes that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 12:33:27 -03:00
Dirk Hohndel
a960cd2d45 Show & edit trip location and notes when exactly one trip is selected
While we still show the selected_dive in the profile and use it for Dive
Info and Equipment, in the Dive Notes tab we now show the trip location
and trip notes (and none of the other fields), if the user directly
selects a whole trip by clicking on the trip header.

This clever reuse of the widget now allows trip location and notes to be
edited in place.

As a side note: the Gtk version has long allowed the user to edit the
trip location and trip notes, but nowhere did it ever SHOW the trip
notes... so this is more than just feature parity...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 09:20:20 -07:00
Henrik Brautaset Aronsen
0031b64df7 Disable Document Mode for MainTab on MacOSX
Commit c4f06dc536 introduced Document
Mode on the MainTab QTabWidget. This doesn't look good on MacOSX.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:42:13 -07:00
Dirk Hohndel
9dab886117 Reload globe after dive location was modified
This way a change to the location name is immediately reflected in the
map display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 11:39:40 +09:00
Tomaz Canabrava
48dda4192f Added a new widget 'MinMaxAvgWidget'
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>
2013-06-04 18:51:27 -03:00
Dirk Hohndel
e88a9aa83e Once again try to fix the selection
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>
2013-06-02 20:31:04 +09:00
Dirk Hohndel
9a65798daf Use a slightly shorter date string for Info tab
This way the spacing of the elements looks nicer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 17:59:01 +10:00
Tomaz Canabrava
bd6dfa1ebd Align Labels on center.
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>
2013-05-30 11:30:23 -03: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Henrik Brautaset Aronsen
f9598f062c Clean up some typos
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>
2013-05-14 05:24:28 -04:00
Tomaz Canabrava
a6d9f27445 Change setText(QString()) to clear()
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13 21:32:03 -05:00
Tomaz Canabrava
61373eaccf Fix segfault on mouseOver at the Profile with an invalid dive selected ( trip )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-13 15:28:17 -03:00
Amit Chaudhuri
97a044d41f Tweaks to maintab
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>
2013-05-10 16:01:17 -07:00
Amit Chaudhuri
7f9fbd2295 Horizontally align labels on info widget page.
Left aligning text values looked wrong.

Use Qobject cast to filter labels from any other qobjects around and
set alignment. Doing this via Qt Designer would be tedious.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09 12:10:34 -07:00