diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index a8e39557e..464c82bf8 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_common.h" #include "api/api_updates.h" #include "base/qt/qt_common_adapters.h" +#include "base/custom_app_icon.h" #include "zlib.h" @@ -283,6 +284,29 @@ auto GenerateCodes() { Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing.."); }); +#ifdef Q_OS_MAC + codes.emplace(qsl("customicon"), [](SessionController *window) { + const auto iconFilters = qsl("Icon files (*.icns *.png);;") + FileDialog::AllFilesFilter(); + const auto change = [](const QString &path) { + const auto success = path.isEmpty() + ? base::ClearCustomAppIcon() + : base::SetCustomAppIcon(path); + Ui::Toast::Show(success + ? (path.isEmpty() + ? "Icon cleared. Restarting the Dock." + : "Icon updated. Restarting the Dock.") + : (path.isEmpty() + ? "Icon clear failed. See log.txt for details." + : "Icon update failed. See log.txt for details.")); + }; + FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Choose custom icon", iconFilters, [=](const FileDialog::OpenResult &result) { + change(result.paths.isEmpty() ? QString() : result.paths.front()); + }, [=] { + change(QString()); + }); + }); +#endif // Q_OS_MAC + return codes; } diff --git a/Telegram/lib_base b/Telegram/lib_base index eb631e9f8..2aebd29af 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit eb631e9f8cd36d2e969ed490e34560e5d87f5a83 +Subproject commit 2aebd29afcad5929bde456dfcd3bf71a7bf25760