mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: remove count_dives_with_*() functions
The simplified filter-widget doesn't present lists of existing values with counts. Thus, a whole slew of count_dives_with_*() functions can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f0164e97a2
commit
6184f5d276
3 changed files with 0 additions and 83 deletions
64
core/dive.c
64
core/dive.c
|
@ -3357,70 +3357,6 @@ void dump_taglist(const char *intro, struct tag_entry *tl)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the dives where the tag list contains the given tag
|
|
||||||
int count_dives_with_tag(const char *tag)
|
|
||||||
{
|
|
||||||
int i, counter = 0;
|
|
||||||
struct dive *d;
|
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
|
||||||
if (empty_string(tag)) {
|
|
||||||
// count dives with no tags
|
|
||||||
if (d->tag_list == NULL)
|
|
||||||
counter++;
|
|
||||||
} else if (taglist_contains(d->tag_list, tag)) {
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern bool string_sequence_contains(const char *string_sequence, const char *text);
|
|
||||||
|
|
||||||
// count the dives where the person is included in the comma separated string sequences of buddies or divemasters
|
|
||||||
int count_dives_with_person(const char *person)
|
|
||||||
{
|
|
||||||
int i, counter = 0;
|
|
||||||
struct dive *d;
|
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
|
||||||
if (empty_string(person)) {
|
|
||||||
// solo dive
|
|
||||||
if (empty_string(d->buddy) && empty_string(d->divemaster))
|
|
||||||
counter++;
|
|
||||||
} else if (string_sequence_contains(d->buddy, person) || string_sequence_contains(d->divemaster, person)) {
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
// count the dives with exactly the location
|
|
||||||
int count_dives_with_location(const char *location)
|
|
||||||
{
|
|
||||||
int i, counter = 0;
|
|
||||||
struct dive *d;
|
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
|
||||||
if (same_string(get_dive_location(d), location))
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
// count the dives with exactly the suit
|
|
||||||
int count_dives_with_suit(const char *suit)
|
|
||||||
{
|
|
||||||
int i, counter = 0;
|
|
||||||
struct dive *d;
|
|
||||||
|
|
||||||
for_each_dive (i, d) {
|
|
||||||
if (same_string(d->suit, suit))
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Merging two dives can be subtle, because there's two different ways
|
* Merging two dives can be subtle, because there's two different ways
|
||||||
* of merging:
|
* of merging:
|
||||||
|
|
|
@ -227,12 +227,7 @@ void taglist_cleanup(struct tag_entry **tag_list);
|
||||||
|
|
||||||
void taglist_init_global();
|
void taglist_init_global();
|
||||||
void taglist_free(struct tag_entry *tag_list);
|
void taglist_free(struct tag_entry *tag_list);
|
||||||
|
|
||||||
bool taglist_contains(struct tag_entry *tag_list, const char *tag);
|
bool taglist_contains(struct tag_entry *tag_list, const char *tag);
|
||||||
int count_dives_with_tag(const char *tag);
|
|
||||||
int count_dives_with_person(const char *person);
|
|
||||||
int count_dives_with_location(const char *location);
|
|
||||||
int count_dives_with_suit(const char *suit);
|
|
||||||
|
|
||||||
struct extra_data {
|
struct extra_data {
|
||||||
const char *key;
|
const char *key;
|
||||||
|
|
|
@ -362,20 +362,6 @@ extern "C" void copy_image_and_overwrite(const char *cfileName, const char *path
|
||||||
qDebug() << "copy of" << fileName << "to" << newName << "failed";
|
qDebug() << "copy of" << fileName << "to" << newName << "failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" bool string_sequence_contains(const char *string_sequence, const char *text)
|
|
||||||
{
|
|
||||||
if (empty_string(text) || empty_string(string_sequence))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QString stringSequence(string_sequence);
|
|
||||||
QStringList strings = stringSequence.split(",", QString::SkipEmptyParts);
|
|
||||||
Q_FOREACH (const QString& string, strings) {
|
|
||||||
if (string.trimmed().compare(QString(text).trimmed(), Qt::CaseInsensitive) == 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool lessThan(const QPair<QString, int> &a, const QPair<QString, int> &b)
|
static bool lessThan(const QPair<QString, int> &a, const QPair<QString, int> &b)
|
||||||
{
|
{
|
||||||
return a.second < b.second;
|
return a.second < b.second;
|
||||||
|
|
Loading…
Add table
Reference in a new issue