2017-04-27 18:24:53 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-06-17 22:58:26 +00:00
|
|
|
#ifndef QTHELPER_H
|
|
|
|
#define QTHELPER_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2013-10-04 18:39:33 +00:00
|
|
|
#include "dive.h"
|
2013-11-26 17:44:18 +00:00
|
|
|
#include "divelist.h"
|
2018-02-24 22:28:13 +00:00
|
|
|
|
2018-02-21 21:35:50 +00:00
|
|
|
// 1) Types and macros
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define __printf(x, y) __attribute__((__format__(__printf__, x, y)))
|
|
|
|
#else
|
|
|
|
#define __printf(x, y)
|
|
|
|
#endif
|
2018-02-24 22:28:13 +00:00
|
|
|
|
|
|
|
enum inertgas {N2, HE};
|
|
|
|
|
|
|
|
// 2) Functions visible only to C++ parts
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <QMultiMap>
|
|
|
|
#include <QString>
|
2013-10-09 05:25:02 +00:00
|
|
|
#include <QTranslator>
|
2015-02-26 13:39:42 +00:00
|
|
|
#include <QDir>
|
2013-10-04 18:39:33 +00:00
|
|
|
QString weight_string(int weight_in_grams);
|
2015-07-14 18:35:04 +00:00
|
|
|
QString distance_string(int distanceInMeters);
|
2014-06-03 01:13:50 +00:00
|
|
|
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0);
|
2013-11-26 17:44:18 +00:00
|
|
|
QList<int> getDivesInTrip(dive_trip_t *trip);
|
2015-05-28 19:23:49 +00:00
|
|
|
QString get_gas_string(struct gasmix gas);
|
2016-07-06 12:40:28 +00:00
|
|
|
QString get_divepoint_gas_string(struct dive *d, const divedatapoint& dp);
|
2015-02-26 13:39:42 +00:00
|
|
|
void read_hashes();
|
|
|
|
void write_hashes();
|
|
|
|
void updateHash(struct picture *picture);
|
|
|
|
QByteArray hashFile(const QString filename);
|
2016-03-07 00:32:12 +00:00
|
|
|
void learnImages(const QDir dir, int max_recursions);
|
2015-03-02 15:17:51 +00:00
|
|
|
void add_hash(const QString filename, QByteArray hash);
|
2016-01-09 15:27:23 +00:00
|
|
|
void hashPicture(struct picture *picture);
|
2018-02-18 13:07:15 +00:00
|
|
|
extern "C" char *hashstring(const char *filename);
|
2015-02-26 13:39:42 +00:00
|
|
|
QString localFilePath(const QString originalFilename);
|
2017-02-21 09:00:16 +00:00
|
|
|
QString fileFromHash(const char *hash);
|
2018-02-18 13:57:42 +00:00
|
|
|
void learnHash(const QString &originalName, const QString &localName, const QByteArray &hash);
|
2015-05-28 20:17:09 +00:00
|
|
|
weight_t string_to_weight(const char *str);
|
|
|
|
depth_t string_to_depth(const char *str);
|
|
|
|
pressure_t string_to_pressure(const char *str);
|
|
|
|
volume_t string_to_volume(const char *str, pressure_t workp);
|
|
|
|
fraction_t string_to_fraction(const char *str);
|
2015-06-01 20:09:45 +00:00
|
|
|
int getCloudURL(QString &filename);
|
2015-07-31 01:38:28 +00:00
|
|
|
bool parseGpsText(const QString &gps_text, double *latitude, double *longitude);
|
2015-08-22 14:05:13 +00:00
|
|
|
QByteArray getCurrentAppState();
|
|
|
|
void setCurrentAppState(QByteArray state);
|
2015-11-14 18:43:37 +00:00
|
|
|
void init_proxy();
|
2015-11-19 01:57:13 +00:00
|
|
|
QString getUUID();
|
2017-05-05 19:13:46 +00:00
|
|
|
QStringList imageExtensionFilters();
|
2017-05-07 06:41:27 +00:00
|
|
|
char *intdup(int index);
|
2018-02-21 21:35:50 +00:00
|
|
|
__printf(1, 2) QString asprintf_loc(const char *cformat, ...);
|
|
|
|
__printf(1, 0) QString vasprintf_loc(const char *cformat, va_list ap);
|
|
|
|
|
2018-02-24 22:28:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// 3) Functions visible to C and C++
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const char *printGPSCoords(int lat, int lon);
|
|
|
|
bool in_planner();
|
|
|
|
bool getProxyString(char **buffer);
|
|
|
|
bool canReachCloudServer();
|
|
|
|
void updateWindowTitle();
|
|
|
|
void subsurface_mkdir(const char *dir);
|
|
|
|
char *get_file_name(const char *fileName);
|
|
|
|
void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName);
|
|
|
|
char *hashstring(const char *filename);
|
|
|
|
bool picture_exists(struct picture *picture);
|
|
|
|
char *move_away(const char *path);
|
|
|
|
const char *local_file_path(struct picture *picture);
|
|
|
|
void savePictureLocal(struct picture *picture, const char *data, int len);
|
|
|
|
void cache_picture(struct picture *picture);
|
|
|
|
char *cloud_url();
|
|
|
|
char *hashfile_name_string();
|
|
|
|
char *picturedir_string();
|
|
|
|
const char *subsurface_user_agent();
|
|
|
|
enum deco_mode decoMode();
|
|
|
|
int parse_seabear_header(const char *filename, char **params, int pnr);
|
|
|
|
const char *get_current_date();
|
|
|
|
double cache_value(int tissue, int timestep, enum inertgas gas);
|
|
|
|
void cache_insert(int tissue, int timestep, enum inertgas gas, double value);
|
|
|
|
void print_qt_versions();
|
|
|
|
void lock_planner();
|
|
|
|
void unlock_planner();
|
2018-02-21 21:35:50 +00:00
|
|
|
__printf(3, 4) int snprintf_loc(char *dst, size_t size, const char *cformat, ...);
|
|
|
|
__printf(3, 0) int vsnprintf_loc(char *dst, size_t size, const char *cformat, va_list ap);
|
2018-02-24 22:28:13 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-06-17 22:58:26 +00:00
|
|
|
#endif // QTHELPER_H
|