Skip to content

Commit

Permalink
core: replace dive master by dive guide
Browse files Browse the repository at this point in the history
In general, replace "dive master" by "dive guide".

However, do not change written dive logs for now. On reading,
accept both versions.

Signed-off-by: Berthold Stoeger <[email protected]>
  • Loading branch information
bstoeger authored and dirkhh committed Feb 15, 2022
1 parent 889827a commit 9e0712d
Show file tree
Hide file tree
Showing 38 changed files with 141 additions and 133 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- desktop: Don't lose cursor position in notes when switching between windows [#3369]
- Uemis support: fix the ability disconnect/reconnect the Zurich when its filesystem is full
- general: rename dive master to dive guide
- libdivecomputer: add support for latest BLE hardware in OSTC dive computers

---
Expand Down
2 changes: 1 addition & 1 deletion backend-shared/exportfuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain, ExportCall
put_format(&buf, "\\def\\%sprofilename{profile%d}\n", ssrf, dive->number);
put_format(&buf, "\\def\\%scomment{%s}\n", ssrf, dive->notes ? dive->notes : "");
put_format(&buf, "\\def\\%sbuddy{%s}\n", ssrf, dive->buddy ? dive->buddy : "");
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->divemaster ? dive->divemaster : "");
put_format(&buf, "\\def\\%sdivemaster{%s}\n", ssrf, dive->diveguide ? dive->diveguide : "");
put_format(&buf, "\\def\\%ssuit{%s}\n", ssrf, dive->suit ? dive->suit : "");

// Print cylinder data
Expand Down
4 changes: 2 additions & 2 deletions commands/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ int editBuddies(const QStringList &newList, bool currentDiveOnly)
return execute_edit(new EditBuddies(newList, currentDiveOnly));
}

int editDiveMaster(const QStringList &newList, bool currentDiveOnly)
int editDiveGuide(const QStringList &newList, bool currentDiveOnly)
{
return execute_edit(new EditDiveMaster(newList, currentDiveOnly));
return execute_edit(new EditDiveGuide(newList, currentDiveOnly));
}

void pasteDives(const dive *d, dive_components what)
Expand Down
2 changes: 1 addition & 1 deletion commands/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int editDiveSite(struct dive_site *newValue, bool currentDiveOnly);
int editDiveSiteNew(const QString &newName, bool currentDiveOnly);
int editTags(const QStringList &newList, bool currentDiveOnly);
int editBuddies(const QStringList &newList, bool currentDiveOnly);
int editDiveMaster(const QStringList &newList, bool currentDiveOnly);
int editDiveGuide(const QStringList &newList, bool currentDiveOnly);
void pasteDives(const dive *d, dive_components what);
void replanDive(dive *d); // dive computer(s) and cylinder(s) will be reset!
void editProfile(dive *d); // dive computer(s) and cylinder(s) will be reset!
Expand Down
30 changes: 15 additions & 15 deletions commands/command_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,22 +600,22 @@ QString EditBuddies::fieldName() const
return Command::Base::tr("buddies");
}

// ***** DiveMaster *****
QStringList EditDiveMaster::data(struct dive *d) const
// ***** DiveGuide *****
QStringList EditDiveGuide::data(struct dive *d) const
{
return stringToList(d->divemaster);
return stringToList(d->diveguide);
}

void EditDiveMaster::set(struct dive *d, const QStringList &v) const
void EditDiveGuide::set(struct dive *d, const QStringList &v) const
{
QString text = v.join(", ");
free(d->divemaster);
d->divemaster = copy_qstring(text);
free(d->diveguide);
d->diveguide = copy_qstring(text);
}

QString EditDiveMaster::fieldName() const
QString EditDiveGuide::fieldName() const
{
return Command::Base::tr("dive master");
return Command::Base::tr("dive guide");
}

static void swapCandQString(QString &q, char *&c)
Expand All @@ -633,8 +633,8 @@ PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dI
memset(&weightsystems, 0, sizeof(weightsystems));
if (what.notes)
notes = data->notes;
if (what.divemaster)
divemaster = data->divemaster;
if (what.diveguide)
diveguide = data->diveguide;
if (what.buddy)
buddy = data->buddy;
if (what.suit)
Expand Down Expand Up @@ -706,8 +706,8 @@ void PasteState::swap(dive_components what)
{
if (what.notes)
swapCandQString(notes, d->notes);
if (what.divemaster)
swapCandQString(divemaster, d->divemaster);
if (what.diveguide)
swapCandQString(diveguide, d->diveguide);
if (what.buddy)
swapCandQString(buddy, d->buddy);
if (what.suit)
Expand Down Expand Up @@ -767,7 +767,7 @@ void PasteDives::undo()
// Send signals.
DiveField fields(DiveField::NONE);
fields.notes = what.notes;
fields.divemaster = what.divemaster;
fields.diveguide = what.diveguide;
fields.buddy = what.buddy;
fields.suit = what.suit;
fields.rating = what.rating;
Expand Down Expand Up @@ -1322,8 +1322,8 @@ EditDive::EditDive(dive *oldDiveIn, dive *newDiveIn, dive_site *createDs, dive_s
changedFields |= DiveField::ATM_PRESS;
if (oldDive->dive_site != newDive->dive_site)
changedFields |= DiveField::DIVESITE;
if (!same_string(oldDive->divemaster, newDive->divemaster))
changedFields |= DiveField::DIVEMASTER;
if (!same_string(oldDive->diveguide, newDive->diveguide))
changedFields |= DiveField::DIVEGUIDE;
if (!same_string(oldDive->buddy, newDive->buddy))
changedFields |= DiveField::BUDDY;
if (oldDive->rating != newDive->rating)
Expand Down
6 changes: 3 additions & 3 deletions commands/command_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class EditInvalid : public EditDefaultSetter<bool, DiveField::INVALID, &dive::in
QString fieldName() const override;
};

// Fields that work with tag-lists (tags, buddies, divemasters) work differently and therefore
// Fields that work with tag-lists (tags, buddies, dive guides) work differently and therefore
// have their own base class. In this case, it's not a template, as all these lists are base
// on strings.
class EditTagsBase : public EditDivesBase {
Expand Down Expand Up @@ -276,7 +276,7 @@ class EditBuddies : public EditTagsTemplate<DiveField::BUDDY> {
QString fieldName() const override;
};

class EditDiveMaster : public EditTagsTemplate<DiveField::DIVEMASTER> {
class EditDiveGuide : public EditTagsTemplate<DiveField::DIVEGUIDE> {
public:
using EditTagsTemplate::EditTagsTemplate; // Use constructor of base class.
QStringList data(struct dive *d) const override;
Expand All @@ -289,7 +289,7 @@ struct PasteState {
dive *d;
dive_site *divesite;
QString notes;
QString divemaster;
QString diveguide;
QString buddy;
QString suit;
int rating;
Expand Down
8 changes: 4 additions & 4 deletions core/dive.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void free_dive_structures(struct dive *d)
fulltext_unregister(d);
/* free the strings */
free(d->buddy);
free(d->divemaster);
free(d->diveguide);
free(d->notes);
free(d->suit);
/* free tags, additional dive computers, and pictures */
Expand Down Expand Up @@ -272,7 +272,7 @@ static void copy_dive_nodc(const struct dive *s, struct dive *d)
d->full_text = NULL;
invalidate_dive_cache(d);
d->buddy = copy_string(s->buddy);
d->divemaster = copy_string(s->divemaster);
d->diveguide = copy_string(s->diveguide);
d->notes = copy_string(s->notes);
d->suit = copy_string(s->suit);
copy_cylinders(&s->cylinders, &d->cylinders);
Expand Down Expand Up @@ -319,7 +319,7 @@ void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_compo
if (clear)
clear_dive(d);
CONDITIONAL_COPY_STRING(notes);
CONDITIONAL_COPY_STRING(divemaster);
CONDITIONAL_COPY_STRING(diveguide);
CONDITIONAL_COPY_STRING(buddy);
CONDITIONAL_COPY_STRING(suit);
if (what.rating)
Expand Down Expand Up @@ -2616,7 +2616,7 @@ struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset,
*trip = get_preferred_trip(a, b);
MERGE_TXT(res, a, b, notes, "\n--\n");
MERGE_TXT(res, a, b, buddy, ", ");
MERGE_TXT(res, a, b, divemaster, ", ");
MERGE_TXT(res, a, b, diveguide, ", ");
MERGE_MAX(res, a, b, rating);
MERGE_TXT(res, a, b, suit, ", ");
MERGE_MAX(res, a, b, number);
Expand Down
4 changes: 2 additions & 2 deletions core/dive.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct dive {
timestamp_t when;
struct dive_site *dive_site;
char *notes;
char *divemaster, *buddy;
char *diveguide, *buddy;
struct cylinder_table cylinders;
struct weightsystem_table weightsystems;
char *suit;
Expand Down Expand Up @@ -78,7 +78,7 @@ extern int same_gasmix_cylinder(const cylinder_t *cyl, int cylid, const struct d
struct dive_components {
unsigned int divesite : 1;
unsigned int notes : 1;
unsigned int divemaster : 1;
unsigned int diveguide : 1;
unsigned int buddy : 1;
unsigned int suit : 1;
unsigned int rating : 1;
Expand Down
2 changes: 1 addition & 1 deletion core/filterconstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ static bool has_people(const filter_constraint &c, const struct dive *d)
QStringList dive_people;
for (const QString &s: QString(d->buddy).split(",", SKIP_EMPTY))
dive_people.push_back(s.trimmed());
for (const QString &s: QString(d->divemaster).split(",", SKIP_EMPTY))
for (const QString &s: QString(d->diveguide).split(",", SKIP_EMPTY))
dive_people.push_back(s.trimmed());
return check(c, dive_people);
}
Expand Down
2 changes: 1 addition & 1 deletion core/fulltext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static std::vector<QString> getWords(const dive *d)
{
std::vector<QString> res;
tokenize(QString(d->notes), res);
tokenize(QString(d->divemaster), res);
tokenize(QString(d->diveguide), res);
tokenize(QString(d->buddy), res);
tokenize(QString(d->suit), res);
for (const tag_entry *tag = d->tag_list; tag; tag = tag->next)
Expand Down
2 changes: 1 addition & 1 deletion core/import-divinglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static int divinglog_dive(void *param, int columns, char **data, char **column)
state->cur_dive->dc.duration.seconds = atoi(data[6]) * 60;

if (data[7])
utf8_string(data[7], &state->cur_dive->divemaster);
utf8_string(data[7], &state->cur_dive->diveguide);

if (data[8])
state->cur_dive->airtemp.mkelvin = C_to_mkelvin(atol(data[8]));
Expand Down
9 changes: 5 additions & 4 deletions core/load-git.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ static void parse_dive_location(char *line, struct membuffer *str, struct git_pa
free(name);
}

static void parse_dive_divemaster(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(line); state->active_dive->divemaster = detach_cstring(str); }
static void parse_dive_diveguide(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(line); state->active_dive->diveguide = detach_cstring(str); }

static void parse_dive_buddy(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(line); state->active_dive->buddy = detach_cstring(str); }
Expand Down Expand Up @@ -1113,8 +1113,9 @@ static void divecomputer_parser(char *line, struct membuffer *str, struct git_pa
struct keyword_action dive_action[] = {
#undef D
#define D(x) { #x, parse_dive_ ## x }
D(airpressure), D(airtemp), D(buddy), D(chill), D(current), D(cylinder), D(divemaster), D(divesiteid), D(duration),
D(gps), D(invalid), D(location), D(notes), D(notrip), D(rating), D(suit), D(surge),
/* For historical reasons, we accept divemaster and diveguide */
D(airpressure), D(airtemp), D(buddy), D(chill), D(current), D(cylinder), D(diveguide), { "divemaster", parse_dive_diveguide },
D(divesiteid), D(duration), D(gps), D(invalid), D(location), D(notes), D(notrip), D(rating), D(suit), D(surge),
D(tags), D(visibility), D(watersalinity), D(watertemp), D(wavesize), D(weightsystem)
};

Expand Down
5 changes: 4 additions & 1 deletion core/parse-xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,10 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
return;
if (MATCH("notes", utf8_string, &dive->notes))
return;
if (MATCH("divemaster", utf8_string, &dive->divemaster))
// For historic reasons, we accept dive guide as well as dive master
if (MATCH("diveguide", utf8_string, &dive->diveguide))
return;
if (MATCH("divemaster", utf8_string, &dive->diveguide))
return;
if (MATCH("buddy", utf8_string, &dive->buddy))
return;
Expand Down
2 changes: 1 addition & 1 deletion core/save-git.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void show_utf8(struct membuffer *b, const char *prefix, const char *value

static void save_overview(struct membuffer *b, struct dive *dive)
{
show_utf8(b, "divemaster ", dive->divemaster, "\n");
show_utf8(b, "divemaster ", dive->diveguide, "\n");
show_utf8(b, "buddy ", dive->buddy, "\n");
show_utf8(b, "suit ", dive->suit, "\n");
show_utf8(b, "notes ", dive->notes, "\n");
Expand Down
3 changes: 2 additions & 1 deletion core/save-html.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static void write_one_dive(struct membuffer *b, struct dive *dive, const char *p
put_HTML_watertemp(b, dive, "\"water\":\"", "\"");
put_string(b, " },");
write_attribute(b, "buddy", dive->buddy, ", ");
write_attribute(b, "divemaster", dive->divemaster, ", ");
write_attribute(b, "divemaster", dive->diveguide, ", ");
write_attribute(b, "suit", dive->suit, ", ");
put_HTML_tags(b, dive, "\"tags\":", ",");
if (!list_only) {
Expand Down Expand Up @@ -528,6 +528,7 @@ void export_translation(const char *file_name)
write_attribute(b, "Surge", translate("gettextFromC", "Surge"), ", ");
write_attribute(b, "Chill", translate("gettextFromC", "Chill"), ", ");
write_attribute(b, "Duration", translate("gettextFromC", "Duration"), ", ");
write_attribute(b, "DiveGuide", translate("gettextFromC", "Diveguide"), ", ");
write_attribute(b, "DiveMaster", translate("gettextFromC", "Divemaster"), ", ");
write_attribute(b, "Buddy", translate("gettextFromC", "Buddy"), ", ");
write_attribute(b, "Suit", translate("gettextFromC", "Suit"), ", ");
Expand Down
2 changes: 1 addition & 1 deletion core/save-xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static void save_salinity(struct membuffer *b, struct divecomputer *dc)

static void save_overview(struct membuffer *b, struct dive *dive, bool anonymize)
{
show_utf8_blanked(b, dive->divemaster, " <divemaster>", "</divemaster>\n", 0, anonymize);
show_utf8_blanked(b, dive->diveguide, " <divemaster>", "</divemaster>\n", 0, anonymize);
show_utf8_blanked(b, dive->buddy, " <buddy>", "</buddy>\n", 0, anonymize);
show_utf8_blanked(b, dive->notes, " <notes>", "</notes>\n", 0, anonymize);
show_utf8_blanked(b, dive->suit, " <suit>", "</suit>\n", 0, anonymize);
Expand Down
6 changes: 3 additions & 3 deletions core/subsurface-qt/divelistnotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct DiveField {
unsigned int water_temp : 1;
unsigned int atm_press : 1;
unsigned int divesite : 1;
unsigned int divemaster : 1;
unsigned int diveguide : 1;
unsigned int buddy : 1;
unsigned int rating : 1;
unsigned int visibility : 1;
Expand All @@ -49,7 +49,7 @@ struct DiveField {
WATER_TEMP = 1 << 5,
ATM_PRESS = 1 << 6,
DIVESITE = 1 << 7,
DIVEMASTER = 1 << 8,
DIVEGUIDE = 1 << 8,
BUDDY = 1 << 9,
RATING = 1 << 10,
VISIBILITY = 1 << 11,
Expand Down Expand Up @@ -159,7 +159,7 @@ inline DiveField::DiveField(int flags) :
water_temp((flags & WATER_TEMP) != 0),
atm_press((flags & ATM_PRESS) != 0),
divesite((flags & DIVESITE) != 0),
divemaster((flags & DIVEMASTER) != 0),
diveguide((flags & DIVEGUIDE) != 0),
buddy((flags & BUDDY) != 0),
rating((flags & RATING) != 0),
visibility((flags & VISIBILITY) != 0),
Expand Down
2 changes: 1 addition & 1 deletion core/uemis-downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ static bool uemis_delete_dive(device_data_t *devdata, uint32_t diveid)

free(dive->dc.sample);
free((void *)dive->notes);
free((void *)dive->divemaster);
free((void *)dive->diveguide);
free((void *)dive->buddy);
free((void *)dive->suit);
taglist_free(dive->tag_list);
Expand Down
4 changes: 2 additions & 2 deletions desktop-widgets/divecomponentselection.ui
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="divemaster">
<widget class="QCheckBox" name="diveguide">
<property name="text">
<string>Divemaster</string>
<string>Dive guide</string>
</property>
</widget>
</item>
Expand Down
8 changes: 4 additions & 4 deletions desktop-widgets/simplewidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
ui.setupUi(this);
what = _what;
UI_FROM_COMPONENT(divesite);
UI_FROM_COMPONENT(divemaster);
UI_FROM_COMPONENT(diveguide);
UI_FROM_COMPONENT(buddy);
UI_FROM_COMPONENT(rating);
UI_FROM_COMPONENT(visibility);
Expand All @@ -327,7 +327,7 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
{
if (current_dive && ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
COMPONENT_FROM_UI(divesite);
COMPONENT_FROM_UI(divemaster);
COMPONENT_FROM_UI(diveguide);
COMPONENT_FROM_UI(buddy);
COMPONENT_FROM_UI(rating);
COMPONENT_FROM_UI(visibility);
Expand All @@ -345,8 +345,8 @@ void DiveComponentSelection::buttonClicked(QAbstractButton *button)
text.setString(&cliptext);
if (what->divesite && current_dive->dive_site)
text << tr("Dive site: ") << current_dive->dive_site->name << "\n";
if (what->divemaster)
text << tr("Dive master: ") << current_dive->divemaster << "\n";
if (what->diveguide)
text << tr("Dive guide: ") << current_dive->diveguide << "\n";
if (what->buddy)
text << tr("Buddy: ") << current_dive->buddy << "\n";
if (what->rating)
Expand Down
Loading

0 comments on commit 9e0712d

Please sign in to comment.