fix: taskbar on Windows

fix: more branding
fix: smth
This commit is contained in:
ZavaruKitsu 2023-09-06 21:17:39 +03:00
parent f668c8d5ac
commit 3ccb0e16fc
36 changed files with 140 additions and 62 deletions

View file

@ -29,8 +29,8 @@ endif()
project(Telegram
LANGUAGES ${project_langs}
VERSION ${desktop_app_version_cmake}
DESCRIPTION "Official Telegram Desktop messenger"
HOMEPAGE_URL "https://desktop.telegram.org"
DESCRIPTION "AyuGram Desktop"
HOMEPAGE_URL "https://ayugram.one"
)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Telegram)

View file

@ -104,6 +104,8 @@ PRIVATE
ayu/ayu_constants.h
ayu/utils/telegram_helpers.cpp
ayu/utils/telegram_helpers.h
ayu/utils/windows_utils.cpp
ayu/utils/windows_utils.h
ayu/ui/ayu_lottie.cpp
ayu/ui/ayu_lottie.h
ayu/ui/ayu_assets.cpp

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View file

@ -4063,8 +4063,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_DontSendOnlinePackets" = "Don't send online";
"ayu_DontSendUploadProgress" = "Don't send typing";
"ayu_SendOfflinePacketAfterOnline" = "Immediate offline after online";
"ayu_MarkReadAfterSend" = "Send read status after reply";
"ayu_MarkReadAfterAction" = "Mark read after actions";
"ayu_MarkReadAfterSend" = "Send";
"ayu_MarkReadAfterReaction" = "Reaction";
"ayu_MarkReadAfterPoll" = "Poll";
"ayu_UseScheduledMessages" = "Schedule messages";
"ayu_SuggestGhostModeBeforeViewingStory" = "Alert before opening story";
"ayu_SpyEssentialsHeader" = "Spy essentials";
"ayu_SaveDeletedMessages" = "Save deleted messages";
"ayu_SaveMessagesHistory" = "Save edits history";
@ -4102,6 +4106,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_RegexFilters" = "Message Filters";
"ayu_RegexFiltersAmount" = "filters";
"ayu_RegexFiltersHeader" = "Filters";
"ayu_FiltersHideFromBlocked" = "Hide from blocked users";
"ayu_RegexFiltersEnableInChats" = "Enable in chats";
"ayu_RegexFiltersCaseInsensitive" = "Case insensitive expressions";
"ayu_RegexFiltersAdd" = "Add filter";
@ -4156,11 +4161,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_DisableStreamerModeTray" = "Disable Streamer Mode";
"ayu_EditsHistoryTitle" = "Edits history";
"ayu_EditsHistoryMenuText" = "History";
"ayu_ClearDeletedMenuText" = "Clear Deleted";
"ayu_ReadUntilMenuText" = "Read Message";
"ayu_DeleteKeepLocally" = "Keep locally";
"ayu_BoxActionReset" = "Reset";
"ayu_ReadConfirmationBoxQuestion" = "Do you want to read all messages?";
"ayu_ReadConfirmationBoxActionText" = "Read";
"ayu_ClearDeletedMessagesTitle" = "Clear deleted messages";
"ayu_ClearDeletedMessagesText" = "Are you sure you want to clear all deleted messages in this chat?";
"ayu_ClearDeletedMessagesActionText" = "Clear";
"ayu_SuggestGhostModeTitle" = "Ghost Mode";
"ayu_SuggestGhostModeStoryText" = "Do you want to enable Ghost Mode before viewing the story?";
"ayu_SuggestGhostModeStoryActionText" = "Enable";
"ayu_HideNextViewsDescriptionAyu" = "Hide my views forever, until Ghost Mode disabled.";
"ayu_EnableGhostModeStories" = "Enable Ghost Mode";
"ayu_GhostModeIsActive" = "Ghost Mode Is Active";
"ayu_AyuForwardStatusForwarding" = "Forwarding messages…";
"ayu_AyuForwardStatusLoadingMedia" = "Loading media…";
"ayu_AyuForwardForwardingDescription" = "Please keep this window open while AyuGram is forwarding your messages.";
@ -4175,5 +4190,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_ContextCopyCallbackData" = "Copy Callback Data";
"ayu_LocalPremiumNotice" = "You're using **local** Telegram Premium.\nIt **won't** give you any benefits, except translator.\n**Enjoy the star near your nickname!**";
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";
"ayu_IntroAbout" = "Welcome to the AyuGram Desktop.\nIt's cool and looks less ugly.";
"ayu_AboutText1" = "Just a cool Telegram client based on {api_link}.";
"ayu_UpdateAyuGram" = "Update AyuGram";
"ayu_UtilityRestartRequired" = "App will close in 5 seconds.";

View file

@ -1,8 +1,13 @@
<RCC>
<qresource prefix="/gui">
<file alias="art/ayu/default/logo256.png">../../art/ayu/default/logo256.png</file>
<file alias="art/ayu/default/logo256_no_margin.png">../../art/ayu/default/logo256_no_margin.png</file>
<file alias="art/ayu/default/logo256_no_margin.ico">../../art/ayu/default/logo256_no_margin.ico</file>
<file alias="art/ayu/alt/logo256.png">../../art/ayu/alt/logo256.png</file>
<file alias="art/ayu/alt/logo256_no_margin.png">../../art/ayu/alt/logo256_no_margin.png</file>
<file alias="art/ayu/alt/logo256_no_margin.ico">../../art/ayu/alt/logo256_no_margin.ico</file>
<file alias="art/ayu/nothing/logo256.png">../../art/ayu/nothing/logo256.png</file>
<file alias="art/ayu/nothing/logo256_no_margin.png">../../art/ayu/nothing/logo256_no_margin.png</file>
<file alias="art/ayu/nothing/logo256_no_margin.ico">../../art/ayu/nothing/logo256_no_margin.ico</file>
</qresource>
</RCC>

View file

@ -8,9 +8,25 @@
#include "ayu_assets.h"
#include "ayu/ayu_settings.h"
QString LAST_LOADED_NAME;
QImage LAST_LOADED;
QImage LAST_LOADED_NO_MARGIN;
static QString LAST_LOADED_NAME;
static QImage LAST_LOADED;
static QImage LAST_LOADED_NO_MARGIN;
void loadAppIco() {
auto settings = &AyuSettings::getInstance();
QString appDataPath = QDir::fromNativeSeparators(qgetenv("APPDATA"));
QString tempIconPath = appDataPath + "/AyuGram.ico";
// workaround for read-only file
auto f = QFile(tempIconPath);
if (f.exists()) {
f.setPermissions(QFile::WriteOther);
f.remove();
}
f.close();
QFile::copy(qsl(":/gui/art/ayu/%1/logo256_no_margin.ico").arg(settings->appIcon), tempIconPath);
}
void loadIcons()
{
@ -18,59 +34,27 @@ void loadIcons()
if (LAST_LOADED_NAME != settings->appIcon)
{
LAST_LOADED_NAME = settings->appIcon;
if (settings->appIcon == AyuSettings::DEFAULT_ICON)
{
LAST_LOADED = logo();
LAST_LOADED_NO_MARGIN = logoNoMargin();
}
else if (settings->appIcon == AyuSettings::ALT_ICON)
{
LAST_LOADED = logoAlt();
LAST_LOADED_NO_MARGIN = logoAltNoMargin();
}
else if (settings->appIcon == AyuSettings::NOTHING_ICON)
{
LAST_LOADED = logoNothing();
LAST_LOADED_NO_MARGIN = logoNothingNoMargin();
}
else
{
LAST_LOADED = logo();
LAST_LOADED_NO_MARGIN = logoNoMargin();
}
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/logo256.png").arg(settings->appIcon));
LAST_LOADED_NO_MARGIN = QImage(qsl(":/gui/art/ayu/%1/logo256_no_margin.png").arg(settings->appIcon));
}
}
QImage logo()
QImage logoPreview()
{
return QImage(qsl(":/gui/art/logo_256.png"));
return QImage(qsl(":/gui/art/ayu/default/logo256.png"));
}
QImage logoNoMargin()
{
return QImage(qsl(":/gui/art/logo_256_no_margin.png"));
}
QImage logoAlt()
QImage logoAltPreview()
{
return QImage(qsl(":/gui/art/ayu/alt/logo256.png"));
}
QImage logoAltNoMargin()
{
return QImage(qsl(":/gui/art/ayu/alt/logo256_no_margin.png"));
}
QImage logoNothing()
QImage logoNothingPreview()
{
return QImage(qsl(":/gui/art/ayu/nothing/logo256.png"));
}
QImage logoNothingNoMargin()
{
return QImage(qsl(":/gui/art/ayu/nothing/logo256_no_margin.png"));
}
QString currentAppLogoName()
{
return LAST_LOADED_NAME;

View file

@ -7,14 +7,11 @@
#pragma once
QImage logo();
QImage logoNoMargin();
void loadAppIco();
QImage logoAlt();
QImage logoAltNoMargin();
QImage logoNothing();
QImage logoNothingNoMargin();
QImage logoPreview();
QImage logoAltPreview();
QImage logoNothingPreview();
QString currentAppLogoName();
QImage currentAppLogo();

View file

@ -9,6 +9,7 @@
#include "ayu/ayu_settings.h"
#include "core/application.h"
#include "styles/style_layers.h"
#include "tray.h"
#include "ayu/ui/ayu_assets.h"
#include "main/main_domain.h"
@ -16,6 +17,10 @@
#include "ui/painter.h"
#include "window/main_window.h"
#ifdef Q_OS_WIN
#include "ayu/utils/windows_utils.h"
#endif
void drawIcon(QPainter& p, const QImage& icon, int offset, bool selected)
{
if (selected)
@ -40,9 +45,9 @@ void IconPicker::paintEvent(QPaintEvent* e)
Painter p(this);
PainterHighQualityEnabler hq(p);
auto icon1 = logo().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto icon2 = logoAlt().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto icon3 = logoNothing().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto icon1 = logoPreview().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto icon2 = logoAltPreview().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto icon3 = logoNothingPreview().scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
// todo: center
drawIcon(p, icon1, 0, currentAppLogoName() == AyuSettings::DEFAULT_ICON);
@ -76,8 +81,14 @@ void IconPicker::mousePressEvent(QMouseEvent* e)
{
AyuSettings::save();
#ifdef Q_OS_WIN
loadAppIco();
reloadAppIconFromTaskBar();
#endif
Window::OverrideApplicationIcon(currentAppLogo());
Core::App().refreshApplicationIcon();
Core::App().tray().updateIconCounters();
Core::App().domain().notifyUnreadBadgeChanged();
repaint();

View file

@ -0,0 +1,46 @@
// This is the source code of AyuGram for Desktop.
//
// We do not and cannot prevent the use of our code,
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2023
#include "windows_utils.h"
#include <ShlObj_core.h>
void reloadAppIconFromTaskBar() {
QString appdata = QDir::fromNativeSeparators(qgetenv("APPDATA"));
QString ayugramIconPath = appdata + "/AyuGram.ico";
QString shortcut = appdata + "/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar/AyuGram Desktop.lnk";
if (!QFile::exists(shortcut)) {
shortcut = appdata + "/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar/AyuGram.lnk";
}
if (QFile::exists(shortcut)) {
IShellLink *pShellLink = NULL;
IPersistFile *pPersistFile = NULL;
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
(void **) &pShellLink);
if (SUCCEEDED(hr)) {
hr = pShellLink->QueryInterface(IID_IPersistFile, (void **) &pPersistFile);
if (SUCCEEDED(hr)) {
WCHAR wszShortcutPath[MAX_PATH];
shortcut.toWCharArray(wszShortcutPath);
wszShortcutPath[shortcut.length()] = '\0';
if (SUCCEEDED(pPersistFile->Load(wszShortcutPath, STGM_READWRITE))) {
pShellLink->SetIconLocation(ayugramIconPath.toStdWString().c_str(), 0);
pPersistFile->Save(wszShortcutPath, TRUE);
}
pPersistFile->Release();
}
pShellLink->Release();
}
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
}

View file

@ -0,0 +1,9 @@
// This is the source code of AyuGram for Desktop.
//
// We do not and cannot prevent the use of our code,
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2023
#pragma once
void reloadAppIconFromTaskBar();

View file

@ -25,7 +25,7 @@ StartWidget::StartWidget(
: Step(parent, account, data, true) {
setMouseTracking(true);
setTitleText(rpl::single(u"AyuGram Desktop"_q));
setDescriptionText(tr::lng_intro_about());
setDescriptionText(tr::ayu_IntroAbout());
show();
}

View file

@ -38,6 +38,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_intro.h"
#include "styles/style_window.h"
// AyuGram includes
#include "ayu/ui/ayu_assets.h"
namespace Intro {
namespace details {
namespace {
@ -445,7 +449,8 @@ void Step::paintCover(QPainter &p, int top) {
planeLeft += deltaLeft;
// planeTop += top;
}
st::introCoverIcon.paint(p, planeLeft, planeTop, width());
const auto ayuGramIcon = Ui::PixmapFromImage(currentAppLogo());
QIcon(ayuGramIcon).paint(&p, QRect(width() / 2 - ayuGramIcon.width() / 2, planeTop - 16, ayuGramIcon.width(), st::introCoverIcon.height()));
}
int Step::contentLeft() const {

View file

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
// AyuGram includes
#include "ayu/ui/ayu_assets.h"
#include "ui/painter.h"
namespace Platform {
@ -94,6 +95,7 @@ constexpr auto kTooltipDelay = crl::time(10000);
return Window::WithSmallCounter(std::move(result), std::move(args));
}
QPainter p(&result);
PainterHighQualityEnabler hq(p); // AyuGram: fix for lq icons
const auto half = d.size / 2;
args.size = half;
p.drawPixmap(

View file

@ -20,9 +20,9 @@ namespace Platform {
namespace AppUserModelId {
namespace {
const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 };
const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 };
const PROPERTYKEY pkey_AppUserModel_ToastActivator = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 26 };
const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2666, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 };
const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2666, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 };
const PROPERTYKEY pkey_AppUserModel_ToastActivator = { { 0x9F4C2666, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 26 };
#ifdef OS_WIN_STORE
const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop.Store";

View file

@ -473,8 +473,8 @@ MainMenu::MainMenu(
parentResized();
_telegram->setMarkedText(Ui::Text::Link(
u"Telegram Desktop"_q,
u"https://desktop.telegram.org"_q));
u"AyuGram Desktop"_q,
u"https://ayugram.one"_q));
_telegram->setLinksTrusted();
_version->setMarkedText(
Ui::Text::Link(