2022-04-05 20:51:42 +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
|
|
|
|
|
|
|
|
namespace Ui {
|
2022-04-10 10:49:14 +00:00
|
|
|
class PopupMenu;
|
2022-04-05 20:51:42 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2022-05-09 13:09:46 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
2022-04-05 20:51:42 +00:00
|
|
|
class History;
|
|
|
|
|
|
|
|
class ChooseFilterValidator final {
|
|
|
|
public:
|
|
|
|
ChooseFilterValidator(not_null<History*> history);
|
2022-06-07 05:05:33 +00:00
|
|
|
struct LimitData {
|
|
|
|
const bool reached = false;
|
|
|
|
const int count = 0;
|
|
|
|
};
|
2022-04-05 20:51:42 +00:00
|
|
|
|
|
|
|
[[nodiscard]] bool canAdd() const;
|
|
|
|
[[nodiscard]] bool canRemove(FilterId filterId) const;
|
2023-08-11 13:27:17 +00:00
|
|
|
[[nodiscard]] LimitData limitReached(
|
|
|
|
FilterId filterId,
|
|
|
|
bool always) const;
|
2022-04-05 20:51:42 +00:00
|
|
|
|
|
|
|
void add(FilterId filterId) const;
|
|
|
|
void remove(FilterId filterId) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const not_null<History*> _history;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-04-10 10:49:14 +00:00
|
|
|
void FillChooseFilterMenu(
|
2022-05-09 13:09:46 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2022-04-10 10:49:14 +00:00
|
|
|
not_null<Ui::PopupMenu*> menu,
|
|
|
|
not_null<History*> history);
|