summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-19 20:50:40 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-23 22:45:30 +0100
commiteedb1ce0ea23b8e01f1dfe28d501d18fe0179006 (patch)
tree47f9e910385125d8c24bdf45639fe1d29aa5b21c
parent2caaf8889bc43acada947223d72bd20f3dc297b3 (diff)
downloadsubsurface-eedb1ce0ea23b8e01f1dfe28d501d18fe0179006.tar.gz
Mobile/filtering: add two preferences for filtering
With this we can make it configurable if the search should include the notes field and if the search should be case sensitive or not. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/pref.h2
-rw-r--r--core/settings/qPrefGeneral.cpp7
-rw-r--r--core/settings/qPrefGeneral.h10
-rw-r--r--core/subsurfacestartup.c2
4 files changed, 21 insertions, 0 deletions
diff --git a/core/pref.h b/core/pref.h
index 2e283fc3a..9662b1a57 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -126,6 +126,8 @@ struct preferences {
int o2consumption; // ml per min
int pscr_ratio; // dump ratio times 1000
bool use_default_file;
+ bool filterFullTextNotes; // mobile only - include notes information in full text searh
+ bool filterCaseSensitive; // mobile only - make fltering case sensitive
// ********** Geocoding **********
geocoding_prefs_t geocoding;
diff --git a/core/settings/qPrefGeneral.cpp b/core/settings/qPrefGeneral.cpp
index 3f18b496a..9254a8c51 100644
--- a/core/settings/qPrefGeneral.cpp
+++ b/core/settings/qPrefGeneral.cpp
@@ -36,6 +36,9 @@ void qPrefGeneral::loadSync(bool doSync)
disk_o2consumption(doSync);
disk_pscr_ratio(doSync);
disk_use_default_file(doSync);
+ disk_filterFullTextNotes(doSync);
+ disk_filterCaseSensitive(doSync);
+
if (!doSync) {
load_diveshareExport_uid();
load_diveshareExport_private();
@@ -95,3 +98,7 @@ HANDLE_PREFERENCE_BOOL(General, "use_default_file", use_default_file);
HANDLE_PROP_QSTRING(General, "diveshareExport/uid", diveshareExport_uid);
HANDLE_PROP_BOOL(General, "diveshareExport/private", diveshareExport_private);
+
+HANDLE_PREFERENCE_BOOL(General, "filterFullTextNotes", filterFullTextNotes);
+
+HANDLE_PREFERENCE_BOOL(General, "filterCaseSensitive", filterCaseSensitive);
diff --git a/core/settings/qPrefGeneral.h b/core/settings/qPrefGeneral.h
index 41b2928ad..2d0bde937 100644
--- a/core/settings/qPrefGeneral.h
+++ b/core/settings/qPrefGeneral.h
@@ -20,6 +20,8 @@ class qPrefGeneral : public QObject {
Q_PROPERTY(bool use_default_file READ use_default_file WRITE set_use_default_file NOTIFY use_default_fileChanged);
Q_PROPERTY(QString diveshareExport_uid READ diveshareExport_uid WRITE set_diveshareExport_uid NOTIFY diveshareExport_uidChanged);
Q_PROPERTY(bool diveshareExport_private READ diveshareExport_private WRITE set_diveshareExport_private NOTIFY diveshareExport_privateChanged);
+ Q_PROPERTY(bool filterFullTextNotes READ filterFullTextNotes WRITE set_filterFullTextNotes NOTIFY filterFullTextNotesChanged)
+ Q_PROPERTY(bool filterCaseSensitive READ filterCaseSensitive WRITE set_filterCaseSensitive NOTIFY filterCaseSensitiveChanged)
public:
qPrefGeneral(QObject *parent = NULL);
@@ -44,6 +46,8 @@ public:
static bool use_default_file() { return prefs.use_default_file; }
static QString diveshareExport_uid() { return st_diveshareExport_uid; }
static bool diveshareExport_private() { return st_diveshareExport_private; }
+ static bool filterFullTextNotes() { return prefs.filterFullTextNotes; }
+ static bool filterCaseSensitive() { return prefs.filterCaseSensitive; }
public slots:
static void set_auto_recalculate_thumbnails(bool value);
@@ -59,6 +63,8 @@ public slots:
static void set_use_default_file(bool value);
static void set_diveshareExport_uid(const QString& value);
static void set_diveshareExport_private(bool value);
+ static void set_filterFullTextNotes(bool value);
+ static void set_filterCaseSensitive(bool value);
signals:
void auto_recalculate_thumbnailsChanged(bool value);
@@ -74,6 +80,8 @@ signals:
void use_default_fileChanged(bool value);
void diveshareExport_uidChanged(const QString& value);
void diveshareExport_privateChanged(bool value);
+ void filterFullTextNotesChanged(bool value);
+ void filterCaseSensitiveChanged(bool value);
private:
static void disk_auto_recalculate_thumbnails(bool doSync);
@@ -87,6 +95,8 @@ private:
static void disk_o2consumption(bool doSync);
static void disk_pscr_ratio(bool doSync);
static void disk_use_default_file(bool doSync);
+ static void disk_filterFullTextNotes(bool doSync);
+ static void disk_filterCaseSensitive(bool doSync);
// class variables are load only
static void load_diveshareExport_uid();
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index 263845671..607090219 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -100,6 +100,8 @@ struct preferences default_prefs = {
.auto_recalculate_thumbnails = true,
.extract_video_thumbnails = true,
.extract_video_thumbnails_position = 20, // The first fifth seems like a reasonable place
+ .filterCaseSensitive = false,
+ .filterFullTextNotes = true,
};
int run_survey;