[core][qt] Handle Mastodon and Bluesky

Signed-off-by: Harry Bond <me@hbond.xyz>
This commit is contained in:
Harry Bond 2025-01-31 14:14:35 +00:00
parent 6557471697
commit 445dbc8264
7 changed files with 26 additions and 2 deletions

View file

@ -81,6 +81,12 @@
<field name="contact_instagram">
<tag k="contact:instagram" />
</field>
<field name="contact_fediverse">
<tag k="contact:mastodon" />
</field>
<field name="contact_bluesky">
<tag k="contact:bluesky" />
</field>
<field name="contact_twitter">
<tag k="contact:twitter" />
</field>
@ -181,6 +187,8 @@
<field_ref name="website" />
<field_ref name="contact_facebook" />
<field_ref name="contact_instagram" />
<field_ref name="contact_fediverse" />
<field_ref name="contact_bluesky" />
<field_ref name="contact_twitter" />
<field_ref name="contact_vk" />
<field_ref name="contact_line" />
@ -197,6 +205,8 @@
<field_ref name="website" />
<field_ref name="contact_facebook" />
<field_ref name="contact_instagram" />
<field_ref name="contact_fediverse" />
<field_ref name="contact_bluesky" />
<field_ref name="contact_twitter" />
<field_ref name="contact_vk" />
<field_ref name="contact_line" />

View file

@ -22,6 +22,8 @@ static std::unordered_map<std::string, EType> const kNamesToFMD = {
{"website", EType::FMD_WEBSITE},
{"contact_facebook", EType::FMD_CONTACT_FACEBOOK},
{"contact_instagram", EType::FMD_CONTACT_INSTAGRAM},
{"contact_fediverse", EType::FMD_CONTACT_FEDIVERSE},
{"contact_bluesky", EType::FMD_CONTACT_BLUESKY},
{"contact_twitter", EType::FMD_CONTACT_TWITTER},
{"contact_vk", EType::FMD_CONTACT_VK},
{"contact_line", EType::FMD_CONTACT_LINE},

View file

@ -22,6 +22,8 @@ UNIT_TEST(EditorConfig_TypeDescription)
EType::FMD_CONTACT_TWITTER,
EType::FMD_CONTACT_VK,
EType::FMD_CONTACT_LINE,
EType::FMD_CONTACT_FEDIVERSE,
EType::FMD_CONTACT_BLUESKY,
};
pugi::xml_document doc;

View file

@ -261,6 +261,8 @@ public:
string const contact_twitter(meta.Get(feature::Metadata::FMD_CONTACT_TWITTER));
string const contact_vk(meta.Get(feature::Metadata::FMD_CONTACT_VK));
string const contact_line(meta.Get(feature::Metadata::FMD_CONTACT_LINE));
string const contact_fediverse(meta.Get(feature::Metadata::FMD_CONTACT_FEDIVERSE));
string const contact_bluesky(meta.Get(feature::Metadata::FMD_CONTACT_BLUESKY));
string const stars(meta.Get(feature::Metadata::FMD_STARS));
string const internet(meta.Get(feature::Metadata::FMD_INTERNET));
string const denomination(meta.Get(feature::Metadata::FMD_DENOMINATION));
@ -276,7 +278,7 @@ public:
osmId, uid, lat, lon, mwmName, category, name, std::string(city),
addrStreet, addrHouse, phone, website, stars, std::string(metaOperator), internet,
denomination, wheelchair, opening_hours, wikipedia, floor, fee, atm, contact_facebook,
contact_instagram, contact_twitter, contact_vk, contact_line, wikimedia_commons};
contact_instagram, contact_twitter, contact_vk, contact_line, contact_fediverse, contact_bluesky, wikimedia_commons};
AppendNames(f, columns);
PrintAsCSV(columns, ';', cout);
@ -290,7 +292,7 @@ void PrintHeader()
"phone", "website", "cuisines", "stars", "operator",
"internet", "denomination", "wheelchair", "opening_hours", "wikipedia",
"floor", "fee", "atm", "contact_facebook", "contact_instagram",
"contact_twitter", "contact_vk", "contact_line", "wikimedia_commons"};
"contact_twitter", "contact_vk", "contact_line", "contact_fediverse", "contact_bluesky", "wikimedia_commons"};
// Append all supported name languages in order.
for (uint8_t idx = 1; idx < kLangCount; idx++)
columns.push_back("name_" + string(StringUtf8Multilang::GetLangByCode(idx)));

View file

@ -249,6 +249,8 @@ bool EditableMapObject::IsValidMetadata(MetadataID type, std::string const & val
case MetadataID::FMD_CONTACT_TWITTER: return ValidateTwitterPage(value);
case MetadataID::FMD_CONTACT_VK: return ValidateVkPage(value);
case MetadataID::FMD_CONTACT_LINE: return ValidateLinePage(value);
case MetadataID::FMD_CONTACT_FEDIVERSE: return ValidateFediversePage(value);
case MetadataID::FMD_CONTACT_BLUESKY: return ValidateBlueskyPage(value);
case MetadataID::FMD_STARS:
{
@ -284,6 +286,8 @@ void EditableMapObject::SetMetadata(MetadataID type, std::string value)
case MetadataID::FMD_CONTACT_TWITTER: value = ValidateAndFormat_twitter(value); break;
case MetadataID::FMD_CONTACT_VK: value = ValidateAndFormat_vk(value); break;
case MetadataID::FMD_CONTACT_LINE: value = ValidateAndFormat_contactLine(value); break;
case MetadataID::FMD_CONTACT_FEDIVERSE: value = ValidateAndFormat_fediverse(value); break;
case MetadataID::FMD_CONTACT_BLUESKY: value = ValidateAndFormat_bluesky(value); break;
default: break;
}

View file

@ -113,6 +113,8 @@ PlacePageDialogDeveloper::PlacePageDialogDeveloper(QWidget * parent, place_page:
case PropID::FMD_CONTACT_TWITTER:
case PropID::FMD_CONTACT_VK:
case PropID::FMD_CONTACT_LINE:
case PropID::FMD_CONTACT_FEDIVERSE:
case PropID::FMD_CONTACT_BLUESKY:
case PropID::FMD_WIKIPEDIA:
case PropID::FMD_WIKIMEDIA_COMMONS:
isLink = true;

View file

@ -218,6 +218,8 @@ PlacePageDialogUser::PlacePageDialogUser(QWidget * parent, place_page::Info cons
addSocialNetworkWidget("Twitter", feature::Metadata::EType::FMD_CONTACT_TWITTER);
addSocialNetworkWidget("VK", feature::Metadata::EType::FMD_CONTACT_VK);
addSocialNetworkWidget("Line", feature::Metadata::EType::FMD_CONTACT_LINE);
addSocialNetworkWidget("Mastodon", feature::Metadata::EType::FMD_CONTACT_FEDIVERSE);
addSocialNetworkWidget("Bluesky", feature::Metadata::EType::FMD_CONTACT_BLUESKY);
}
if (auto wikimedia_commons = info.GetMetadata(feature::Metadata::EType::FMD_WIKIMEDIA_COMMONS); !wikimedia_commons.empty())