aboutsummaryrefslogtreecommitdiffstats
path: root/helpers.h
AgeCommit message (Collapse)Author
2015-09-07Save Bluetooth download mode settingsGravatar Claudiu Olteanu
Save the dive computer download mode flag. In this way, if the user used Bluetooth mode to download its dives on his last session he doesn't need to open the Bth selection dialog if he wants to use the same device. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23Move helper functions aroundGravatar Dirk Hohndel
We had a ton of helper functions in qt-gui.cpp which really didn't make much sense. So I moved them all into qthelper.cpp. Also moved the UserAgent helper that didn't belong in the UpdateHandler to begin with - that's a generic helper used in many places... With this we can successfully build using cmake again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-29Facebook integration: improve the confirmation UI experienceGravatar Dirk Hohndel
Date and time needs to be a string, not a time_t. Duration should be called that (and not time) and wasn't hooked up. Also added a helper to get the duration string. Finally reordered the components of the text that is shown to make it more natural (or I should say, more in line with the order we use elsewhere). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-01Fix time zone issues in 32bit buildsGravatar Dirk Hohndel
The bug is obvious, tracking it down wasn't. A simple thinko brought us time_t instead of timestamp_t - which doesn't matter on 64bit builds, but makes things fail in weird ways on 32bit builds - like our Windows binaries. In this case instead of checking today's date to detect the timezone offset we happened to be using a date in December 1969, so no dailight savings, so the times were off. Fixes #655 Fixes #667 See #670 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Pick the correct timezoneoffset for the day in questionGravatar Dirk Hohndel
Calculating the timezoneoffset for the current date really makes no sense whatsoever when displaying a time that isn't "now". Fixes #605 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Date picker l10n for profile and plannerGravatar Sergey Starosek
- set application-wide locale from preferences - use custom date format for display Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-28Calendar Widget: set the locale appropriate first day of the weekGravatar Dirk Hohndel
Also adjust the minimum size, given I changed this in commit 26855234acef ("Make date widget easier to read"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-25Make gas mod be reasonable for users of imperial units as wellGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-09Add gas consumption statistic for selected divesGravatar Dirk Hohndel
We already did a list of gases and volume consumed for the selected dive on the Dive Info tab, but did not provide that same data on the Stats tab for all the selected dives. I arbitrary limited this to eight gases (as the list can get quite long when you select a lot of dives). The gases are sorted by volume consumed. Fixes #535 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-06User manual: show a localized version of the manual if it existsGravatar Dirk Hohndel
So far we only have Spanish, but it always pays to plan ahead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Don't assume that pressures are always positiveGravatar Dirk Hohndel
When planning a dive, the dive could use more gas than is in the cylinder. So getting a negative end pressure is a useful indication to the user that there plan might not be a good one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-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-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-02Fix imperial cylinder sizes in equipment tabGravatar Linus Torvalds
The imperial cylinder sizes are not just in cubic feet: they are in cubic feet of gas at STP. So the imperial/metric difference is not just about converting blindly from liters to cubic feet, you also have to take the working pressure of the cylinder into account. This was broken by commit f9b7c5dfe9d0 ("Make units in cells consistant in CylindersModel"), because those poor sheltered Swedish people have never had to work with the wondrous imperial cylinder sizing, and think that units should make _sense_. Hah. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20Use M_OR_FT macro instead of switch statementGravatar Dirk Hohndel
This is easier to read and also avoids an incorrect gcc warning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21Work around QMessageBox not showing its title on MacGravatar Dirk Hohndel
This is a bit hacky and simply adds the title to the message text when compiling on a Mac, but hopefully this will be enough. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16Helpers: move some date related function to qt-gui.cppGravatar Lubomir I. Ivanov
divelist.c: get_dive_date_string() get_short_dive_date_string() get_trip_date_string() MinGW support for *printf and parameter positions (e.g. %1$d) is horribly broken. Instead of implementing *proper* support for this feature Microsoft decide to ignore the standard (again) and they implement new functions with the '_p' suffix, such as 'sprintf_p', which seem to be available from a 2003 runtime. To top that 'sprintf_p' is not really a 'sprintf' but rather a 'snprintf'. It seems that the MinGW people ignore the issue and do not provide wrappers of any sort, or at least for the current recommended compiler for Qt 4.8.5 on Windows - which is a 4.4.0. A note of warning; inspecting how MinGW does certain things in headers such as stdio.h, can ensue bad dreams or other negative effects on to the viewer. This forces us to move the following functions from the 'back-end' (divelist.c) to the 'front-end' (qt-gui.cpp) and use QString. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Helpers: add get_cylinder_used_gas_string()Gravatar Lubomir I. Ivanov
get_cylinder_used_gas_string() retrieves used gas per cylinder with optional units display. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Support imperial measurements in dive planner / add diveGravatar Dirk Hohndel
This was not as hard as I assumed it would be. I may still change the horizontal dimension to be the more logical seconds instead of minutes, but for now this achieves the main goal. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21Allow editing of date & time and air & water temperaturesGravatar Dirk Hohndel
Add two more rows to the widget - this is getting quite busy. There still is some weirdness where the focus isn't returned where it should be and a few other details, but overall getting there. Added helper functions to parse a temperature and to deal with the timezone offset - with that latter one I also fixed the time offset bug in the planner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Improve display of yearly statisticsGravatar Dirk Hohndel
Display the units in the header, make the header more consistent looking, convert the values into the right units with appropriate precision. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18Converting the device_info list into a Qt data structureGravatar Dirk Hohndel
This data structure was quite fragile and made 'undo' when editing rather hard to implement. So instead I decided to turn this into a QMultiMap which seemed like the ideal data structure for it. This map holds all the dive computer related data indexed by the model. As QMultiMap it allows multiple entries per key (model string) and disambiguates between them with the deviceId. This commit turned out much larger than I wanted. But I didn't manage to find a clean way to break it up and make the pieces make sense. So this brings back the Ok / Cancel button for the dive computer edit dialog. And it makes those two buttons actually do the right thing (which is what started this whole process). For this to work we simply copy the map to a working copy and do all edits on that one - and then copy that over the 'real' map when we accept the changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31Display the Subsurface manual in the help widgetGravatar Dirk Hohndel
This adds a helper function to determine the Subsurface data directory (are we running from build directory? installed on Linux? installed on Mac? - still need to add support for Windows). This same function is then used by both the setup for Marble and for the help browser. This assumes that the user-manual.html file has actually been built and installed (which we don't do by default with the current Makefile). Right now there are rendering issues with our manual in the help browser widget - I'm sure this can be fixed... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Implement default dive computer and deviceGravatar Dirk Hohndel
The data is saved in the settings and the correct dive computer (vendor and product) and device are picked when the download dialog is openend. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Missing helpers.h fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>