aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
AgeCommit message (Collapse)Author
2014-03-03Whitespace cleanupGravatar Dirk Hohndel
Minor change to the perl postprocessing script and resulting changes to the affected source files. This deals with two issues: - "foreach"-like structures were not always treated correctly - some longer calculations that ended on "+ constant" were reformatted in a rather unatractive manner In one source file (divelist.c) I ended up adding braces to the sources... trying to cascade the indentation further down without having the block there seemed a lot more trouble than it's worth. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17Code cleanupGravatar Dirk Hohndel
We called the helper functions way too often. Whitespace / coding style adjustments. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17Compute dive computer/camera time offset from sample pictureGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17Store camera time offset in preferencesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Replace mainWindow() with MainWindow::instance()Gravatar Boris Barbulovski
C++ style of accessing single instance class object. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Don't ignore the return values from readfile and EXIF parserGravatar Dirk Hohndel
If readfile fails it already frees its buffer. If the parsing failed we shouldn't use the data in the structure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09DiveListView tiny cleanupGravatar Boris Barbulovski
* Change 'searchBox' member type from 'QLineEdit *' to 'QLineEdit' Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09ShiftImageTimesDialog class cleanup.Gravatar Boris Barbulovski
* Remove static ShiftImageTimesDialog::instance() method * Add ShiftImageTimesDialog::amount() member Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06Include images in profileGravatar Robert C. Helling
This adds an entry to the dive list context menu to load images. The user can select image files and set a time offset to align camera and dive computer clocks. Using the exif time stamp the images are tried to match to the times of the selected dives (with a grace period of an hour before and after the dive). Upon success an event of type 123 is created per image with the string value being the path to the image. Those images are displayed as thumbnails in the profile. If the matching dive does not yet have a geo location specified but the image provides one it is copied to the dive (making the camera a poor man's companion app). This patch includes easyexif https://code.google.com/p/easyexif/ which is originally under a New BSD License to parse the image meta data. This commit includes a new test dive dives/test31.xml with a matching image wreck.jpg to try out the functionallity. Obvious to do's: Have images on the map Have the images clickable Have a proper picture viewer Give visual reference for image time shifting. Use the new profile Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Fix some memory leaks.Gravatar Boris Barbulovski
Memory leaks were caused by broken parent/child relations. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Whitespace and coding style updatesGravatar Dirk Hohndel
Another futile attempt to cleanup the code and make coding style and whitespace consistent. I tried to add a file that describes the key points of our coding style. I have no illusions that this will help the least bit... This commit should ONLY change whitespace Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15Convert to TRUE/FALSE to stdbools true/falseGravatar Anton Lundin
I had problems with this one on Qt5. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15Make this code Qt5 compatibleGravatar Anton Lundin
The method have bin renamed in Qt5. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make divelist search case insensitiveGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make Ctrl-F window shortcutGravatar Sergey Starosek
The shortcut may be used elsewhere, e.g. in user manual Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Setting dive as 'current' when restoring selectionGravatar Tomaz Canabrava
Restoring the selection was not setting the selected dive as current, and thus, breaking keyboard navigation. Fixes #402 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20Silence a few warningsGravatar Dirk Hohndel
None of these are actual bugs. But none of the fixes are harmful, either. And much as I hate adding the 'default' clauses, I'd rather not have the build output cluttered by invalid warnings. The exception is the fix in divelistview.cpp - while I don't think it is possible for this function to be called with no dive selected, initializing pd to NULL is cheap insurance in case that does happen for some weird reason. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20Use QFile::{encode,decode}Name for file namesGravatar Thiago Macieira
And make them use UTF-8 on Windows instead of the local 8 bit encoding. This will also get us the proper NFD encoding on OS X. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Fix incorrect handling of autogrouped tripsGravatar Dirk Hohndel
When toggling autogroup in the menu we ended up setting the NO_TRIP flag for dives that were removed from a trip that was created by autogroup. So toggling things on and off and on again meant no more auto grouping. Fixes #337 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Fix TableWidget ( equipment ones ) on dark scheme.Gravatar Tomaz Canabrava
This patch uses the class created by the previous patch to get rid of the CSS and be really desktop native. it fixes a lot of stuff in non-blue-styles and throws a lot of code away. <3 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-12Kill the use of CSS - Fixes a Lot of issues on dark color schemes.Gravatar Tomaz Canabrava
The css was done by me in the first days of subsurface for Qt, and it was a code that I was never proud of. Mostly because I tougth at the time that it was better to write it into CSS than to create a new class just to take care of the size of the default cell height on a tree view. Now I see that it was a biased approach since it created issues on dark color schemes and it also didn't make a 'native' experience on Gnome or OSX, only on KDE. This fixes that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-09Divelogs.de: add a divelist context menu item for uploadGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-08Remove pointless codeGravatar Dirk Hohndel
When removing the selected dives from their trips, it makes no sense to check if the pointer was actually pointing at a valid dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-06Stub out a mark dive invalid functionGravatar Dirk Hohndel
Not sure I'll be able to finish this for 4.0 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04Divelist: fix a crash when updating the preferencesGravatar Lubomir I. Ivanov
Hitting apply in the preferences dialog causes a QList assert. This led to DiveListView::reloadHeaderActions(), where we have an out of range access. Patch makes the column count match the header action count. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Text cleanup to amend lacking consistencyGravatar Henrik Brautaset Aronsen
- Removed the "Visible:" header on the column selector. It doesn't have to be there, and it's not in the similar equipment column selector - PO2 --> pO₂ (and others) - Use same initial case in the units selector in preferences Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Fix ignoring empty selections on the globe and code cleanup.Gravatar Tomaz Canabrava
If the 'mouseClicked' didn't get any dives at the click-geolocation, ignore it and do not try to select an empty selection. this was causing a lot of issues when map-navigation. Also, good deal of code cleanup. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02Huge speedup when selecting Dives from the Globe View.Gravatar Tomaz Canabrava
The old code ( slow++ ) ignored that each new dive-selection we recreated all information on the profile window, so this version ( a lot more verbose, I know. ) will ignore all dives that are being selected and will only send the 'dive was selected' information in the last line of the algorithm, instead of calling it for each dive on the list of 'to be selected' dives. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30More strings for translationGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30Remove use of uninitialized variable nrGravatar Anton Lundin
nr was used but never initialized. Also, the code removed used select_dive had likely just been forgotten to be removed when the correct code using selectDive() was added a little later in the function. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30QT-UI: fix some typosGravatar Alexandre Belloni
Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26Remember Trip Selection.Gravatar Tomaz Canabrava
This patch remembers the trip selection across the Dive Tree Model. It's a tiny bit big because we used to have a variable 'selected trips' that's now calculed dynamically - this is more future proof. This is a start of Un-cluttering the view ( for 4.1 I hope to reduce the code in this class to nearly a half. ) Fixes #303 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19Clear selected trips after restoring selectionGravatar Dirk Hohndel
The rememberSelection() / restoreSelection() functions ONLY handle selected dives, not selected trips. This is a bit of a misfeature, but because of that we need to make sure we clear our notion of selected trips when we use restoreSelection() Fixes #285 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-18Shift times of selected divesGravatar Robert Helling
This patch adds the possibility to shift the times of all selected dives by a fixed amount to correct for time zone problems or mis-set dive computer clocks. Select the dives and right click in the dive list. [Dirk Hohndel: added .ui file to FORMS and fixed some whitespace damage] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17Add "add dive(s) to trip above" featureGravatar Dirk Hohndel
This honors the sort order of the dive list when figuring which trip is "above". It works both on a single dive or all selected dives. This also fixes a couple other cases where the dive list selection and trip display could get messed up. Fixes #287 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17Fix a couple of problems with dive mergingGravatar Dirk Hohndel
- Dive list no longer has messed up trip entries - Dive list is now correctly marked as modified after trips are merged - When data file is closed, the list of selected trips is cleared which avoids a potential crash when loading a new data file Fixes #286 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Fix crash when entering a dive via dive-add on a empty table.Gravatar Tomaz Canabrava
We were selecting garbage, not anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Fix dive mergingGravatar Linus Torvalds
This limits merging dives to dives that have at most half an hour of surface time between them. That "half hour" is kind of a random thing to pick, but it's not horribly horribly wrong. It also changes the semantics of "merge selected dives" to something that actually works pretty well: you can select a whole range of dives, and it will merge only the ones that makes sense to merge. I tested it, and it's reasonable. I could select all my dives from one dive trip, and then do "Merge selected dives", and it did the right thing (Dirk: I selected the florida trip, and it merged the aborted "missed the trench" dive with the _actual_ "trench" dive). I'm _slightly_ hesitant about this in the sense that maybe some crazy person actually would want to merge dives with more than half an hour of surface time between them, but it really doesn't seem to make much sense. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Removed duplicated method.Gravatar Tomaz Canabrava
This patch removes a duplicated method: get_divenr and get_index_for_dive. The two are exactly the same ( if my c is not broken, but I may be broken since I'm working like crazy for almost 30h nonstop. ), so please take a good look before applying this one. [Dirk Hohndel: Tomaz took the slightly broken of the two implementations, so I switched that out for the correct one] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Expand the trip of the newly selected dive.Gravatar Tomaz Canabrava
I hit this bug on deleting dives and the newly selected one got inside a trip, that wasn't expanded. anyway, easy one. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Selects the dive before the deleted ones.Gravatar Tomaz Canabrava
This patch makes a selection just after the dives that got deleted, or nothing if the list is empty. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Do not break Dive Headings on trip mode when a delete dive is done.Gravatar Tomaz Canabrava
When the dive is deleted, we force a recreation of the dive list, this is done because we were broken by design on the first transition to the Qt infrastructure - one thing to change for 4.1, but no time for 4.0. We forgot to ask the headers to 'please, span more than one row, please' when we recreate the model. easy =) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Fix wrong handling of Dive Table, and revert some wrong changes.Gravatar Tomaz Canabrava
This patch just reverts some wrong changes that I'v done on a past commit ( sorry ) and correctly handles the selectDive, by using a IDX instead of the dive pointer, as dirk told me it's extremely error-prone since the pointer can change. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15This moves the removal code to the model.Gravatar Tomaz Canabrava
It's very important when programming via Model/View, in gtk or qt, to not mess with the model data outside of the model. We were deleting stuff that the model controlled outside of the model, so it thought that there was still data there. This fixes the deletion part, but there are also lots of other parts that I'll tackle in the next commits. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Maintain opened the trips of the selected dive.Gravatar Tomaz Canabrava
In various occasions the branches of selected dives got collapsed because I'm dummy boy and didn't programmed the logic correctly. This one correctly works for the few cases that I'v tried, I'm verifying if the current selected index is a trip or a dive, and asking to expand it. The expanded state is lost because we delete and recreate the model ( and we do that because we can switch between tree and table model ). Now I think we correctly track the cornercases. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Fix the sentense 'collapse' to 'collapse others' and scroll to it.Gravatar Tomaz Canabrava
This patch changes the string 'collapse' to a more meaningfull 'collapse others', it also scrolls the view to the first selec ted index, since after collapsing the others, things could be in the wrong position., Fixes #233 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Make more context menu functions act on all selected divesGravatar Dirk Hohndel
Remove from trip and delete both should deal with all selected dives. Fixes #247 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Avoid std::string: QByteArray is enough and already compiled inGravatar Thiago Macieira
No need to add more code to Subsurface by bringing in std::string too. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Manually add trips from dive list context menuGravatar Dirk Hohndel
We had all the logic, we were just lacking the UI. Fixes #243 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>