Commit graph

2175 commits

Author SHA1 Message Date
Dirk Hohndel
f9c97ff97d Show cylinder and gas used in the Qt dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 10:48:09 -07:00
Dirk Hohndel
63c5080561 Move gas string computation into core logic code
This is now a helper called from the Gtk UI code (and will soon be used by
the Qt UI code).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 10:39:35 -07:00
Dirk Hohndel
e6ec626c97 Show trip date (with number of dives) in dive/trip list
That was easy :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 09:33:51 -07:00
Dirk Hohndel
6b7797140b Minor style updates
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 22:00:08 -07:00
Tomaz Canabrava
e5ad47e459 Merge branch 'Qt' into RenderStarsOnTable 2013-05-01 23:54:38 -03:00
Tomaz Canabrava
764a863082 Added Support for the Trips and Dives on the DiveList model.
Now the list and dives will work in the same way that the GTK
version does. The code got changed heavly because the old one
was just looking at the dives and didn't worked like a tree.

small adaptations on the list view and model delegates because
of the changes done on this model.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-01 23:51:34 -03:00
Dirk Hohndel
00d8531382 Fix a couple of small problems in add weightsystem
The constructor letf the currentWeightsytem variable uninitialized.
Instead of creating the memory leak by malloc-ing the newWeightsystem in
the on_addWeight_clicked() function use a local variable instead and pass
its address around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 16:23:20 -07:00
Dirk Hohndel
f45618f0c7 Create Add Weightsystem dialog
My first attempt to create a Qt dialog and to hook it up with the program.
Unsurprisingly this doesn't quite work as expected (i.e., the values I
enter aren't populated in the model), but it's a start...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 16:02:34 -07:00
Dirk Hohndel
482bea84c2 Don't add cylinders and weightsystems past the MAX
We actually should disable the 'Add' button, I guess.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 14:49:17 -07:00
Dirk Hohndel
04e59a0e1c Hook up adding a weightsystem
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 14:43:07 -07:00
Dirk Hohndel
5c2ce0ac20 Add data and add functions for WeightModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 10:11:46 -07:00
Dirk Hohndel
730e055e5a Use the existing current_dive macro in Qt code
Replicating this with the currentDive member seems to make no sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 10:10:16 -07:00
Dirk Hohndel
0794f03b5e Merge branch 'RenderStarsOnTable' of https://github.com/tcanabrava/subsurface into Qt 2013-04-28 13:10:20 -07:00
Amit Chaudhuri
4c665be05f Save and retore splitter dimensions.
Rename splitters and remove seemingly redundant empty splitter.

Use save/restoreState to save splitter sizes using QSettings.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-28 10:17:53 -07:00
Tomaz Canabrava
0be521bb25 Fixed loading the stars when opening with file as argv. minor cleanup
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-28 08:45:22 -03:00
Dirk Hohndel
4179885da7 Merge branch 'RenderStarsOnTable' of https://github.com/tcanabrava/subsurface into Qt 2013-04-27 20:53:25 -07:00
Dirk Hohndel
4bb0cd8cef Minor coding style cleanups - and use core logic function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27 20:47:47 -07:00
Amit Chaudhuri
89f02c42aa Add support for remembering settings
Use QSettings to provide persistent storage of settings. For example, we
store and restore the size of the MainWindow.

We use the organisation name hohndel.org and keep subsurface as the
application name.

A section is specified for things to do with the MainWindow; other
sections could be added e.g. for preferred units?

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27 20:44:36 -07:00
Tomaz Canabrava
2f4d6bbe53 Added support for showing the Stars on the DiveTable
For the stars on the dive table I had to rework a bit my
StarRating widget, because it used a pixmap for each widget
that were created. Not it uses only 2 pixmaps: the active
and inactive ones.

A new file was created named modeldelegates(h, cpp) that
should hold all delegates of the models. For the GTK / C
folks, a 'Delegate' ia s way to bypass the default behavior
of the view that's displaying the data.

I also added the code to display the stars if no delegate
is set ( good for debugging. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-27 12:27:27 -03:00
Dirk Hohndel
1d0d42f861 Remove the explicit UTF-8 conversions
Thanks to commit bdbfdcdfa0fb ('Ask Qt 4 to use the UTF-8 codec as the
"codec for C strings"') we no longer need the explicit UTF-8 conversion
when creating QStrings from char *.

Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 21:10:05 -07:00
Dirk Hohndel
106659774a Merge branch 'QtStuff' of git://github.com/tcanabrava/subsurface into Qt 2013-04-25 20:49:03 -07:00
Thiago Macieira
8da7a6985b Ask Qt 4 to use the UTF-8 codec as the "codec for C strings"
Qt 5 does this by default, so it's not necessary there (in fact,
setCodecForCStrings was removed, so you catch any mistakes).

Now all QString methods taking a const char* or QByteArray
(constructor, append(), operator+=, operator<, etc.) will interpret
that char array as UTF-8. Conversely, the QByteArray methods taking a
QString will generate UTF-8 too. This includes the badly named
QString::fromAscii() and QString::toAscii().

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 20:11:36 -07:00
Tomaz Canabrava
b20b57b29f Make dirk happy by enabling sort in the model.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-25 20:44:06 -03:00
Dirk Hohndel
98027be1c1 Minor cleanup of constructors and one accessor for DiveItem
Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 08:39:40 -07:00
Henrik Brautaset Aronsen
8a884d2cf7 Remove useless members of DiveItem
Just use the dive struct directly.

Suggested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 07:13:19 -07:00
Henrik Brautaset Aronsen
5d4d40df91 Simplify DiveItem
The DiveItem constructor had 13 variables.  By passing it the full
dive we reduce that to 2.

[Dirk Hohndel: changed to use "struct dive *" instead of just "dive *"]

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 06:39:02 -07:00
Dirk Hohndel
fde0f49df8 Use Subsurface's data structures for DiveItem
We have these data structures for a reason. They provide context
about the units used and prevent mistakes. And of course they
are used everywhere else so we should use them here, too.

This also tries to display some more data and make things look
a bit more like the Gtk version when it comes to alignment and
formatting.

My guess is this will make Qt developers' eyes bleed. My apologies.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 23:21:57 -07:00
Dirk Hohndel
4587f8a274 Call the get_date functions with timestamp_t instead of struct tm
This is the much more natural way to use this function, now that I look at
it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 21:05:57 -07:00
Thiago Macieira
1e0bc8a1ab Fix building for Windows: cache the Windows-specific variables
Otherwise, we won't link to winsock or set the subsystem correctly.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 17:03:58 -07:00
Dirk Hohndel
8efd63b233 MSVC is c89
In case someone wants to compile this with an outdated C compiler...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:52:18 -07:00
Dirk Hohndel
92a5a5c35b Split report_dives into UI and logic and move to divelist files
Functionality is unchanged, except we now have a nice process_dives
function that deals with all the logic and that gets called from
report_dives from the Gtk code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:38:25 -07:00
Dirk Hohndel
02d822924c Merge branch 'useStarWidgets' of git://github.com/tcanabrava/subsurface into Qt 2013-04-24 16:18:08 -07:00
Dirk Hohndel
ce235bd581 Correctly format depth and time
We really need those leading 0s.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:03:14 -07:00
Dirk Hohndel
e156b00f05 Fix column headings for divelist
This looks better and is consistent with the Gtk version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:02:41 -07:00
Tomaz Canabrava
639dbe95f8 Fix the order of the DiveInformation tab bar.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:59:52 -03:00
Tomaz Canabrava
607c08bb25 Remove the use of this->
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:57:50 -03:00
Tomaz Canabrava
634abb8bb2 Use the star widget in it's right place
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:57:10 -03:00
Amit Chaudhuri
edab566105 Amend divetrip model to use int units
Amend the DiveItem class to avoid float in favour of int. Add getters
which return display friendly QStrings reflecting user preferences for
(e.g.) depth.

Modify DiveTripModel to support controlled alignment by column; right
align for depth and duration.

Fix problems with utf8 encoding on rating stars, degree symbols and
O2 subscript.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 13:06:42 -07:00
Miika Turkia
17c4120143 A hook for DM4 XML import
This will take the DM4 XSLT into use.

In the future it is quite likely that we will have to start using
something more specific on top of the root element name to identify dive
log formats. But as "Dive" is currently a unique root element name for
us, this suffices for now.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 20:48:09 -07:00
Miika Turkia
68cf4f742e XSLT for importing individual DM4 dives
This XSLT can be used when exporting single dives from DM4 and importing
them to Subsurface.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 20:48:00 -07:00
Miika Turkia
2d0473f6f5 Retain event sort order on restart
The events that had same time stamp were reversed in order on every new
load of the log file. This patch will keep the order static. (Changing
order is annoying when using version control to store the logs.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 20:47:48 -07:00
Anton Lundin
ee0025f696 Add a simple table-based cns calculations
For dives where divecomputers haven't provided us with a cns, we
calculate our cns accumulated during that dive based on a simple table.

We also check if we did a dive in the prior 12 ours and grab the cns
from it and calculate how much of that still affects us.

[Dirk Hohndel: a couple of small changes: remove unnecessary check of cns
               values in the samples of the first dive computer, changed
	       the way we determine the 'previous dive' and used the end
	       time of that previous dive for the decay calculation]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 20:43:34 -07:00
Miika Turkia
8cdb836400 Switch to UTF-8 on .DLD export
Let's use the shiny new UTF-8 encoding on divelogs.de export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 20:43:12 -07:00
Dirk Hohndel
26f7e82b62 Merge branch 'StarWidgetResource' of git://github.com/tcanabrava/subsurface into Qt 2013-04-23 14:05:43 -07:00
Henrik Brautaset Aronsen
e9625d70c1 Fix missing gtk-mac-integration includes
GTKCFLAGS were overwritten.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 14:04:24 -07:00
Henrik Brautaset Aronsen
b495c298e3 Remove trailing spaces from config.cache file
Things like «ifeq ($(UNAME), darwin)» would not trigger, since variables
in the config.cache files had trailing spaces.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 14:04:24 -07:00
Tomaz Canabrava
0ac67c4256 Use the star from the resource file instead of hardcoding it's patch
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-23 17:32:30 -03:00
Henrik Brautaset Aronsen
6a3ccaea35 Fix config.cache creation on a Mac
Mac uses BSD sed by default, which doesn't support \n substition
by default.  Replacing sed with tr.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 12:31:15 -07:00
Dirk Hohndel
315c0b505c Set the window icon in Qt
And even use the resource file to allow me to use an alias for it in the
actual code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 09:55:08 -07:00
Dirk Hohndel
d72f4e470a Consolidate the two .qrc files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 08:30:10 -07:00