MCPcopy Create free account
hub / github.com/comaps/comaps / PlacePageDialogDeveloper

Method PlacePageDialogDeveloper

qt/place_page_dialog_developer.cpp:16–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include <string>
15
16PlacePageDialogDeveloper::PlacePageDialogDeveloper(QWidget * parent, place_page::Info const & info,
17 search::ReverseGeocoder::Address const & address)
18 : QDialog(parent)
19{
20 QVBoxLayout * layout = new QVBoxLayout();
21 QGridLayout * grid = new QGridLayout();
22 int row = 0;
23
24 auto const addEntry = [grid, &row](std::string const & key, std::string const & value, bool isLink = false)
25 {
26 grid->addWidget(new QLabel(QString::fromStdString(key)), row, 0);
27 QLabel * label = new QLabel(QString::fromStdString(value));
28 label->setTextInteractionFlags(Qt::TextSelectableByMouse);
29 if (isLink)
30 {
31 label->setOpenExternalLinks(true);
32 label->setTextInteractionFlags(Qt::TextBrowserInteraction);
33 label->setText(QString::fromStdString("<a href=\"" + value + "\">" + value + "</a>"));
34 }
35 grid->addWidget(label, row++, 1);
36 return label;
37 };
38
39 {
40 ms::LatLon const ll = info.GetLatLon();
41 addEntry("lat, lon", strings::to_string_dac(ll.m_lat, 7) + ", " + strings::to_string_dac(ll.m_lon, 7));
42 }
43
44 addEntry("CountryId", info.GetCountryId());
45
46 auto const & title = info.GetTitle();
47 if (!title.empty())
48 addEntry("Title", title);
49
50 if (auto const & subTitle = info.GetSubtitle(); !subTitle.empty())
51 addEntry("Subtitle", subTitle);
52
53 addEntry("Address", address.FormatAddress());
54
55 if (info.IsBookmark())
56 {
57 grid->addWidget(new QLabel("Bookmark"), row, 0);
58 grid->addWidget(new QLabel("Yes"), row++, 1);
59 }
60
61 if (info.IsMyPosition())
62 {
63 grid->addWidget(new QLabel("MyPosition"), row, 0);
64 grid->addWidget(new QLabel("Yes"), row++, 1);
65 }
66
67 if (info.HasApiUrl())
68 {
69 grid->addWidget(new QLabel("Api URL"), row, 0);
70 grid->addWidget(new QLabel(QString::fromStdString(info.GetApiUrl())), row++, 1);
71 }
72
73 if (info.IsFeature())

Callers

nothing calls this directly

Calls 15

to_string_dacFunction · 0.85
to_stringFunction · 0.85
addCommonButtonsFunction · 0.85
TextDialogClass · 0.85
GetCountryIdMethod · 0.80
FormatAddressMethod · 0.80
HasApiUrlMethod · 0.80
IsFeatureMethod · 0.80
FormatCuisinesMethod · 0.80
ShouldShowEditPlaceMethod · 0.80
GetWikiDescriptionMethod · 0.80

Tested by

no test coverage detected