Things are working as they should, but I hit on -probably- a Qt bug
that makes painting on the table view a bit weird ( it only updates
the painting by moving the mouse around ). I'll try to fake the
mouse movements in a couple of commits after this one.
There's also a few columns that are not being correctly sorted,
probably something to do with the SortRole.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
By default, sorting is done by the display role, but then we end up
sorting by the string we display, which is almost always the wrong thing.
So this adds a new "SORT_ROLE" that is used for sorting, and then the
data lookup can return the raw data we want to sort by.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds support for switching Tree / List
while clicking on a column header. This triggers
a sad-painting bug on the list - I guess I'll have
to fix it too. I'd apreciate some help on it, tougth.
next: keep the selection.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This code adds the possibility to make the DiveList behave
like a Tree or a List, depending on what layout is set.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Several changes:
- split the reload of the DiveListView from the reload of the header
- don't include the column title in the name of the setting; the title
will change depending on the units and localization chosen by the user
- rename the slot that toggles visibility to make the code more readable
- use setCollumHidden() method to simplify the code
- don't save the width of hidden columns (as they would be saved as zero
width and can then no longer be enabled)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This also changed a bit the behavior on how the QSettings are managed,
till now, we used the QSettings constructor passing the name of the
software and the 'company', but this is now default - so there's no
need to pass anything by the QSettings contructor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
When the application launches, the oldModel is null.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes loading a second dive-file after the first
one had been loaded. it simply clears some information and
makes sure that the current selected dive is invalid when
the file closes. I also did a bit of code cleanup on this one
to make things simpler in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
And rip out all the code that Dirk put there to do that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
Add files for dive list model/view implementation. Replace TableView
with the custom list view. Amendments to makefile to match.
Note: we don't yet handle trips and may want to add additional columns
to describe the dive.
A single, dummy dive is added to show how this works (get root; item is
child of root). Purely to illustrate - needs proper integration etc.
Amend member names for dive list view components
Various naming changes to conform to coding style. Required changes to
members (remove prefix) and methods (avoid clash with members).
Clean up indentation (swap spaces for tabs). Code for model/view was
written with a different editor which had different settings :-/
[Dirk Hohndel: minor whitespace cleanup]
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>