mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
filter: remove filter_preset_table_t
We used a typedef "filter_preset_table_t" for the filter preset table, because it is a "std::vector<filter_preset>". However, that is in contrast to all the other global tables (dives, trips, sites) that we have. Therefore, turn this into a standard struct, which simply inherits from "std::vector<filter_preset>". Note that while inheriting from std::vector<> is generally not recommended, it is not a problem here, because we don't modify it in any shape or form. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
67aec56f8c
commit
a7bbb6c1cc
20 changed files with 52 additions and 46 deletions
|
@ -18,7 +18,7 @@ void addDive(dive *d, bool autogroup, bool newNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
void importDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *presets, int flags, const QString &source)
|
struct filter_preset_table *presets, int flags, const QString &source)
|
||||||
{
|
{
|
||||||
execute(new ImportDives(dives, trips, sites, presets, flags, source));
|
execute(new ImportDives(dives, trips, sites, presets, flags, source));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ QString changesMade(); // return a string with the texts from all commands on
|
||||||
// insertion position.
|
// insertion position.
|
||||||
void addDive(dive *d, bool autogroup, bool newNumber);
|
void addDive(dive *d, bool autogroup, bool newNumber);
|
||||||
void importDives(struct dive_table *dives, struct trip_table *trips,
|
void importDives(struct dive_table *dives, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets,
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets,
|
||||||
int flags, const QString &source); // The tables are consumed!
|
int flags, const QString &source); // The tables are consumed!
|
||||||
void deleteDive(const QVector<struct dive*> &divesToDelete);
|
void deleteDive(const QVector<struct dive*> &divesToDelete);
|
||||||
void shiftTime(const std::vector<dive *> &changedDives, int amount);
|
void shiftTime(const std::vector<dive *> &changedDives, int amount);
|
||||||
|
|
|
@ -470,7 +470,7 @@ void AddDive::undoit()
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
ImportDives::ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets, int flags, const QString &source)
|
struct filter_preset_table *filter_presets, int flags, const QString &source)
|
||||||
{
|
{
|
||||||
setText(Command::Base::tr("import %n dive(s) from %1", "", dives->nr).arg(source));
|
setText(Command::Base::tr("import %n dive(s) from %1", "", dives->nr).arg(source));
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ class ImportDives : public DiveListBase {
|
||||||
public:
|
public:
|
||||||
// Note: dives and trips are consumed - after the call they will be empty.
|
// Note: dives and trips are consumed - after the call they will be empty.
|
||||||
ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets, int flags, const QString &source);
|
struct filter_preset_table *filter_presets, int flags, const QString &source);
|
||||||
private:
|
private:
|
||||||
void undoit() override;
|
void undoit() override;
|
||||||
void redoit() override;
|
void redoit() override;
|
||||||
|
|
10
core/file.c
10
core/file.c
|
@ -77,7 +77,7 @@ out:
|
||||||
|
|
||||||
|
|
||||||
static void zip_read(struct zip_file *file, const char *filename, struct dive_table *table, struct trip_table *trips,
|
static void zip_read(struct zip_file *file, const char *filename, struct dive_table *table, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int size = 1024, n, read = 0;
|
int size = 1024, n, read = 0;
|
||||||
char *mem = malloc(size);
|
char *mem = malloc(size);
|
||||||
|
@ -93,7 +93,7 @@ static void zip_read(struct zip_file *file, const char *filename, struct dive_ta
|
||||||
}
|
}
|
||||||
|
|
||||||
int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets)
|
struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
/* Grr. libzip needs to re-open the file, it can't take a buffer */
|
/* Grr. libzip needs to re-open the file, it can't take a buffer */
|
||||||
|
@ -227,7 +227,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem, struct div
|
||||||
*/
|
*/
|
||||||
static int open_by_filename(const char *filename, const char *fmt, struct memblock *mem,
|
static int open_by_filename(const char *filename, const char *fmt, struct memblock *mem,
|
||||||
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets)
|
struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
// hack to be able to provide a comment for the translated string
|
// hack to be able to provide a comment for the translated string
|
||||||
static char *csv_warning = QT_TRANSLATE_NOOP3("gettextFromC",
|
static char *csv_warning = QT_TRANSLATE_NOOP3("gettextFromC",
|
||||||
|
@ -258,7 +258,7 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_file_buffer(const char *filename, struct memblock *mem, struct dive_table *table,
|
static int parse_file_buffer(const char *filename, struct memblock *mem, struct dive_table *table,
|
||||||
struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *fmt = strrchr(filename, '.');
|
char *fmt = strrchr(filename, '.');
|
||||||
|
@ -305,7 +305,7 @@ int check_git_sha(const char *filename, struct git_repository **git_p, const cha
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
struct git_repository *git;
|
struct git_repository *git;
|
||||||
const char *branch = NULL;
|
const char *branch = NULL;
|
||||||
|
|
|
@ -26,8 +26,8 @@ extern int datatrak_import(struct memblock *mem, struct memblock *wl_mem, struct
|
||||||
extern void ostctools_import(const char *file, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
extern void ostctools_import(const char *file, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||||
|
|
||||||
extern int readfile(const char *filename, struct memblock *mem);
|
extern int readfile(const char *filename, struct memblock *mem);
|
||||||
extern int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
extern int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
extern int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
extern int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
|
|
||||||
// Platform specific functions
|
// Platform specific functions
|
||||||
extern int subsurface_rename(const char *path, const char *newpath);
|
extern int subsurface_rename(const char *path, const char *newpath);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "qthelper.h"
|
#include "qthelper.h"
|
||||||
#include "subsurface-string.h"
|
#include "subsurface-string.h"
|
||||||
|
|
||||||
std::vector<filter_preset> filter_preset_table;
|
struct filter_preset_table filter_preset_table;
|
||||||
|
|
||||||
extern "C" void clear_filter_presets(void)
|
extern "C" void clear_filter_presets(void)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ extern "C" void filter_preset_set_name(struct filter_preset *preset, const char
|
||||||
preset->name = name;
|
preset->name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filter_preset_add_to_table(const QString &name, const FilterData &d, filter_preset_table_t &table)
|
static int filter_preset_add_to_table(const QString &name, const FilterData &d, struct filter_preset_table &table)
|
||||||
{
|
{
|
||||||
// std::lower_bound does a binary search - the vector must be sorted.
|
// std::lower_bound does a binary search - the vector must be sorted.
|
||||||
filter_preset newEntry { name, d };
|
filter_preset newEntry { name, d };
|
||||||
|
@ -86,7 +86,7 @@ static int filter_preset_add_to_table(const QString &name, const FilterData &d,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Take care that the name doesn't already exist by adding numbers
|
// Take care that the name doesn't already exist by adding numbers
|
||||||
static QString get_unique_preset_name(const QString &orig, const filter_preset_table_t &table)
|
static QString get_unique_preset_name(const QString &orig, const struct filter_preset_table &table)
|
||||||
{
|
{
|
||||||
QString res = orig;
|
QString res = orig;
|
||||||
int count = 2;
|
int count = 2;
|
||||||
|
@ -99,7 +99,7 @@ static QString get_unique_preset_name(const QString &orig, const filter_preset_t
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void add_filter_preset_to_table(const struct filter_preset *preset, filter_preset_table_t *table)
|
extern "C" void add_filter_preset_to_table(const struct filter_preset *preset, struct filter_preset_table *table)
|
||||||
{
|
{
|
||||||
QString name = get_unique_preset_name(preset->name, *table);
|
QString name = get_unique_preset_name(preset->name, *table);
|
||||||
filter_preset_add_to_table(name, preset->data, *table);
|
filter_preset_add_to_table(name, preset->data, *table);
|
||||||
|
|
|
@ -24,12 +24,18 @@ struct filter_preset {
|
||||||
FilterData data;
|
FilterData data;
|
||||||
};
|
};
|
||||||
|
|
||||||
using filter_preset_table_t = std::vector<filter_preset>;
|
// Subclassing standard library containers is generally
|
||||||
extern filter_preset_table_t filter_preset_table;
|
// not recommended. However, this makes interaction with
|
||||||
|
// C-code easier and since we don't add any member functions,
|
||||||
|
// this is not a problem.
|
||||||
|
struct filter_preset_table : public std::vector<filter_preset>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct filter_preset_table filter_preset_table;
|
||||||
#else
|
#else
|
||||||
struct filter_preset;
|
struct filter_preset;
|
||||||
struct filter_preset_table;
|
struct filter_preset_table;
|
||||||
typedef struct filter_preset_table filter_preset_table_t;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +55,7 @@ extern struct filter_preset *alloc_filter_preset();
|
||||||
extern void free_filter_preset(const struct filter_preset *preset);
|
extern void free_filter_preset(const struct filter_preset *preset);
|
||||||
extern void filter_preset_set_name(struct filter_preset *preset, const char *name);
|
extern void filter_preset_set_name(struct filter_preset *preset, const char *name);
|
||||||
extern void filter_preset_set_fulltext(struct filter_preset *preset, const char *fulltext, const char *fulltext_string_mode);
|
extern void filter_preset_set_fulltext(struct filter_preset *preset, const char *fulltext, const char *fulltext_string_mode);
|
||||||
extern void add_filter_preset_to_table(const struct filter_preset *preset, filter_preset_table_t *table);
|
extern void add_filter_preset_to_table(const struct filter_preset *preset, struct filter_preset_table *table);
|
||||||
extern void filter_preset_add_constraint(struct filter_preset *preset, const char *type, const char *string_mode,
|
extern void filter_preset_add_constraint(struct filter_preset *preset, const char *type, const char *string_mode,
|
||||||
const char *range_mode, bool negate, const char *data); // called by the parser, therefore data passed as strings.
|
const char *range_mode, bool negate, const char *data); // called by the parser, therefore data passed as strings.
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern int check_git_sha(const char *filename, git_repository **git_p, const cha
|
||||||
extern int sync_with_remote(struct git_repository *repo, const char *remote, const char *branch, enum remote_transport rt);
|
extern int sync_with_remote(struct git_repository *repo, const char *remote, const char *branch, enum remote_transport rt);
|
||||||
extern int git_save_dives(struct git_repository *, const char *, const char *remote, bool select_only);
|
extern int git_save_dives(struct git_repository *, const char *, const char *remote, bool select_only);
|
||||||
extern int git_load_dives(struct git_repository *repo, const char *branch, struct dive_table *table, struct trip_table *trips,
|
extern int git_load_dives(struct git_repository *repo, const char *branch, struct dive_table *table, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
extern const char *get_sha(git_repository *repo, const char *branch);
|
extern const char *get_sha(git_repository *repo, const char *branch);
|
||||||
extern int do_git_save(git_repository *repo, const char *branch, const char *remote, bool select_only, bool create_empty);
|
extern int do_git_save(git_repository *repo, const char *branch, const char *remote, bool select_only, bool create_empty);
|
||||||
extern const char *saved_git_id;
|
extern const char *saved_git_id;
|
||||||
|
|
|
@ -105,7 +105,7 @@ static char *parse_dan_new_line(char *buf, const char *NL)
|
||||||
static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, const char *tag);
|
static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, const char *tag);
|
||||||
static int parse_dan_format(const char *filename, char **params, int pnr, struct dive_table *table,
|
static int parse_dan_format(const char *filename, char **params, int pnr, struct dive_table *table,
|
||||||
struct trip_table *trips, struct dive_site_table *sites,
|
struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets)
|
struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int ret = 0, i;
|
int ret = 0, i;
|
||||||
size_t end_ptr = 0;
|
size_t end_ptr = 0;
|
||||||
|
@ -286,7 +286,7 @@ static int parse_dan_format(const char *filename, char **params, int pnr, struct
|
||||||
|
|
||||||
int parse_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
int parse_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
||||||
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets)
|
struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
struct memblock mem;
|
struct memblock mem;
|
||||||
|
@ -808,8 +808,8 @@ int parse_txt_file(const char *filename, const char *csv, struct dive_table *tab
|
||||||
|
|
||||||
#define SBPARAMS 40
|
#define SBPARAMS 40
|
||||||
static int parse_seabear_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
static int parse_seabear_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
||||||
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
int parse_seabear_log(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
int parse_seabear_log(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
char *params[SBPARAMS];
|
char *params[SBPARAMS];
|
||||||
int pnr = 0;
|
int pnr = 0;
|
||||||
|
@ -826,7 +826,7 @@ int parse_seabear_log(const char *filename, struct dive_table *table, struct tri
|
||||||
|
|
||||||
static int parse_seabear_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
static int parse_seabear_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate,
|
||||||
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets)
|
struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
struct memblock mem;
|
struct memblock mem;
|
||||||
|
@ -954,7 +954,7 @@ static int parse_seabear_csv_file(const char *filename, char **params, int pnr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_manual_file(const char *filename, char **params, int pnr, struct dive_table *table, struct trip_table *trips,
|
int parse_manual_file(const char *filename, char **params, int pnr, struct dive_table *table, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
struct memblock mem;
|
struct memblock mem;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
|
@ -24,14 +24,14 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int parse_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate, struct dive_table *table,
|
int parse_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate, struct dive_table *table,
|
||||||
struct trip_table *trips, struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
struct trip_table *trips, struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
int try_to_open_csv(struct memblock *mem, enum csv_format type, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
int try_to_open_csv(struct memblock *mem, enum csv_format type, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||||
int parse_txt_file(const char *filename, const char *csv, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
int parse_txt_file(const char *filename, const char *csv, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||||
|
|
||||||
int parse_seabear_log(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
int parse_seabear_log(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets);
|
struct filter_preset_table *filter_presets);
|
||||||
int parse_manual_file(const char *filename, char **params, int pnr, struct dive_table *table, struct trip_table *trips,
|
int parse_manual_file(const char *filename, char **params, int pnr, struct dive_table *table, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets);
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct git_parser_state {
|
||||||
struct dive_table *table;
|
struct dive_table *table;
|
||||||
struct trip_table *trips;
|
struct trip_table *trips;
|
||||||
struct dive_site_table *sites;
|
struct dive_site_table *sites;
|
||||||
filter_preset_table_t *filter_presets;
|
struct filter_preset_table *filter_presets;
|
||||||
int o2pressure_sensor;
|
int o2pressure_sensor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1879,7 +1879,7 @@ const char *get_sha(git_repository *repo, const char *branch)
|
||||||
* or report an error and return 1 if the load failed.
|
* or report an error and return 1 if the load failed.
|
||||||
*/
|
*/
|
||||||
int git_load_dives(struct git_repository *repo, const char *branch, struct dive_table *table, struct trip_table *trips,
|
int git_load_dives(struct git_repository *repo, const char *branch, struct dive_table *table, struct trip_table *trips,
|
||||||
struct dive_site_table *sites, filter_preset_table_t *filter_presets)
|
struct dive_site_table *sites, struct filter_preset_table *filter_presets)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct git_parser_state state = { 0 };
|
struct git_parser_state state = { 0 };
|
||||||
|
|
|
@ -1721,7 +1721,7 @@ static const char *preprocess_divelog_de(const char *buffer)
|
||||||
|
|
||||||
int parse_xml_buffer(const char *url, const char *buffer, int size,
|
int parse_xml_buffer(const char *url, const char *buffer, int size,
|
||||||
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets, const char **params)
|
struct filter_preset_table *filter_presets, const char **params)
|
||||||
{
|
{
|
||||||
UNUSED(size);
|
UNUSED(size);
|
||||||
xmlDoc *doc;
|
xmlDoc *doc;
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct parser_state {
|
||||||
struct dive_table *target_table; /* non-owning */
|
struct dive_table *target_table; /* non-owning */
|
||||||
struct trip_table *trips; /* non-owning */
|
struct trip_table *trips; /* non-owning */
|
||||||
struct dive_site_table *sites; /* non-owning */
|
struct dive_site_table *sites; /* non-owning */
|
||||||
filter_preset_table_t *filter_presets; /* non-owning */
|
struct filter_preset_table *filter_presets; /* non-owning */
|
||||||
|
|
||||||
sqlite3 *sql_handle; /* for SQL based parsers */
|
sqlite3 *sql_handle; /* for SQL based parsers */
|
||||||
event_allocation_t event_allocation;
|
event_allocation_t event_allocation;
|
||||||
|
@ -140,7 +140,7 @@ int atoi_n(char *ptr, unsigned int len);
|
||||||
|
|
||||||
void parse_xml_init(void);
|
void parse_xml_init(void);
|
||||||
int parse_xml_buffer(const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
int parse_xml_buffer(const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
|
||||||
filter_preset_table_t *filter_presets, const char **params);
|
struct filter_preset_table *filter_presets, const char **params);
|
||||||
void parse_xml_exit(void);
|
void parse_xml_exit(void);
|
||||||
int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||||
int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||||
|
|
|
@ -909,7 +909,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QStringList r = resultModel->result();
|
QStringList r = resultModel->result();
|
||||||
if (ui->knownImports->currentText() != "Manual import") {
|
if (ui->knownImports->currentText() != "Manual import") {
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
|
|
|
@ -1549,7 +1549,7 @@ void MainWindow::importFiles(const QStringList fileNames)
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
fileNamePtr = QFile::encodeName(fileNames.at(i));
|
fileNamePtr = QFile::encodeName(fileNames.at(i));
|
||||||
|
|
|
@ -456,7 +456,7 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton *button)
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
parse_file(QFile::encodeName(zipFile.fileName()), &table, &trips, &sites, &filter_presets);
|
parse_file(QFile::encodeName(zipFile.fileName()), &table, &trips, &sites, &filter_presets);
|
||||||
Command::importDives(&table, &trips, &sites, nullptr, IMPORT_MERGE_ALL_TRIPS, QStringLiteral("divelogs.de"));
|
Command::importDives(&table, &trips, &sites, nullptr, IMPORT_MERGE_ALL_TRIPS, QStringLiteral("divelogs.de"));
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ void QMLManager::mergeLocalRepo()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
parse_file(qPrintable(nocloud_localstorage()), &table, &trips, &sites, &filter_presets);
|
parse_file(qPrintable(nocloud_localstorage()), &table, &trips, &sites, &filter_presets);
|
||||||
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
||||||
}
|
}
|
||||||
|
@ -2236,7 +2236,7 @@ void QMLManager::importCacheRepo(QString repo)
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QString repoPath = QString("%1/cloudstorage/%2").arg(system_default_directory()).arg(repo);
|
QString repoPath = QString("%1/cloudstorage/%2").arg(system_default_directory()).arg(repo);
|
||||||
appendTextToLog(QString("importing %1").arg(repoPath));
|
appendTextToLog(QString("importing %1").arg(repoPath));
|
||||||
parse_file(qPrintable(repoPath), &table, &trips, &sites, &filter_presets);
|
parse_file(qPrintable(repoPath), &table, &trips, &sites, &filter_presets);
|
||||||
|
|
|
@ -25,7 +25,7 @@ void TestMerge::testMergeEmpty()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
|
@ -52,7 +52,7 @@ void TestMerge::testMergeBackwards()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
|
|
|
@ -17,7 +17,7 @@ void TestRenumber::testMerge()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
||||||
QCOMPARE(dive_table.nr, 1);
|
QCOMPARE(dive_table.nr, 1);
|
||||||
|
@ -30,7 +30,7 @@ void TestRenumber::testMergeAndAppend()
|
||||||
struct dive_table table = empty_dive_table;
|
struct dive_table table = empty_dive_table;
|
||||||
struct trip_table trips = empty_trip_table;
|
struct trip_table trips = empty_trip_table;
|
||||||
struct dive_site_table sites = empty_dive_site_table;
|
struct dive_site_table sites = empty_dive_site_table;
|
||||||
filter_preset_table_t filter_presets;
|
struct filter_preset_table filter_presets;
|
||||||
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trips, &sites, &filter_presets), 0);
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trips, &sites, &filter_presets), 0);
|
||||||
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS);
|
||||||
QCOMPARE(dive_table.nr, 2);
|
QCOMPARE(dive_table.nr, 2);
|
||||||
|
|
Loading…
Reference in a new issue