core: replace dive master by dive guide

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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-02-12 14:03:18 +01:00 committed by Dirk Hohndel
parent 889827aadb
commit 9e0712d5dc
38 changed files with 141 additions and 133 deletions

View file

@ -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)

View file

@ -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!

View file

@ -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)
@ -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)
@ -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)
@ -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;
@ -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)

View file

@ -229,7 +229,7 @@ public:
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 {
@ -276,7 +276,7 @@ public:
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;
@ -289,7 +289,7 @@ struct PasteState {
dive *d;
dive_site *divesite;
QString notes;
QString divemaster;
QString diveguide;
QString buddy;
QString suit;
int rating;