2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 06:07:45 +00:00

Option to disable taskbar flashing

This commit is contained in:
RadRussianRus 2020-02-23 05:30:39 +03:00
parent 6aa631cba9
commit c06486d2ce
9 changed files with 45 additions and 2 deletions

View File

@ -15,5 +15,6 @@
// "net_speed_boost": null,
// "show_phone_in_drawer": true,
// "scales": [],
// "confirm_before_calls": false
// "confirm_before_calls": false,
// "no_taskbar_flash": false
}

View File

@ -2355,6 +2355,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_net_boost_restart_desc" = "You'll need to restart app to change upload boost.\n\nRestart now?";
"ktg_settings_system" = "System";
"ktg_settings_no_taskbar_flash" = "Disable taskbar flashing";
"ktg_settings_other" = "Other";
"ktg_settings_show_chat_id" = "Show chat ID";
"ktg_profile_copy_id" = "Copy ID";

View File

@ -74,6 +74,8 @@
"ktg_net_speed_boost_medium": "Среднее",
"ktg_net_speed_boost_big": "Высокое",
"ktg_net_boost_restart_desc": "Для изменения ускорения загрузки на сервер требуется перезапуск.\n\nПерезапустить сейчас?",
"ktg_settings_system": "Система",
"ktg_settings_no_taskbar_flash": "Отключить мигание на панели задач",
"ktg_settings_other": "Прочие",
"ktg_settings_show_chat_id": "Показывать ID чата",
"ktg_profile_copy_id": "Копировать ID",

View File

@ -270,6 +270,11 @@ bool Manager::readCustomFile() {
if (settingsCallConfirmIt != settings.constEnd() && (*settingsCallConfirmIt).isBool()) {
cSetConfirmBeforeCall((*settingsCallConfirmIt).toBool());
}
const auto settingsNoTaskbarFlashing = settings.constFind(qsl("no_taskbar_flash"));
if (settingsNoTaskbarFlashing != settings.constEnd() && (*settingsNoTaskbarFlashing).isBool()) {
cSetNoTaskbarFlashing((*settingsNoTaskbarFlashing).toBool());
}
return true;
}
@ -309,6 +314,7 @@ void Manager::writeDefaultFile() {
settings.insert(qsl("chat_list_lines"), DialogListLines());
settings.insert(qsl("disable_up_edit"), cDisableUpEdit());
settings.insert(qsl("confirm_before_calls"), cConfirmBeforeCall());
settings.insert(qsl("no_taskbar_flash"), cNoTaskbarFlashing());
auto settingsScales = QJsonArray();
settings.insert(qsl("scales"), settingsScales);
@ -369,6 +375,7 @@ void Manager::writeCurrentSettings() {
settings.insert(qsl("chat_list_lines"), DialogListLines());
settings.insert(qsl("disable_up_edit"), cDisableUpEdit());
settings.insert(qsl("confirm_before_calls"), cConfirmBeforeCall());
settings.insert(qsl("no_taskbar_flash"), cNoTaskbarFlashing());
auto settingsScales = QJsonArray();
auto currentScales = cInterfaceScales();

View File

@ -220,6 +220,7 @@ bool gUseSystemFont = false;
bool gUseOriginalMetrics = false;
rpl::variable<int> gStickerHeight = 170;
void SetStickerHeight(int height) {
gStickerHeight = height;
@ -301,3 +302,4 @@ bool AddCustomReplace(QString from, QString to) {
}
bool gConfirmBeforeCall = false;
bool gNoTaskbarFlashing = false;

View File

@ -188,6 +188,7 @@ DeclareSetting(QString, MonospaceFont);
DeclareSetting(bool, UseSystemFont);
DeclareSetting(bool, UseOriginalMetrics);
void SetBigEmojiOutline(bool enabled);
[[nodiscard]] bool BigEmojiOutline();
[[nodiscard]] rpl::producer<bool> BigEmojiOutlineChanges();
@ -240,3 +241,4 @@ using CustomReplacementsMap = QMap<QString, QString>;
DeclareRefSetting(CustomReplacementsMap, CustomReplaces);
bool AddCustomReplace(QString from, QString to);
DeclareSetting(bool, ConfirmBeforeCall);
DeclareSetting(bool, NoTaskbarFlashing);

View File

@ -169,6 +169,28 @@ void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container) {
AddSkip(container);
}
void SetupKotatoSystem(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
AddSubsectionTitle(container, tr::ktg_settings_system());
AddButton(
container,
tr::ktg_settings_no_taskbar_flash(),
st::settingsButton
)->toggleOn(
rpl::single(cNoTaskbarFlashing())
)->toggledValue(
) | rpl::filter([](bool enabled) {
return (enabled != cNoTaskbarFlashing());
}) | rpl::start_with_next([](bool enabled) {
cSetNoTaskbarFlashing(enabled);
KotatoSettings::Write();
}, container->lifetime());
AddSkip(container);
}
void SetupKotatoOther(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container);
@ -231,6 +253,7 @@ void Kotato::setupContent(not_null<Window::SessionController*> controller) {
SetupKotatoChats(content);
SetupKotatoNetwork(content);
SetupKotatoSystem(content);
SetupKotatoOther(content);
Ui::ResizeFitChild(this, content);

View File

@ -15,6 +15,7 @@ namespace Settings {
void SetupKotatoChats(not_null<Ui::VerticalLayout*> container);
void SetupKotatoNetwork(not_null<Ui::VerticalLayout*> container);
void SetupKotatoSystem(not_null<Ui::VerticalLayout*> container);
void SetupKotatoOther(not_null<Ui::VerticalLayout*> container);
class Kotato : public Section {

View File

@ -290,7 +290,9 @@ void System::showNext() {
}
}
if (alert) {
Platform::Notifications::FlashBounce();
if (!cNoTaskbarFlashing()) {
Platform::Notifications::FlashBounce();
}
if (Global::SoundNotify() && !Platform::Notifications::SkipAudio()) {
ensureSoundCreated();
_soundTrack->playOnce();