Moved out AdminLog::FilterValue to separate file.

This commit is contained in:
23rd 2024-08-20 11:15:46 +03:00
parent 6b83c52c7c
commit 10ebd7e6ef
5 changed files with 61 additions and 41 deletions

View file

@ -8,10 +8,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "ui/layers/box_content.h"
#include "history/admin_log/history_admin_log_section.h"
#include "history/admin_log/history_admin_log_filter_value.h"
namespace AdminLog {
struct FilterValue;
class FilterBox : public Ui::BoxContent {
public:
FilterBox(

View file

@ -0,0 +1,54 @@
/*
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 AdminLog {
struct FilterValue final {
enum class Flag : uint32 {
Join = (1U << 0),
Leave = (1U << 1),
Invite = (1U << 2),
Ban = (1U << 3),
Unban = (1U << 4),
Kick = (1U << 5),
Unkick = (1U << 6),
Promote = (1U << 7),
Demote = (1U << 8),
Info = (1U << 9),
Settings = (1U << 10),
Pinned = (1U << 11),
Edit = (1U << 12),
Delete = (1U << 13),
GroupCall = (1U << 14),
Invites = (1U << 15),
Topics = (1U << 16),
MAX_FIELD = (1U << 16),
};
using Flags = base::flags<Flag>;
friend inline constexpr bool is_flag_type(Flag) { return true; };
// Empty "flags" means all events.
Flags flags = 0;
std::vector<not_null<UserData*>> admins;
bool allUsers = true;
};
inline bool operator==(const FilterValue &a, const FilterValue &b) {
return (a.flags == b.flags)
&& (a.admins == b.admins)
&& (a.allUsers == b.allUsers);
}
inline bool operator!=(const FilterValue &a, const FilterValue &b) {
return !(a == b);
}
} // namespace AdminLog

View file

@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_element.h"
#include "history/admin_log/history_admin_log_item.h"
#include "history/admin_log/history_admin_log_section.h"
#include "history/admin_log/history_admin_log_filter_value.h"
#include "menu/menu_antispam_validator.h"
#include "ui/rp_widget.h"
#include "ui/effects/animations.h"
@ -34,6 +34,7 @@ enum class PointState : char;
namespace Ui {
class PopupMenu;
class ChatStyle;
class ChatTheme;
struct PeerUserpicView;
} // namespace Ui

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/section_widget.h"
#include "window/section_memento.h"
#include "history/admin_log/history_admin_log_item.h"
#include "history/admin_log/history_admin_log_filter_value.h"
#include "mtproto/sender.h"
namespace Ui {
@ -28,45 +29,6 @@ class FixedBar;
class InnerWidget;
class SectionMemento;
struct FilterValue {
enum class Flag : uint32 {
Join = (1U << 0),
Leave = (1U << 1),
Invite = (1U << 2),
Ban = (1U << 3),
Unban = (1U << 4),
Kick = (1U << 5),
Unkick = (1U << 6),
Promote = (1U << 7),
Demote = (1U << 8),
Info = (1U << 9),
Settings = (1U << 10),
Pinned = (1U << 11),
Edit = (1U << 12),
Delete = (1U << 13),
GroupCall = (1U << 14),
Invites = (1U << 15),
Topics = (1U << 16),
MAX_FIELD = (1U << 16),
};
using Flags = base::flags<Flag>;
friend inline constexpr bool is_flag_type(Flag) { return true; };
// Empty "flags" means all events.
Flags flags = 0;
std::vector<not_null<UserData*>> admins;
bool allUsers = true;
};
inline bool operator==(const FilterValue &a, const FilterValue &b) {
return (a.flags == b.flags && a.admins == b.admins && a.allUsers == b.allUsers);
}
inline bool operator!=(const FilterValue &a, const FilterValue &b) {
return !(a == b);
}
class Widget final : public Window::SectionWidget {
public:
Widget(

View file

@ -124,6 +124,7 @@ PRIVATE
editor/scene/scene_item_line.cpp
editor/scene/scene_item_line.h
history/admin_log/history_admin_log_filter_value.h
history/history_view_top_toast.cpp
history/history_view_top_toast.h
history/view/controls/history_view_characters_limit.cpp