mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Allow to set custom app icon on macOS.
This commit is contained in:
parent
d89d8b09da
commit
666251f23e
2 changed files with 25 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit eb631e9f8cd36d2e969ed490e34560e5d87f5a83
|
||||
Subproject commit 2aebd29afcad5929bde456dfcd3bf71a7bf25760
|
Loading…
Add table
Reference in a new issue