string Info::FormatNewBookmarkName() const { string const title = GetTitle(); if (title.empty()) return GetLocalizedType(); return title; }
void Info::SetFromFeatureType(FeatureType & ft) { MapObject::SetFromFeatureType(ft); std::string primaryName; std::string secondaryName; GetPrefferedNames(primaryName, secondaryName); m_sortedTypes = m_types; m_sortedTypes.SortBySpec(); m_primaryFeatureName = primaryName; if (IsBookmark()) { m_uiTitle = GetBookmarkName(); auto const secondaryTitle = m_customName.empty() ? primaryName : m_customName; if (m_uiTitle != secondaryTitle) m_uiSecondaryTitle = secondaryTitle; m_uiSubtitle = FormatSubtitle(true /* withType */); m_uiAddress = m_address; } else if (!primaryName.empty()) { m_uiTitle = primaryName; m_uiSecondaryTitle = secondaryName; m_uiSubtitle = FormatSubtitle(true /* withType */); m_uiAddress = m_address; } else if (IsBuilding()) { bool const isAddressEmpty = m_address.empty(); m_uiTitle = isAddressEmpty ? GetLocalizedType() : m_address; m_uiSubtitle = FormatSubtitle(!isAddressEmpty /* withType */); } else { m_uiTitle = GetLocalizedType(); m_uiSubtitle = FormatSubtitle(false /* withType */); m_uiAddress = m_address; } m_hotelType = ftypes::IsHotelChecker::Instance().GetHotelType(ft); }
void CGUIDialogSmartPlaylistEditor::OnInitWindow() { m_cancelled = false; SendMessage(GUI_MSG_ITEM_SELECT, CONTROL_LIMIT, m_playlist.m_limit); std::vector<PLAYLIST_TYPE> allowedTypes; if (m_mode == "partymusic") { allowedTypes.push_back(TYPE_SONGS); allowedTypes.push_back(TYPE_MIXED); } else if (m_mode == "partyvideo") { allowedTypes.push_back(TYPE_MUSICVIDEOS); allowedTypes.push_back(TYPE_MIXED); } else if (m_mode == "music") { // music types + mixed allowedTypes.push_back(TYPE_SONGS); allowedTypes.push_back(TYPE_ALBUMS); allowedTypes.push_back(TYPE_ARTISTS); allowedTypes.push_back(TYPE_MIXED); } else if (m_mode == "video") { // general category for videos allowedTypes.push_back(TYPE_MOVIES); allowedTypes.push_back(TYPE_TVSHOWS); allowedTypes.push_back(TYPE_EPISODES); allowedTypes.push_back(TYPE_MUSICVIDEOS); allowedTypes.push_back(TYPE_MIXED); } // add to the spinner std::vector< std::pair<std::string, int> > labels; for (unsigned int i = 0; i < allowedTypes.size(); i++) labels.push_back(make_pair(GetLocalizedType(allowedTypes[i]), allowedTypes[i])); // check our playlist type is allowed PLAYLIST_TYPE type = ConvertType(m_playlist.GetType()); bool allowed = false; for (unsigned int i = 0; i < allowedTypes.size(); i++) if (type == allowedTypes[i]) allowed = true; if (!allowed && allowedTypes.size()) type = allowedTypes[0]; SET_CONTROL_LABELS(CONTROL_TYPE, type, &labels); m_playlist.SetType(ConvertType(type)); UpdateButtons(); SET_CONTROL_LABEL(CONTROL_HEADING, 21432); CGUIDialog::OnInitWindow(); }
string Info::GetSubtitle() const { if (!IsFeature()) { if (IsBookmark()) return m_bookmarkCategoryName; return {}; } vector<string> values; // Bookmark category. if (IsBookmark()) values.push_back(m_bookmarkCategoryName); // Type. values.push_back(GetLocalizedType()); // Flats. string const flats = GetFlats(); if (!flats.empty()) values.push_back(flats); // Cuisines. for (string const & cuisine : GetLocalizedCuisines()) values.push_back(cuisine); // Stars. string const stars = FormatStars(); if (!stars.empty()) values.push_back(stars); // Operator. string const op = GetOperator(); if (!op.empty()) values.push_back(op); // Elevation. string const eleStr = GetElevationFormatted(); if (!eleStr.empty()) values.push_back(kMountainSymbol + eleStr); if (HasWifi()) values.push_back(m_localizedWifiString); return strings::JoinStrings(values, kSubtitleSeparator); }
string Info::FormatSubtitle(bool withType) const { std::vector<std::string> subtitle; if (IsBookmark()) subtitle.push_back(m_bookmarkCategoryName); if (withType) subtitle.push_back(GetLocalizedType()); // Flats. string const flats = GetFlats(); if (!flats.empty()) subtitle.push_back(flats); // Cuisines. for (string const & cuisine : GetLocalizedCuisines()) subtitle.push_back(cuisine); // Airport IATA code. string const iata = GetAirportIata(); if (!iata.empty()) subtitle.push_back(iata); // Stars. string const stars = FormatStars(); if (!stars.empty()) subtitle.push_back(stars); // Operator. string const op = GetOperator(); if (!op.empty()) subtitle.push_back(op); // Elevation. string const eleStr = GetElevationFormatted(); if (!eleStr.empty()) subtitle.push_back(kMountainSymbol + eleStr); if (HasWifi()) subtitle.push_back(m_localizedWifiString); // Wheelchair if (GetWheelchairType() == ftraits::WheelchairAvailability::Yes) subtitle.push_back(kWheelchairSymbol); return strings::JoinStrings(subtitle, kSubtitleSeparator); }