Commit graph

2148 commits

Author SHA1 Message Date
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
Dirk Hohndel
121740db2a Merge branch 'buildsystem-for-dirk' of http://github.com/thiagomacieira/subsurface into Qt 2013-04-23 08:09:57 -07:00
Thiago Macieira
72ad76fc26 Fix compilation: in C++, enums don't have operator++
To use ++, we need to declare the variable as int. But then we need to
cast to the enum type.

This is using C-style casts because this is still C-like code.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 08:06:00 -07:00
Thiago Macieira
b073823e3a
Clean up the moc intermediates too in make clean
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:41 -07:00
Thiago Macieira
d312b7d6fd Don't hardcode the paths for mkdir: just get them from the target
The $(@D) (equivalent to $(dir $@)) tells us what the directory the
target is in. We could also have used the one for the source. They're
equivalent there.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
c5d244eeea Add support for Qt resources in Subsurface
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
17ea074dc0 Prettify the msgfmt and linking arguments
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
f94b6bbefd Make the "silent mode" compilation be optional only.
If you run
   make V=1

Then we'll output the full command-line. It's useful for debugging
problems with the build.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
ce3f073d42 Generate the C++ dependencies at configure-time
We use the -MG preprocessor option to the compiler to ask it to check
all #includes and tell us what's missing. Then our own rules will
generate the moc and uic files that the .cpp #include.

Unfortunately, our rules make uic generate output in qt-ui/ for
qt-ui/*.ui, while the compiler generates rules for no directory. We
need to fake it by forcing the generation.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
a0b523a5af Get the list of dependency includes from the SOURCES list
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
d773c02bf3 Add a SOURCES variable to the Makefile, replacing OBJS
Instead of listing objects, let's list sources. This matches also what
qmake and most other buildsystems do. The notable exception is the
kernel.

The reason that listing the sources will be interesting is because I'm
about to add rules to create the dependency files.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
c8b360c3b5 Add a HEADERS variable to the Makefile
Similar to the qmake variable of the same name, this lists (at least)
the headers that may need moc to be run on. Adding more headers is not
a problem.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
b1c9ed76dc Cache the Qt tools detected (and detect RCC)
Since we're caching the include flags and linker flags, we should also
cache the exact helper binaries we're running. This avoids getting
errors because the environment changed.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
c11ce7e157 Introduce a cache of the configuration
You may have noticed that running make is a little slow. Every time
that it is loaded, it will try to detect everything again. So,
instead, save the output and reload it the next time.

This is implemented by adding a rule that (re-)creates the
config.cache file, which is included by make. If the file doesn't
exist yet, make will first run the rule which creates it, then reload
itself.

You can also cause it to reconfigure by running "make configure".

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
d47b904580 Trim Makefile, Configure.mk and Rules.mk
Configure.mk contains the detection rules, whereas Rules.mk contains
the rules to actually build Subsurface. This simplifies Makefile
greatly, which is the file that should be actually modified during
regular updates to the codebase.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
f6d133f387 Create Rules.mk and Configure.mk by copying the Makefile
This is to help Git know that the two files are the same content as
the Makefile. The next commit will trim the files to what they need to
be.
2013-04-23 00:06:32 -07:00
Thiago Macieira
ddbb942d0f Reorder the Makefile
Create three sections:
 1) the detection rules
 2) the main rules, what we usually edit
 3) the build rules, which we usually don't change

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
77ebc2f4c8 Move the MSGOBJS variable definition a little further down
Move it closer to the actual rules. This is not a variable that we'll
usually modify.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
50420d48d9 Remove the unused OSSUPPORT_CFLAGS variable
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:32 -07:00
Thiago Macieira
83309d9369 Move the list of objects a little further up
This also implies we don't need the OSSUPPORT variable anymore. We
simply add to OBJS.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:31 -07:00
Thiago Macieira
e9ec2dcc45 Split the SQLite3, libzip, libxslt and osmgpsmap detection from use
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:31 -07:00
Thiago Macieira
d326a91c86 Move some of the checks a little bit up
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-04-23 00:06:31 -07:00
Tomaz Canabrava
9ffb707d9d Initial version of the Star Picker Widget.
A very simple to use widget:
StarWidget *stars = new StarWidget( windowParent);
stars->setMaximumStars(10);
stars->setCurrentStars( rand()%10);
stars->show();
connect(stars, SIGNAL(valueChanged(int)), someObj, SLOT(starsChangedValue(int)));

It currently uses a 'star.svg' file on the same folder as the binary.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 16:09:21 -07:00
Tomaz Canabrava
a0280ae7d2 Move model related code from MainWindow and adjustments.
Moves the DiveTrip model related code to models.h

The DiveTripModel was implemented in three parts:

 DiveTripModel.h
 DiveTripModel.cpp
 MainWindow.cpp (the code to populate the model)

This patch changes the DiveTripModel from it's original
implementation to the file models.h, wich should store
all models (Dirk requested the Qt developers to not create
2 files per class, but instead to use a file for functionality,
and data-models are one functionality.)

Besides that, this code cleans up a bit the style:
removed operator<< for .push_back, const references where they apply,
moved the internal DiveItem class to the .cpp since it should be visible
only to the DiveTripModel class, and redesigned the current interface of
the model to be identical of the GTK one (used the UTF8-star and 2
subscribed, for instance).

Amit (the creator of the original code) should comment here if it's ok
with my changes.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:42:13 -07:00
Dirk Hohndel
5da11cbc6a Fix crash with some setups
Initialize Qt earlier, before Gtk gets its hands on argc / argv.

Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 06:45:57 -07:00
Dirk Hohndel
26076610e5 Use helper function to get dive date string
Correct order of arguments in the DiveItem constructor call.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18 13:23:46 -07:00
Dirk Hohndel
75765be14c Move creation of dive and dive trip date string into helper functions
This allows this code to easily be shared by Gtk and Qt UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18 13:18:09 -07:00
Amit Chaudhuri
1a15462073 Use get_dive to populate divelistview with dives
Add dives from dive_table to the model/view using the functions provided
to extract the dives.

We do not yet handle trips.

Formatting of date/time, depth and duration need attention.

Relies on earlier patch to delay Qt ui construction.

We should look at the signals we publish to link to other widgets etc..

[Dirk Hohndel: use for_each_dive -- clean up some white space]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18 12:38:52 -07:00