Commit graph

11 commits

Author SHA1 Message Date
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
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
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
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
Tomaz Canabrava
115ee47bfc Added the code that will load and populate the Tank Info
Added the code that will load and populate the Tank Info
ComboBox that`s used by the user to select the Cylinder
description.

Code curerntly implements more than the GTK version since
the GTK version of it was a plain-list, this one is a
table based model that can be used in ListViews ( like
we use now in the ComboBox ) but also in TableViews
( if there`s a need in the future to see everything
that`s catalogued in the Tank Info struct. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15 17:34:44 -07:00
Dirk Hohndel
d8e11439ad Undoing the last Qtr_ hack
The Qtr_ hack isn't needed as in commit 720fc15b2dcd ("Introduce
QApplication") had already made sure that we are using gettext.

I didn't revert the two commits as I wanted to keep the added header
comments and fix the tooling in the Makefile as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-14 06:58:56 -07:00
Dirk Hohndel
f5c958ad73 Add Qtr_ macros that uses gettext in a tr() compatible manner
This should wrap gettext nicely and replace the "_()" macros we use in C
code.

Also added comments to the top of all the new files.

Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-13 20:44:02 -07:00
Tomaz Canabrava
92397a2bad Started the real code on the Qt Interface.
1 - Open File already open files, it tries to not break the Gtk version,
    but some methods on the GTK version still need to be called inside Qt
    because the code is too tight-coupled.

2 - Close file already close files, same comments for the open file dialog
    applies here.

3 - The code for adding new cylinders in the cylinder dialog is done,
    already works and it's integrated with the system.  There's a need to
    implement the edit and delete now, but it will be easyer since I'm
    starting to not get lost on the code.

4 - Some functions that were used to convert unities have been moved to
    convert.h ( can be changed later, put there because it's easyer to
    find something that converts in a convert.h =p ) because they were
    static functions that operated in the GTK version but I need those
    functions in the Qt version too.

[Dirk Hohndel: lots and lots of whitespace and coding style changes]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-13 14:08:16 -07:00