diff --git a/android/res/layout/place_page_wifi.xml b/android/res/layout/place_page_wifi.xml index cfc80b999d..7268358a8a 100644 --- a/android/res/layout/place_page_wifi.xml +++ b/android/res/layout/place_page_wifi.xml @@ -15,5 +15,5 @@ + android:text="@string/yes"/> \ No newline at end of file diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index e31fffb827..904ed14576 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -128,6 +128,7 @@ public class PlacePageView extends NestedScrollViewClickFixed private RecyclerView mFullWeekOpeningHours; private PlaceOpeningHoursAdapter mOpeningHoursAdapter; private View mWifi; + private TextView mTvWiFi; private View mEmail; private TextView mTvEmail; private View mOperator; @@ -371,6 +372,7 @@ public class PlacePageView extends NestedScrollViewClickFixed mOpeningHoursAdapter = new PlaceOpeningHoursAdapter(); mFullWeekOpeningHours.setAdapter(mOpeningHoursAdapter); mWifi = findViewById(R.id.ll__place_wifi); + mTvWiFi = findViewById(R.id.tv__place_wifi); mEmail = findViewById(R.id.ll__place_email); mEmail.setOnClickListener(this); mTvEmail = findViewById(R.id.tv__place_email); @@ -848,7 +850,7 @@ public class PlacePageView extends NestedScrollViewClickFixed refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_OPERATOR), mOperator, mTvOperator); refreshMetadataOrHide(Framework.nativeGetActiveObjectFormattedCuisine(), mCuisine, mTvCuisine); refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_WIKIPEDIA), mWiki, null); - refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_INTERNET), mWifi, null); + refreshWiFi(mapObject); refreshMetadataOrHide(mapObject.getMetadata(Metadata.MetadataType.FMD_FLATS), mEntrance, mTvEntrance); refreshOpeningHours(mapObject); refreshSocialLinks(mapObject); @@ -968,6 +970,19 @@ public class PlacePageView extends NestedScrollViewClickFixed UiUtils.setTextAndShow(mTodayNonBusinessTime, TimeFormatUtils.formatNonBusinessTime(closedTimespans, hoursClosedLabel)); } + private void refreshWiFi(@NonNull MapObject mapObject) + { + final String inet = mapObject.getMetadata(Metadata.MetadataType.FMD_INTERNET); + if (inet != null) + { + mWifi.setVisibility(View.VISIBLE); + /// @todo Better (but harder) to wrap C++ osm::Internet into Java, instead of comparing with "no". + mTvWiFi.setText(TextUtils.equals(inet, "no") ? R.string.no_available : R.string.yes_available); + } + else + mWifi.setVisibility(View.GONE); + } + private void refreshSocialLinks(@NonNull MapObject mapObject) { final String facebookPageLink = mapObject.getMetadata(Metadata.MetadataType.FMD_CONTACT_FACEBOOK); diff --git a/data/replaced_tags.txt b/data/replaced_tags.txt index b4d1cc9f32..219a518818 100644 --- a/data/replaced_tags.txt +++ b/data/replaced_tags.txt @@ -79,6 +79,10 @@ power=transformer : power=substation organic=limited : organic=yes +wifi=yes : internet_access=wlan +wifi=free : internet_access=wlan +wifi=no : internet_access=no + diet:vegetarian=yes : cuisine=vegetarian diet:vegetarian=only : cuisine=vegetarian diet=vegetarian : cuisine=vegetarian diff --git a/data/strings/strings.txt b/data/strings/strings.txt index 0943e25925..66d11c2c72 100644 --- a/data/strings/strings.txt +++ b/data/strings/strings.txt @@ -6650,43 +6650,6 @@ zh-Hans = 蓝灰色 zh-Hant = 藍灰色 - [WiFi_available] - comment = Wi-Fi available - tags = android,ios - en = Yes - ar = نعم - be = Так - bg = Да - cs = Ano - da = Ja - de = Ja - el = Ναι - es = Sí - fa = بلی - fi = Kyllä - fr = Oui - he = כן - hu = Igen - id = Ya - it = Sì - ja = はい - ko = 네 - nb = Ja - nl = Ja - pl = Tak - pt = Sim - pt-BR = Sim - ro = Da - ru = Есть - sk = Áno - sv = Ja - th = ใช่ - tr = Var - uk = Так - vi = Có - zh-Hans = 是 - zh-Hant = 是 - [[Routing dialogs strings]] [dialog_routing_disclaimer_title] @@ -18940,17 +18903,19 @@ zh-Hans = 想重建路线? zh-Hant = 想重建路線? - [redirect_route_yes] - tags = ios + [yes] + comment = A generic "Yes" button in dialogs + tags = android,ios en = Yes ar = نعم be = Так + bg = Да cs = Ano da = Ja de = Ja el = Ναι - es = Si - es-MX = Si + es = Sí + es-MX = Sí fa = بله fi = Kyllä fr = Oui @@ -18976,11 +18941,13 @@ zh-Hans = 是 zh-Hant = 是 - [redirect_route_no] - tags = ios + [no] + comment = A generic "No" button in dialogs + tags = android,ios en = No ar = لا be = Не + bg = Не cs = Ne da = Nej de = Nein @@ -19012,6 +18979,23 @@ zh-Hans = 否 zh-Hant = 否 + [yes_available] + comment = E.g. "WiFi:Yes" + tags = android,ios + ref = yes + be = Ёсць + fa = بلی + he = כן + ru = Есть + tr = Var + + [no_available] + comment = E.g. "WiFi:No" + tags = android,ios + ref = no + be = Няма + tr = Yok + [trip_finished] tags = ios en = You have arrived! diff --git a/generator/generator_tests/osm_type_test.cpp b/generator/generator_tests/osm_type_test.cpp index 4ccbb2f518..8039a5f321 100644 --- a/generator/generator_tests/osm_type_test.cpp +++ b/generator/generator_tests/osm_type_test.cpp @@ -1437,6 +1437,63 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Organic) } } +UNIT_CLASS_TEST(TestWithClassificator, OsmType_Internet) +{ + { + Tags const tags = { + {"internet_access", "no"}, + {"wifi", "no"}, + {"amenity", "cafe"}, + }; + + auto const params = GetFeatureBuilderParams(tags); + + TEST_EQUAL(params.m_types.size(), 1, (params)); + TEST(params.IsTypeExist(GetType({"amenity", "cafe"})), (params)); + } + + { + Tags const tags = { + {"internet_access", "wlan"}, + {"office", "it"}, + }; + + auto const params = GetFeatureBuilderParams(tags); + + TEST_EQUAL(params.m_types.size(), 2, (params)); + TEST(params.IsTypeExist(GetType({"office"})), (params)); + TEST(params.IsTypeExist(GetType({"internet_access", "wlan"})), (params)); + } + + { + Tags const tags = { + {"wifi", "free"}, + {"internet_access", "yes"}, + {"shop", "clothes"}, + }; + + auto const params = GetFeatureBuilderParams(tags); + + TEST_EQUAL(params.m_types.size(), 2, (params)); + TEST(params.IsTypeExist(GetType({"shop", "clothes" })), (params)); + TEST(params.IsTypeExist(GetType({"internet_access", "wlan"})), (params)); + } + + { + Tags const tags = { + {"wifi", "no"}, + {"internet_access", "terminal"}, + {"amenity", "internet_cafe"}, + }; + + auto const params = GetFeatureBuilderParams(tags); + + TEST_EQUAL(params.m_types.size(), 2, (params)); + TEST(params.IsTypeExist(GetType({"amenity", "internet_cafe" })), (params)); + TEST(params.IsTypeExist(GetType({"internet_access"})), (params)); + } +} + UNIT_CLASS_TEST(TestWithClassificator, OsmType_SimpleTypesSmoke) { Tags const oneTypes = { diff --git a/generator/osm2meta.cpp b/generator/osm2meta.cpp index bfa034d6be..a782c97377 100644 --- a/generator/osm2meta.cpp +++ b/generator/osm2meta.cpp @@ -175,12 +175,11 @@ string MetadataTagProcessorImpl::ValidateAndFormat_flats(string const & v) const string MetadataTagProcessorImpl::ValidateAndFormat_internet(string v) const { - // TODO(AlexZ): Reuse/synchronize this code with MapObject::SetInternet(). strings::AsciiToLower(v); - if (v == "wlan" || v == "wired" || v == "yes" || v == "no") + if (v == "wlan" || v == "wired" || v == "terminal" || v == "yes" || v == "no") return v; - // Process wifi=free tag. - if (v == "free") + // Process additional top tags. + if (v == "free" || v == "wifi" || v == "public") return "wlan"; return {}; } diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp index 7bc86fc3fe..0ee084cff2 100644 --- a/indexer/editable_map_object.cpp +++ b/indexer/editable_map_object.cpp @@ -2,6 +2,7 @@ #include "indexer/classificator.hpp" #include "indexer/cuisines.hpp" +#include "indexer/ftypes_matcher.hpp" #include "indexer/postcodes_matcher.hpp" #include "indexer/validate_and_format_contacts.hpp" @@ -520,11 +521,12 @@ void EditableMapObject::SetInternet(Internet internet) { m_metadata.Set(feature::Metadata::FMD_INTERNET, DebugPrint(internet)); - static auto const wifiType = classif().GetTypeByPath({"internet_access", "wlan"}); + uint32_t const wifiType = ftypes::IsWifiChecker::Instance().GetType(); + bool const hasWiFi = m_types.Has(wifiType); - if (m_types.Has(wifiType) && internet != Internet::Wlan) + if (hasWiFi && internet != Internet::Wlan) m_types.Remove(wifiType); - else if (!m_types.Has(wifiType) && internet == Internet::Wlan) + else if (!hasWiFi && internet == Internet::Wlan) m_types.Add(wifiType); } diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index 30c092dd2b..3b5ff91fc1 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -115,6 +115,7 @@ public: FMD_OPERATOR = 6, FMD_URL = 7, FMD_WEBSITE = 8, + /// @todo We have meta and classifier type at the same type. It's ok now for search, but should be revised in future. FMD_INTERNET = 9, FMD_ELE = 10, FMD_TURN_LANES = 11, diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp index 23871b0983..379af76e3a 100644 --- a/indexer/ftypes_matcher.hpp +++ b/indexer/ftypes_matcher.hpp @@ -406,6 +406,8 @@ class IsWifiChecker : public BaseChecker IsWifiChecker(); public: DECLARE_CHECKER_INSTANCE(IsWifiChecker); + + uint32_t GetType() const { return m_types[0]; } }; class IsEatChecker : public BaseChecker diff --git a/indexer/indexer_tests/editable_map_object_test.cpp b/indexer/indexer_tests/editable_map_object_test.cpp index 5116adac9c..8d6f33df79 100644 --- a/indexer/indexer_tests/editable_map_object_test.cpp +++ b/indexer/indexer_tests/editable_map_object_test.cpp @@ -347,6 +347,7 @@ UNIT_TEST(EditableMapObject_SetInternet) setInternetAndCheck(emo, osm::Internet::Wired, false); setInternetAndCheck(emo, osm::Internet::Wlan, true); setInternetAndCheck(emo, osm::Internet::Unknown, false); + setInternetAndCheck(emo, osm::Internet::Terminal, false); EditableMapObject bunkerEmo; bunkerEmo.SetType(classif().GetTypeByPath({"military", "bunker"})); @@ -362,6 +363,8 @@ UNIT_TEST(EditableMapObject_SetInternet) setInternetAndCheck(bunkerEmo, osm::Internet::Wlan, true); setInternetAndCheck(bunkerEmo, osm::Internet::Unknown, false); setInternetAndCheck(bunkerEmo, osm::Internet::Wlan, true); + setInternetAndCheck(bunkerEmo, osm::Internet::Terminal, false); + setInternetAndCheck(bunkerEmo, osm::Internet::Wlan, true); setInternetAndCheck(bunkerEmo, osm::Internet::Wlan, true); } @@ -644,23 +647,20 @@ UNIT_TEST(EditableMapObject_FromFeatureType) classificator::Load(); EditableMapObject emo; - auto const wifiType = classif().GetTypeByPath({"internet_access", "wlan"}); - auto const cafeType = classif().GetTypeByPath({"amenity", "cafe"}); + feature::TypesHolder types; - types.Add(wifiType); - types.Add(cafeType); + types.Add(classif().GetTypeByPath({"amenity", "cafe"})); emo.SetTypes(types); emo.SetHouseNumber("1"); StringUtf8Multilang names; - names.AddString(GetLangCode("default"), "Default name"); names.AddString(GetLangCode("ru"), "Ru name"); + emo.SetName(names); emo.SetWebsite("https://some.thing.org"); - - emo.SetName(names); + emo.SetInternet(osm::Internet::Wlan); emo.SetPointType(); emo.SetMercator(m2::PointD(1.0, 1.0)); @@ -668,11 +668,15 @@ UNIT_TEST(EditableMapObject_FromFeatureType) FeatureType ft(emo); EditableMapObject emo2; emo2.SetFromFeatureType(ft); + TEST(emo.GetTypes().Equals(emo2.GetTypes()), ()); + TEST_EQUAL(emo.GetNameMultilang(), emo2.GetNameMultilang(), ()); TEST_EQUAL(emo.GetHouseNumber(), emo2.GetHouseNumber(), ()); TEST_EQUAL(emo.GetMercator(), emo2.GetMercator(), ()); TEST_EQUAL(emo.GetWebsite(), emo2.GetWebsite(), ()); + TEST_EQUAL(emo.GetInternet(), emo2.GetInternet(), ()); + TEST(emo.IsPointType(), ()); TEST(emo2.IsPointType(), ()); } diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index 535a11f614..0f9b8562cd 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -20,17 +20,10 @@ namespace { constexpr char const * kWlan = "wlan"; constexpr char const * kWired = "wired"; +constexpr char const * kTerminal = "terminal"; constexpr char const * kYes = "yes"; constexpr char const * kNo = "no"; constexpr char const * kFieldsSeparator = " • "; - -void SetInetIfNeeded(FeatureType & ft, feature::Metadata & metadata) -{ - if (!ftypes::IsWifiChecker::Instance()(ft) || metadata.Has(feature::Metadata::FMD_INTERNET)) - return; - - metadata.Set(feature::Metadata::FMD_INTERNET, kWlan); -} } // namespace string DebugPrint(osm::Internet internet) @@ -41,6 +34,7 @@ string DebugPrint(osm::Internet internet) case Internet::Yes: return kYes; case Internet::Wlan: return kWlan; case Internet::Wired: return kWired; + case Internet::Terminal: return kTerminal; case Internet::Unknown: break; } return {}; @@ -105,7 +99,10 @@ void MapObject::SetFromFeatureType(FeatureType & ft) FeatureType::BEST_GEOMETRY); } - SetInetIfNeeded(ft, m_metadata); +#ifdef DEBUG + if (ftypes::IsWifiChecker::Instance()(ft)) + ASSERT(m_metadata.Has(feature::Metadata::FMD_INTERNET), ()); +#endif } FeatureID const & MapObject::GetID() const { return m_featureID; } @@ -191,15 +188,19 @@ string MapObject::GetLinePage() const Internet MapObject::GetInternet() const { - string inet = m_metadata.Get(feature::Metadata::FMD_INTERNET); - strings::AsciiToLower(inet); - // Most popular case. + return InternetFromString(m_metadata.Get(feature::Metadata::FMD_INTERNET)); +} + +Internet InternetFromString(std::string const & inet) +{ if (inet.empty()) return Internet::Unknown; if (inet.find(kWlan) != string::npos) return Internet::Wlan; if (inet.find(kWired) != string::npos) return Internet::Wired; + if (inet.find(kTerminal) != string::npos) + return Internet::Terminal; if (inet == kYes) return Internet::Yes; if (inet == kNo) diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp index 55af81fb6b..d1d9cb1bce 100644 --- a/indexer/map_object.hpp +++ b/indexer/map_object.hpp @@ -25,11 +25,14 @@ enum class Internet { Unknown, //!< Internet state is unknown (default). Wlan, //!< Wireless Internet access is present. + Terminal, //!< A computer with internet service. Wired, //!< Wired Internet access is present. Yes, //!< Unspecified Internet access is available. No //!< There is definitely no any Internet access. }; std::string DebugPrint(Internet internet); +/// @param[in] inet Should be lowercase like in DebugPrint. +Internet InternetFromString(std::string const & inet); // Object details in the sorted order, visible to users. // Must correspond MapObject.java @@ -88,6 +91,7 @@ public: std::string GetVkPage() const; std::string GetLinePage() const; Internet GetInternet() const; + /// @returns non-localized cuisines keys. std::vector GetCuisines() const; /// @returns translated cuisine(s). diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h index 41c161f87a..3fe129b9b5 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly, nullable) NSString *address; @property(nonatomic, readonly, nullable) NSString *rawCoordinates; @property(nonatomic, readonly, nullable) NSString *formattedCoordinates; -@property(nonatomic, readonly) BOOL wifiAvailable; +@property(nonatomic, readonly, nullable) NSString *wifiAvailable; @end diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm index bcad7f6938..424748c2a3 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm @@ -46,7 +46,8 @@ using namespace osm; _ppOperator = @(rawData.GetOperator().c_str()); break; case Props::Internet: - _wifiAvailable = YES; + _wifiAvailable = (rawData.GetInternet() == osm::Internet::No) + ? NSLocalizedString(@"no_available", nil) : NSLocalizedString(@"yes_available", nil); break; default: break; diff --git a/iphone/Maps/Classes/CarPlay/CarPlayService.swift b/iphone/Maps/Classes/CarPlay/CarPlayService.swift index 0f33e4ae62..3eb34b09a8 100644 --- a/iphone/Maps/Classes/CarPlay/CarPlayService.swift +++ b/iphone/Maps/Classes/CarPlay/CarPlayService.swift @@ -647,13 +647,13 @@ extension CarPlayService { } func showRerouteAlert(trips: [CPTrip]) { - let yesAction = CPAlertAction(title: L("redirect_route_yes"), style: .default, handler: { [unowned self] _ in + let yesAction = CPAlertAction(title: L("yes"), style: .default, handler: { [unowned self] _ in self.router?.cancelTrip() self.updateMapTemplateUIToBase() self.preparedToPreviewTrips = trips self.interfaceController?.dismissTemplate(animated: true) }) - let noAction = CPAlertAction(title: L("redirect_route_no"), style: .cancel, handler: { [unowned self] _ in + let noAction = CPAlertAction(title: L("no"), style: .cancel, handler: { [unowned self] _ in self.interfaceController?.dismissTemplate(animated: true) }) let alert = CPAlertTemplate(titleVariants: [L("redirect_route_alert")], actions: [noAction, yesAction]) diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift index 3d99000499..cf37dc5f54 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift @@ -130,8 +130,8 @@ class PlacePageInfoViewController: UIViewController { operatorView = createInfoItem(ppOperator, icon: UIImage(named: "ic_placepage_operator")) } - if placePageInfoData.wifiAvailable { - wifiView = createInfoItem(L("WiFi_available"), icon: UIImage(named: "ic_placepage_wifi")) + if let wifi = placePageInfoData.wifiAvailable { + wifiView = createInfoItem(wifi, icon: UIImage(named: "ic_placepage_wifi")) } if let address = placePageInfoData.address { diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index f3b3bc1035..542cea9c8d 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -100,6 +100,7 @@ std::string Info::FormatSubtitle(bool withType) const if (withType) subtitle.push_back(GetLocalizedType()); + // Flats. std::string const flats = GetFlats(); if (!flats.empty()) @@ -137,6 +138,8 @@ std::string Info::FormatSubtitle(bool withType) const std::string const eleStr = GetElevationFormatted(); if (!eleStr.empty()) subtitle.push_back(kMountainSymbol + eleStr); + + // Internet. if (HasWifi()) subtitle.push_back(m_localizedWifiString); diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 7d12e3d3fa..0d2f0622b7 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -46,6 +46,8 @@ #include #include +namespace qt +{ using namespace qt::common; namespace @@ -80,8 +82,6 @@ void DrawMwmBorder(df::DrapeApi & drapeApi, std::string const & mwmName, } } // namespace -namespace qt -{ DrawWidget::DrawWidget(Framework & framework, bool apiOpenGLES3, std::unique_ptr && screenshotParams, QWidget * parent) : TBase(framework, apiOpenGLES3, screenshotParams != nullptr, parent) diff --git a/qt/editor_dialog.cpp b/qt/editor_dialog.cpp index 1b32dab584..0a81aafa4f 100644 --- a/qt/editor_dialog.cpp +++ b/qt/editor_dialog.cpp @@ -134,6 +134,7 @@ EditorDialog::EditorDialog(QWidget * parent, osm::EditableMapObject & emo) std::string const values[] = {DebugPrint(osm::Internet::Unknown), DebugPrint(osm::Internet::Wlan), DebugPrint(osm::Internet::Wired), + DebugPrint(osm::Internet::Terminal), DebugPrint(osm::Internet::Yes), DebugPrint(osm::Internet::No)}; for (auto const & v : values) @@ -228,17 +229,7 @@ void EditorDialog::OnSave() if (prop == osm::Props::Internet) { QComboBox * cmb = findChild(kInternetObjectName); - std::string const str = cmb->currentText().toStdString(); - osm::Internet v = osm::Internet::Unknown; - if (str == DebugPrint(osm::Internet::Wlan)) - v = osm::Internet::Wlan; - else if (str == DebugPrint(osm::Internet::Wired)) - v = osm::Internet::Wired; - else if (str == DebugPrint(osm::Internet::No)) - v = osm::Internet::No; - else if (str == DebugPrint(osm::Internet::Yes)) - v = osm::Internet::Yes; - m_feature.SetInternet(v); + m_feature.SetInternet(osm::InternetFromString(cmb->currentText().toStdString())); continue; } diff --git a/qt/place_page_dialog.cpp b/qt/place_page_dialog.cpp index 0c3d3a5622..f62f2ac41b 100644 --- a/qt/place_page_dialog.cpp +++ b/qt/place_page_dialog.cpp @@ -27,6 +27,7 @@ PlacePageDialog::PlacePageDialog(QWidget * parent, place_page::Info const & info { QGridLayout * grid = new QGridLayout(); int row = 0; + { // Coordinates. grid->addWidget(new QLabel("lat, lon"), row, 0); ms::LatLon const ll = info.GetLatLon(); @@ -36,20 +37,23 @@ PlacePageDialog::PlacePageDialog(QWidget * parent, place_page::Info const & info label->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(label, row++, 1); } + { grid->addWidget(new QLabel("CountryId"), row, 0); QLabel * label = new QLabel(QString::fromStdString(info.GetCountryId())); label->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(label, row++, 1); } + // Title/Name/Custom Name. - if (!info.GetTitle().empty()) + if (auto const title = info.GetTitle(); !title.empty()) { grid->addWidget(new QLabel("Title"), row, 0); - QLabel * label = new QLabel(QString::fromStdString(info.GetTitle())); + QLabel * label = new QLabel(QString::fromStdString(title)); label->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(label, row++, 1); } + // Subtitle. if (info.IsFeature()) { @@ -58,27 +62,32 @@ PlacePageDialog::PlacePageDialog(QWidget * parent, place_page::Info const & info label->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(label, row++, 1); } + { // Address. grid->addWidget(new QLabel("Address"), row, 0); QLabel * label = new QLabel(QString::fromStdString(address.FormatAddress())); label->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(label, row++, 1); } + if (info.IsBookmark()) { grid->addWidget(new QLabel("Bookmark"), row, 0); grid->addWidget(new QLabel("Yes"), row++, 1); } + if (info.IsMyPosition()) { grid->addWidget(new QLabel("MyPosition"), row, 0); grid->addWidget(new QLabel("Yes"), row++, 1); } + if (info.HasApiUrl()) { grid->addWidget(new QLabel("Api URL"), row, 0); grid->addWidget(new QLabel(QString::fromStdString(info.GetApiUrl())), row++, 1); } + if (info.IsFeature()) { grid->addWidget(new QLabel("Feature ID"), row, 0); @@ -91,6 +100,7 @@ PlacePageDialog::PlacePageDialog(QWidget * parent, place_page::Info const & info labelT->setTextInteractionFlags(Qt::TextSelectableByMouse); grid->addWidget(labelT, row++, 1); } + for (auto const prop : info.AvailableProperties()) { QString k;