filter: compile fulltext index on mobile

The code is not used yet.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-02-18 16:25:01 +01:00 committed by Dirk Hohndel
parent 2c038a24b0
commit 5bbc0fdb58
7 changed files with 8 additions and 20 deletions

View file

@ -17,9 +17,7 @@
#include "tag.h"
#include "trip.h"
#include "structured_list.h"
#ifndef SUBSURFACE_MOBILE
#include "fulltext.h"
#endif
/* one could argue about the best place to have this variable -
@ -360,9 +358,7 @@ static void free_dive_structures(struct dive *d)
{
if (!d)
return;
#ifndef SUBSURFACE_MOBILE
fulltext_unregister(d);
#endif
/* free the strings */
free(d->buddy);
free(d->divemaster);
@ -408,9 +404,7 @@ static void copy_dive_nodc(const struct dive *s, struct dive *d)
*d = *s;
memset(&d->cylinders, 0, sizeof(d->cylinders));
memset(&d->weightsystems, 0, sizeof(d->weightsystems));
#ifndef SUBSURFACE_MOBILE
d->full_text = NULL;
#endif
invalidate_dive_cache(d);
d->buddy = copy_string(s->buddy);
d->divemaster = copy_string(s->divemaster);

View file

@ -171,9 +171,7 @@ struct dive {
bool notrip; /* Don't autogroup this dive to a trip */
bool selected;
bool hidden_by_filter;
#if !defined(SUBSURFACE_MOBILE)
struct full_text_cache *full_text; /* word cache for full text search */
#endif
#if defined(SUBSURFACE_MOBILE)
uint8_t collapsed; /* four values: 0 = don't show, 1 = show as dive, 2 = show corresponding trip, 3 = show dive and trip */
#endif

View file

@ -10,10 +10,14 @@ DiveFilter::DiveFilter()
ShownChange DiveFilter::update(const QVector<dive *> &) const
{
ShownChange res;
return res;
}
ShownChange DiveFilter::updateAll() const
{
ShownChange res;
return res;
}
#else // SUBSURFACE_MOBILE

View file

@ -831,9 +831,7 @@ void process_loaded_dives()
/* Autogroup dives if desired by user. */
autogroup_dives(&dive_table, &trip_table);
#ifndef SUBSURFACE_MOBILE
fulltext_reload();
#endif
}
/*
@ -1343,9 +1341,7 @@ int get_dive_id_closest_to(timestamp_t when)
void clear_dive_file_data()
{
#ifndef SUBSURFACE_MOBILE
fulltext_unregister_all();
#endif
while (dive_table.nr)
delete_single_dive(0);

View file

@ -7,8 +7,6 @@
#include <QLocale>
#include <map>
#ifndef SUBSURFACE_MOBILE
// This class caches each dives words, so that we can unregister a dive from the full text search
struct full_text_cache {
std::vector<QString> words;
@ -287,5 +285,3 @@ bool FullTextResult::dive_matches(const struct dive *d) const
{
return std::find(dives.begin(), dives.end(), d) != dives.end();
}
#endif

View file

@ -13,9 +13,6 @@
#ifndef FULLTEXT_H
#define FULLTEXT_H
// For now only compile on desktop
#ifndef SUBSURFACE_MOBILE
// 1) The C-accessible interface
#ifdef __cplusplus
@ -65,5 +62,4 @@ FullTextResult fulltext_find_dives(const FullTextQuery &q, StringFilterMode);
bool fulltext_dive_matches(const struct dive *d, const FullTextQuery &q, StringFilterMode);
#endif
#endif // SUBSURFACE_MOBILE
#endif

View file

@ -41,11 +41,13 @@ SOURCES += ../../subsurface-mobile-main.cpp \
../../core/subsurfacesysinfo.cpp \
../../core/windowtitleupdate.cpp \
../../core/file.c \
../../core/fulltext.cpp \
../../core/subsurfacestartup.c \
../../core/ios.cpp \
../../core/profile.c \
../../core/device.c \
../../core/dive.c \
../../core/divefilter.cpp \
../../core/divelist.c \
../../core/gas-model.c \
../../core/gaspressures.c \
@ -195,11 +197,13 @@ HEADERS += \
../../core/deco.h \
../../core/display.h \
../../core/divecomputer.h \
../../core/divefilter.h \
../../core/divelist.h \
../../core/divelogexportlogic.h \
../../core/divesitehelpers.h \
../../core/exif.h \
../../core/file.h \
../../core/fulltext.h \
../../core/gaspressures.h \
../../core/gettext.h \
../../core/gettextfromc.h \