mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 01:50:36 +00:00
Wrapped filter value labels with EditFlagsControl.
This commit is contained in:
parent
10ebd7e6ef
commit
1e6236a987
@ -4344,11 +4344,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_filter" = "Filter";
|
||||
"lng_admin_log_filter_title" = "Filter";
|
||||
"lng_admin_log_filter_all_actions" = "All actions";
|
||||
"lng_admin_log_filter_actions_type_subtitle" = "Filter actions by type";
|
||||
"lng_admin_log_filter_actions_member_section" = "Members And Admins";
|
||||
"lng_admin_log_filter_restrictions" = "New restrictions";
|
||||
"lng_admin_log_filter_admins_new" = "New admins";
|
||||
"lng_admin_log_filter_members_new" = "New members";
|
||||
"lng_admin_log_filter_actions_settings_section" = "Group Settings";
|
||||
"lng_admin_log_filter_info_group" = "Group info";
|
||||
"lng_admin_log_filter_info_channel" = "Channel info";
|
||||
"lng_admin_log_filter_actions_messages_section" = "Messages";
|
||||
"lng_admin_log_filter_messages_deleted" = "Deleted messages";
|
||||
"lng_admin_log_filter_messages_edited" = "Edited messages";
|
||||
"lng_admin_log_filter_messages_pinned" = "Pinned messages";
|
||||
@ -4358,6 +4362,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_filter_members_removed" = "Leaving members";
|
||||
"lng_admin_log_filter_topics" = "Topics";
|
||||
"lng_admin_log_filter_all_admins" = "All users and admins";
|
||||
"lng_admin_log_filter_actions_admins_subtitle" = "Filter actions by admins";
|
||||
"lng_admin_log_filter_actions_admins_section" = "Show Actions by All Admins";
|
||||
"lng_admin_log_about" = "What is this?";
|
||||
"lng_admin_log_about_text" = "This is a list of all service actions taken by the group's members and admins in the last 48 hours.";
|
||||
"lng_admin_log_about_text_channel" = "This is a list of all service actions taken by the channel's admins in the last 48 hours.";
|
||||
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "history/admin_log/history_admin_log_filter.h"
|
||||
#include "core/ui_integration.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "data/data_channel.h"
|
||||
@ -55,6 +56,11 @@ constexpr auto kForceDisableTooltipDuration = 3 * crl::time(1000);
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]] auto Dependencies(AdminLog::FilterValue::Flags) {
|
||||
using Flag = AdminLog::FilterValue::Flag;
|
||||
return std::vector<std::pair<Flag, Flag>>{};
|
||||
}
|
||||
|
||||
[[nodiscard]] auto NestedRestrictionLabelsList(
|
||||
Data::RestrictionsSetOptions options)
|
||||
-> std::vector<NestedEditFlagsLabels<ChatRestrictions>> {
|
||||
@ -1432,3 +1438,18 @@ EditFlagsControl<PowerSaving::Flags> CreateEditPowerSaving(
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
EditFlagsControl<AdminLog::FilterValue::Flags> CreateEditAdminLogFilter(
|
||||
QWidget *parent,
|
||||
AdminLog::FilterValue::Flags flags,
|
||||
bool isChannel) {
|
||||
auto widget = object_ptr<Ui::VerticalLayout>(parent);
|
||||
auto descriptor = AdminLog::FilterValueLabels(isChannel);
|
||||
auto result = CreateEditFlags(
|
||||
widget.data(),
|
||||
flags,
|
||||
std::move(descriptor));
|
||||
result.widget = std::move(widget);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -7,8 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "data/data_chat_participant_status.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "data/data_chat_participant_status.h"
|
||||
#include "history/admin_log/history_admin_log_filter_value.h"
|
||||
|
||||
namespace style {
|
||||
struct SettingsButton;
|
||||
@ -115,3 +116,9 @@ using AdminRightLabel = EditFlagsLabel<ChatAdminRights>;
|
||||
PowerSaving::Flags flags,
|
||||
rpl::producer<QString> forceDisabledMessage
|
||||
) -> EditFlagsControl<PowerSaving::Flags>;
|
||||
|
||||
[[nodiscard]] auto CreateEditAdminLogFilter(
|
||||
QWidget *parent,
|
||||
AdminLog::FilterValue::Flags flags,
|
||||
bool isChannel
|
||||
) -> EditFlagsControl<AdminLog::FilterValue::Flags>;
|
||||
|
@ -7,15 +7,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "history/admin_log/history_admin_log_filter.h"
|
||||
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/painter.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_user.h"
|
||||
#include "history/admin_log/history_admin_log_filter_value.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat.h"
|
||||
@ -440,4 +444,76 @@ void FilterBox::resizeToContent() {
|
||||
setDimensions(_inner->width(), _inner->height());
|
||||
}
|
||||
|
||||
EditFlagsDescriptor<FilterValue::Flags> FilterValueLabels(bool isChannel) {
|
||||
using Label = EditFlagsLabel<FilterValue::Flags>;
|
||||
using Flag = FilterValue::Flag;
|
||||
|
||||
const auto adminRights = Flag::Promote | Flag::Demote;
|
||||
const auto restrictions = Flag::Ban
|
||||
| Flag::Unban
|
||||
| Flag::Kick
|
||||
| Flag::Unkick;
|
||||
const auto membersNew = Flag::Join | Flag::Invite;
|
||||
const auto membersRemoved = Flag::Leave;
|
||||
|
||||
auto members = std::vector<Label>{
|
||||
{ adminRights, tr::lng_admin_log_filter_admins_new(tr::now) },
|
||||
{ restrictions, tr::lng_admin_log_filter_restrictions(tr::now) },
|
||||
{ membersNew, tr::lng_admin_log_filter_members_new(tr::now) },
|
||||
{ membersRemoved, tr::lng_admin_log_filter_members_removed(tr::now) },
|
||||
};
|
||||
|
||||
const auto info = Flag::Info | Flag::Settings;
|
||||
const auto invites = Flag::Invites;
|
||||
const auto calls = Flag::GroupCall;
|
||||
auto settings = std::vector<Label>{
|
||||
{
|
||||
info,
|
||||
((!isChannel)
|
||||
? tr::lng_admin_log_filter_info_group
|
||||
: tr::lng_admin_log_filter_info_channel)(tr::now),
|
||||
},
|
||||
{ invites, tr::lng_admin_log_filter_invite_links(tr::now) },
|
||||
{
|
||||
calls,
|
||||
((!isChannel)
|
||||
? tr::lng_admin_log_filter_voice_chats
|
||||
: tr::lng_admin_log_filter_voice_chats_channel)(tr::now),
|
||||
},
|
||||
};
|
||||
if (!isChannel) {
|
||||
settings.push_back({
|
||||
Flag::Topics,
|
||||
tr::lng_admin_log_filter_topics(tr::now),
|
||||
});
|
||||
}
|
||||
const auto deleted = Flag::Delete;
|
||||
const auto edited = Flag::Edit;
|
||||
const auto pinned = Flag::Pinned;
|
||||
auto messages = std::vector<Label>{
|
||||
{ deleted, tr::lng_admin_log_filter_messages_deleted(tr::now) },
|
||||
{ edited, tr::lng_admin_log_filter_messages_edited(tr::now) },
|
||||
};
|
||||
if (!isChannel) {
|
||||
messages.push_back({
|
||||
pinned,
|
||||
tr::lng_admin_log_filter_messages_pinned(tr::now),
|
||||
});
|
||||
}
|
||||
return { .labels = {
|
||||
{
|
||||
tr::lng_admin_log_filter_actions_member_section(),
|
||||
std::move(members),
|
||||
},
|
||||
{
|
||||
tr::lng_admin_log_filter_actions_settings_section(),
|
||||
std::move(settings),
|
||||
},
|
||||
{
|
||||
tr::lng_admin_log_filter_actions_messages_section(),
|
||||
std::move(messages),
|
||||
},
|
||||
}, .st = nullptr };
|
||||
}
|
||||
|
||||
} // namespace AdminLog
|
||||
|
@ -7,8 +7,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/layers/box_content.h"
|
||||
#include "history/admin_log/history_admin_log_filter_value.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
|
||||
template <typename Flags>
|
||||
struct EditFlagsDescriptor;
|
||||
|
||||
namespace AdminLog {
|
||||
|
||||
@ -40,4 +43,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
EditFlagsDescriptor<FilterValue::Flags> FilterValueLabels(bool isChannel);
|
||||
|
||||
} // namespace AdminLog
|
||||
|
Loading…
Reference in New Issue
Block a user