aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-03-18Profile2: use unsigned int for the divecomputer numberGravatar Lubomir I. Ivanov
display.h: dc_number is unsigned int, thus a couple of warnings may pop-out. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18Clear PN2 PO2 PHE GasItemGravatar Hugle
After the dive log has been closed, the ProfileWidget2 does not clear the pn2 po2 and ph2 gas line. This patch cleared the three lines after dive log closed. Acked-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Hugle <wulong@comp.nus.edu.sg> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Don't devide by 0 if fO2 is 100%Gravatar Dirk Hohndel
Fixes #465 Initial-patch-by: Anton Lundin <glance@acc.umu.se> Better-idea-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Translate using tr() to be Qt5-compatibleGravatar Anton Lundin
There are no utf8 in those strings, and we can translate them as everything else with tr() instead. QApplication::UnicodeUTF8-part is deprecated and removed in Qt5. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Make dc_number defined when using itGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Add forward declaration of QSettingsGravatar Anton Lundin
Its needed for Qt5 Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17User manual: Changes to sections 1 and 2Gravatar Willem Ferguson
The text for these two sections has been corrected and updated in order to be ready for the release of V4.1. The very first paragraph of the manual is expanded substantially. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Be more careful about dive computer selectionGravatar Linus Torvalds
The selection logic was a bit random: some places would return NULL if the dive computer index was out of range, others would return the primary dive computer, and actually moving between dive computers would just blindly increment and decrement the number. This always selects the primary computer if the index is out of bounds, and makes sure we stay in bound when switching beteen dive computers (but switching between dives can then turn an in-bound number into an out-of-bounds one) Fixes #464 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17Silly change to a commentGravatar Dirk Hohndel
I had intended to amend the previous commit with this before pushing it out. This changes the comment that pointed out the bug that the previous commit fixed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-16New profile: fix event hiding logicGravatar Dirk Hohndel
Turns out we unconditionally set all events as visible when redrawing the dive - even with a comment that this should take into account if the event is visible. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15User manual: Update sections 4 and 5Gravatar Willem Ferguson
A new figure is included to reflect the actions of the new profile buttons on the calculated ceilings. A number of small edits on sections 4 and 5 of the user manual are done. These sections are now finalised for the new release. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15New profile: add event manipulation to context menuGravatar Dirk Hohndel
This got lost when we switched to the new profile. Remove event works. Hide events does call hide() on the DiveEventItem but for some reason it stays visible. I'll hope for one of the more experienced Qt people to fix that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Don't put cylinder widget in edit mode if deletion of cylinder failedGravatar Dirk Hohndel
If the user tries to delete a cylinder that is in use and that action is rejected, the cylinder widget (and the whole dive) should not be put into edit mode. After all, nothing changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Add test dive to show erroneous pp graphsGravatar Jan Mulder
Add simple test dive to show the erroneous pp graph in case of multiple periods of high p02. See commit aa0cd792bbe3e for the fix. Signed-off-by: Jan Mulder <jlmulder@planet.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Correctly check if tank is in useGravatar Dirk Hohndel
We always checked if the tank was in use by the planner / dive editor - even if we were not in dive edit mode. With this patch, when not in dive edit mode, we check our cylinder "used" flag instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Don't check for tank size information only on first tankGravatar Dirk Hohndel
commit d681bdcb6308 ("Only use default cylinder for first one") has a stupid bug in that it only calls get_tanksize for the first tank. That's of course completely bogus. Thanks to Linus for catching this. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Only use default cylinder for first oneGravatar Dirk Hohndel
When downloading from a divecomputer it makes little sense to assume that all tanks are the default cylinder. There's a good case to be made for having a default first cylinder (you always dive with your own cylinder, or you are always on a dive boat with AL80 tanks), but in multi-cylinder situations this is much more likely to cause unintended harm; for example for those dive computers that always report their maximum number of cylinders, even if some of them aren't used. Here setting a default cylinder turns those entries from obviously empty into something that appears to have meaning (i.e., cylinder type is filled in) even though this was just a default added by Subsurface. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Only use a default cylinder if it is explicitly setGravatar Dirk Hohndel
We used to fall back to an AL80 default cylinder, but that meant that a user who doesn't want a default cylinder at all had no way to indicate that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Bugfix: generalize pp graphs to allow for multi over-threshold periodsGravatar Jan Mulder
Especially in O2 decompression parts of a dive, the pp02 is typically very close to the threshold value (normally 1.60 bar). The old implementation of the pp profile graphs assumes that there is exacty 1 consecutive set of samples that needs to be in the "warning color". This results in an erroneous display of the mentioned graphs, connecting multiple episodes of too high pp with bogus lines in between. This fix generalizes the pp graph logic to allow for multiple segments of high pp, each to been drawn seperately in the "warning color". Signed-off-by: Jan Mulder <jlmulder@planet.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15User manual: Add the missing iconsGravatar Willem Ferguson
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14Revert "If saving to a git repository fails, don't create oddly named XML file"Gravatar Dirk Hohndel
This reverts commit e70bbb637e1d Linus' solution in commit 27c36ec4cf41 ("Improved handling of git syntax names with no git repository") is much better and makes my hack unnecessary.
2014-03-14Improved handling of git syntax names with no git repositoryGravatar Linus Torvalds
This makes "is_git_repository()" return non-NULL for all file names that match the git name pattern, even if we don't find an actual git repository there. That way, we won't fall back to writing out an XML file with an odd filename. If there is no actual git repository, we return a special invalid dummy pointer, and then the git reading and writing routines will catch it and return the appropriate error. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14If saving to a git repository fails, don't create oddly named XML fileGravatar Dirk Hohndel
Before this change when the user gave a git style filename, say /tmp/mydives[myname], if Subsurface couldn't create a repository with that branch, it instead saved an XML file to this exact name, with '[' and ']'. That clearly is not the desired behavior, so report an error instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14Make "save changes" dialog modalGravatar Dirk Hohndel
This definitely seems to be a good candidate for a modal dialog. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14Revision of Profile part of manualGravatar Willem Ferguson
The last figures in the manual using the Unity desktop have been replaced with equivalent figures using Gnome 3. There should now be no figures remaining from Unity. This is a revision of the profile part of the manual in the light of the changes for V4.1. Text has been moved around, some new text added or rewritten. Graphics has been replaced to reflect the UI for V4.1, including Tomaz's button bar and Louisa's new buttons for that bar. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14Convert other users of showError() to the new world orderGravatar Linus Torvalds
The "report_error()" interface is a lot simpler, although some of the C++ code uses QStrings which make them a bit annoying, especially for the varargs model. Still, even with the explicit conversion to UTF8 and "char *", the report_error() model is much nicer. This also just makes refreshDisplay() do the error reporting in the UI automatically, so a number of error paths don't even have to worry. And the multi-line model of error reporting means that it all automatically does the right thing, and reports errors for each file rather than just for the last file that failed to open. So this removes closer to a hundred lines of cruft, while being a simpler interface and doing better error reporting. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14show the error string in the GUI rather than stderrGravatar Linus Torvalds
This makes the error string just be an internal "membuffer", which the GUI can fetch and show when errors occur. The error string keeps accumulating until somebody retrieves it with "get_error_string()". This should make any write errors actually show up to the user. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14propagate save errors further, don't mark divelist unchangedGravatar Linus Torvalds
This at least avoids marking the dive list as unchanged on a failed write, and propagates the error further up the stack. We still don't show the error string in the GUI, though. I'll start doing that next, I think. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14error handling: return errors for save functionsGravatar Linus Torvalds
Note! This just returns the error (and uses "report_error()" to generate a string that is currently printed to stderr). Nothing actually *uses* that error return yet, and we don't show the error string in the GUI. Baby steps. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14git access: allow arbitrary revision specifiers on readingGravatar Linus Torvalds
Commit 13e2210d75bb ("Allow remote branch names when reading a git object tree") made it possible to read (but not write) remote branches, which is very convenient when you just want to look at somebody elses dives in a shared repository. However, it was really quite stupidly done - both overly complicated, and overly restrictive. It's much better and simpler to just allow general git revision specifications, which includes branches (both remote and local) as a simple case, but also allows general git revision expressions. So you can tag things, and use a tag-name instead. Or you can say that you want to look at the previous save, by using the "branchname^" syntax. Or, you can use the git reflog, and do things like subsurface ~/scuba/[linus@{two.days.ago}] to see the dives that your repository contained two days ago. Obviously, you will not be able to save to this kind of ref-spec (and I really will have to make error handling work better), but for browsing state it's quite useful. And in git terms, this is actually simpler than the "lets try to first see if we have a local branch of that name, and then if we have a remote one", as shown by the fact that this removes more lines than it adds. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13git object format: make sure parenthood isn't lost when savingGravatar Linus Torvalds
This makes subsurface remember the git source commit of the dive data. If you save to an existing branch, subsurface will now complain and refuse to save if you try to save if the existing branch is not related to the original source. That would destroy the history of the dive data, which in turn would make it impossible to do sane merging of the data. If you save to a new branch, it will see if the previous parent commit is known in the repository you are saving to, and will save parenthood information if so. Otherwise it will save it as a new parentless commit ("root commit" in git parlance). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13New iconsGravatar Luisa Pires
These are contributed to Subsurface under GPL. Signed-off-by: Luisa Pires <luisapiresdesign@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13New profile: fix Information overlay locationGravatar Dirk Hohndel
By simply storing the coordinates based on the scene (instead of trying to map them to real coordinates) the overlay position is correctly restored. Also remove the redundant positioning before readPos is called. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13Allow remote branch names when reading a git object treeGravatar Linus Torvalds
This is the quick hack to read from a remote branch, which allows you to look at other peoples branches when sharing a git tree. Note that the "remote" part of "remote branch" is the _git_ meaning of a remote branch: it is the local cached copy from a remote. This does not imply any kind of network traffic - but if you have done a "git fetch" to get branches from some other source, you can now use the remote branch-name to see them in subsurface. Also notice that you should *NOT* save the end result. It will "work", but it won't do what you think it does. Saving does not update the remote branch, it would create a new *local* branch with that same branch-name, and since it's a new branch, it would do so with no parenthood information. So you'll be very very confused. I think I'll add code to remember the parent when loading from a git repository, and then use that remembered information when saving. So then you could create a real local branch with real history. But that's an independent issue from this loading case. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Create Documentation directory if missingGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Stop using the "git descriptor file" modelGravatar Linus Torvalds
Instead, just encode the git repository information in the filename. We want to make it much harder to make it match a real filename, but to still allow easy browsing with the file manager interface. So the git repository "filename" format is the path to the git repository directory, with the branch name encoded as "[branch]" at the end rather than the "path:branch" format that we used in the descriptor file. [ For example, on Windows, a filename like "c:\my.xml" could be interpreted as the branchame "\my.xml" in the repository in the directory "c" ] In particular, with this model, no filename that ends with ".xml" could possibly ever be considered a git repository name, since the last character of a git pathname is always ']'. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12MainWindow: maintain one window instance of the yearly statisticsGravatar Lubomir I. Ivanov
This is a bit tricky because we are using a plain widget for a window and don't have a class for it (req. more source files). Also for the table model to update we need to create a new YearlyStatisticsModel instance each time. At least, in that regard we can re-create the model each time refreshDisplay() is called. This patch adds a couple of private variables that are used to manage the memory of the yearly statistics model and window and also close that same window on MainWindow::closeEvent(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Profile2: place the ruler and tooltip on top (Z order)Gravatar Lubomir I. Ivanov
The topmost Z order of items in the profile should be: - background (poster / logo) - toolTipItem - rulerItem ... This mostly fixes the ruler being under other elements. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Ruler: change how the ruler text drawing worksGravatar Lubomir I. Ivanov
A couple of problems with the ruler: - the rotated text doesn't look very well at all and interpolation doesn't help it much - measuring towards the right most part of the profile makes the text go out of the screen To solve these issues and attempt to improve the ruler this patch does the following: - place the text at the bottom of the lowest of the start and end points. this way the line will never intersect with the text - clamp the x position, so that the text doesn't ever leave the screen horizontally - place a white background behind the text so that it will cover text and graphics under the ruler item (TODO: place the ruler on top of everything else) Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Update and add translationsGravatar Dirk Hohndel
Only the change to subsurface.pro is authored by me. The rest is generated (subsurface_source.ts) or created by the translators on Transifex. This adds Greek, Hungarian (partial), Latvian (partial), Romanian, and Turkish (partial) translations. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Make some dialogs modal to MainWindowGravatar Lubomir I. Ivanov
For most dialogs it would be much safer to make them Qt::WindowModal to the parent (MainWindow). For now we are not doing this for the preferences dialog as there are situations where the user might want to be able to move it around and even interact with the main window. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11git-save: don't create a redundant new commits with no changesGravatar Linus Torvalds
If the newly created save tree is identical to the parent commit tree, don't bother creating a new commit. We are already fully up-to-date. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11git-save: don't save the subsurface version string in the object treeGravatar Linus Torvalds
I didn't think that one through: the version string is already saved in the commit message, and so saving it in the tree object is redundant. Now a little redundancy doesn't hurt, but having the tree object depend on th esubsurface version _does_ end up being annoying: it means that as you update the subsurface version, doing a data save will result in a different tree SHA1 even if none of the data changed. Which doesn't actually matter right now, since we always create a new commit anyway, but my plan was to skip the commit creation if nothing changed in the tree. And saving the version string defeats that if you are a subsurface developer and the subsurface version keeps changing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11git-load: Add trips to the trip list on loadingGravatar Linus Torvalds
We don't actually much use the trip list any more, and it's possible we should simply get rid of it. I hadn't added the trips to the trip list when loading them, and everything worked fine. Well, *almost* everything worked fine. There is one use of the list of trips, and that's the "clear the trip index for each trip before saving them". That literally seems to be the only non-debug use of this list, but when we didn't add the trips to the list, the trip index never got cleared before saving trips. And even that is unnoticeable for the *first* save event, because the trip index will have been clear before that. But on the *second* save event, if the trip index doesn't get cleared before saving, the saving code will look at the index, say "Hey, I already saved this" and skip the trip. So if you loaded the trips from a git repository, and then saved things, everything worked fine. But it you saved things a *second* time, nothing would get saved at all, because all the trips were marked as saved already. Anyway, I think the real solution is to get rid of the pointless trip list, and just use "for_each_dive()" to find all the trips, since that list clearly is just more pain than gain. But in the meantime, this makes the git loading add the trips properly to the list. Signed-off-by: Linus "oops" Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Only anim if not first dive when openning subsurface with a divelog.Gravatar Tomaz Canabrava
The animation appeared when the user started subsurface with a default file, wich was a little annoying since it didn't had a 'from' position to go and it was also increasing it's size on some window managers that do subtle windows animations when a program starts. This patch treats the first dive opened when the program loads with a divelog pa rameter differently as the following ones storing the velocity value on a temporary, and reassigning it later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Defer mainwindow->show()Gravatar Tomaz Canabrava
The mainwindow->show(); was being called before we parsed the dives, so in the case of a large dive file, we got a very quick, but spottable, gray background on the profile. The mainwindow->show(); now is called just before the Qt main-loop starts. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Support save / load for the Animation Speed on the PreferencesGravatar Tomaz Canabrava
User can now fine-tune the animation speed on the preferences, a value of zero disables it completely. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Support Animation Speed via Settings.Gravatar Tomaz Canabrava
This is very userfull for a ( yet to be implemented ) preference dialog about the animation speed, so the user can enable / disable the animations or make it a bit faster for it's taste. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11Profile2: provide means to disable the tool buttonsGravatar Lubomir I. Ivanov
Once the poster is displayed when there are no dives in the list, we may also want to disable the QToolButtons (PO2, SAC, etc..), until a new dive is loaded and the profile is redrawn. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11MainWindow: close all windows once we close the main oneGravatar Lubomir I. Ivanov
This is useful if we have more non-modal windows and we want them simply to close with the main one without explicitly creating class member variables to point to such instances. A practical example would be the debug window created in ProfileWidget2() (diveDepthTableView) which holds the depth profile values. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>