|
|
|
@ -94,7 +94,6 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MapPanel::clear() { |
|
|
|
@ -122,6 +121,7 @@ void MapPanel::parseResponse(const QString &response) { |
|
|
|
|
clear(); |
|
|
|
|
|
|
|
|
|
bool has_recents = false; |
|
|
|
|
for (auto &save_type: {"favorite", "recent"}) { |
|
|
|
|
for (auto location : doc.array()) { |
|
|
|
|
auto obj = location.toObject(); |
|
|
|
|
|
|
|
|
@ -130,6 +130,8 @@ void MapPanel::parseResponse(const QString &response) { |
|
|
|
|
auto name = obj["place_name"].toString(); |
|
|
|
|
auto details = shorten(obj["place_details"].toString(), 30); |
|
|
|
|
|
|
|
|
|
if (type != save_type) continue; |
|
|
|
|
|
|
|
|
|
if (type == "favorite" && label == "home") { |
|
|
|
|
home_address->setText(name); |
|
|
|
|
home_address->setStyleSheet(R"(font-size: 50px; color: white;)"); |
|
|
|
@ -149,10 +151,21 @@ void MapPanel::parseResponse(const QString &response) { |
|
|
|
|
} else { |
|
|
|
|
ClickableWidget *widget = new ClickableWidget; |
|
|
|
|
QHBoxLayout *layout = new QHBoxLayout(widget); |
|
|
|
|
layout->setContentsMargins(40, 10, 40, 10); |
|
|
|
|
layout->setContentsMargins(15, 10, 40, 10); |
|
|
|
|
|
|
|
|
|
QLabel *star = new QLabel("★"); |
|
|
|
|
auto sp = star->sizePolicy(); |
|
|
|
|
sp.setRetainSizeWhenHidden(true); |
|
|
|
|
star->setSizePolicy(sp); |
|
|
|
|
|
|
|
|
|
star->setVisible(type == "favorite"); |
|
|
|
|
star->setStyleSheet(R"(font-size: 60px;)"); |
|
|
|
|
layout->addWidget(star); |
|
|
|
|
layout->addSpacing(10); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel *recent_label = new QLabel(name + " " + details); |
|
|
|
|
recent_label->setStyleSheet(R"(font-size: 50px; color: #9c9c9c)"); |
|
|
|
|
recent_label->setStyleSheet(R"(font-size: 50px;)"); |
|
|
|
|
|
|
|
|
|
layout->addWidget(recent_label); |
|
|
|
|
layout->addStretch(); |
|
|
|
@ -170,6 +183,7 @@ void MapPanel::parseResponse(const QString &response) { |
|
|
|
|
} |
|
|
|
|
QWidget { |
|
|
|
|
background-color: #393939; |
|
|
|
|
color: #9c9c9c; |
|
|
|
|
} |
|
|
|
|
)"); |
|
|
|
|
|
|
|
|
@ -184,6 +198,8 @@ void MapPanel::parseResponse(const QString &response) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!has_recents) { |
|
|
|
|
QLabel *no_recents = new QLabel(" no recent destinations"); |
|
|
|
|
no_recents->setStyleSheet(R"(font-size: 50px; color: #9c9c9c)"); |
|
|
|
|