mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-13 04:37:11 +02:00
feat: hide notification badge on windows
This commit is contained in:
parent
b2efc2ad14
commit
c4e1e8415c
6 changed files with 53 additions and 4 deletions
|
@ -5456,6 +5456,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_EditedMarkText" = "Edited Mark";
|
||||
"ayu_SemiTransparentDeletedMessages" = "Translucent Deleted Messages";
|
||||
"ayu_HideNotificationCounters" = "Hide Notification Counters";
|
||||
"ayu_HideNotificationBadge" = "Hide Notification Badge";
|
||||
"ayu_HideAllChats" = "Hide \"All Chats\" Tab";
|
||||
"ayu_ChannelBottomButton" = "Channel Bottom Button";
|
||||
"ayu_ChannelBottomButtonHide" = "Hide";
|
||||
|
|
|
@ -249,6 +249,7 @@ AyuGramSettings::AyuGramSettings() {
|
|||
monoFont = "";
|
||||
|
||||
hideNotificationCounters = false;
|
||||
hideNotificationBadge = false;
|
||||
hideAllChatsFolder = false;
|
||||
|
||||
/*
|
||||
|
@ -451,6 +452,10 @@ void AyuGramSettings::set_hideNotificationCounters(bool val) {
|
|||
hideNotificationCounters = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideNotificationBadge(bool val) {
|
||||
hideNotificationBadge = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideAllChatsFolder(bool val) {
|
||||
hideAllChatsFolder = val;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
QString monoFont;
|
||||
|
||||
bool hideNotificationCounters;
|
||||
bool hideNotificationBadge;
|
||||
bool hideAllChatsFolder;
|
||||
|
||||
int channelBottomButton;
|
||||
|
@ -131,6 +132,7 @@ public:
|
|||
void set_monoFont(QString val);
|
||||
|
||||
void set_hideNotificationCounters(bool val);
|
||||
void set_hideNotificationBadge(bool val);
|
||||
void set_hideAllChatsFolder(bool val);
|
||||
|
||||
void set_channelBottomButton(int val);
|
||||
|
@ -184,6 +186,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
|||
showStreamerToggleInTray,
|
||||
monoFont,
|
||||
hideNotificationCounters,
|
||||
hideNotificationBadge,
|
||||
hideAllChatsFolder,
|
||||
channelBottomButton,
|
||||
showPeerId,
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#include "styles/style_widgets.h"
|
||||
|
||||
#include "icon_picker.h"
|
||||
#include "tray.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_domain.h"
|
||||
#include "styles/style_ayu_icons.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/vertical_list.h"
|
||||
|
@ -1203,7 +1205,7 @@ void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
|||
});
|
||||
}
|
||||
|
||||
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddButtonWithIcon(
|
||||
|
@ -1225,6 +1227,32 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container) {
|
|||
},
|
||||
container->lifetime());
|
||||
|
||||
// not about folders, but it's a good place for it
|
||||
#ifdef Q_OS_WIN
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideNotificationBadge(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->hideNotificationBadge)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->hideNotificationBadge);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_hideNotificationBadge(enabled);
|
||||
AyuSettings::save();
|
||||
|
||||
Core::App().refreshApplicationIcon();
|
||||
Core::App().tray().updateIconCounters();
|
||||
Core::App().domain().notifyUnreadBadgeChanged();
|
||||
},
|
||||
container->lifetime());
|
||||
#endif
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideAllChats(),
|
||||
|
@ -1377,7 +1405,7 @@ void SetupCustomization(not_null<Ui::VerticalLayout*> container,
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupFolderSettings(container);
|
||||
SetupFolderSettings(container, controller);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <Windowsx.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
// Taken from qtbase/src/gui/image/qpixmap_win.cpp
|
||||
HICON qt_pixmapToWinHICON(const QPixmap &);
|
||||
HBITMAP qt_imageToWinHBITMAP(const QImage &, int hbitmapFormat);
|
||||
|
@ -508,8 +512,10 @@ void MainWindow::unreadCounterChangedHook() {
|
|||
}
|
||||
|
||||
void MainWindow::updateTaskbarAndIconCounters() {
|
||||
const auto counter = Core::App().unreadBadge();
|
||||
const auto muted = Core::App().unreadBadgeMuted();
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
|
||||
const auto counter = settings->hideNotificationBadge ? 0 : Core::App().unreadBadge();
|
||||
const auto muted = settings->hideNotificationBadge ? 0 : Core::App().unreadBadgeMuted();
|
||||
const auto controller = sessionController();
|
||||
const auto session = controller ? &controller->session() : nullptr;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QBuffer>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
#include "ayu/ui/ayu_logo.h"
|
||||
#include "styles/style_ayu_icons.h"
|
||||
|
||||
|
@ -141,6 +142,11 @@ bool DarkTasbarValueValid/* = false*/;
|
|||
ScaledLogoLight = base::flat_map<int, QImage>();
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationBadge) {
|
||||
args.count = 0;
|
||||
}
|
||||
|
||||
const auto darkMode = IsDarkTaskbar();
|
||||
auto &scaled = (monochrome && darkMode)
|
||||
? (*darkMode
|
||||
|
|
Loading…
Add table
Reference in a new issue