2020-03-13 11:07:27 +00:00
|
|
|
/*
|
|
|
|
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 "boxes/peer_list_controllers.h"
|
|
|
|
#include "data/data_chat_filters.h"
|
|
|
|
|
|
|
|
class History;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GenericBox;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2020-03-13 13:05:21 +00:00
|
|
|
class Painter;
|
|
|
|
|
|
|
|
[[nodiscard]] QString FilterChatsTypeName(Data::ChatFilter::Flag flag);
|
|
|
|
void PaintFilterChatsTypeIcon(
|
2022-09-16 20:23:27 +00:00
|
|
|
QPainter &p,
|
2020-03-13 13:05:21 +00:00
|
|
|
Data::ChatFilter::Flag flag,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int outerWidth,
|
|
|
|
int size);
|
|
|
|
|
2022-03-23 14:22:09 +00:00
|
|
|
[[nodiscard]] object_ptr<Ui::RpWidget> CreatePeerListSectionSubtitle(
|
|
|
|
not_null<QWidget*> parent,
|
|
|
|
rpl::producer<QString> text);
|
|
|
|
|
2020-03-13 11:07:27 +00:00
|
|
|
class EditFilterChatsListController final : public ChatsListBoxController {
|
|
|
|
public:
|
|
|
|
using Flag = Data::ChatFilter::Flag;
|
|
|
|
using Flags = Data::ChatFilter::Flags;
|
2023-07-30 03:02:14 +00:00
|
|
|
using LimitBoxFactory = Fn<object_ptr<Ui::BoxContent>(int)>;
|
2020-03-13 11:07:27 +00:00
|
|
|
|
|
|
|
EditFilterChatsListController(
|
2020-12-21 19:43:23 +00:00
|
|
|
not_null<Main::Session*> session,
|
2020-03-13 11:07:27 +00:00
|
|
|
rpl::producer<QString> title,
|
|
|
|
Flags options,
|
|
|
|
Flags selected,
|
2023-07-30 03:02:14 +00:00
|
|
|
const base::flat_set<not_null<History*>> &peers,
|
|
|
|
LimitBoxFactory limitBox);
|
2020-03-13 11:07:27 +00:00
|
|
|
|
2020-03-13 13:05:21 +00:00
|
|
|
[[nodiscard]] Main::Session &session() const override;
|
|
|
|
[[nodiscard]] Flags chosenOptions() const {
|
|
|
|
return _selected;
|
|
|
|
}
|
2020-03-13 11:07:27 +00:00
|
|
|
|
|
|
|
void rowClicked(not_null<PeerListRow*> row) override;
|
|
|
|
void itemDeselectedHook(not_null<PeerData*> peer) override;
|
2020-03-13 14:44:25 +00:00
|
|
|
bool isForeignRow(PeerListRowId itemId) override;
|
|
|
|
bool handleDeselectForeignRow(PeerListRowId itemId) override;
|
2020-03-13 11:07:27 +00:00
|
|
|
|
2020-03-13 13:05:21 +00:00
|
|
|
private:
|
2022-05-06 16:06:15 +00:00
|
|
|
int selectedTypesCount() const;
|
2020-03-13 11:07:27 +00:00
|
|
|
void prepareViewHook() override;
|
|
|
|
std::unique_ptr<Row> createRow(not_null<History*> history) override;
|
2020-03-13 13:05:21 +00:00
|
|
|
[[nodiscard]] object_ptr<Ui::RpWidget> prepareTypesList();
|
2020-03-13 11:07:27 +00:00
|
|
|
|
|
|
|
void updateTitle();
|
|
|
|
|
2020-12-21 19:43:23 +00:00
|
|
|
const not_null<Main::Session*> _session;
|
2023-07-30 03:02:14 +00:00
|
|
|
const LimitBoxFactory _limitBox;
|
2020-03-13 11:07:27 +00:00
|
|
|
rpl::producer<QString> _title;
|
|
|
|
base::flat_set<not_null<History*>> _peers;
|
2020-03-13 13:05:21 +00:00
|
|
|
Flags _options;
|
|
|
|
Flags _selected;
|
2022-05-06 16:06:15 +00:00
|
|
|
int _limit = 0;
|
2023-04-03 07:58:30 +00:00
|
|
|
bool _chatlist = false;
|
2020-03-13 13:05:21 +00:00
|
|
|
|
2020-03-13 14:44:25 +00:00
|
|
|
Fn<void(PeerListRowId)> _deselectOption;
|
|
|
|
|
2022-05-06 16:06:15 +00:00
|
|
|
PeerListContentDelegate *_typesDelegate = nullptr;
|
|
|
|
|
2020-03-13 13:05:21 +00:00
|
|
|
rpl::lifetime _lifetime;
|
2020-03-13 11:07:27 +00:00
|
|
|
|
|
|
|
};
|