Add fsqr promo footer.

This commit is contained in:
John Preston 2024-07-15 09:32:52 +02:00
parent b83b403b75
commit 8a92c89f39
3 changed files with 29 additions and 0 deletions

View File

@ -3199,6 +3199,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_maps_places_in_area" = "Places in this area"; "lng_maps_places_in_area" = "Places in this area";
"lng_maps_no_places" = "No places found"; "lng_maps_no_places" = "No places found";
"lng_maps_choose_to_search" = "Choose location to see places nearby."; "lng_maps_choose_to_search" = "Choose location to see places nearby.";
"lng_maps_venues_source" = "Powered by Foursquare";
"lng_live_location" = "Live Location"; "lng_live_location" = "Live Location";
"lng_live_location_now" = "updated just now"; "lng_live_location_now" = "updated just now";
"lng_live_location_minutes#one" = "updated {count} minute ago"; "lng_live_location_minutes#one" = "updated {count} minute ago";

View File

@ -1474,3 +1474,4 @@ pickLocationLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
color: windowSubTextFg; color: windowSubTextFg;
thickness: 4px; thickness: 4px;
} }
pickLocationPromoHeight: 32px;

View File

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h" #include "ui/text/text_utilities.h"
#include "ui/widgets/scroll_area.h" #include "ui/widgets/scroll_area.h"
#include "ui/widgets/separate_panel.h" #include "ui/widgets/separate_panel.h"
#include "ui/widgets/shadow.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/wrap/slide_wrap.h" #include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h" #include "ui/wrap/vertical_layout.h"
@ -182,6 +183,27 @@ private:
return query.trimmed().toLower(); return query.trimmed().toLower();
} }
[[nodiscard]] object_ptr<RpWidget> MakeFoursquarePromo() {
auto result = object_ptr<RpWidget>((QWidget*)nullptr);
const auto raw = result.data();
raw->resize(0, st::pickLocationPromoHeight);
const auto shadow = CreateChild<PlainShadow>(raw);
raw->widthValue() | rpl::start_with_next([=](int width) {
shadow->setGeometry(0, 0, width, st::lineWidth);
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=](QRect clip) {
auto p = QPainter(raw);
p.fillRect(clip, st::windowBg);
p.setPen(st::windowSubTextFg);
p.setFont(st::normalFont);
p.drawText(
raw->rect(),
tr::lng_maps_venues_source(tr::now),
style::al_center);
}, raw->lifetime());
return result;
}
VenuesController::VenuesController( VenuesController::VenuesController(
not_null<Main::Session*> session, not_null<Main::Session*> session,
rpl::producer<std::vector<VenueData>> content, rpl::producer<std::vector<VenueData>> content,
@ -214,6 +236,11 @@ void VenuesController::rebuild(const std::vector<VenueData> &rows) {
delegate()->peerListRemoveRow(delegate()->peerListRowAt(i)); delegate()->peerListRemoveRow(delegate()->peerListRowAt(i));
--count; --count;
} }
if (i > 0) {
delegate()->peerListSetBelowWidget(MakeFoursquarePromo());
} else {
delegate()->peerListSetBelowWidget({ nullptr });
}
delegate()->peerListRefreshRows(); delegate()->peerListRefreshRows();
} }