Commit graph

302 commits

Author SHA1 Message Date
Dirk Hohndel
8856417b2f Allow translation of the cylinder use strings for the UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 14:39:30 +00:00
Dirk Hohndel
0c3f13d128 Add the ability to modify the cylinder use in the UI
Thanks to Tomaz for writing a first draft of the delegate.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 14:03:37 +00:00
Dirk Hohndel
80bdbc348d Divelist trip text includes the number of dives shown with current filter
But only if not all dives in the trip are shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-16 18:46:07 +00:00
Dirk Hohndel
8d766e13e2 Make sure we always have copies of equipment descriptions
Having pointers copied around that might get freed elsewhere could be a
problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-14 13:45:54 -08:00
Dirk Hohndel
ac9ead4571 Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-13 12:52:35 -08:00
Tomaz Canabrava
10fecefddd Move the filters code to it's own file.
We already have a bunch of filters, let's pack them together

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-13 12:01:00 -08:00
Dirk Hohndel
61dc19d2e0 Show the number of dives with given person / location in the filter panel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-12 16:02:37 -08:00
Dirk Hohndel
0b31854031 Deselect dives that are no longer shown as the dive list is filtered
This cleans up the way we ensure that all dives are handled as the dive
list is filtered.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-12 14:07:07 -08:00
Dirk Hohndel
19ca90f1a0 Embed the information whether a dive is hidden by a filter in the dive
This way other parts of the code can act on the "hidden_by_filter" state.

This also cleans up the way we track if a dive is hidden - do it in the
multi filter instead of the individual filters.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-11 13:34:12 -08:00
Tomaz Canabrava
d5ffc16c36 Clean Filters
Code to clean the filters. Maybe I'll also need to call this upon
closing the dialog?

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-11 13:09:11 -08:00
Tomaz Canabrava
819d358f8c A bit of code cleanup.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-11 13:09:03 -08:00
Dirk Hohndel
d06cc2c68e Show the number of dives with each tag in the filter panel
This is a rather brute force implementation. It might be worth while
caching this information - but I'd like to do some benchmarking, first.

Sadly this code also shows that there are some bugs hidden in the
selection code when filtering is present. When a trip is selected all
dives in the trip get selected, even those that are not visible under the
current filter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-11 02:36:09 -08:00
Anton Lundin
0b0e5d834f Reorder initializers to be more c++-strict
c++ have some idea about in what order things should be initialized.
This makes us comply with that order.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:17:11 -08:00
Anton Lundin
450093df85 Remove leading spaces in buddy tags
The buddy list generated by the buddy tag logic gets separated by
,<space> so this trims away any leading spaces from the buddy name.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:11:36 -08:00
Dirk Hohndel
45251ec724 Show extra data in separate tab on MainTab
This way any extra data probided by the dive computer is visible to the
user (without other processing). This data cannot be edited by the user as
it reflects the information given by the dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:00:58 -08:00
Dirk Hohndel
def9e3fc1b Make sure we don't use the 'changed' flag uninitialized
Valgrind reported this while I was testing the previous commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 15:05:35 -08:00
Dirk Hohndel
0dd87989a8 Correctly unselect trips when dive list filters change
Oddly Qt left the trips selected (but all dives where unselected in the
UI). This got our internal state rather confused. With this change we
clean up that mess and go back to just having those dives that were
originally selected and are still visible show up as selected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 17:52:04 -08:00
Dirk Hohndel
a3f1dc7681 Improve selection behavior of the multi filter
Only dives that remain visible stay selected. And if all selected dives
are removed by the filter, pick a new selected dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 17:32:12 -08:00
Tomaz Canabrava
4e9aff047e Show single buddies instead on the filter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:01:33 -07:00
Tim Wootton
683f4dc3fe Make filter UI comply with capitalisation style
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 09:27:18 -07:00
Dirk Hohndel
8bdc9d1ec4 Small random whitespace cleanups
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:57 -07:00
Tomaz Canabrava
fd1cc4ea2d FilterRow implemented for LocationFilter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
8399d6f977 Repopulate method on LocationFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
1a4e69a3bb setData method for LocationFilter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
dc147be153 Implemented the flags method for LocationFilter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
1c0da67a26 Implemented the 'data' method of LocationFilter.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
894e0bc7a9 Implemented the constructor of LocationFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
5bc793b0f0 Implemented the instance method of LocationFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
2f60b73bb1 Location Filter, skeleton code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
03c22c3b18 Treat buddy as Buddy and Divemaster, sort the filter lists.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
2827da5ecf Fixes in the buddy finding algorithm.
I was comparing the strings in the opposite direction.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:56 -07:00
Tomaz Canabrava
358611d029 Implement the Buddy Filter interface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
b1d76ed4d7 Implemented the filterRow method for BuddyList.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
30cf0ba79a Implemented the 'repopulate method' for BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
e17fa41192 Implemented the flags method for BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
a65280fbae Implemented the setData method for BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
1f9abad852 Impelmented the Data method for BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
7c4ddcbf7a Implemented the constructor for the BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
e90eac2d38 Implemented the instance method for the BuddyFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
2c924b6834 Added the skeleton for the BuddyFilter
Just the skeleton of the functions, nothing working yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 14:58:55 -07:00
Tomaz Canabrava
c68a94da6a TagFilter -> MultiFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31 13:52:51 -07:00
Dirk Hohndel
c0536e8d57 Revert "Divelist: make the column headers for units left aligned"
This reverts commit d5f19c43c9.

With the changes to the headers in commit 3515ad71c1 ("Divelist: remove
units from header, add tooltip") I think this isn't needed anymore and
actually reverting it creates a cleaner look.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 10:21:59 -07:00
Linus Torvalds
ca8fc978d2 Display dive duration in dive list in whole minutes
The whole "duration in seconds" is being way too OCD about the
information, and just makes it harder to read.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 10:13:44 -07:00
Dirk Hohndel
3515ad71c1 Divelist: remove units from header, add tooltip
This should help with the issues we are having with alignment / visibility
of the relevant information in the divelist.

Most people will never switch the units (or maybe switch them once, the
first time they use Subsurface). So having the units shown in the table
header quickly becomes redundant - yet having the units in there causes
all kinds of layout issues.

This patch adds a tooltip to both the header and the main data area of the
divelist. The tooltip shows the column name plus unit and the column
header no longer shows the units.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 07:40:22 -07:00
Lubomir I. Ivanov
d5f19c43c9 Divelist: make the column headers for units left aligned
Fixes #739

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-29 09:29:14 -07:00
Giuseppe Bilotta
dfec501e7a Resolution-independent trash icon
Also, generate the corresponding pixmap only once, and distribute it to
all models that need it.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-19 07:23:36 -07:00
Giuseppe Bilotta
5a2db2db4b Define auxiliary functions for metrics
Collect font, font metrics and icon size functions in a separate module.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18 15:16:07 -07:00
Tomaz Canabrava
e0b60167f2 Add possibility to filter by more than one criteria at a time
This new version of the TagFilterSortModel actually accepts
*any* new MultiFilterInterface.

So, how to use it to create a new filter:

Implement a class that inherits from MultiFilterInterface

Implement the filterRow method

TagFilterSortModel::instance->add( myClass );

and you are done.

[Dirk Hohndel: removed some debug code and did whitespace cleanup]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-02 07:35:23 -07:00
Tomaz Canabrava
a2f2751792 Show everything when nothing is checked.
This patch fixes a bit of the logic used. Now we show every
dive if nothing is chedked.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-20 18:35:02 -07:00
Anton Lundin
50adde828c Switch some columns to right alignment in divelist
Some columns in the dive list makes more sense to have right aligned
than left aligned. This switches the numeric columns to right alignment
so they is more easily compared visually.

But, we keep the NR-column left-aligned because we use its left
indentation as dive-in-a-trip marker.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18 06:42:18 -07:00