forked from organicmaps/organicmaps
[android][ios] Fixed internet_access.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
parent
a40ca23f1d
commit
9849c3c04c
20 changed files with 170 additions and 92 deletions
|
@ -15,5 +15,5 @@
|
|||
<TextView
|
||||
android:id="@+id/tv__place_wifi"
|
||||
style="@style/PlacePageMetadataText"
|
||||
android:text="@string/WiFi_available"/>
|
||||
android:text="@string/yes"/>
|
||||
</LinearLayout>
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(), ());
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<std::string> GetCuisines() const;
|
||||
/// @returns translated cuisine(s).
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
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> && screenshotParams,
|
||||
QWidget * parent)
|
||||
: TBase(framework, apiOpenGLES3, screenshotParams != nullptr, parent)
|
||||
|
|
|
@ -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<QComboBox *>(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue