aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
AgeCommit message (Collapse)Author
2013-11-05Fix dive mergingGravatar Dirk Hohndel
When merging dives, the indices of the following dives change - so we need to adjust the variable used in the for_each loop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05Remember the column we are sorting byGravatar Dirk Hohndel
A call to DiveListView::reload always reset our sortcolumn to be 0. Instead we are tracking the correct sort column and sort direction. This also removes an obsolete private member that was unused. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-20Export dives in UDDF formatGravatar Miika Turkia
Implement exporting in UDDF format as was done in Gtk version. File menu exports all the dives, right click on selection exports the selected ones. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17Some adjustments to "save as"Gravatar Dirk Hohndel
The popup menu entries should be all lowercase. Also we should handle this the same as regular save and open when it comes to remembering the last path. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17Added 'Save As' option on the dive list menu.Gravatar Tomaz Canabrava
This adds the 'Save As' option on the dive list, very straigth forward, just simple and beauty. tested and working. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15Random white space cleanupGravatar Dirk Hohndel
Because I can. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Good deal of whitespace fixes and code cleanup.Gravatar Tomaz Canabrava
I just went thru all of subsurface code removing some whitespaces issues and trying to make the code prettyer, I also removed a few QString issues.d Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-04Fix showing all columns by default on first run.Gravatar Tomaz Canabrava
Some columns are a nice addition, but not a must have, and thus are hidden-by-default, uncluttering the user interface. This was discussed with a few designers before writting the code, and also discussed with dirk on irc. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-01Fix weight adding in the Qt UI & fix the header height for tablesGravatar Patrick Valsecchi
Fixes #203 Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-24Only offer to merge dives if they are consecutive in the divelistGravatar Dirk Hohndel
You cannot merge dives if there is another, unselected dive "between" them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-24Much easier way to detect if more than one dive is selectedGravatar Dirk Hohndel
Instead of getting data from Qt just use our internal notion of the number of selected dive to decide if more than one dive is selected (and therefore if we need to show the 'merge dives' option in the context menu). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-23Add "merge selected dives" to dive list popup menuGravatar Dirk Hohndel
This is fairly straight forward. What I dislike is the check for the magic number of "14 indeces". I'm sure there's a better way to tell if more than one dive is selected... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Correctly handle empty dive list after deleteGravatar Dirk Hohndel
Things need to be cleared out and disabled. But fixing this bug leaves another issue - while the newly selected dive after a delete acts as if it was selected, it doesn't show up as selected in the dive list. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-16Fix for double-rendering, double selection and other annoyances.Gravatar Tomaz Canabrava
This patch fixes a thing that I run into when trying to implement the multi-edition system. Whenever a dive was selected, via mouse or keyboard, it had two stages: first, it would select the previous and the current ( and thus, render the profile of the current) and then whould release the previous and select the current again ( and thus, rerendering the profile again, plus a few other things. ) With the multi-edition system this caused a more severe bug, since the edition of the dives is directly applied as soon as the text fields changes, as soon as we selected any dive on the list, the 'before' dive would be modified by the 'current'. This patch fixes this - but since it's just a 'code removal' patch, this can led to bad things in the future, I tested it quite a bit, but didn't found anything, no regression. *fingers crossed.* Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Qt: Implement trip merging logicGravatar Linus Torvalds
So during my Maui trip, I had a short hiatus in diving, causing subsurface to start a new trip for the last day of diving. I could have just started the old gtk branch to fix it up, but decided that I might as well try to implement the "merge trip" logic in the Qt branch instead. This is the end result of that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17Changed a lot of code to reduce boilerplate on models in the future.Gravatar Tomaz Canabrava
So, I changed a lot of code to reduce boilerplate on models in the future. Currently we do not have a lot of models, but this can increase quite rapdly. There's a second TreeModel in the works, the Yearly Statistics, this patch will save around 250 LOC for this new model, and more and more models will give us a greater saving. Iwll do that for the table models in the future too - I did the tree models now because they are the most complex case and I didn't wanted to create a second tree model without this. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-14Show & edit trip location and notes when exactly one trip is selectedGravatar Dirk Hohndel
While we still show the selected_dive in the profile and use it for Dive Info and Equipment, in the Dive Notes tab we now show the trip location and trip notes (and none of the other fields), if the user directly selects a whole trip by clicking on the trip header. This clever reuse of the widget now allows trip location and notes to be edited in place. As a side note: the Gtk version has long allowed the user to edit the trip location and trip notes, but nowhere did it ever SHOW the trip notes... so this is more than just feature parity... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14Don't offer "delete dive" context menu for tripGravatar Dirk Hohndel
If we are not on a dive we shouldn't try to delete it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14First deselect, then selectGravatar Dirk Hohndel
For reasons I still don't understand, sometimes (but not always) when clicking on a trip header we appear to get a select notification for the trip and at the same time deselect notifications for every dive in the trip. This seems wrong but I can't seem to figure out why it happens - and of course it causes us to have a mixed up interpretation of what is selected in our internal selection tracking. Simply acting on the new selection after the newly deselected items are handled appears to fix the issue, but I do worry about this change. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12Implements the DiveList to behave like Linus Explained.Gravatar Tomaz Canabrava
Implements the divelist to behave like linus explained, essentially, it filters the layoutChanges of the model, greps for trips, and for each trip that it finds, it set the 'firstColumnSpanned' property, to make the column to have the size of the whole table. e Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-09Ticket 127 - Repopulate context menu on preferences changeGravatar Helio Chissini de Castro
Ticket 127 mention that context menu is fixed on imperial mode, which is partial true. Context menu only not have the changes on header model updated when preferences are chenges during execution. Hard to note because if program is closed and opened again, the context is initialized properly. Since actions aren't bound to the header model, we need iteract of current items and change the title. Signed-off-by: Helio Chissini de Castro <helio@kde.org>
2013-06-08Use the official QItemSelectionModel::SelectionFlagsGravatar Thiago Macieira
It's a typedef to the QFlags<QItemSelectionModel::SelectionFlag>. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07Make a map ctrl-click toggle the selection stateGravatar Linus Torvalds
This way the map selection works like normal selections do. Except we don't do "ranged" selections (shift-click) for fairly obvious reasons. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07Fix unused variable warning and spellingGravatar Linus Torvalds
Commit 4b405caa2c47 ("Clean up divelist dive selection") made the sort model variable in headerClicked unused, so get rid of it. Fix a speling eror closeby while at it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Try to get rid of unnecessary reloads of the dive listGravatar Dirk Hohndel
Don't call refreshDisplay() after preferences change. This strangely somehow leads to a situation where I need to move the mouse over the dive list before changes to the units are reflected. When calling reload() do not force layout change / resort unless that is the intention. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Add delete dive context menu entryGravatar Dirk Hohndel
Getting closer to the way this should work. Adjusted the call to reload to not switch back to tree view and resort (oops). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Implement the context menu a different wayGravatar Dirk Hohndel
It seems that this is the way this is supposed to be done - instead of manually looking at what kind of click we get, Qt decides when to create a context menu for us - this way things like the Windows Menu button will work automagically. As an example I also implemented the "remove dive from trip" functionality, which exposes some other bugs (like the fact that the dive that isn't part of a trip ends up being sorted at the very end of the dive list). This commit contains a "testSlot" implementation to remind me how to figure out which dive / trip we are on. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Only show expand/collapse context menu when in tree modeGravatar Dirk Hohndel
The options make no sense when in list view mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Distinguish between "collapse" and "collapse all"Gravatar Dirk Hohndel
Some users might want to really see nothing but trips, others might want to be able to keep the trip with the selected dive open. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06Add context menu to dive listGravatar Dirk Hohndel
So far we support "expand all" and "collapse" all. This still needs to be restricted to only be shown when in trip / tree mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05Clean up divelist dive selectionGravatar Linus Torvalds
Since we have a "selectDive()" method, let's just use it rather than opencoding it. Similarly for "unselectDives()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05Fixing some issues with the dive selection after OK on preferencesGravatar Dirk Hohndel
These changes should be correct - but they still don't fix the problem that after we click 'OK' on the preferences (regardless of whether any changes were made), the first dive is set as current dive and shown in the map window. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05Keep selected dive in viewGravatar Dirk Hohndel
Somehow we managed to break this. Again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05First cut at selecting dives from the mapGravatar Linus Torvalds
We'll want to enhance this: better logic for which dives are near the selection, and it's probably best to have a "control-click" that adds the dives to the selection rather than deselecting all the old ones. But it's already useful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-04Stop showing the first dive after a preferences changeGravatar Dirk Hohndel
What is missing is the code to actually show the RIGHT dive... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-02Once again try to fix the selectionGravatar Dirk Hohndel
Things got broken. Again. We no longer kept track of the selected dives in our structures which broke statistics. This attempts to fix that, but appears to still have a bug when selecting trips. Sometimes this results in 0 dives being selected according to our data structures, while Qt happily shows all dives of the trip as seected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31Scroll to (and re-expand) the selection when sorting and movingGravatar Linus Torvalds
The keyboard movement wouldn't scroll to the newly changed selection. Similarly, when sorting the dive list, we'd end up losing the currently selected dive (and generally collapsing the currently exposed trips). This adds the scrolling/exposing logic for those cases. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Add a proof of concept for filtering the Dive List,Gravatar Tomaz Canabrava
Press CTRL+F and a line edit will appear, whenever you write on that will be used as a filter against all columns. The results are maybe somewhat surprising in trip mode, but when sorting by another column this shows some potential. Hit ESC to remove the filtering. I need to find a better position to put the Widget, but it's a proof of concept. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Don't display "show" in front of every columnGravatar Henrik Brautaset Aronsen
When (de)selecting columns, a the list of columns have a "show" in front of every entry. We don't need that. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Code layout changesGravatar Dirk Hohndel
Tomaz convinced me (with help from Linus) that it might be a good idea to go with the compacter "single line" case statements in some specific instances where this makes the code much more compact and easier to read. While doing that I changed Linus' code to do 'retVal = ...; break;' instead of just 'return ...;' - this is more consistent and makes debugging a little easier. And while doing all that, I also cleaned up divelistview.cpp a little bit. And removed an unused variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Code Cleanup.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29Fixed the regression of selection not being stored from table to treeGravatar Tomaz Canabrava
This fixes the regression that I caused in the last commit, where the selection was being correctly reestored from tree-to-table, but it was incorrectly being restored from table-to-tree. I also added a bit of speedup on the view while changing columns. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29More work on bug 111, Sorting works as it should.Gravatar Tomaz Canabrava
Sorting is now working as it should, changing from table to tree, keeping the selection from table to tree ( but there's a regression on tree to table conversion, I'll try to fix it in the following commit. ). this commit also cleans a lot of boilerplate code that I wrote to bypass a graphics bug, that I seem to have correctly fixed in this version. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29Reimplement the Sort method to change from Tree / List, and remember selection.Gravatar Tomaz Canabrava
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>
2013-05-29Add a "sort role" for sorting the dive listGravatar Linus Torvalds
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>
2013-05-28Saves the selection to select it later.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28Switch between Tree / list on column - click.Gravatar Tomaz Canabrava
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>
2013-05-28Adds the code to make the dive list behave like tree or listGravatar Tomaz Canabrava
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>
2013-05-26Fix colum visibility selection in the divelistGravatar Dirk Hohndel
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>
2013-05-22The never ending, futile fight for whitespace consistencyGravatar Dirk Hohndel
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>