aboutsummaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
AgeCommit message (Collapse)Author
2017-03-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
Wfloat-conversion enabled for C++ part of the code Fix warnings raised by the flag using lrint Original issue reported on the mailing list: The ascent/descent rates are sometimes not what is expected. E.g. setting the ascent rate to 10m/min results in an actual ascent rate of 9m/min. This is due to truncating the ascent rate preference, then effectively rounding up the time to reach each stop to 2s intervals. The result being that setting the ascent rate to 10m/min results in 20s to ascend 3m (9m/min), when it should be exactly 18s. Reported-by: John Smith <noseygit@hotmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08Change calls to rint into lrint avoiding conversion warningsGravatar Jeremie Guichard
Using gcc option "-Wfloat-conversion" is useful to catch potential conversion errors (where lrint should be used). rint returns double and still raises the same warning, this is why this change updates all rint calls to lrint. In few places, where input type is a float, corresponding lrinf is used. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-04Add helper to parse duration textGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-21Many filenames are const stringsGravatar Robert C. Helling
So we can use string constants for those Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-19Update exif.cpp from upstreamGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-14Prevent crash on Mac when typing comma in GPS coordinates fieldGravatar Dirk Hohndel
Our attempt to skip any white space after the comma causes an ASSERT (strangely only on Macs). This closes #158 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-06Rename prefs.deco_mode to prefs.planner_deco_modeGravatar Robert C. Helling
This is to avoid confusion with planner.display_deco_mode. When accessing the "current deco mode" use the decoMode() helper function. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06Fix deco_mode confusionGravatar Robert C. Helling
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB vs RECREATIONAL): One for the planner (deco_mode) and one for displaying dives (display_deco_mode). The former is set in the planner settings while the latter is set in the preferences. This patch clears up a confusion which of the two to use by introducing a helper function that selects the correct variable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-30Fix picture hashing logic for pictures on the web.Gravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-27Correctly open the resource fileGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26Get rid of debug messagesGravatar Robert C. Helling
...that managed to sneak in in a previous commit. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-04Empty image hashes are not validGravatar Robert C. Helling
I don't know how those arose in the first place, but an empty QByteArray is never a valid hash value for an image. So we should not store those in our translation tables and also get rid of them when loading the tables from disk. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-22Correctly pick up the UI language from settingsGravatar Dirk Hohndel
While Linux can set the locale from the language text, Windows needs the correct locale value (which makes more sense to use, anyway - that's why we save it). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20Language preference: once we figure out the locale, remember itGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20Don't look up the setting againGravatar Dirk Hohndel
This caused us to do the wrong thing if the setting wasn't set at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Fix missing groups and Language initializationGravatar Tomaz Canabrava
There's one function named uiLanguage() that should return the current uiLanguage() that subsurface is running, but it actually sets a whole lot of preferences, I think that the general idea of that function is okay, but it seems broken for me. still, I used it to load the correct language from the preferences since it's what this function is currently doing right now. Also, a lot of missing groups where added. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Move loadPreferences out of qt-helper.cppGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Correct commentGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27Settings update: Remove unused include and add FIXME commentGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10Include full year for trip on divelistGravatar Miika Turkia
Having only the last 2 digits of the year is somewhat confusing as one can easily think that to be the day. Thus it is more clear to use full year for the trip header. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09Have divedatapoint store cylinder id instead of gasmixGravatar Rick Walsh
Determining the correct cylinder index from a known gas mix can be complicated, but it is trivial to look up the gasmix from the cylinder_t structure. It makes sense to remember which cylinder is being used. This simplifies handling changing a cylinder's gas mix, either directly by the user, or indirectly in the planner. It also permits tracking of multiple cylinders of the same mix, e.g. independent twins / sidemount. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-28Add some gas mix validation to the plannerGravatar Rick Walsh
A few basic rules for gas validation: We can't have <0%, or >100% of either O2 or He O2 + He must not be >100% Switch depth can't be <0% This places limits on user-input values Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29Protect access to image hash dictionaries with lockGravatar Robert C. Helling
Otherwise we step on our own feet when downloading several images, like after import from divelogs.de with many linked images. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29Fix Qt date interfaces for times before 1970Gravatar Linus Torvalds
This seems to work around the crazy QDateTime::fromTime_t() problem in Qt. It is *very* lightly tested. In fact, the only test is that "test0.xml" change that is part of this patch. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05Remove unused and buggy get_cylinder_used_gas_string() functionGravatar Linus Torvalds
It's good that this is unused, because it does the calculations wrong. Due to the gas compressibility the gas use calculations should subtract the gas_volume() values at the differing pressures, not the pressures themselves. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>