[Option][GUI] Disable notifications from top bar
This commit is contained in:
parent
85f67aaf29
commit
6c4617f04b
10 changed files with 72 additions and 3 deletions
BIN
Telegram/Resources/icons/info/info_notifications_active.png
Normal file
BIN
Telegram/Resources/icons/info/info_notifications_active.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/info/info_notifications_active@2x.png
Normal file
BIN
Telegram/Resources/icons/info/info_notifications_active@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/info/info_notifications_active@3x.png
Normal file
BIN
Telegram/Resources/icons/info/info_notifications_active@3x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -81,6 +81,7 @@
|
||||||
"ktg_settings_filters_only_unmuted_counter": "Do not count muted chats",
|
"ktg_settings_filters_only_unmuted_counter": "Do not count muted chats",
|
||||||
"ktg_settings_filters_hide_edit": "Hide Edit button",
|
"ktg_settings_filters_hide_edit": "Hide Edit button",
|
||||||
"ktg_settings_filters_hide_folder_names": "Compact folders",
|
"ktg_settings_filters_hide_folder_names": "Compact folders",
|
||||||
|
"ktg_settings_top_bar_mute": "Mute in profile top bar",
|
||||||
"ktg_settings_messages": "Messages",
|
"ktg_settings_messages": "Messages",
|
||||||
"ktg_settings_filters_hide_all": "Hide \"All chats\" folder",
|
"ktg_settings_filters_hide_all": "Hide \"All chats\" folder",
|
||||||
"ktg_settings_tray_icon": "Tray icon",
|
"ktg_settings_tray_icon": "Tray icon",
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,19 @@ infoTopBarMenu: IconButton(infoTopBarBack) {
|
||||||
iconPosition: point(18px, -1px);
|
iconPosition: point(18px, -1px);
|
||||||
rippleAreaPosition: point(1px, 6px);
|
rippleAreaPosition: point(1px, 6px);
|
||||||
}
|
}
|
||||||
infoTopBarCall: IconButton(infoTopBarMenu) {
|
|
||||||
|
infoTopBarNotifications: IconButton(infoTopBarMenu) {
|
||||||
width: 42px;
|
width: 42px;
|
||||||
|
icon: icon {{ "info/info_notifications", boxTitleCloseFg }};
|
||||||
|
iconOver: icon {{ "info/info_notifications", boxTitleCloseFgOver }};
|
||||||
|
iconPosition: point(5px, -1px);
|
||||||
|
rippleAreaPosition: point(0px, 6px);
|
||||||
|
}
|
||||||
|
infoNotificationsActive: icon {{
|
||||||
|
"info/info_notifications_active",
|
||||||
|
windowBgActive
|
||||||
|
}};
|
||||||
|
infoTopBarCall: IconButton(infoTopBarNotifications) {
|
||||||
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
||||||
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
||||||
iconPosition: point(5px, -1px);
|
iconPosition: point(5px, -1px);
|
||||||
|
|
@ -244,6 +255,12 @@ infoLayerTopBarMenu: IconButton(infoLayerTopBarClose) {
|
||||||
iconOver: icon {{ "title_menu_dots", boxTitleCloseFgOver }};
|
iconOver: icon {{ "title_menu_dots", boxTitleCloseFgOver }};
|
||||||
iconPosition: point(16px, -1px);
|
iconPosition: point(16px, -1px);
|
||||||
}
|
}
|
||||||
|
infoLayerTopBarNotifications: IconButton(infoLayerTopBarMenu) {
|
||||||
|
icon: icon {{ "info/info_notifications", boxTitleCloseFg }};
|
||||||
|
iconOver: icon {{ "info/info_notifications", boxTitleCloseFgOver }};
|
||||||
|
iconPosition: point(4px, -1px);
|
||||||
|
rippleAreaPosition: point(0px, 9px);
|
||||||
|
}
|
||||||
infoLayerTopBarCall: IconButton(infoLayerTopBarMenu) {
|
infoLayerTopBarCall: IconButton(infoLayerTopBarMenu) {
|
||||||
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
icon: icon {{ "top_bar_call", boxTitleCloseFg }};
|
||||||
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }};
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "info/info_wrap_widget.h"
|
#include "info/info_wrap_widget.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "kotato/kotato_settings_menu.h"
|
#include "kotato/kotato_settings_menu.h"
|
||||||
#include "info/profile/info_profile_widget.h"
|
#include "info/profile/info_profile_widget.h"
|
||||||
#include "info/profile/info_profile_values.h"
|
#include "info/profile/info_profile_values.h"
|
||||||
|
|
@ -36,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "menu/menu_mute.h"
|
||||||
#include "mtproto/mtproto_config.h"
|
#include "mtproto/mtproto_config.h"
|
||||||
#include "data/data_download_manager.h"
|
#include "data/data_download_manager.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
|
@ -377,6 +379,11 @@ void WrapWidget::createTopBar() {
|
||||||
}, _topBar->lifetime());
|
}, _topBar->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (section.type() == Section::Type::Profile
|
||||||
|
&& ::Kotato::JsonSettings::GetBool("profile_top_mute")) {
|
||||||
|
addProfileNotificationsButton();
|
||||||
|
}
|
||||||
|
|
||||||
_topBar->lower();
|
_topBar->lower();
|
||||||
_topBar->resizeToWidth(width());
|
_topBar->resizeToWidth(width());
|
||||||
_topBar->finishAnimating();
|
_topBar->finishAnimating();
|
||||||
|
|
@ -447,6 +454,45 @@ void WrapWidget::addProfileCallsButton() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WrapWidget::addProfileNotificationsButton() {
|
||||||
|
Expects(_topBar != nullptr);
|
||||||
|
|
||||||
|
const auto peer = key().peer();
|
||||||
|
if (!peer || peer->isSelf()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto topic = key().topic();
|
||||||
|
const auto topicRootId = topic ? topic->rootId() : MsgId();
|
||||||
|
const auto makeThread = [=] {
|
||||||
|
return topicRootId
|
||||||
|
? static_cast<Data::Thread*>(peer->forumTopicFor(topicRootId))
|
||||||
|
: reinterpret_cast<Data::Thread*>(peer->owner().history(peer).get());
|
||||||
|
};
|
||||||
|
auto notifications = _topBar->addButton(
|
||||||
|
base::make_unique_q<Ui::IconButton>(
|
||||||
|
_topBar,
|
||||||
|
(wrap() == Wrap::Layer
|
||||||
|
? st::infoLayerTopBarNotifications
|
||||||
|
: st::infoTopBarNotifications)));
|
||||||
|
MuteMenu::SetupMuteMenu(
|
||||||
|
notifications,
|
||||||
|
notifications->clicks() | rpl::to_empty,
|
||||||
|
makeThread,
|
||||||
|
_controller->uiShow());
|
||||||
|
Profile::NotificationsEnabledValue(
|
||||||
|
peer
|
||||||
|
) | rpl::start_with_next([notifications](bool enabled) {
|
||||||
|
const auto iconOverride = enabled
|
||||||
|
? &st::infoNotificationsActive
|
||||||
|
: nullptr;
|
||||||
|
const auto rippleOverride = enabled
|
||||||
|
? &st::lightButtonBgOver
|
||||||
|
: nullptr;
|
||||||
|
notifications->setIconOverride(iconOverride, iconOverride);
|
||||||
|
notifications->setRippleColorOverride(rippleOverride);
|
||||||
|
}, notifications->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
void WrapWidget::showTopBarMenu(bool check) {
|
void WrapWidget::showTopBarMenu(bool check) {
|
||||||
if (_topBarMenu) {
|
if (_topBarMenu) {
|
||||||
_topBarMenu->hideMenu(true);
|
_topBarMenu->hideMenu(true);
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@ private:
|
||||||
|
|
||||||
void addTopBarMenuButton();
|
void addTopBarMenuButton();
|
||||||
void addProfileCallsButton();
|
void addProfileCallsButton();
|
||||||
|
void addProfileNotificationsButton();
|
||||||
void showTopBarMenu(bool check);
|
void showTopBarMenu(bool check);
|
||||||
void deleteAllDownloads();
|
void deleteAllDownloads();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
addTranslateToMenu(about.text, AboutWithIdValue(_peer));
|
addTranslateToMenu(about.text, AboutWithIdValue(_peer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_peer->isSelf()) {
|
if (!_peer->isSelf() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) {
|
||||||
// No notifications toggle for Self => no separator.
|
// No notifications toggle for Self => no separator.
|
||||||
result->add(object_ptr<Ui::SlideWrap<>>(
|
result->add(object_ptr<Ui::SlideWrap<>>(
|
||||||
result,
|
result,
|
||||||
|
|
@ -950,7 +950,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::fill() {
|
||||||
add(object_ptr<Ui::BoxContentDivider>(_wrap));
|
add(object_ptr<Ui::BoxContentDivider>(_wrap));
|
||||||
add(CreateSkipWidget(_wrap));
|
add(CreateSkipWidget(_wrap));
|
||||||
add(setupInfo());
|
add(setupInfo());
|
||||||
if (!_peer->isSelf()) {
|
if (!_peer->isSelf() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) {
|
||||||
add(setupMuteToggle());
|
add(setupMuteToggle());
|
||||||
}
|
}
|
||||||
setupMainButtons();
|
setupMainButtons();
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "folders/hide_all_chats", {
|
{ "folders/hide_all_chats", {
|
||||||
.type = SettingType::BoolSetting,
|
.type = SettingType::BoolSetting,
|
||||||
.defaultValue = false, }},
|
.defaultValue = false, }},
|
||||||
|
{ "profile_top_mute", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
{ "folders/local", {
|
{ "folders/local", {
|
||||||
.scope = SettingScope::Account,
|
.scope = SettingScope::Account,
|
||||||
.type = SettingType::QJsonArraySetting, }},
|
.type = SettingType::QJsonArraySetting, }},
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ void SetupKotatoChats(
|
||||||
updateRecentStickersLimitHeight);
|
updateRecentStickersLimitHeight);
|
||||||
updateRecentStickersLimitLabel(::Kotato::JsonSettings::GetInt("recent_stickers_limit"));
|
updateRecentStickersLimitLabel(::Kotato::JsonSettings::GetInt("recent_stickers_limit"));
|
||||||
|
|
||||||
|
SettingsMenuJsonSwitch(ktg_settings_top_bar_mute, profile_top_mute);
|
||||||
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
||||||
SettingsMenuJsonSwitch(ktg_settings_always_show_scheduled, always_show_scheduled);
|
SettingsMenuJsonSwitch(ktg_settings_always_show_scheduled, always_show_scheduled);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue