summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-05-13Move DiveList related methods/classes to own file.Gravatar Tomaz Canabrava
The DiveList classes were a partial mess (and some of it is still in a messy state). The classes that deal with it where done in 'qtHelpers.h', the extern global variable in dive.h, a few methods here and there. This concentrates most - but not all - functions in their own file. The reason for that is to make the new developer faster when looking for things: if it's a divecomputer related method, it should be in a single file, not scattered around. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-13Move printGpsCoords from MainTab to QtHelperGravatar Tomaz Canabrava
Last time I touched this I got a scream from dirk, but then I looked at the code again and the problem that I faced was that I broke translations in a sad way, well, now I broke it again. However, this method shouldn't belong to MainTab ( because of that thingy that I said before and also many others: Separate the logic of your application from the UI specific code ) This generates a string that's going to be used on the Interface, it doesn't display it on the interface. Move it down below makes it easier to test ( I don't need to create an Widget and worry about the parent-relationship with the mainwindow just to test this function, for instance. ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-12Don't use locale for git save formatGravatar Linus Torvalds
I stupidly used "weekday()" without realizing we localize it. And we really don't want to make save formats be localized (we don't localize decimal numbers etc either). This fixes the git save format to just use a hardcoded weekday list. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-12Fix git loading of odd localesGravatar Linus Torvalds
This should make git loading be able to load git saves with arbitrary weekday names. Even strange German ones. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-12Uemis downloader: fix corner caseGravatar Dirk Hohndel
When we first get an invalid dive info and then, once we decremented the offset, get a valid one but for the wrong dive and then try to calculate the correct offset, we need to keep the existing offset in mind. What a horrid design. Thanks, UEMIS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Documentation spelling errorsGravatar Jeremiah Mahler
A general review of the documentation has found more spelling errors. Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Prefix a method with 'dive_' because it should work only with divesGravatar Tomaz Canabrava
I'll probably add prefixes to functions to make it easier to find method via autocomplete from the grep or interface helpers, do you wanna know all the functions that works with a dive? ask for the completion for dive_, do you wanna know all the functions that works with a divelist? ask for the completions on divelist_ or run grep -rIs divelist_ on the header files. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11use for_each_dive instead of hand-written loop.Gravatar Tomaz Canabrava
It's easyer to make a mistake in the loop insteaf of using the currently correct one that's already written Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11When creating methods that pass QString, use const QString&Gravatar Tomaz Canabrava
This removes unecessary creation and destruction of the object making the code shine a bit more and be more fluffy. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11'Class' string is unecessary when using a Container.Gravatar Tomaz Canabrava
pretty self explanatory, the 'class' keyword is unecessary when defining things inside a Container, be it a QList, QVector, QMap, QHahs or anything else. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Simplify code.Gravatar Tomaz Canabrava
this is not necessary when you don't have a variable that has the exact same name as the 'this->variable' name, also, there's no need to check if a QString is empty before trying to use the == on them. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Correct the usage of std::string and QStringGravatar Tomaz Canabrava
QStrings shouldn't be == "" to check for empty string, use .isEmpty() QStrings shouldn't be != "" to check for non empty, use .size() std::string shouldn't be cleared with = "", use .clear() Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Remove old defines.Gravatar Tomaz Canabrava
Those were from the ancient Gtk times where we hardcoded the white stars and black stars as font glyphs instead of drawing them. get rid of it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11Move unit related code to units.hGravatar Tomaz Canabrava
The units are used everywhere in the application, we don't really need to include "dive.h" to be able to use unit conversion, so I changed them to a new file. There is still a lot of non-dive stuff in dive.h / c, I'll try to move more later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-10CodingStyle "to" "too" typoGravatar Jeremiah Mahler
Small typo in CodingStyle. ".. in this file to." should be "... in this file too." Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08When starting the planner, copy cylinders from currently selected dive.Gravatar Robert C. Helling
This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Use the used flag on cylinders in get_dive_gasGravatar Anton Lundin
Now when we have a used flag on every cylinder that are set in mark_used_tanks we can use it here. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Use enum name instead of its int value.Gravatar Anton Lundin
SAMPLE_EVENT_GASCHANGE2 is the libdivecomputer name of the event. Compare with that instead of its int value. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Remove unnecessary include from dive.cGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Fix building with NO_MARBLE after prototype changeGravatar Anton Lundin
4243fcb915 ("Dont set coordinates when two or more dives are selected") Changed how the prototypes in GlobeGPS looks. This aligns NO_MARBLE version of GlobeGPS with that. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Offer to discard the plan when Quit is triggered in planner.Gravatar Robert C. Helling
Upon pressing Ctrl-Q or the window close button a modal dialog was shown to remind the user that the planned dive is not saved. This patch triggers the "cancel plan" action before trying to quit. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: show gas for the NEXT segmentGravatar Robert C. Helling
For deco stops show the gas of the next segment in the table. In recalculation remove old deco stops earlier. In struct diveplan, the items are "segments" with a beginning, a duration, and a gas. In contrast, the UI of the planner uses "waypoints" which are the boundaries between segments. It is conventional at least for deco stops to display the gas of the _next_ segment in the runtime table (i.e. the gas possibly to be switched to). Furthermore, in addStop, the old deco stops have to be removed earlier as otherwise a new waypoint later than a previous generated gas switch inherits the gas of the old switch. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Add waipoints when changing ascend rate in plannerGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Implement ascend rate according to GUE standard proceduresGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Planner: Change when we recalculate decoGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Rewrite show_location to use membuffer primitivesGravatar Anton Lundin
This simplifies the logic and doesn't rely on show_utf8 to print empty blocks. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08Yet some more changes to Companion part of user manualv4.1Gravatar Willem Ferguson
A last few changes before 4.1. The first figure in "Using Companion app" needs a third part. This was inserted. Which, in turn, affected the last figure in that section. So that was also changed accordingly. Few tiny changes to text to clean up references to figures. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Fix another dangling pointerGravatar Thiago Macieira
Same problem as the previous commit: toStdString() returns a temporary, and c_str() will return a pointer to internal data, freed at the end of the statement. So get the pointer to be strcpy'ed in the same statement. Changed to toUtf8() to be more explicit about the encoding and to avoid std::string Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Fix crash on dereferencing dangling pointersGravatar Thiago Macieira
QList::first() returns a reference to an item, but that list was a temporary. The list gets destroyed at the end of the statement (the semi-colon), so we ended up keeping a reference to freed data (i.e., a dangling pointer) Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Getting ready for 4.1Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Latest translation from TransifexGravatar Dirk Hohndel
As always, I'm not the author, just committing the changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Add known issues / bugs to ReleaseNotes.txtGravatar Thomas Maisl
Some bugs couldn't be addressed before the release of Subversion 4.1. Add the most important ones to the ReleaseNotes. Signed-off-by: Thomas M <exp-122004@maisl.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Apply the edit of trip locationsGravatar Anton Lundin
This re-adds this code that got removed in a209dfbfd53 ("Multi dive edit: don't change location texts until user saves the change") Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Only mark location changed when in edit modeGravatar Anton Lundin
Otherwise the code loading a dive into the field would mark it as changed. This re-adds this code that got removed in a209dfbfd53 ("Multi dive edit: don't change location texts until user saves the change") Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Improve the color coding when editing coordinatesGravatar Dirk Hohndel
This still gets it wrong (i.e. marks things as edited when they are not or not edited when they are) but at least they are no longer incorrectly marked as incorrectly parsed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Hack around a translation issueGravatar Dirk Hohndel
I cannot figure out how to get the hemisphere letters translated correctly in qthelper.cpp. Short term hack for now - someone who understands how this is supposed to work really needs to take a look. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Remove spurious debug printoutGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Globe: assume that we are looking at the current_diveGravatar Dirk Hohndel
As in commit 3870bdafee53 ("Globe: we always center on the current dive") passing in a specific dive here makes no sense - it's always about the current dive. Fixes #513 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Globe: we always center on the current diveGravatar Dirk Hohndel
Simplify the API (we'll take advantage of this in the next commit). We always center the globe on the current dive, so no point in passing that dive in. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Multi dive edit: don't change location texts until user saves the changeGravatar Dirk Hohndel
If we keep updating the location text of all selected dives we can lose the status of which dives had the same text of the original dive and which did not (this happens if the location we are adding is identical to a selected location but adds text to the end of it). Now we only edit the other dives after we accepted the change. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Even if there is progress text, still set the progress bar percentageGravatar Dirk Hohndel
I don't understand why we wouldn't set the percentage if we displayed text there as well. This looks much better. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Fix stupid typoGravatar Dirk Hohndel
Yeah, that doesn't work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Manually implement strndupGravatar Dirk Hohndel
Mac and Windows don't appear to have that function, so just implement the poor man's version by hand. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07Remove trailing spaces from the produced outputGravatar Anton Lundin
The code found the trailing spaces and just didn't care about it. This also removes the FIXME quoting, because quoting is managed. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07User manual: Updates regarding the companion appGravatar Willem Ferguson
These adiitions and changes were made in accordance with the screenshots provided by Venkatesh and Salvador and after managing to actually run the companion app on my phone. Large parts of the text of this section have been changed in accordance with the Companion V2 interface. Two graphics were changed. After Version 2 has stabilised, some more adaptation of the text will be required. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-06Qt turns edited locations into null-stringsGravatar Anton Lundin
They aren't null pointers after you touched them, so we can't rely on that to choose if we should use put_string or show_utf8. show_utf8 would not print the tag if it only contains a \0 as body. Fixes #440 Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-06Terminate the string before relying on strlenGravatar Anton Lundin
Its a c-string we put, so it must be null-terminated. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-06Revert "Save latitude and longitude on XML even if location not set"Gravatar Anton Lundin
This fixes the bug in #440 by accident, and introduces lots of empty attributes and tags in the xml. This reverts commit 6378bfd91ee6c0ad746b072d8a9389e0eba7c614. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-06Simplify string comparisonGravatar Dirk Hohndel
This is based on Linus' idea on the mailing list. Treat NULL strings and empty strings as identical. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-06More multi-edit fixesGravatar Dirk Hohndel
This time for values that aren't simply text. For normal integers this is rather straight forward. For the 'when' timestamp we simply assume that this is a shift in time. What is still missing is consistent handling of the three fields that are implemented as tags: tags, buddy and divemaster. We have special code for tags that makes no sense in a multi-edit scenario. And we treat divemaster and buddy as a single string - which kinda works but treats "Bill, Joe" and "Joe, Bill" as different. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>