Commit graph

5307 commits

Author SHA1 Message Date
Dirk Hohndel
d8c3113584 UI restructure: don't use random dives from the divelist for data
Everything should come from the displayed_dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 14:43:32 -07:00
Dirk Hohndel
117b212cdd UI restructure: make planner act on displayed_dive
Instead of constantly creating and deleting dives and messing with the
dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 13:39:06 -07:00
Dirk Hohndel
47f9f59c1a UI restructure: add clone_dive helper
This is kind of the inverse to copy_dive(). Instead of duplicating all the
data that the dive points to, it moves it to a new struct dive and zeroes
out the old one so there are no two sets of pointers to these data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 13:34:27 -07:00
Dirk Hohndel
6b1b2bc919 UI restructure: get rid of "current" pointer in cylinders and weights
Instead always display the display_dive.

Now the only thing left to slay is the stagingDive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
a86aca0378 UI restructure: only switch to edit mode if user made change
With this patch a simple click into the main tab does not start editing
mode. Only once a value is modified do we show the message box and disable
the other widgets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
66870add77 UI restructure: track if any data was modified
Instead of comparing the dive structures (which doesn't work since the
strings are actually copies), track if the user made changes.

Cylinders and weights still need to be compared as they are handled in
different widgets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
20d9fafd7c UI restructure: improve memory handling in maintab
Free strings before overwriting them. Use copy_dive() instead of just
copying the dive structure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
2cfe97e4dd Add a "smart strdup" helper named copy_string()
If the string is non-NULL, copy it, otherwise return NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
56501dda1e UI restructure: updateDiveInfo displays displayed_dive
Instead of passing in a divenr of -1 to make it clear things this changes
things to use an options "clear" flag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
ce47683de8 UI restructure: always display pictures for displayed dive
The only time this is ever wrong is in print mode, so let's never show
pictures in print mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
635a7ab771 UI restructure: updateDiveInfo shows the selected dive by default
So don't be redundant.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
2a55e55868 UI restructure: plotDive: plot current dive by default & use displayed_dive
No longer use the dive structure that is passed in but instead always use
the displayed_dive to display things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:54 -07:00
Dirk Hohndel
cd65c8512d UI restructure: add helper function to copy and clear a dive
This way we can safely copy around dives (specifically, copy the dive to
be displayed / edited into the displayed_dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:43 -07:00
Dirk Hohndel
b298306eb1 UI restructure: fix get_divenr to do the right thing on a copy of a dive
We should not care if the dive has the same address in memory. We care if
it is the same dive (by using the unique ID).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-02 12:50:00 -07:00
Dirk Hohndel
91086d08ad UI restructure: plotDive should just take one dive
We don't have a concept of what to do when plotting multiple dives, so
let's not pretend and remove all the messing around with lists.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-02 12:03:40 -07:00
Dirk Hohndel
a221a6e9f5 UI restructure: use a global variable to hold the dive we show / edit
There is massive confusion about what we display when and where and which
dive structure (or pointer to a dive structure) contains which information
at which stage. This is the first step towards restructuring all of this.

This creates a global variable displayed_dive which at any point in time
should be what is displayed on screen (both in the profile and in the
maintab). It removes the editedDive concept from MainTab.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-02 11:56:36 -07:00
Gehad Elrobey
d568f96d05 HTML: use Right/Left arrows to switch between dives
Use arrows to switch between dives in dive detailed view.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 19:41:11 -07:00
Linus Torvalds
3c7bb789af Don't show gaschange events at the beginning of a dive
The initial gas change event is really special - it just specifies the gas
mix from the dive computer. So don't show it as an event if that already
matches the initial gas.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 14:08:20 -07:00
Dirk Hohndel
81f8ed901f Add dive: remove cylinder pressures from samples
These cylinder pressures are actually just artefacts of the way we track
gas consumption in the code shared between planner and add dive. We don't
want them in the actual dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 10:28:42 -07:00
Dirk Hohndel
8bd16a7808 Equipment edit: for some reason we need a local copy of index
Calling enableEdition appears to corrupt the index that is passed into
this slot.

This doesn't fix the problem that we can't edit the cylinder start and end
pressure of a manually added dive, but at least we no longer try to edit
and invalid index.

See #582

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 10:18:21 -07:00
Dirk Hohndel
48e059c49d Maintab: fix tab stop order
This keeps getting screwed up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:53:31 -07:00
Dirk Hohndel
55ec4bf397 Planner: use the traditional date widget
Much as I love the calendar, that meeds a little more tuning, so switch
back as we did for the maintab.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:49:12 -07:00
Anton Lundin
b1869c619a Use gas_mod helper instead of local version
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:38:15 -07:00
Dirk Hohndel
1d09ce2ce2 Picture loading: only add the pictures to "reasonable" dives
If the picture has a timestamp that was within 30 minutes of the start and
finish of the dive, we take it. Otherwise we don't.

If the timestamps of the images are off, the time shift dialog allows the
user to fix this.

And with this patch the user can select all the dives of a trip and all
the pictures they took on the trip and the "right thing" will happen.

Fixes #578

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:29:19 -07:00
Dirk Hohndel
1d0193c62e Small whitespace fix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:29:01 -07:00
Dirk Hohndel
6548773ad6 Implement a cache for the scaled images
No point in scaling them every time the user looks at the dive. Over time
this may waste some memory (especially if people have a ton of pictures
and let the process run a very long time). For now I won't worry about
that.

Fixes #577

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:02:10 -07:00
Anton Lundin
2af7aefd73 Clarify the gaschange icon
This removes the white circle in the backround of the gaschange icon.
This makes it stand out a bit less but looks better to me.

This also fills in the black part on the cylinder neck.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 07:10:38 -07:00
Robert C. Helling
496f658838 Show subsurface logo in dive plan print out
A little bit of CI: Print our logo on the print out dive plan.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 07:05:12 -07:00
Robert C. Helling
1b7abab9b9 Show ascent gas consumption separately in planner
In the worst gase you have to provide gas for your buddy during all the
ascent. So you should have the amount of gas used in ascent as a reserve.
This patch makes the planner notes display that value separately.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 07:05:01 -07:00
Joakim Bygdell
2766ed8093 fix tab step order in planner settings.
--f46d04426a604016a404fd1cd218
Content-Type: text/plain; charset=UTF-8

Tab step order should follow a logical order, top to bottom, left to right
and not jump around.

--
//Jocke

<div dir="ltr">Tab step order should follow a logical order, top to bottom, left to right and not jump around.<br><br clear="all"><div><br>-- <br><div>//Jocke</div>
</div></div>

From e8ff7986f858403fb4f5277741c9fa528962f9bc Mon Sep 17 00:00:00 2001
From: Joakim Bygdell <j.bygdell@gmail.com>
Date: Tue, 1 Jul 2014 09:28:23 +0200
Subject: [PATCH] Fix tab step order in planner settings.

Tab step order should follow a logical order, top to bottom
left to right.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 07:01:44 -07:00
Dirk Hohndel
37ee0baf58 Main Window: start showing dive list and globe
Fixes #571

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 20:53:53 -07:00
Tomaz Canabrava
1ac0b00662 Only replot the dive if maxDepth > oldMaxDepth on plan / add mode.
This fixes the "impossible to work with" planner with the mouse
now the dive will only grow and not shrink untill you release
the mouse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:53 -07:00
Tomaz Canabrava
4da7dee8cf Better colors for Add and Plan modes.
Those are ligther colors and it should be a better choice
a way better choice is to ask for a designer wich color to use
but most of my minions are busy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:41 -07:00
Tomaz Canabrava
f610662edb Revert Date widget to default in Qt
The new one, while it's prettier, doesn't fit into the
current layout in a good way, we need a better layout for
it. So it's code will continue as dead code for a while.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:32 -07:00
Tomaz Canabrava
a17537ed50 Selects the dive date before showing it up.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:18 -07:00
Tomaz Canabrava
274f2bf124 Added a shortcut 'ESC' to close the calendar widget
This hides the calendar widget when the user press esc
when it's running.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:05 -07:00
Tomaz Canabrava
facf6e4b59 Calendar widget should hide when clicking somewhere else
This patch adds a event filter to hide the calendar
widget when it loses focus

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:05:43 -07:00
Tomaz Canabrava
927bc5d601 Fixed SearchBar layout and icons
This is almost a rewrite of the Search function on the WebView
the old code had a few uneeded things, mostly being a subclass
of QMainWindow instead of the QWebView - this makes the code
use a tiny bit less ram.

The SearchBox was also moved to an own class ( we can use it
later to filter the contents of the DiveList for instance )

and a forced use of the pixmaps for the Mac and Windows platform
was added.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:04:24 -07:00
Tomaz Canabrava
4c7ea24921 Align the texts on the Left inside of Right for the DiveList
The Qt Framework adds a visual 'tab' on the children of a
node, but if we forced a right alignment on them, it will
lose that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:03:46 -07:00
Dirk Hohndel
fd22e8123b User survey: detect the machine the app is running on
We build 32bit Windows binaries - but we really want to know if the OS is
x86_64 or i386. This little hack should give us that information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 15:54:49 -07:00
Dirk Hohndel
5149bc0df8 User survey: don't ask more than once per invocation
Otherwise when the user selects "Ask Again" they will get asked when they
change preferences.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 14:42:48 -07:00
Dirk Hohndel
8315f44d2c Merge branch 'survey' 2014-06-30 14:06:03 -07:00
Dirk Hohndel
e4a88db7dc Fix Qt4 build
Strangely no problems on Qt5 without those declarations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 14:05:02 -07:00
Dirk Hohndel
b2f473d927 User survey: actually collect and send the data to the backend
This switches the QTextEdit fields to QPlainTextEdit (I don't see a reason
why we should allow HTML here), no longer tries to have a default text but
instead adds labels for the two fields, connects the UI so th data is
collected and uses a bastardized WebServices subclass to send the data to
our backend.

Fixes #546

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 12:30:46 -07:00
Miika Turkia
5b93c61348 Small white space tune-up on JS file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 08:01:11 -07:00
Gehad elrobey
3a28507dc1 HTML: Show nice values when pressure is not available
Show nice values instead of the undefined when the pressure is not
available.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 08:00:59 -07:00
Gehad elrobey
a110b2858d HTML: Fix listlib whitespace errors.
Fix some code style and whitespace errors.

[Dirk Hohndel: one hunk didn't apply as there was no such code...?]

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 07:59:53 -07:00
Gehad elrobey
023187a73e HTML: Use jqplot to draw profile.
Use jqplot to draw dive profile, Depth and pressure curves. add the
library Javascript files under the theme directory and editing the
exporter. Load them to the HTML template dynamically with
synchronization as they are dependant on each other.
Also Adding min version of JQuery that is needed by the library.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 07:56:47 -07:00
Gehad elrobey
ac46158d65 HTML: some css enhancment
Detailed dive view needs more padding just to view normally.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 07:56:43 -07:00
Gehad elrobey
f139eff590 HTML: Add temperature and pressure curves to the JSON data.
Add more dive sample details to the JSON data.
This is not so optimized some zero values can be ignored.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 07:56:35 -07:00