2013-06-17 15:58:26 -07:00
|
|
|
#ifndef QTHELPER_H
|
|
|
|
#define QTHELPER_H
|
|
|
|
|
|
|
|
#include <QMultiMap>
|
|
|
|
#include <QString>
|
|
|
|
#include <stdint.h>
|
2013-10-04 21:39:33 +03:00
|
|
|
#include "dive.h"
|
2013-11-26 15:44:18 -02:00
|
|
|
#include "divelist.h"
|
2013-10-08 22:25:02 -07:00
|
|
|
#include <QTranslator>
|
2015-02-26 14:39:42 +01:00
|
|
|
#include <QDir>
|
2013-10-08 22:25:02 -07:00
|
|
|
|
2015-08-18 12:03:30 +03:00
|
|
|
class Dive {
|
|
|
|
private:
|
|
|
|
int m_number;
|
|
|
|
int m_id;
|
|
|
|
int m_rating;
|
|
|
|
QString m_date;
|
|
|
|
timestamp_t m_timestamp;
|
|
|
|
QString m_time;
|
|
|
|
QString m_location;
|
|
|
|
QString m_duration;
|
|
|
|
QString m_depth;
|
|
|
|
QString m_divemaster;
|
|
|
|
QString m_buddy;
|
|
|
|
QString m_airTemp;
|
|
|
|
QString m_waterTemp;
|
|
|
|
QString m_notes;
|
|
|
|
QString m_tags;
|
|
|
|
QString m_gas;
|
|
|
|
QString m_sac;
|
2015-11-17 00:29:18 +02:00
|
|
|
QStringList m_weights;
|
2015-08-18 12:03:30 +03:00
|
|
|
QString m_suit;
|
2015-11-17 00:29:18 +02:00
|
|
|
QStringList m_cylinders;
|
2015-08-18 12:03:30 +03:00
|
|
|
QString m_trip;
|
2015-11-17 00:29:21 +02:00
|
|
|
QString m_maxcns;
|
|
|
|
QString m_otu;
|
2015-08-18 12:03:30 +03:00
|
|
|
struct dive *dive;
|
|
|
|
void put_date_time();
|
|
|
|
void put_timestamp();
|
|
|
|
void put_location();
|
|
|
|
void put_duration();
|
|
|
|
void put_depth();
|
|
|
|
void put_divemaster();
|
|
|
|
void put_buddy();
|
|
|
|
void put_temp();
|
|
|
|
void put_notes();
|
|
|
|
void put_tags();
|
|
|
|
void put_gas();
|
|
|
|
void put_sac();
|
|
|
|
void put_weight();
|
|
|
|
void put_suit();
|
|
|
|
void put_cylinder();
|
|
|
|
void put_trip();
|
2015-11-17 00:29:21 +02:00
|
|
|
void put_maxcns();
|
|
|
|
void put_otu();
|
2015-08-18 12:03:30 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
Dive(struct dive *dive)
|
|
|
|
: dive(dive)
|
|
|
|
{
|
|
|
|
m_number = dive->number;
|
|
|
|
m_id = dive->id;
|
|
|
|
m_rating = dive->rating;
|
|
|
|
put_date_time();
|
|
|
|
put_location();
|
|
|
|
put_duration();
|
|
|
|
put_depth();
|
|
|
|
put_divemaster();
|
|
|
|
put_buddy();
|
|
|
|
put_temp();
|
|
|
|
put_notes();
|
|
|
|
put_tags();
|
|
|
|
put_gas();
|
|
|
|
put_sac();
|
|
|
|
put_timestamp();
|
|
|
|
put_weight();
|
|
|
|
put_suit();
|
|
|
|
put_cylinder();
|
|
|
|
put_trip();
|
2015-11-17 00:29:21 +02:00
|
|
|
put_maxcns();
|
|
|
|
put_otu();
|
2015-08-18 12:03:30 +03:00
|
|
|
}
|
|
|
|
Dive();
|
|
|
|
~Dive();
|
|
|
|
int number() const;
|
|
|
|
int id() const;
|
|
|
|
int rating() const;
|
|
|
|
QString date() const;
|
|
|
|
timestamp_t timestamp() const;
|
|
|
|
QString time() const;
|
|
|
|
QString location() const;
|
|
|
|
QString duration() const;
|
|
|
|
QString depth() const;
|
|
|
|
QString divemaster() const;
|
|
|
|
QString buddy() const;
|
|
|
|
QString airTemp() const;
|
|
|
|
QString waterTemp() const;
|
|
|
|
QString notes() const;
|
|
|
|
QString tags() const;
|
|
|
|
QString gas() const;
|
|
|
|
QString sac() const;
|
2015-11-17 00:29:18 +02:00
|
|
|
QString weights() const;
|
|
|
|
QString weight(int idx) const;
|
2015-08-18 12:03:30 +03:00
|
|
|
QString suit() const;
|
2015-11-17 00:29:18 +02:00
|
|
|
QString cylinders() const;
|
|
|
|
QString cylinder(int idx) const;
|
2015-08-18 12:03:30 +03:00
|
|
|
QString trip() const;
|
2015-11-17 00:29:21 +02:00
|
|
|
QString maxcns() const;
|
|
|
|
QString otu() const;
|
2015-08-18 12:03:30 +03:00
|
|
|
};
|
|
|
|
|
2013-10-08 22:25:02 -07:00
|
|
|
// global pointers for our translation
|
|
|
|
extern QTranslator *qtTranslator, *ssrfTranslator;
|
2013-06-17 15:58:26 -07:00
|
|
|
|
2013-10-04 21:39:33 +03:00
|
|
|
QString weight_string(int weight_in_grams);
|
2015-07-14 11:35:04 -07:00
|
|
|
QString distance_string(int distanceInMeters);
|
2014-06-02 18:13:50 -07:00
|
|
|
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0);
|
2015-02-14 17:50:48 -08:00
|
|
|
extern "C" const char *printGPSCoords(int lat, int lon);
|
2013-11-26 15:44:18 -02:00
|
|
|
QList<int> getDivesInTrip(dive_trip_t *trip);
|
2015-05-28 16:23:49 -03:00
|
|
|
QString get_gas_string(struct gasmix gas);
|
|
|
|
QString get_divepoint_gas_string(const divedatapoint& dp);
|
2015-02-26 14:39:42 +01:00
|
|
|
void read_hashes();
|
|
|
|
void write_hashes();
|
|
|
|
void updateHash(struct picture *picture);
|
|
|
|
QByteArray hashFile(const QString filename);
|
2015-02-26 14:44:27 +01:00
|
|
|
void learnImages(const QDir dir, int max_recursions, bool recursed);
|
2015-03-02 16:17:51 +01:00
|
|
|
void add_hash(const QString filename, QByteArray hash);
|
2015-02-26 14:39:42 +01:00
|
|
|
QString localFilePath(const QString originalFilename);
|
|
|
|
QString fileFromHash(char *hash);
|
2015-03-02 16:18:16 +01:00
|
|
|
void learnHash(struct picture *picture, QByteArray hash);
|
2015-09-17 16:56:58 +02:00
|
|
|
extern "C" void cache_picture(struct picture *picture);
|
2015-05-28 17:17:09 -03: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 13:09:45 -07:00
|
|
|
int getCloudURL(QString &filename);
|
2015-07-25 22:08:25 -07:00
|
|
|
void loadPreferences();
|
2015-07-30 22:38:28 -03:00
|
|
|
bool parseGpsText(const QString &gps_text, double *latitude, double *longitude);
|
2015-08-22 07:05:13 -07:00
|
|
|
QByteArray getCurrentAppState();
|
|
|
|
void setCurrentAppState(QByteArray state);
|
2015-08-19 23:12:30 +02:00
|
|
|
extern "C" bool in_planner();
|
2015-10-13 11:34:26 -07:00
|
|
|
extern "C" void subsurface_mkdir(const char *dir);
|
2015-11-14 10:43:37 -08:00
|
|
|
void init_proxy();
|
2015-11-18 17:57:13 -08:00
|
|
|
QString getUUID();
|
2015-07-30 22:38:28 -03:00
|
|
|
|
2013-06-17 15:58:26 -07:00
|
|
|
#endif // QTHELPER_H
|