mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 21:20:19 +00:00
861b524e7a
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>
38 lines
1.4 KiB
C
38 lines
1.4 KiB
C
/*
|
|
* helpers.h
|
|
*
|
|
* header file for random helper functions of Subsurface
|
|
*
|
|
*/
|
|
#ifndef HELPER_H
|
|
#define HELPER_H
|
|
|
|
#include <QString>
|
|
#include "dive.h"
|
|
#include "qthelper.h"
|
|
|
|
QString get_depth_string(depth_t depth, bool showunit = false, bool showdecimal = true);
|
|
QString get_depth_string(int mm, bool showunit = false, bool showdecimal = true);
|
|
QString get_depth_unit();
|
|
QString get_weight_string(weight_t weight, bool showunit = false);
|
|
QString get_weight_unit();
|
|
QString get_cylinder_used_gas_string(cylinder_t *cyl, bool showunit = false);
|
|
QString get_temperature_string(temperature_t temp, bool showunit = false);
|
|
QString get_temp_unit();
|
|
QString get_volume_string(volume_t volume, bool showunit = false);
|
|
QString get_volume_unit();
|
|
QString get_pressure_string(pressure_t pressure, bool showunit = false);
|
|
QString get_pressure_unit();
|
|
void set_default_dive_computer(const char *vendor, const char *product);
|
|
void set_default_dive_computer_device(const char *name);
|
|
QString getSubsurfaceDataPath(QString folderToFind);
|
|
extern const QString get_dc_nickname(const char *model, uint32_t deviceid);
|
|
int gettimezoneoffset();
|
|
int parseTemperatureToMkelvin(const QString& text);
|
|
QString get_dive_date_string(timestamp_t when);
|
|
QString get_short_dive_date_string(timestamp_t when);
|
|
QString get_trip_date_string(timestamp_t when, int nr);
|
|
|
|
extern DiveComputerList dcList;
|
|
|
|
#endif /* HELPER_H */
|