feat: simple quotes & replies

Just like in 64Gram, but with ripples

Co-authored-by: c0re100 <corehusky@gmail.com>
This commit is contained in:
ZavaruKitsu 2023-11-10 15:52:58 +03:00
parent a5b446f6df
commit aa0d733cde
11 changed files with 62 additions and 9 deletions

View file

@ -4445,6 +4445,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
// AyuGram keys generated
"ayu_AyuPreferences" = "AyuGram Preferences";
"ayu_DocsText" = "Documentation";
"ayu_GhostEssentialsHeader" = "Ghost essentials";
"ayu_DontReadMessages" = "Don't read messages";
"ayu_DontReadStories" = "Don't read stories";
@ -4505,6 +4506,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_EnableExpression" = "Enable expression";
"ayu_CaseInsensitiveExpression" = "Case insensitive expression";
"ayu_RegexFiltersAddError" = "Regex syntax error";
"ayu_RegexFilterQuickAdd" = "Add filter";
"ayu_AyuSyncHeader" = "AyuSync";
"ayu_AyuSyncStatusTitle" = "Sync status";
"ayu_AyuSyncStatusOk" = "connected";
@ -4527,7 +4529,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuSyncDownloadAgent" = "Download agent";
"ayu_IconDefault" = "Default";
"ayu_IconAlternative" = "AyuGram Alt";
"ayu_IconDiscord" = "Discord";
"ayu_IconSpotify" = "Spotify";
"ayu_IconExtera" = "extera";
"ayu_IconNothing" = "Nothing";
"ayu_IconBard" = "Google Bard";
"ayu_IconYaPlus" = "Yandex Plus";
"ayu_WALMode" = "Enable WAL mode";
"ayu_PushNotificationCount" = "FCM notifications received";
"ayu_ClearAyuDatabase" = "Clear Ayu Database";
@ -4554,8 +4561,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_DisableStreamerModeTray" = "Disable Streamer Mode";
"ayu_EditsHistoryTitle" = "Edits history";
"ayu_EditsHistoryMenuText" = "History";
"ayu_PeekOnlineMenuText" = "Peek Online";
"ayu_ClearDeletedMenuText" = "Clear Deleted";
"ayu_ViewFiltersMenuText" = "View Filters";
"ayu_PeekOnlineSuccess" = "Peeked via";
"ayu_OneViewTTL" = "one view";
"ayu_ReadUntilMenuText" = "Read Message";
"ayu_DeleteKeepLocally" = "Keep locally";
@ -4566,11 +4575,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"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_SuggestGhostModeStoryText" = "Do you want to enable **Ghost Mode** before viewing the story?";
"ayu_SuggestGhostModeStoryActionTextYes" = "Yes";
"ayu_SuggestGhostModeStoryActionTextNo" = "No";
"ayu_HideNextViewsDescriptionAyu" = "Hide my views forever, until Ghost Mode disabled.";
"ayu_EnableGhostModeStories" = "Enable Ghost Mode";
"ayu_GhostModeIsActive" = "Ghost Mode Is Active";
"ayu_SimpleQuotesAndReplies" = "Simple quotes & replies";
"ayu_MainFont" = "Application font";
"ayu_MonospaceFont" = "Monospace font";
"ayu_FontDefault" = "Default";
@ -4580,6 +4591,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuForwardForwardingDescription" = "Please keep this window open while AyuGram is forwarding your messages.";
"ayu_AyuForwardLoadingMediaDescription" = "Please keep this window open while AyuGram is downloading media from your messages.";
"ayu_DeleteDateMenuText" = "Delete Date";
"ayu_ForwardableMenuText" = "Forwardable";
"ayu_ForwardableMenuTextNo" = "No";
"ayu_LikelyOfflineStatus" = "offline ?";
"ayu_GhostModeShortcut" = "Enter with Ghost";
"ayu_SettingsShowMessageSeconds" = "Show message seconds";

View file

@ -265,6 +265,10 @@ void AyuGramSettings::set_appIcon(QString val)
appIcon = std::move(val);
}
void AyuGramSettings::set_simpleQuotesAndReplies(bool val) {
simpleQuotesAndReplies = val;
}
void AyuGramSettings::set_deletedMark(QString val)
{
deletedMark = std::move(val);

View file

@ -60,6 +60,7 @@ public:
// ~ Customization
appIcon = DEFAULT_ICON;
simpleQuotesAndReplies = true;
deletedMark = "🧹";
editedMark = tr::lng_edited(tr::now);
recentStickersCount = 20;
@ -100,6 +101,7 @@ public:
bool localPremium;
bool copyUsernameAsLink;
QString appIcon;
bool simpleQuotesAndReplies;
QString deletedMark;
QString editedMark;
int recentStickersCount;
@ -150,6 +152,8 @@ public:
void set_appIcon(QString val);
void set_simpleQuotesAndReplies(bool val);
void set_deletedMark(QString val);
void set_editedMark(QString val);

View file

@ -800,6 +800,22 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
AyuSettings::save();
}, container->lifetime());
AddButton(
container,
tr::ayu_SimpleQuotesAndReplies(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->simpleQuotesAndReplies)
)->toggledValue(
) | rpl::filter([=](bool enabled)
{
return (enabled != settings->simpleQuotesAndReplies);
}) | start_with_next([=](bool enabled)
{
settings->set_simpleQuotesAndReplies(enabled);
AyuSettings::save();
}, container->lifetime());
AddButton(
container,
tr::ayu_ShowGhostToggleInDrawer(),

View file

@ -33,6 +33,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_chat.h"
#include "styles/style_dialogs.h"
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace HistoryView {
namespace {
@ -618,13 +622,15 @@ void Reply::paint(
inBubble,
colorIndexPlusOne)]
: nullptr;
const auto rippleColor = cache->bg;
const auto rippleColor = cache->bg2;
if (!inBubble) {
cache->bg = QColor(0, 0, 0, 0);
}
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
if (backgroundEmoji) {
const auto settings = &AyuSettings::getInstance();
if (!settings->simpleQuotesAndReplies && backgroundEmoji) {
ValidateBackgroundEmoji(
backgroundEmojiId,
backgroundEmoji,

View file

@ -241,7 +241,7 @@ void ViewButton::draw(
const auto radius = st::historyPagePreview.radius;
if (_inner->ripple && !_inner->ripple->empty()) {
_inner->ripple->paint(p, r.left(), r.top(), r.width(), &cache->bg);
_inner->ripple->paint(p, r.left(), r.top(), r.width(), &cache->bg2);
}
PainterHighQualityEnabler hq(p);

View file

@ -228,7 +228,7 @@ void Game::draw(Painter &p, const PaintContext &context) const {
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
if (_ripple) {
_ripple->paint(p, outer.x(), outer.y(), width(), &cache->bg);
_ripple->paint(p, outer.x(), outer.y(), width(), &cache->bg2);
if (_ripple->empty()) {
_ripple = nullptr;
}

View file

@ -372,7 +372,7 @@ void Giveaway::paintChannels(
geometry.x(),
geometry.y(),
width(),
&cache->bg);
&cache->bg2);
if (channel.ripple->empty()) {
channel.ripple = nullptr;
}

View file

@ -530,7 +530,7 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
if (_ripple) {
_ripple->paint(p, outer.x(), outer.y(), width(), &cache->bg);
_ripple->paint(p, outer.x(), outer.y(), width(), &cache->bg2);
if (_ripple->empty()) {
_ripple = nullptr;
}

View file

@ -17,6 +17,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_dialogs.h"
#include "styles/style_widgets.h"
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace Ui {
namespace {
@ -39,8 +43,14 @@ void EnsureBlockquoteCache(
cache = std::make_unique<Text::QuotePaintCache>();
const auto &colors = values();
cache->bg = colors.bg;
cache->bg2 = colors.bg;
cache->outlines = colors.outlines;
cache->icon = colors.name;
const auto settings = &AyuSettings::getInstance();
if (settings->simpleQuotesAndReplies) {
cache->bg = QColor(0, 0, 0, 0);
}
}
void EnsurePreCache(

@ -1 +1 @@
Subproject commit 5b079bd1bd6dcf1e55d9bba5aa1b5ff67b60e45c
Subproject commit f370fb3a0a3cc3de41291f8ad23d5a9746794744