| 14 | #include <string> |
| 15 | |
| 16 | PlacePageDialogDeveloper::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()) |
nothing calls this directly
no test coverage detected