1
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-03-25 04:38:23 +00:00

Fix empty state of Downloads section.

This commit is contained in:
John Preston 2022-02-26 11:03:11 +03:00
parent 1710863231
commit 1f2eba9dc9
6 changed files with 24 additions and 7 deletions

View File

@ -27,6 +27,8 @@ public:
protected:
int resizeGetHeight(int newWidth) override;
void paintEvent(QPaintEvent *e) override;
private:
object_ptr<Ui::FlatLabel> _text;
int _height = 0;
@ -70,6 +72,14 @@ int EmptyWidget::resizeGetHeight(int newWidth) {
return _height;
}
void EmptyWidget::paintEvent(QPaintEvent *e) {
auto p = QPainter(this);
const auto iconLeft = (width() - st::infoEmptyFile.width()) / 2;
const auto iconTop = height() - st::infoEmptyIconTop;
st::infoEmptyFile.paint(p, iconLeft, iconTop, width());
}
InnerWidget::InnerWidget(
QWidget *parent,
not_null<Controller*> controller)

View File

@ -114,6 +114,7 @@ void Provider::refreshViewer() {
ranges::remove(_elements, item, &Element::item),
end(_elements));
}
_fullCount = _elements.size();
if (added) {
ranges::sort(_elements, ranges::less(), &Element::started);
_refreshed.fire({});

View File

@ -51,6 +51,11 @@ Widget::Widget(
_inner = setInnerWidget(object_ptr<InnerWidget>(
this,
controller));
_inner->setScrollHeightValue(scrollHeightValue());
_inner->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
scrollTo(request);
}, _inner->lifetime());
}
bool Widget::showInternal(not_null<ContentMemento*> memento) {

View File

@ -325,7 +325,7 @@ rpl::producer<bool> Controller::searchEnabledByContent() const {
rpl::producer<QString> Controller::mediaSourceQueryValue() const {
return _searchController
? _searchController->currentQueryValue()
: rpl::never<QString>(); // #TODO downloads
: rpl::single(QString()); // #TODO downloads
}
rpl::producer<SparseIdsMergedSlice> Controller::mediaSource(

View File

@ -479,6 +479,7 @@ int ListWidget::resizeGetHeight(int newWidth) {
auto ListWidget::findItemByPoint(QPoint point) const -> FoundItem {
Expects(!_sections.empty());
auto sectionIt = findSectionAfterTop(point.y());
if (sectionIt == _sections.end()) {
--sectionIt;

View File

@ -73,12 +73,12 @@ paymentsSectionButton: SettingsButton(infoProfileButton) {
padding: margins(68px, 11px, 14px, 9px);
}
paymentsIconPaymentMethod: icon {{ "payments/payment_card", menuIconFg }};
paymentsIconShippingAddress: icon {{ "payments/payment_address", menuIconFg }};
paymentsIconName: icon {{ "payments/payment_name", menuIconFg }};
paymentsIconEmail: icon {{ "payments/payment_email", menuIconFg }};
paymentsIconPhone: icon {{ "payments/payment_phone", menuIconFg }};
paymentsIconShippingMethod: icon {{ "payments/payment_shipping", menuIconFg }};
paymentsIconPaymentMethod: icon {{ "payments/payment_card", windowBoldFg }};
paymentsIconShippingAddress: icon {{ "payments/payment_address", windowBoldFg }};
paymentsIconName: icon {{ "payments/payment_name", windowBoldFg }};
paymentsIconEmail: icon {{ "payments/payment_email", windowBoldFg }};
paymentsIconPhone: icon {{ "payments/payment_phone", windowBoldFg }};
paymentsIconShippingMethod: icon {{ "payments/payment_shipping", windowBoldFg }};
paymentsField: defaultInputField;
paymentsMoneyField: InputField(paymentsField) {