aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelogexportdialog.cpp
AgeCommit message (Collapse)Author
2018-09-07Cleanup: constify get_units()Gravatar Berthold Stoeger
get_units() returns a pointer to the units struct in the preferences. Callers should not modify the preferences via this struct, therefore make the return value point to const. This is a small step in constifying the global preferences structure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-25desktop-widget: remove QSettingsGravatar jan Iversen
Update desktop-widget to use qPrefDisplay (amended variable) Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23Cleanup: pass gasmix by valueGravatar Berthold Stoeger
In a previous commit, the get_gasmix_* functions were changed to return by value. For consistency, also pass gasmix by value. Note that on common 64-bit platforms struct gasmix is the size of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the same space on the stack. On 32-bit platforms, the stack use is probably doubled, but in return a dereference is avoided. Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an invasive change that going back to pointers is probably the least of our worries. This commit is a step in const-ifying input parameters (passing by value is the ultimate way of signaling that the input parameter will not be changed [unless there are references to said parameter]). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-21desktop-widgets: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-17Unify float calulations: use doubleGravatar Berthold Stoeger
Internal floating point (FP) calculations should be performed using double unless there is a very good reason. This avoids headaches with conversions. Indeed, the vast majority of FP calculations were already done using double. This patch adapts most remaining calculations. Not converted where things that were based on binary representations and variables which weren't used anyway. An analysis of all instances follows: core/plannernotes.c, l.404: This was a comparison between two floats. On the left side, first an integer was cast to float then multiplied with and integer and divided by a constant double. The right hand side was an integer cast to a float. Simply divide by 1000.0 first to convert to double and continue with calculations. On the right hand side, remove the cast, because the integer will be implicitely cast to double for comparison. This conversion actually emits less instructions, because no conversion to double and back is performed. core/planner.c, l.613: Same analysis as previous case. subsurface-desktop-main.cpp, l.155: A local variable representing the version OpenGL version. Turn this into integer logic. Not only does this avoid dreaded FP rounding issues, it also works correctly for minor version > 10 (not that such a thing is to be expected anytime soon). abstractpreferenceswidget.[h/cpp]: A widget where the position is described as a float. Turn into double. desktop-widgets/divelogexportdialog.cpp, l.313: total_weight is described as float. Use double arithmetics instead. This instance fixes a truncation warning emitted by gcc.
2017-12-11Write profile images to correct directory in TeX exportGravatar Robert C. Helling
Before, we did not look at the path of the filename to export to but we should write the images there and not in pwd. Fixes #931 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-04Use QDir::exists() instead of QDir::setCurrent() to check for existenceGravatar Berthold Stoeger
Don't change into a directory just to see if it exists. Remove unnecessary braces of one of the changed if statements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-04Correct, cleanup, translate and unify file filtersGravatar Stefan Fuchs
Correct spelling and typos in file filters. Unify and translate file filter names. Don't pass a file filter to a directory open dialog - not needed. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-08-26Another unused variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Tex export: remove incorrect codeGravatar Dirk Hohndel
These two variables are calculated later in the function and the same two lines of code are there again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-10More details for TeX exportGravatar Robert C. Helling
Include the gasname, get rid of more spaces in front of units, update the template to use new gas fields. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10Move the decision how to typeset unit to TeX-style fileGravatar Robert C. Helling
This way, the user can adopt those once and for all for all her dives. This includes the space between number and unit symbol. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10Use letters instead of digit in TeX macro namesGravatar Robert C. Helling
TeX doesn't like digits there, so let's use letters Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10Cleaning up TeX exportGravatar Robert C. Helling
Removed some merge artefacts and made sure code compiles and produces wellformed TeX. Shortend some comments. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-10Add additional data to TeX-exportGravatar Ben McCandless
The purpose of this work is to allow for generation of more complete log pages using TeX/LaTeX. Previously, the exporting to TeX generated a document that contained very limited information about the dive. For example: the only details reported about air consumption were delta pressure and SAC. In addition no data was reported about what equipment (weights, tanks, suit) was used. Per feedback, code was updated to use helper functions, and now exports data with the units set by the user in the Subsurface preferences. Some characters (Degree symbol) do not render correctly by default in LaTeX, so sample code to address this was included in the top comments. Volume units do not export an ideal character string, so another string was substituted. This update adds the following information: * GPS Location * Dive computer used * Max, Min, Air, and Water Temperatures * Average depth * Number of cylinders listed, mix, and start/end pressure for each * Total weight used, and the description and quantity of each weight * Dive rating (previously, only visibility was reported) * Buddy * Dive master * Suit This update moved several fields that had no output or had unexpected names (i.e. "spot", "place") into a "Deprecated section" Future work: * The export currently only includes the first entry in the tag list. * Future versions should export all tags. * Ideally, this would export a screenshot of the dive location. * Create a table of correct size for weights and cylinders. * It would be nice to have a bit more control over the generation of profile images, but that may be beyond me. Rebased-and-cleaned-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Ben McCandless <mccand@gmail.com>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-21missing dotGravatar Martin Měřinský
2017-02-03Revert "In statistics, ignore gas use of planned dives"Gravatar Dirk Hohndel
This reverts commit 1d8662006cbb5edae941315e30ede381c23a817b. Mistakenly pushed to master Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-02In statistics, ignore gas use of planned divesGravatar Robert C. Helling
When merged with real dives, those would double count otherwise. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-26Remove unused variablesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20Add country information to TeX exportGravatar Robert C. Helling
This is a bit ugly since it does a regexp match on divesite.notes but what can I do... Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20TeX export: check site pointer, before accessing itGravatar Martin Gysel
Print empty string rather than 'null' Signed-off-by: Martin Gysel <me@bearsh.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-11Export to TeX file initializedGravatar Robert C. Helling
This does the basic export as a TeX file including a template. It still lacks proper location parsing. Signed-off-by: Robert C. Helling <helling@atdotde.de> 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>
2016-03-09Silence warnings in divelogexportdialog.cppGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09Remove unused member functionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Move qt-ui to desktop-widgetsGravatar Tomaz Canabrava
Since we have now destkop and mobile versions, 'qt-ui' was a very poor name choice for a folder that contains only destkop-enabled widgets. Also, move the graphicsview-common.h/cpp to subsurface-core because it doesn't depend on qgraphicsview, it merely implements all the colors that we use throughout Subsurface, and we will use colors on both desktop and mobile versions Same thing applies for metrics.h/cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>