ZaStoGram_desktop/Telegram/SourceFiles/dialogs/dialogs_indexed_list.h
loop-uh 0e40e4b8a9 Merge upstream tdesktop a8de5f928b (v7.3.4 + 51: Update brotli to 1.2.1)
Ручное слияние для Windows-клиента: оригинал в dev не попадал с v7.3.1, так как
синхронизация v7.3.2-v7.3.4 встала на конфликте lib_ui. Таймер upstream-sync на
время слияния остановлен.

- lib_ui: форк 7e5d8bc (слияние с оригиналом 1ff7be7).
- Версия 7.3.4 без бета-признака: BetaChannel 0, AppBetaVersion false.
- mtproto: «плохая конфигурация прокси» теперь учитывает прокси (колбэк рантайма,
  делегат сессии, соединение); правки session_private перенесены в
  mtproto/session/private/* (лимиты длины, пустые RPC-ответы, DEBUG_LOG дампов).
- update_checker: ограничение размера ответа и отключение HTTP/2 оригинала поверх
  гонки зеркал форка.
- thanos_effect_renderer: версия оригинала (R32F вместо RGBA32F); проверка
  возможностей — по compute.
- download_manager_mtproto: проверка слишком большой части оригинала.
- prepare.py: патчи qtsvg и Windows 7 оригинала вместе с patches_extra форка.
- Файлы .agents/.claude/.github, удалённые форком, остаются удалёнными.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 16:07:40 -05:00

105 lines
3.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "dialogs/dialogs_list.h"
namespace Dialogs {
struct RowsByLetter;
class Row;
class IndexedList {
public:
IndexedList(SortMode sortMode, FilterId filterId = 0);
RowsByLetter addToEnd(Key key);
Row *addByName(Key key);
void adjustByDate(const RowsByLetter &links);
void moveToTop(Key key);
void freeze();
void unfreeze();
bool updateHeight(Key key, float64 narrowRatio);
bool updateHeights(float64 narrowRatio);
// row must belong to this indexed list all().
void movePinned(Row *row, int delta);
// For sortMode != SortMode::Date && != Complex
void peerNameChanged(
not_null<PeerData*> peer,
const base::flat_set<QChar> &oldChars);
//For sortMode == SortMode::Date || == Complex
void peerNameChanged(
FilterId filterId,
not_null<PeerData*> peer,
const base::flat_set<QChar> &oldChars);
void entryNameChanged(
FilterId filterId,
Key key,
const base::flat_set<QChar> &oldChars);
void remove(Key key, Row *replacedBy = nullptr);
void clear();
[[nodiscard]] const List &all() const {
return _list;
}
[[nodiscard]] const List *filtered(QChar ch) const;
[[nodiscard]] std::vector<not_null<Row*>> filtered(
const QStringList &words) const;
// Part of List interface is duplicated here for all() list.
[[nodiscard]] int size() const { return all().size(); }
[[nodiscard]] bool empty() const { return all().empty(); }
[[nodiscard]] int height() const { return all().height(); }
[[nodiscard]] bool contains(Key key) const {
return all().contains(key);
}
[[nodiscard]] Row *getRow(Key key) const { return all().getRow(key); }
[[nodiscard]] Row *rowAtY(int y) const { return all().rowAtY(y); }
using iterator = List::iterator;
using const_iterator = List::const_iterator;
[[nodiscard]] const_iterator cbegin() const { return all().cbegin(); }
[[nodiscard]] const_iterator cend() const { return all().cend(); }
[[nodiscard]] const_iterator begin() const { return all().cbegin(); }
[[nodiscard]] const_iterator end() const { return all().cend(); }
[[nodiscard]] iterator begin() { return all().begin(); }
[[nodiscard]] iterator end() { return all().end(); }
[[nodiscard]] const_iterator cfind(Row *value) const {
return all().cfind(value);
}
[[nodiscard]] const_iterator find(Row *value) const {
return all().cfind(value);
}
[[nodiscard]] iterator find(Row *value) { return all().find(value); }
[[nodiscard]] const_iterator findByY(int y) const {
return all().findByY(y);
}
[[nodiscard]] iterator findByY(int y) { return all().findByY(y); }
private:
void adjustByName(
Key key,
const base::flat_set<QChar> &oldChars);
void adjustNames(
FilterId filterId,
Key key,
const base::flat_set<QChar> &oldChars);
SortMode _sortMode = SortMode();
FilterId _filterId = 0;
uint64 _dateVersion = 1;
List _list, _empty;
mutable base::flat_map<QChar, List> _index;
};
} // namespace Dialogs