mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-21 13:12:50 +02:00
chore: refactor settings
This commit is contained in:
parent
4870d59a43
commit
409165dec6
65 changed files with 647 additions and 651 deletions
|
@ -171,8 +171,8 @@ void Polls::sendVotes(
|
|||
hideSending();
|
||||
_session->updates().applyUpdates(result);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction && item)
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction && item)
|
||||
{
|
||||
readHistory(item);
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ void SendProgressManager::send(const Key &key, int progress) {
|
|||
}
|
||||
|
||||
// AyuGram sendUploadProgress
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendUploadProgress)
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendUploadProgress)
|
||||
{
|
||||
DEBUG_LOG(("[AyuGram] Don't send upload progress"));
|
||||
return;
|
||||
|
|
|
@ -997,10 +997,10 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
|
|||
});
|
||||
|
||||
// AyuGram sendOnlinePackets
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
const auto& config = _session->serverConfig();
|
||||
bool isOnlineOrig = Core::App().hasActiveWindow(&session());
|
||||
bool isOnline = settings->sendOnlinePackets && isOnlineOrig;
|
||||
bool isOnline = settings.sendOnlinePackets && isOnlineOrig;
|
||||
|
||||
int updateIn = config.onlineUpdatePeriod;
|
||||
Assert(updateIn >= 0);
|
||||
|
|
|
@ -302,8 +302,8 @@ void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
|
|||
base::unixtime::now(),
|
||||
_topPromotionNextRequestTime);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableAds) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableAds) {
|
||||
_session->data().setTopPromoted(nullptr, QString(), QString());
|
||||
return;
|
||||
}
|
||||
|
@ -507,8 +507,8 @@ void ApiWrap::toggleHistoryArchived(
|
|||
if (archived) {
|
||||
history->setFolder(_session->data().folder(archiveId));
|
||||
} else {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideAllChatsFolder) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideAllChatsFolder) {
|
||||
if (const auto window = Core::App().activeWindow()) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
const auto filters = &_session->data().chatsFilters();
|
||||
|
@ -1384,7 +1384,7 @@ void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
|||
|
||||
void ApiWrap::markContentsRead(
|
||||
const base::flat_set<not_null<HistoryItem*>> &items) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto markedIds = QVector<MTPint>();
|
||||
auto channelMarkedIds = base::flat_map<
|
||||
|
@ -1398,7 +1398,7 @@ void ApiWrap::markContentsRead(
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!settings->sendReadMessages && !passthrough) {
|
||||
if (!settings.sendReadMessages && !passthrough) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1430,8 +1430,8 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && !passthrough) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && !passthrough) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1833,8 +1833,8 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
|||
using Flag = ChannelDataFlag;
|
||||
chatParticipants().loadSimilarPeers(channel);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->collapseSimilarChannels) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.collapseSimilarChannels) {
|
||||
channel->setFlags(channel->flags() | Flag::SimilarExpanded);
|
||||
}
|
||||
}
|
||||
|
@ -3461,8 +3461,8 @@ void ApiWrap::forwardMessages(
|
|||
shared->callback();
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction && history->lastMessage())
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
||||
{
|
||||
readHistory(history->lastMessage());
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ void initLang() {
|
|||
}
|
||||
|
||||
void initUiSettings() {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
AyuUiSettings::setMonoFont(settings->monoFont);
|
||||
AyuUiSettings::setWideMultiplier(settings->wideMultiplier);
|
||||
AyuUiSettings::setMonoFont(settings.monoFont);
|
||||
AyuUiSettings::setWideMultiplier(settings.wideMultiplier);
|
||||
}
|
||||
|
||||
void initDatabase() {
|
||||
|
|
|
@ -219,6 +219,7 @@ AyuGramSettings::AyuGramSettings() {
|
|||
disableAds = true;
|
||||
disableStories = false;
|
||||
disableCustomBackgrounds = true;
|
||||
showOnlyAddedEmojisAndStickers = false;
|
||||
collapseSimilarChannels = true;
|
||||
hideSimilarChannels = false;
|
||||
|
||||
|
@ -300,32 +301,32 @@ AyuGramSettings::AyuGramSettings() {
|
|||
voiceConfirmation = false;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendReadMessages(bool val) {
|
||||
sendReadMessages = val;
|
||||
void set_sendReadMessages(bool val) {
|
||||
settings->sendReadMessages = val;
|
||||
sendReadMessagesReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendReadStories(bool val) {
|
||||
sendReadStories = val;
|
||||
void set_sendReadStories(bool val) {
|
||||
settings->sendReadStories = val;
|
||||
sendReadStoriesReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendOnlinePackets(bool val) {
|
||||
sendOnlinePackets = val;
|
||||
void set_sendOnlinePackets(bool val) {
|
||||
settings->sendOnlinePackets = val;
|
||||
sendOnlinePacketsReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendUploadProgress(bool val) {
|
||||
sendUploadProgress = val;
|
||||
void set_sendUploadProgress(bool val) {
|
||||
settings->sendUploadProgress = val;
|
||||
sendUploadProgressReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendOfflinePacketAfterOnline(bool val) {
|
||||
sendOfflinePacketAfterOnline = val;
|
||||
void set_sendOfflinePacketAfterOnline(bool val) {
|
||||
settings->sendOfflinePacketAfterOnline = val;
|
||||
sendOfflinePacketAfterOnlineReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_ghostModeEnabled(bool val) {
|
||||
void set_ghostModeEnabled(bool val) {
|
||||
set_sendReadMessages(!val);
|
||||
set_sendReadStories(!val);
|
||||
set_sendOnlinePackets(!val);
|
||||
|
@ -339,235 +340,234 @@ void AyuGramSettings::set_ghostModeEnabled(bool val) {
|
|||
}
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_markReadAfterAction(bool val) {
|
||||
markReadAfterAction = val;
|
||||
void set_markReadAfterAction(bool val) {
|
||||
settings->markReadAfterAction = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_useScheduledMessages(bool val) {
|
||||
useScheduledMessages = val;
|
||||
void set_useScheduledMessages(bool val) {
|
||||
settings->useScheduledMessages = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_sendWithoutSound(bool val) {
|
||||
sendWithoutSound = val;
|
||||
void set_sendWithoutSound(bool val) {
|
||||
settings->sendWithoutSound = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_saveDeletedMessages(bool val) {
|
||||
saveDeletedMessages = val;
|
||||
void set_saveDeletedMessages(bool val) {
|
||||
settings->saveDeletedMessages = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_saveMessagesHistory(bool val) {
|
||||
saveMessagesHistory = val;
|
||||
void set_saveMessagesHistory(bool val) {
|
||||
settings->saveMessagesHistory = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_saveForBots(bool val) {
|
||||
saveForBots = val;
|
||||
void set_saveForBots(bool val) {
|
||||
settings->saveForBots = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideFromBlocked(bool val) {
|
||||
hideFromBlocked = val;
|
||||
void set_hideFromBlocked(bool val) {
|
||||
settings->hideFromBlocked = val;
|
||||
hideFromBlockedReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableAds(bool val) {
|
||||
disableAds = val;
|
||||
void set_disableAds(bool val) {
|
||||
settings->disableAds = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableStories(bool val) {
|
||||
disableStories = val;
|
||||
void set_disableStories(bool val) {
|
||||
settings->disableStories = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableCustomBackgrounds(bool val) {
|
||||
disableCustomBackgrounds = val;
|
||||
void set_disableCustomBackgrounds(bool val) {
|
||||
settings->disableCustomBackgrounds = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showOnlyAddedEmojisAndStickers(bool val) {
|
||||
showOnlyAddedEmojisAndStickers = val;
|
||||
void set_showOnlyAddedEmojisAndStickers(bool val) {
|
||||
settings->showOnlyAddedEmojisAndStickers = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_collapseSimilarChannels(bool val) {
|
||||
collapseSimilarChannels = val;
|
||||
void set_collapseSimilarChannels(bool val) {
|
||||
settings->collapseSimilarChannels = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideSimilarChannels(bool val) {
|
||||
hideSimilarChannels = val;
|
||||
void set_hideSimilarChannels(bool val) {
|
||||
settings->hideSimilarChannels = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_wideMultiplier(double val) {
|
||||
wideMultiplier = val;
|
||||
void set_wideMultiplier(double val) {
|
||||
settings->wideMultiplier = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_spoofWebviewAsAndroid(bool val) {
|
||||
spoofWebviewAsAndroid = val;
|
||||
void set_spoofWebviewAsAndroid(bool val) {
|
||||
settings->spoofWebviewAsAndroid = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_increaseWebviewHeight(bool val) {
|
||||
increaseWebviewHeight = val;
|
||||
void set_increaseWebviewHeight(bool val) {
|
||||
settings->increaseWebviewHeight = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_increaseWebviewWidth(bool val) {
|
||||
increaseWebviewWidth = val;
|
||||
void set_increaseWebviewWidth(bool val) {
|
||||
settings->increaseWebviewWidth = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableNotificationsDelay(bool val) {
|
||||
disableNotificationsDelay = val;
|
||||
void set_disableNotificationsDelay(bool val) {
|
||||
settings->disableNotificationsDelay = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_localPremium(bool val) {
|
||||
localPremium = val;
|
||||
void set_localPremium(bool val) {
|
||||
settings->localPremium = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_appIcon(QString val) {
|
||||
appIcon = std::move(val);
|
||||
void set_appIcon(QString val) {
|
||||
settings->appIcon = std::move(val);
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_simpleQuotesAndReplies(bool val) {
|
||||
simpleQuotesAndReplies = val;
|
||||
void set_simpleQuotesAndReplies(bool val) {
|
||||
settings->simpleQuotesAndReplies = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_replaceBottomInfoWithIcons(bool val) {
|
||||
replaceBottomInfoWithIcons = val;
|
||||
void set_replaceBottomInfoWithIcons(bool val) {
|
||||
settings->replaceBottomInfoWithIcons = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_deletedMark(QString val) {
|
||||
deletedMark = std::move(val);
|
||||
deletedMarkReactive = deletedMark;
|
||||
void set_deletedMark(QString val) {
|
||||
settings->deletedMark = std::move(val);
|
||||
deletedMarkReactive = settings->deletedMark;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_editedMark(QString val) {
|
||||
editedMark = std::move(val);
|
||||
editedMarkReactive = editedMark;
|
||||
void set_editedMark(QString val) {
|
||||
settings->editedMark = std::move(val);
|
||||
editedMarkReactive = settings->editedMark;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_recentStickersCount(int val) {
|
||||
recentStickersCount = val;
|
||||
void set_recentStickersCount(int val) {
|
||||
settings->recentStickersCount = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showReactionsPanelInContextMenu(int val) {
|
||||
showReactionsPanelInContextMenu = val;
|
||||
void set_showReactionsPanelInContextMenu(int val) {
|
||||
settings->showReactionsPanelInContextMenu = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showViewsPanelInContextMenu(int val) {
|
||||
showViewsPanelInContextMenu = val;
|
||||
void set_showViewsPanelInContextMenu(int val) {
|
||||
settings->showViewsPanelInContextMenu = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showHideMessageInContextMenu(int val) {
|
||||
showHideMessageInContextMenu = val;
|
||||
void set_showHideMessageInContextMenu(int val) {
|
||||
settings->showHideMessageInContextMenu = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showUserMessagesInContextMenu(int val) {
|
||||
showUserMessagesInContextMenu = val;
|
||||
void set_showUserMessagesInContextMenu(int val) {
|
||||
settings->showUserMessagesInContextMenu = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageDetailsInContextMenu(int val) {
|
||||
showMessageDetailsInContextMenu = val;
|
||||
void set_showMessageDetailsInContextMenu(int val) {
|
||||
settings->showMessageDetailsInContextMenu = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showAttachButtonInMessageField(bool val) {
|
||||
showAttachButtonInMessageField = val;
|
||||
void set_showAttachButtonInMessageField(bool val) {
|
||||
settings->showAttachButtonInMessageField = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showCommandsButtonInMessageField(bool val) {
|
||||
showCommandsButtonInMessageField = val;
|
||||
void set_showCommandsButtonInMessageField(bool val) {
|
||||
settings->showCommandsButtonInMessageField = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showEmojiButtonInMessageField(bool val) {
|
||||
showEmojiButtonInMessageField = val;
|
||||
void set_showEmojiButtonInMessageField(bool val) {
|
||||
settings->showEmojiButtonInMessageField = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMicrophoneButtonInMessageField(bool val) {
|
||||
showMicrophoneButtonInMessageField = val;
|
||||
void set_showMicrophoneButtonInMessageField(bool val) {
|
||||
settings->showMicrophoneButtonInMessageField = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showAutoDeleteButtonInMessageField(bool val) {
|
||||
showAutoDeleteButtonInMessageField = val;
|
||||
void set_showAutoDeleteButtonInMessageField(bool val) {
|
||||
settings->showAutoDeleteButtonInMessageField = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showAttachPopup(bool val) {
|
||||
showAttachPopup = val;
|
||||
void set_showAttachPopup(bool val) {
|
||||
settings->showAttachPopup = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showEmojiPopup(bool val) {
|
||||
showEmojiPopup = val;
|
||||
void set_showEmojiPopup(bool val) {
|
||||
settings->showEmojiPopup = val;
|
||||
triggerHistoryUpdate();
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showLReadToggleInDrawer(bool val) {
|
||||
showLReadToggleInDrawer = val;
|
||||
void set_showLReadToggleInDrawer(bool val) {
|
||||
settings->showLReadToggleInDrawer = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showSReadToggleInDrawer(bool val) {
|
||||
showSReadToggleInDrawer = val;
|
||||
void set_showSReadToggleInDrawer(bool val) {
|
||||
settings->showSReadToggleInDrawer = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showGhostToggleInDrawer(bool val) {
|
||||
showGhostToggleInDrawer = val;
|
||||
void set_showGhostToggleInDrawer(bool val) {
|
||||
settings->showGhostToggleInDrawer = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showStreamerToggleInDrawer(bool val) {
|
||||
showStreamerToggleInDrawer = val;
|
||||
void set_showStreamerToggleInDrawer(bool val) {
|
||||
settings->showStreamerToggleInDrawer = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showGhostToggleInTray(bool val) {
|
||||
showGhostToggleInTray = val;
|
||||
void set_showGhostToggleInTray(bool val) {
|
||||
settings->showGhostToggleInTray = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showStreamerToggleInTray(bool val) {
|
||||
showStreamerToggleInTray = val;
|
||||
void set_showStreamerToggleInTray(bool val) {
|
||||
settings->showStreamerToggleInTray = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_monoFont(QString val) {
|
||||
monoFont = val;
|
||||
void set_monoFont(QString val) {
|
||||
settings->monoFont = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showPeerId(int val) {
|
||||
showPeerId = val;
|
||||
void set_showPeerId(int val) {
|
||||
settings->showPeerId = val;
|
||||
showPeerIdReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideNotificationCounters(bool val) {
|
||||
hideNotificationCounters = val;
|
||||
void set_hideNotificationCounters(bool val) {
|
||||
settings->hideNotificationCounters = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideNotificationBadge(bool val) {
|
||||
hideNotificationBadge = val;
|
||||
void set_hideNotificationBadge(bool val) {
|
||||
settings->hideNotificationBadge = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideAllChatsFolder(bool val) {
|
||||
hideAllChatsFolder = val;
|
||||
void set_hideAllChatsFolder(bool val) {
|
||||
settings->hideAllChatsFolder = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_channelBottomButton(int val) {
|
||||
channelBottomButton = val;
|
||||
void set_channelBottomButton(int val) {
|
||||
settings->channelBottomButton = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageSeconds(bool val) {
|
||||
showMessageSeconds = val;
|
||||
void set_showMessageSeconds(bool val) {
|
||||
settings->showMessageSeconds = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageShot(bool val) {
|
||||
showMessageShot = val;
|
||||
void set_showMessageShot(bool val) {
|
||||
settings->showMessageShot = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_stickerConfirmation(bool val) {
|
||||
stickerConfirmation = val;
|
||||
void set_stickerConfirmation(bool val) {
|
||||
settings->stickerConfirmation = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_gifConfirmation(bool val) {
|
||||
gifConfirmation = val;
|
||||
void set_gifConfirmation(bool val) {
|
||||
settings->gifConfirmation = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_voiceConfirmation(bool val) {
|
||||
voiceConfirmation = val;
|
||||
void set_voiceConfirmation(bool val) {
|
||||
settings->voiceConfirmation = val;
|
||||
}
|
||||
|
||||
bool isUseScheduledMessages() {
|
||||
const auto settings = &getInstance();
|
||||
return isGhostModeActive() && settings->useScheduledMessages;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,89 +95,89 @@ public:
|
|||
bool stickerConfirmation;
|
||||
bool gifConfirmation;
|
||||
bool voiceConfirmation;
|
||||
|
||||
void set_sendReadMessages(bool val);
|
||||
void set_sendReadStories(bool val);
|
||||
void set_sendOnlinePackets(bool val);
|
||||
void set_sendUploadProgress(bool val);
|
||||
void set_sendOfflinePacketAfterOnline(bool val);
|
||||
|
||||
void set_ghostModeEnabled(bool val);
|
||||
|
||||
void set_markReadAfterAction(bool val);
|
||||
void set_useScheduledMessages(bool val);
|
||||
void set_sendWithoutSound(bool val);
|
||||
|
||||
void set_saveDeletedMessages(bool val);
|
||||
void set_saveMessagesHistory(bool val);
|
||||
|
||||
void set_saveForBots(bool val);
|
||||
|
||||
void set_hideFromBlocked(bool val);
|
||||
|
||||
void set_disableAds(bool val);
|
||||
void set_disableStories(bool val);
|
||||
void set_disableCustomBackgrounds(bool val);
|
||||
void set_showOnlyAddedEmojisAndStickers(bool val);
|
||||
void set_collapseSimilarChannels(bool val);
|
||||
void set_hideSimilarChannels(bool val);
|
||||
|
||||
void set_wideMultiplier(double val);
|
||||
|
||||
void set_spoofWebviewAsAndroid(bool val);
|
||||
void set_increaseWebviewHeight(bool val);
|
||||
void set_increaseWebviewWidth(bool val);
|
||||
|
||||
void set_disableNotificationsDelay(bool val);
|
||||
void set_localPremium(bool val);
|
||||
|
||||
void set_appIcon(QString val);
|
||||
void set_simpleQuotesAndReplies(bool val);
|
||||
void set_replaceBottomInfoWithIcons(bool val);
|
||||
void set_deletedMark(QString val);
|
||||
void set_editedMark(QString val);
|
||||
void set_recentStickersCount(int val);
|
||||
|
||||
void set_showReactionsPanelInContextMenu(int val);
|
||||
void set_showViewsPanelInContextMenu(int val);
|
||||
void set_showHideMessageInContextMenu(int val);
|
||||
void set_showUserMessagesInContextMenu(int val);
|
||||
void set_showMessageDetailsInContextMenu(int val);
|
||||
|
||||
void set_showAttachButtonInMessageField(bool val);
|
||||
void set_showCommandsButtonInMessageField(bool val);
|
||||
void set_showEmojiButtonInMessageField(bool val);
|
||||
void set_showMicrophoneButtonInMessageField(bool val);
|
||||
void set_showAutoDeleteButtonInMessageField(bool val);
|
||||
|
||||
void set_showAttachPopup(bool val);
|
||||
void set_showEmojiPopup(bool val);
|
||||
|
||||
void set_showLReadToggleInDrawer(bool val);
|
||||
void set_showSReadToggleInDrawer(bool val);
|
||||
void set_showGhostToggleInDrawer(bool val);
|
||||
void set_showStreamerToggleInDrawer(bool val);
|
||||
|
||||
void set_showGhostToggleInTray(bool val);
|
||||
void set_showStreamerToggleInTray(bool val);
|
||||
|
||||
void set_monoFont(QString val);
|
||||
|
||||
void set_hideNotificationCounters(bool val);
|
||||
void set_hideNotificationBadge(bool val);
|
||||
void set_hideAllChatsFolder(bool val);
|
||||
|
||||
void set_channelBottomButton(int val);
|
||||
|
||||
void set_showPeerId(int val);
|
||||
void set_showMessageSeconds(bool val);
|
||||
void set_showMessageShot(bool val);
|
||||
|
||||
void set_stickerConfirmation(bool val);
|
||||
void set_gifConfirmation(bool val);
|
||||
void set_voiceConfirmation(bool val);
|
||||
};
|
||||
|
||||
void set_sendReadMessages(bool val);
|
||||
void set_sendReadStories(bool val);
|
||||
void set_sendOnlinePackets(bool val);
|
||||
void set_sendUploadProgress(bool val);
|
||||
void set_sendOfflinePacketAfterOnline(bool val);
|
||||
|
||||
void set_ghostModeEnabled(bool val);
|
||||
|
||||
void set_markReadAfterAction(bool val);
|
||||
void set_useScheduledMessages(bool val);
|
||||
void set_sendWithoutSound(bool val);
|
||||
|
||||
void set_saveDeletedMessages(bool val);
|
||||
void set_saveMessagesHistory(bool val);
|
||||
|
||||
void set_saveForBots(bool val);
|
||||
|
||||
void set_hideFromBlocked(bool val);
|
||||
|
||||
void set_disableAds(bool val);
|
||||
void set_disableStories(bool val);
|
||||
void set_disableCustomBackgrounds(bool val);
|
||||
void set_showOnlyAddedEmojisAndStickers(bool val);
|
||||
void set_collapseSimilarChannels(bool val);
|
||||
void set_hideSimilarChannels(bool val);
|
||||
|
||||
void set_wideMultiplier(double val);
|
||||
|
||||
void set_spoofWebviewAsAndroid(bool val);
|
||||
void set_increaseWebviewHeight(bool val);
|
||||
void set_increaseWebviewWidth(bool val);
|
||||
|
||||
void set_disableNotificationsDelay(bool val);
|
||||
void set_localPremium(bool val);
|
||||
|
||||
void set_appIcon(QString val);
|
||||
void set_simpleQuotesAndReplies(bool val);
|
||||
void set_replaceBottomInfoWithIcons(bool val);
|
||||
void set_deletedMark(QString val);
|
||||
void set_editedMark(QString val);
|
||||
void set_recentStickersCount(int val);
|
||||
|
||||
void set_showReactionsPanelInContextMenu(int val);
|
||||
void set_showViewsPanelInContextMenu(int val);
|
||||
void set_showHideMessageInContextMenu(int val);
|
||||
void set_showUserMessagesInContextMenu(int val);
|
||||
void set_showMessageDetailsInContextMenu(int val);
|
||||
|
||||
void set_showAttachButtonInMessageField(bool val);
|
||||
void set_showCommandsButtonInMessageField(bool val);
|
||||
void set_showEmojiButtonInMessageField(bool val);
|
||||
void set_showMicrophoneButtonInMessageField(bool val);
|
||||
void set_showAutoDeleteButtonInMessageField(bool val);
|
||||
|
||||
void set_showAttachPopup(bool val);
|
||||
void set_showEmojiPopup(bool val);
|
||||
|
||||
void set_showLReadToggleInDrawer(bool val);
|
||||
void set_showSReadToggleInDrawer(bool val);
|
||||
void set_showGhostToggleInDrawer(bool val);
|
||||
void set_showStreamerToggleInDrawer(bool val);
|
||||
|
||||
void set_showGhostToggleInTray(bool val);
|
||||
void set_showStreamerToggleInTray(bool val);
|
||||
|
||||
void set_monoFont(QString val);
|
||||
|
||||
void set_hideNotificationCounters(bool val);
|
||||
void set_hideNotificationBadge(bool val);
|
||||
void set_hideAllChatsFolder(bool val);
|
||||
|
||||
void set_channelBottomButton(int val);
|
||||
|
||||
void set_showPeerId(int val);
|
||||
void set_showMessageSeconds(bool val);
|
||||
void set_showMessageShot(bool val);
|
||||
|
||||
void set_stickerConfirmation(bool val);
|
||||
void set_gifConfirmation(bool val);
|
||||
void set_voiceConfirmation(bool val);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
||||
AyuGramSettings,
|
||||
sendReadMessages,
|
||||
|
@ -195,6 +195,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
|||
disableAds,
|
||||
disableStories,
|
||||
disableCustomBackgrounds,
|
||||
showOnlyAddedEmojisAndStickers,
|
||||
collapseSimilarChannels,
|
||||
hideSimilarChannels,
|
||||
wideMultiplier,
|
||||
|
|
|
@ -42,8 +42,8 @@ void runOnce() {
|
|||
lateInit();
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendOfflinePacketAfterOnline) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendOfflinePacketAfterOnline) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ static QImage LAST_LOADED_NO_MARGIN;
|
|||
namespace AyuAssets {
|
||||
|
||||
void loadAppIco() {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
QString appDataPath = QDir::fromNativeSeparators(qgetenv("APPDATA"));
|
||||
QString tempIconPath = appDataPath + "/AyuGram.ico";
|
||||
|
@ -26,20 +26,20 @@ void loadAppIco() {
|
|||
f.remove();
|
||||
}
|
||||
f.close();
|
||||
QFile::copy(qsl(":/gui/art/ayu/%1/app_icon.ico").arg(settings->appIcon), tempIconPath);
|
||||
QFile::copy(qsl(":/gui/art/ayu/%1/app_icon.ico").arg(settings.appIcon), tempIconPath);
|
||||
}
|
||||
|
||||
void loadIcons() {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (LAST_LOADED_NAME != settings->appIcon) {
|
||||
LAST_LOADED_NAME = settings->appIcon;
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (LAST_LOADED_NAME != settings.appIcon) {
|
||||
LAST_LOADED_NAME = settings.appIcon;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app_macos.png").arg(settings->appIcon));
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app_macos.png").arg(settings.appIcon));
|
||||
#else
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app.png").arg(settings->appIcon));
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app.png").arg(settings.appIcon));
|
||||
#endif
|
||||
LAST_LOADED_NO_MARGIN = QImage(qsl(":/gui/art/ayu/%1/app_preview.png").arg(settings->appIcon));
|
||||
LAST_LOADED_NO_MARGIN = QImage(qsl(":/gui/art/ayu/%1/app_preview.png").arg(settings.appIcon));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@ void EditDeletedMarkBox::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
|
||||
void EditDeletedMarkBox::save() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
settings->set_deletedMark(_text->getLastText());
|
||||
AyuSettings::set_deletedMark(_text->getLastText());
|
||||
AyuSettings::save();
|
||||
|
||||
closeBox();
|
||||
|
|
|
@ -86,8 +86,7 @@ void EditEditedMarkBox::resizeEvent(QResizeEvent *e) {
|
|||
}
|
||||
|
||||
void EditEditedMarkBox::save() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
settings->set_editedMark(_text->getLastText());
|
||||
AyuSettings::set_editedMark(_text->getLastText());
|
||||
AyuSettings::save();
|
||||
|
||||
closeBox();
|
||||
|
|
|
@ -38,8 +38,8 @@ void MessageShotBox::prepare() {
|
|||
void MessageShotBox::setupContent() {
|
||||
_selectedPalette = std::make_shared<style::palette>();
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto savedShowColorfulReplies = !settings->simpleQuotesAndReplies;
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
const auto savedShowColorfulReplies = !settings.simpleQuotesAndReplies;
|
||||
|
||||
using namespace Settings;
|
||||
|
||||
|
@ -164,8 +164,7 @@ void MessageShotBox::setupContent() {
|
|||
) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
settings->set_simpleQuotesAndReplies(!enabled);
|
||||
AyuSettings::set_simpleQuotesAndReplies(!enabled);
|
||||
|
||||
_config.st = std::make_shared<Ui::ChatStyle>(_config.st.get());
|
||||
updatePreview();
|
||||
|
@ -209,8 +208,7 @@ void MessageShotBox::setupContent() {
|
|||
AyuFeatures::MessageShot::resetDefaultSelected();
|
||||
AyuFeatures::MessageShot::resetShotConfig();
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
settings->set_simpleQuotesAndReplies(!savedShowColorfulReplies);
|
||||
AyuSettings::set_simpleQuotesAndReplies(!savedShowColorfulReplies);
|
||||
},
|
||||
content->lifetime());
|
||||
|
||||
|
|
|
@ -197,8 +197,8 @@ void AddHistoryAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||
}
|
||||
|
||||
void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings->showHideMessageInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings.showHideMessageInContextMenu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,8 @@ void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||
}
|
||||
|
||||
void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings->showUserMessagesInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings.showUserMessagesInContextMenu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -245,8 +245,8 @@ void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||
}
|
||||
|
||||
void AddMessageDetailsAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings->showMessageDetailsInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!needToShowItem(settings.showMessageDetailsInContextMenu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -464,8 +464,8 @@ void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->sendReadMessages) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.sendReadMessages) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void IconPicker::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void IconPicker::mousePressEvent(QMouseEvent *e) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
auto changed = false;
|
||||
|
||||
auto x = e->pos().x();
|
||||
|
@ -139,8 +139,8 @@ void IconPicker::mousePressEvent(QMouseEvent *e) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (settings->appIcon != iconName) {
|
||||
wasSelected = settings->appIcon;
|
||||
if (settings.appIcon != iconName) {
|
||||
wasSelected = settings.appIcon;
|
||||
animation.start(
|
||||
[=]
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ void IconPicker::mousePressEvent(QMouseEvent *e) {
|
|||
anim::easeOutCubic
|
||||
);
|
||||
|
||||
settings->set_appIcon(iconName);
|
||||
AyuSettings::set_appIcon(iconName);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,8 +15,8 @@ constexpr auto kMaxChannelId = -1000000000000;
|
|||
QString IDString(not_null<PeerData*> peer) {
|
||||
auto resultId = QString::number(getBareID(peer));
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->showPeerId == 2) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.showPeerId == 2) {
|
||||
if (peer->isChannel()) {
|
||||
resultId = QString::number(peerToChannel(peer->id).bare - kMaxChannelId).prepend("-");
|
||||
} else if (peer->isChat()) {
|
||||
|
|
|
@ -100,8 +100,8 @@ bool isMessageHidden(const not_null<HistoryItem*> item) {
|
|||
return true;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideFromBlocked) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideFromBlocked) {
|
||||
if (item->from()->isUser() &&
|
||||
item->from()->asUser()->isBlocked()) {
|
||||
// don't hide messages if it's a dialog with blocked user
|
||||
|
@ -505,14 +505,14 @@ int getScheduleTime(int64 sumSize) {
|
|||
}
|
||||
|
||||
bool isMessageSavable(const not_null<HistoryItem *> item) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (!settings->saveDeletedMessages) {
|
||||
if (!settings.saveDeletedMessages) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (const auto possiblyBot = item->history()->peer->asUser()) {
|
||||
return !possiblyBot->isBot() || (settings->saveForBots && possiblyBot->isBot());
|
||||
return !possiblyBot->isBot() || (settings.saveForBots && possiblyBot->isBot());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1731,8 +1731,8 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
|||
}
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction && history->lastMessage())
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
||||
{
|
||||
readHistory(history->lastMessage());
|
||||
}
|
||||
|
|
|
@ -2259,11 +2259,11 @@ void EmojiListWidget::refreshCustom() {
|
|||
&& !_allowWithoutPremium;
|
||||
const auto owner = &session->data();
|
||||
const auto &sets = owner->stickers().sets();
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
const auto push = [&](uint64 setId, bool installed) {
|
||||
const auto megagroup = _megagroupSet
|
||||
&& (setId == Data::Stickers::MegagroupSetId);
|
||||
if (settings->showOnlyAddedEmojisAndStickers && !installed && !megagroup) {
|
||||
if (settings.showOnlyAddedEmojisAndStickers && !installed && !megagroup) {
|
||||
return;
|
||||
}
|
||||
const auto lookupId = megagroup
|
||||
|
|
|
@ -408,11 +408,11 @@ bool FieldAutocomplete::clearFilteredBotCommands() {
|
|||
FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() {
|
||||
const auto data = &_session->data().stickers();
|
||||
const auto list = data->getListByEmoji({ _emoji }, _stickersSeed);
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
auto result = ranges::views::all(
|
||||
list
|
||||
) | ranges::views::filter([&](not_null<DocumentData*> sticker) {
|
||||
return !settings->showOnlyAddedEmojisAndStickers
|
||||
return !settings.showOnlyAddedEmojisAndStickers
|
||||
|| sticker->isStickerSetInstalled();
|
||||
}) | ranges::views::transform([](not_null<DocumentData*> sticker) {
|
||||
return StickerSuggestion{
|
||||
|
|
|
@ -502,7 +502,7 @@ void GifsListWidget::selectInlineResult(
|
|||
return;
|
||||
}
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (AyuSettings::isUseScheduledMessages()) {
|
||||
auto current = base::unixtime::now();
|
||||
options.scheduled = current + 12;
|
||||
|
@ -552,7 +552,7 @@ void GifsListWidget::selectInlineResult(
|
|||
});
|
||||
});
|
||||
|
||||
if (settings->gifConfirmation) {
|
||||
if (settings.gifConfirmation) {
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::ayu_ConfirmationGIF(),
|
||||
.confirmed = sendGIFCallback,
|
||||
|
|
|
@ -763,8 +763,8 @@ void StickersListWidget::fillFilteredStickersRow() {
|
|||
}
|
||||
|
||||
void StickersListWidget::addSearchRow(not_null<StickersSet*> set) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) {
|
||||
return;
|
||||
}
|
||||
const auto skipPremium = !session().premiumPossible();
|
||||
|
@ -1910,7 +1910,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
|||
&& (e->modifiers() & Qt::ControlModifier)) {
|
||||
showStickerSetBox(document, set.id);
|
||||
} else {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
auto from = messageSentAnimationInfo(
|
||||
sticker->section,
|
||||
sticker->index,
|
||||
|
@ -1932,7 +1932,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
|||
});
|
||||
});
|
||||
|
||||
if (settings->stickerConfirmation && (_mode == Mode::Full || _mode == Mode::ChatIntro) && _requireConfirmation) {
|
||||
if (settings.stickerConfirmation && (_mode == Mode::Full || _mode == Mode::ChatIntro) && _requireConfirmation) {
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::ayu_ConfirmationSticker(),
|
||||
.confirmed = sendStickerCallback,
|
||||
|
@ -2339,10 +2339,10 @@ auto StickersListWidget::collectRecentStickers() -> std::vector<Sticker> {
|
|||
result.reserve(cloudCount + recent.size() + customCount);
|
||||
_custom.reserve(cloudCount + recent.size() + customCount);
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto add = [&](not_null<DocumentData*> document, bool custom) {
|
||||
if (result.size() >= settings->recentStickersCount) {
|
||||
if (result.size() >= settings.recentStickersCount) {
|
||||
return;
|
||||
}
|
||||
const auto i = ranges::find(result, document, &Sticker::document);
|
||||
|
|
|
@ -474,9 +474,9 @@ void TabbedPanel::showStarted() {
|
|||
}
|
||||
|
||||
bool TabbedPanel::eventFilter(QObject *obj, QEvent *e) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (TabbedPanelShowOnClick.value() || !settings->showEmojiPopup) {
|
||||
if (TabbedPanelShowOnClick.value() || !settings.showEmojiPopup) {
|
||||
return false;
|
||||
} else if (e->type() == QEvent::Enter) {
|
||||
otherEnter();
|
||||
|
|
|
@ -195,12 +195,12 @@ PreviewWrap::PreviewWrap(
|
|||
}
|
||||
}, lifetime());
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
{
|
||||
const auto close = Ui::CreateChild<Ui::RoundButton>(
|
||||
this,
|
||||
item->out() || settings->saveDeletedMessages
|
||||
item->out() || settings.saveDeletedMessages
|
||||
? tr::lng_close()
|
||||
: tr::lng_ttl_voice_close_in(),
|
||||
st::ttlMediaButton);
|
||||
|
@ -234,8 +234,8 @@ PreviewWrap::PreviewWrap(
|
|||
) | Ui::Text::ToRichLangValue(),
|
||||
Ui::Text::RichLangValue)
|
||||
: (isRound
|
||||
? settings->saveDeletedMessages ? tr::ayu_ExpiringVideoMessageNote : tr::lng_ttl_round_tooltip_in
|
||||
: settings->saveDeletedMessages ? tr::ayu_ExpiringVoiceMessageNote : tr::lng_ttl_voice_tooltip_in)(Ui::Text::RichLangValue);
|
||||
? settings.saveDeletedMessages ? tr::ayu_ExpiringVideoMessageNote : tr::lng_ttl_round_tooltip_in
|
||||
: settings.saveDeletedMessages ? tr::ayu_ExpiringVoiceMessageNote : tr::lng_ttl_voice_tooltip_in)(Ui::Text::RichLangValue);
|
||||
const auto tooltip = Ui::CreateChild<Ui::ImportantTooltip>(
|
||||
this,
|
||||
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
|
|
|
@ -228,8 +228,8 @@ void SponsoredMessages::inject(
|
|||
}
|
||||
|
||||
bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableAds) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableAds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,8 @@ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
|||
}
|
||||
|
||||
bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableAds) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableAds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -484,13 +484,13 @@ void ChatFilters::requestToggleTags(bool value, Fn<void()> fail) {
|
|||
|
||||
void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
||||
// AyuGram hideAllChatsFolder
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto position = 0;
|
||||
auto changed = false;
|
||||
for (const auto &filter : list) {
|
||||
auto parsed = ChatFilter::FromTL(filter, _owner);
|
||||
if (settings->hideAllChatsFolder && parsed.id() == 0 && list.size() > 1) {
|
||||
if (settings.hideAllChatsFolder && parsed.id() == 0 && list.size() > 1) {
|
||||
continue;
|
||||
}
|
||||
const auto b = begin(_list) + position;
|
||||
|
@ -514,7 +514,7 @@ void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
|||
applyRemove(position);
|
||||
changed = true;
|
||||
}
|
||||
if (!settings->hideAllChatsFolder && !ranges::contains(begin(_list), end(_list), 0, &ChatFilter::id)) {
|
||||
if (!settings.hideAllChatsFolder && !ranges::contains(begin(_list), end(_list), 0, &ChatFilter::id)) {
|
||||
_list.insert(begin(_list), ChatFilter());
|
||||
}
|
||||
if (changed || !_loaded || _reloading) {
|
||||
|
@ -526,12 +526,12 @@ void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
|||
|
||||
void ChatFilters::apply(const MTPUpdate &update) {
|
||||
// AyuGram hideAllChatsFolder
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
update.match([&](const MTPDupdateDialogFilter &data) {
|
||||
if (const auto filter = data.vfilter()) {
|
||||
auto parsed = ChatFilter::FromTL(*filter, _owner);
|
||||
if (settings->hideAllChatsFolder && parsed.id() == 0) {
|
||||
if (settings.hideAllChatsFolder && parsed.id() == 0) {
|
||||
return;
|
||||
}
|
||||
set(parsed);
|
||||
|
@ -912,9 +912,9 @@ FilterId ChatFilters::lookupId(int index) const {
|
|||
return FilterId(); // AyuGram: fix crash when using `hideAllChatsFolder`
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (_owner->session().user()->isPremium() || !_list.front().id() || settings->hideAllChatsFolder) {
|
||||
if (_owner->session().user()->isPremium() || !_list.front().id() || settings.hideAllChatsFolder) {
|
||||
return _list[index].id();
|
||||
}
|
||||
const auto i = ranges::find(_list, FilterId(0), &ChatFilter::id);
|
||||
|
|
|
@ -627,8 +627,8 @@ void Histories::sendReadRequests() {
|
|||
DEBUG_LOG(("Reading: send requests with count %1.").arg(_states.size()));
|
||||
|
||||
// AyuGram sendReadMessages
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages) {
|
||||
DEBUG_LOG(("[AyuGram] Don't read messages"));
|
||||
_states.clear();
|
||||
return;
|
||||
|
|
|
@ -1491,8 +1491,8 @@ void Reactions::send(not_null<HistoryItem*> item, bool addToRecent) {
|
|||
_sentRequests.remove(id);
|
||||
_owner->session().api().applyUpdates(result);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction && item) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction && item) {
|
||||
readHistory(item);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
|
|
|
@ -399,8 +399,8 @@ rpl::producer<bool> PeerPremiumValue(not_null<PeerData*> peer) {
|
|||
}
|
||||
|
||||
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
return rpl::single(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1005,8 +1005,8 @@ void RepliesList::sendReadTillRequest() {
|
|||
const auto api = &_history->session().api();
|
||||
api->request(base::take(_readRequestId)).cancel();
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -319,8 +319,8 @@ Session::Session(not_null<Main::Session*> session)
|
|||
}, _lifetime);
|
||||
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->disableStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.disableStories) {
|
||||
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
||||
}
|
||||
});
|
||||
|
@ -2485,14 +2485,14 @@ void Session::updateEditedMessage(const MTPMessage &data) {
|
|||
}
|
||||
|
||||
// AyuGram saveMessagesHistory
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
HistoryMessageEdition edit;
|
||||
|
||||
if (data.type() != mtpc_message) {
|
||||
goto proceed;
|
||||
}
|
||||
edit = HistoryMessageEdition(_session, data.c_message());
|
||||
if (settings->saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) {
|
||||
if (settings.saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) {
|
||||
const auto msg = existing->originalText();
|
||||
|
||||
if (edit.textWithEntities == msg || msg.empty()) {
|
||||
|
@ -2637,12 +2637,12 @@ void Session::unregisterMessageTTL(
|
|||
}
|
||||
|
||||
void Session::checkTTLs() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
_ttlCheckTimer.cancel();
|
||||
const auto now = base::unixtime::now();
|
||||
|
||||
if (settings->saveDeletedMessages) {
|
||||
if (settings.saveDeletedMessages) {
|
||||
auto toBeRemoved = ranges::views::take_while(
|
||||
_ttlMessages,
|
||||
[now](const auto &pair) {
|
||||
|
|
|
@ -1120,8 +1120,8 @@ void Stories::markAsRead(FullStoryId id, bool viewed) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1270,8 +1270,8 @@ void Stories::toggleHidden(
|
|||
void Stories::sendMarkAsReadRequest(
|
||||
not_null<PeerData*> peer,
|
||||
StoryId tillId) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1305,8 +1305,8 @@ void Stories::checkQuitPreventFinished() {
|
|||
void Stories::sendMarkAsReadRequests() {
|
||||
_markReadTimer.cancel();
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1329,8 +1329,8 @@ void Stories::sendIncrementViewsRequests() {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1941,8 +1941,8 @@ bool Stories::isQuitPrevent() {
|
|||
sendIncrementViewsRequests();
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadStories || _markReadRequests.empty() && _incrementViewsRequests.empty()) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadStories || _markReadRequests.empty() && _incrementViewsRequests.empty()) {
|
||||
return false;
|
||||
}
|
||||
LOG(("Stories prevents quit, marking as read..."));
|
||||
|
|
|
@ -489,8 +489,8 @@ bool UserData::isFake() const {
|
|||
|
||||
bool UserData::isPremium() const {
|
||||
if (id) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
if (getSession(id.value)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -553,12 +553,12 @@ void Row::paintUserpic(
|
|||
updateCornerBadgeShown(peer, nullptr, hasUnreadBadgesAbove);
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||
? _cornerBadgeShown
|
||||
: !_cornerBadgeUserpic->layersManager.isDisplayedNone();
|
||||
const auto storiesPeer = settings->disableStories ? nullptr : peer
|
||||
const auto storiesPeer = settings.disableStories ? nullptr : peer
|
||||
? ((peer->isUser() || peer->isChannel()) ? peer : nullptr)
|
||||
: nullptr;
|
||||
const auto storiesFolder = peer ? nullptr : _id.folder();
|
||||
|
|
|
@ -1307,8 +1307,8 @@ void Widget::setupMainMenuToggle() {
|
|||
? &st::dialogsMenuToggleUnread
|
||||
: &st::dialogsMenuToggleUnreadMuted;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationCounters) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideNotificationCounters) {
|
||||
icon = nullptr;
|
||||
}
|
||||
|
||||
|
@ -1318,8 +1318,8 @@ void Widget::setupMainMenuToggle() {
|
|||
|
||||
void Widget::setupStories() {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2277,8 +2277,8 @@ void Widget::updateStoriesVisibility() {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableStories) {
|
||||
_stories->setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1253,11 +1253,11 @@ void HistoryItem::setCommentsItemId(FullMsgId id) {
|
|||
void HistoryItem::setServiceText(PreparedServiceText &&prepared) {
|
||||
auto text = std::move(prepared.text);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (date() > 0) {
|
||||
const auto timeString = QString(" (%1)").arg(QLocale().toString(
|
||||
base::unixtime::parse(_date),
|
||||
settings->showMessageSeconds
|
||||
settings.showMessageSeconds
|
||||
? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
|
||||
: QLocale::system().timeFormat(QLocale::ShortFormat)
|
||||
));
|
||||
|
@ -3183,8 +3183,8 @@ void HistoryItem::setDeleted() {
|
|||
_deleted = true;
|
||||
|
||||
if (isService()) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
setAyuHint(settings->deletedMark);
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
setAyuHint(settings.deletedMark);
|
||||
} else {
|
||||
history()->owner().requestItemViewRefresh(this);
|
||||
history()->owner().requestItemResize(this);
|
||||
|
|
|
@ -484,13 +484,13 @@ void HistoryMessageReply::updateData(
|
|||
&& (asExternal || _fields.manualQuote);
|
||||
_multiline = !_fields.storyId && (asExternal || nonEmptyQuote);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
const auto author = resolvedMessage
|
||||
? resolvedMessage->from().get()
|
||||
: resolvedStory
|
||||
? resolvedStory->peer().get()
|
||||
: nullptr;
|
||||
const auto blocked = settings->hideFromBlocked
|
||||
const auto blocked = settings.hideFromBlocked
|
||||
&& author
|
||||
&& author->isUser()
|
||||
&& author->asUser()->isBlocked();
|
||||
|
|
|
@ -525,8 +525,8 @@ QString NewMessagePostAuthor(const Api::SendAction &action) {
|
|||
bool ShouldSendSilent(
|
||||
not_null<PeerData*> peer,
|
||||
const Api::SendOptions &options) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->sendWithoutSound) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.sendWithoutSound) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -510,13 +510,13 @@ HistoryWidget::HistoryWidget(
|
|||
|
||||
_fieldCharsCountManager.limitExceeds(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
const auto hide = _fieldCharsCountManager.isLimitExceeded();
|
||||
if (_silent) {
|
||||
_silent->setVisible(!hide);
|
||||
}
|
||||
if (_ttlInfo) {
|
||||
_ttlInfo->setVisible(!hide && settings->showAutoDeleteButtonInMessageField);
|
||||
_ttlInfo->setVisible(!hide && settings.showAutoDeleteButtonInMessageField);
|
||||
}
|
||||
if (_giftToUser) {
|
||||
_giftToUser->setVisible(!hide);
|
||||
|
@ -1980,8 +1980,8 @@ void HistoryWidget::fileChosen(ChatHelpers::FileChosen &&data) {
|
|||
Data::InsertCustomEmoji(_field.data(), data.document);
|
||||
}
|
||||
} else if (_history) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction) {
|
||||
if (const auto lastMessage = history()->lastMessage()) {
|
||||
readHistory(lastMessage);
|
||||
}
|
||||
|
@ -2789,10 +2789,10 @@ void HistoryWidget::setHistory(History *history) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto was = _attachBotsMenu && _history && _history->peer->isUser();
|
||||
const auto now = _attachBotsMenu && history && history->peer->isUser() && settings->showAttachPopup;
|
||||
const auto now = _attachBotsMenu && history && history->peer->isUser() && settings.showAttachPopup;
|
||||
if (was && !now) {
|
||||
_attachToggle->removeEventFilter(_attachBotsMenu.get());
|
||||
_attachBotsMenu->hideFast();
|
||||
|
@ -2875,7 +2875,7 @@ void HistoryWidget::refreshAttachBotsMenu() {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
_attachBotsMenu = InlineBots::MakeAttachBotsMenu(
|
||||
this,
|
||||
|
@ -2888,7 +2888,7 @@ void HistoryWidget::refreshAttachBotsMenu() {
|
|||
}
|
||||
_attachBotsMenu->setOrigin(
|
||||
Ui::PanelAnimation::Origin::BottomLeft);
|
||||
if (settings->showAttachPopup) {
|
||||
if (settings.showAttachPopup) {
|
||||
_attachToggle->installEventFilter(_attachBotsMenu.get());
|
||||
}
|
||||
_attachBotsMenu->heightValue(
|
||||
|
@ -3201,7 +3201,7 @@ bool HistoryWidget::canWriteMessage() const {
|
|||
}
|
||||
|
||||
void HistoryWidget::updateControlsVisibility() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto fieldDisabledRemoved = (_fieldDisabled != nullptr);
|
||||
const auto hideExtraButtons = _fieldCharsCountManager.isLimitExceeded();
|
||||
|
@ -3396,27 +3396,27 @@ void HistoryWidget::updateControlsVisibility() {
|
|||
_botCommandStart->hide();
|
||||
} else if (_kbReplyTo) {
|
||||
_kbScroll->hide();
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField);
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings.showEmojiButtonInMessageField);
|
||||
_botKeyboardHide->hide();
|
||||
_botKeyboardShow->hide();
|
||||
_botCommandStart->hide();
|
||||
} else {
|
||||
_kbScroll->hide();
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField);
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings.showEmojiButtonInMessageField);
|
||||
_botKeyboardHide->hide();
|
||||
if (_keyboard->hasMarkup()) {
|
||||
_botKeyboardShow->show();
|
||||
_botCommandStart->hide();
|
||||
} else {
|
||||
_botKeyboardShow->hide();
|
||||
_botCommandStart->setVisible(_cmdStartShown && settings->showCommandsButtonInMessageField);
|
||||
_botCommandStart->setVisible(_cmdStartShown && settings.showCommandsButtonInMessageField);
|
||||
}
|
||||
}
|
||||
if (_replaceMedia) {
|
||||
_replaceMedia->show();
|
||||
_attachToggle->hide();
|
||||
} else {
|
||||
SWITCH_BUTTON(_attachToggle, settings->showAttachButtonInMessageField);
|
||||
SWITCH_BUTTON(_attachToggle, settings.showAttachButtonInMessageField);
|
||||
}
|
||||
if (_botMenu.button) {
|
||||
_botMenu.button->show();
|
||||
|
@ -3452,7 +3452,7 @@ void HistoryWidget::updateControlsVisibility() {
|
|||
}
|
||||
if (_ttlInfo) {
|
||||
const auto was = _ttlInfo->isVisible();
|
||||
const auto now = (!_editMsgId) && (!hideExtraButtons) && settings->showAutoDeleteButtonInMessageField;
|
||||
const auto now = (!_editMsgId) && (!hideExtraButtons) && settings.showAutoDeleteButtonInMessageField;
|
||||
if (was != now) {
|
||||
_ttlInfo->setVisible(now);
|
||||
rightButtonsChanged = true;
|
||||
|
@ -4583,14 +4583,14 @@ void HistoryWidget::sendVoice(const VoiceToSend &data) {
|
|||
}
|
||||
|
||||
void HistoryWidget::send(Api::SendOptions options) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (AyuSettings::isUseScheduledMessages() && !options.scheduled) {
|
||||
auto current = base::unixtime::now();
|
||||
options.scheduled = current + 12;
|
||||
}
|
||||
|
||||
auto lastMessage = _history->lastMessage();
|
||||
if (!settings->sendReadMessages && settings->markReadAfterAction && lastMessage) {
|
||||
if (!settings.sendReadMessages && settings.markReadAfterAction && lastMessage) {
|
||||
readHistory(lastMessage);
|
||||
}
|
||||
|
||||
|
@ -4784,8 +4784,8 @@ void HistoryWidget::goToDiscussionGroup() {
|
|||
}
|
||||
|
||||
bool HistoryWidget::hasDiscussionGroup() const {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->channelBottomButton != 2) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.channelBottomButton != 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5377,8 +5377,8 @@ bool HistoryWidget::isChoosingTheme() const {
|
|||
}
|
||||
|
||||
bool HistoryWidget::isMuteUnmute() const {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->channelBottomButton == 0) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.channelBottomButton == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5394,8 +5394,8 @@ bool HistoryWidget::isSearching() const {
|
|||
}
|
||||
|
||||
bool HistoryWidget::showRecordButton() const {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->showMicrophoneButtonInMessageField) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.showMicrophoneButtonInMessageField) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5637,7 +5637,7 @@ void HistoryWidget::showKeyboardHideButton() {
|
|||
}
|
||||
|
||||
void HistoryWidget::toggleKeyboard(bool manual) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto fieldEnabled = canWriteMessage() && !_showAnimation;
|
||||
if (_kbShown || _kbReplyTo) {
|
||||
|
@ -5674,7 +5674,7 @@ void HistoryWidget::toggleKeyboard(bool manual) {
|
|||
_botKeyboardHide->hide();
|
||||
_botKeyboardShow->hide();
|
||||
if (fieldEnabled) {
|
||||
SWITCH_BUTTON(_botCommandStart, settings->showCommandsButtonInMessageField);
|
||||
SWITCH_BUTTON(_botCommandStart, settings.showCommandsButtonInMessageField);
|
||||
}
|
||||
_kbScroll->hide();
|
||||
_kbShown = false;
|
||||
|
@ -5724,7 +5724,7 @@ void HistoryWidget::toggleKeyboard(bool manual) {
|
|||
updateFieldPlaceholder();
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, _botKeyboardHide->isHidden()
|
||||
&& canWriteMessage()
|
||||
&& !_showAnimation && settings->showEmojiButtonInMessageField);
|
||||
&& !_showAnimation && settings.showEmojiButtonInMessageField);
|
||||
updateField();
|
||||
}
|
||||
|
||||
|
@ -5865,7 +5865,7 @@ bool HistoryWidget::fieldOrDisabledShown() const {
|
|||
}
|
||||
|
||||
void HistoryWidget::moveFieldControls() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto keyboardHeight = 0;
|
||||
auto bottom = height();
|
||||
|
@ -5891,7 +5891,7 @@ void HistoryWidget::moveFieldControls() {
|
|||
if (_replaceMedia) {
|
||||
_replaceMedia->moveToLeft(left, buttonsBottom);
|
||||
}
|
||||
if (settings->showAttachButtonInMessageField) {
|
||||
if (settings.showAttachButtonInMessageField) {
|
||||
_attachToggle->moveToLeft(left, buttonsBottom);
|
||||
left += _attachToggle->width();
|
||||
}
|
||||
|
@ -5912,14 +5912,14 @@ void HistoryWidget::moveFieldControls() {
|
|||
_voiceRecordBar->moveToLeft(0, bottom - _voiceRecordBar->height());
|
||||
_tabbedSelectorToggle->moveToRight(right, buttonsBottom);
|
||||
_botKeyboardHide->moveToRight(right, buttonsBottom);
|
||||
right += settings->showEmojiButtonInMessageField || !_botKeyboardHide->isHidden() ? _botKeyboardHide->width() : 0;
|
||||
right += settings.showEmojiButtonInMessageField || !_botKeyboardHide->isHidden() ? _botKeyboardHide->width() : 0;
|
||||
_botKeyboardShow->moveToRight(right, buttonsBottom);
|
||||
_botCommandStart->moveToRight(right, buttonsBottom);
|
||||
if (_silent) {
|
||||
_silent->moveToRight(right, buttonsBottom);
|
||||
}
|
||||
const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup();
|
||||
if (kbShowShown || (_cmdStartShown && settings->showCommandsButtonInMessageField) || _silent) {
|
||||
if (kbShowShown || (_cmdStartShown && settings.showCommandsButtonInMessageField) || _silent) {
|
||||
right += _botCommandStart->width();
|
||||
}
|
||||
if (_giftToUser) {
|
||||
|
@ -5966,14 +5966,14 @@ void HistoryWidget::moveFieldControls() {
|
|||
}
|
||||
|
||||
void HistoryWidget::updateFieldSize() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup();
|
||||
auto fieldWidth = width()
|
||||
- (settings->showAttachButtonInMessageField ? _attachToggle->width() : 0)
|
||||
- (settings.showAttachButtonInMessageField ? _attachToggle->width() : 0)
|
||||
- st::historySendRight
|
||||
- _send->width()
|
||||
- (settings->showEmojiButtonInMessageField ? _tabbedSelectorToggle->width() : 0);
|
||||
- (settings.showEmojiButtonInMessageField ? _tabbedSelectorToggle->width() : 0);
|
||||
if (_botMenu.button) {
|
||||
fieldWidth -= st::historyBotMenuSkip + _botMenu.button->width();
|
||||
}
|
||||
|
@ -5983,7 +5983,7 @@ void HistoryWidget::updateFieldSize() {
|
|||
if (kbShowShown) {
|
||||
fieldWidth -= _botKeyboardShow->width();
|
||||
}
|
||||
if (_cmdStartShown && settings->showCommandsButtonInMessageField) {
|
||||
if (_cmdStartShown && settings.showCommandsButtonInMessageField) {
|
||||
fieldWidth -= _botCommandStart->width();
|
||||
}
|
||||
if (_silent && !_silent->isHidden()) {
|
||||
|
@ -5995,7 +5995,7 @@ void HistoryWidget::updateFieldSize() {
|
|||
if (_scheduled && !_scheduled->isHidden()) {
|
||||
fieldWidth -= _scheduled->width();
|
||||
}
|
||||
if (_ttlInfo && _ttlInfo->isVisible() && settings->showAutoDeleteButtonInMessageField) {
|
||||
if (_ttlInfo && _ttlInfo->isVisible() && settings.showAutoDeleteButtonInMessageField) {
|
||||
fieldWidth -= _ttlInfo->width();
|
||||
}
|
||||
|
||||
|
@ -7104,7 +7104,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto wasVisible = _kbShown || _kbReplyTo;
|
||||
const auto wasMsgId = _keyboard->forMsgId();
|
||||
|
@ -7156,7 +7156,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
|||
showKeyboardHideButton();
|
||||
} else {
|
||||
_kbScroll->hide();
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField);
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings.showEmojiButtonInMessageField);
|
||||
_botKeyboardHide->hide();
|
||||
}
|
||||
_botKeyboardShow->hide();
|
||||
|
@ -7180,7 +7180,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
|||
} else {
|
||||
if (!_showAnimation) {
|
||||
_kbScroll->hide();
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField);
|
||||
SWITCH_BUTTON(_tabbedSelectorToggle, settings.showEmojiButtonInMessageField);
|
||||
_botKeyboardHide->hide();
|
||||
_botKeyboardShow->show();
|
||||
_botCommandStart->hide();
|
||||
|
@ -7198,11 +7198,11 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
|||
} else {
|
||||
if (!_scroll->isHidden()) {
|
||||
_kbScroll->hide();
|
||||
//SWITCH_BUTTON(_tabbedSelectorToggle, settings->showEmojiButtonInMessageField);
|
||||
//SWITCH_BUTTON(_tabbedSelectorToggle, settings.showEmojiButtonInMessageField);
|
||||
_tabbedSelectorToggle->show();
|
||||
_botKeyboardHide->hide();
|
||||
_botKeyboardShow->hide();
|
||||
_botCommandStart->setVisible(!_editMsgId && settings->showCommandsButtonInMessageField);
|
||||
_botCommandStart->setVisible(!_editMsgId && settings.showCommandsButtonInMessageField);
|
||||
}
|
||||
_field->setMaxHeight(computeMaxFieldHeight());
|
||||
_kbShown = false;
|
||||
|
|
|
@ -2129,7 +2129,7 @@ void VoiceRecordBar::stopRecording(StopType type, bool ttlBeforeHide) {
|
|||
: 0),
|
||||
};
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (AyuSettings::isUseScheduledMessages()) {
|
||||
auto current = base::unixtime::now();
|
||||
options.scheduled = current + 12 + 5;
|
||||
|
@ -2147,7 +2147,7 @@ void VoiceRecordBar::stopRecording(StopType type, bool ttlBeforeHide) {
|
|||
close();
|
||||
});
|
||||
|
||||
if (settings->voiceConfirmation) {
|
||||
if (settings.voiceConfirmation) {
|
||||
_show->showBox(Ui::MakeConfirmBox(
|
||||
{
|
||||
.text = tr::ayu_ConfirmationVoice(),
|
||||
|
@ -2221,7 +2221,7 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
|
|||
options.ttlSeconds = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (AyuSettings::isUseScheduledMessages()) {
|
||||
auto current = base::unixtime::now();
|
||||
options.scheduled = current + 12 + 5;
|
||||
|
@ -2240,7 +2240,7 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
|
|||
close();
|
||||
});
|
||||
|
||||
if (settings->voiceConfirmation) {
|
||||
if (settings.voiceConfirmation) {
|
||||
_show->showBox(Ui::MakeConfirmBox(
|
||||
{
|
||||
.text = tr::ayu_ConfirmationVoice(),
|
||||
|
|
|
@ -415,14 +415,14 @@ void BottomInfo::layout() {
|
|||
}
|
||||
|
||||
void BottomInfo::layoutDateText() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (!settings->replaceBottomInfoWithIcons) {
|
||||
if (!settings.replaceBottomInfoWithIcons) {
|
||||
const auto deleted = (_data.flags & Data::Flag::AyuDeleted)
|
||||
? (settings->deletedMark + ' ')
|
||||
? (settings.deletedMark + ' ')
|
||||
: QString();
|
||||
const auto edited = (_data.flags & Data::Flag::Edited)
|
||||
? (settings->editedMark + ' ')
|
||||
? (settings.editedMark + ' ')
|
||||
: (_data.flags & Data::Flag::EstimateDate)
|
||||
? (tr::lng_approximate(tr::now) + ' ')
|
||||
: QString();
|
||||
|
@ -430,7 +430,7 @@ void BottomInfo::layoutDateText() {
|
|||
const auto prefix = !author.isEmpty() ? u", "_q : QString();
|
||||
const auto date = edited + QLocale().toString(
|
||||
_data.date.time(),
|
||||
settings->showMessageSeconds
|
||||
settings.showMessageSeconds
|
||||
? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
|
||||
: QLocale::system().timeFormat(QLocale::ShortFormat)
|
||||
);
|
||||
|
@ -496,7 +496,7 @@ void BottomInfo::layoutDateText() {
|
|||
|
||||
const auto date = TextWithEntities{}.append(edited).append(QLocale().toString(
|
||||
_data.date.time(),
|
||||
settings->showMessageSeconds
|
||||
settings.showMessageSeconds
|
||||
? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
|
||||
: QLocale::system().timeFormat(QLocale::ShortFormat)
|
||||
));
|
||||
|
|
|
@ -1513,8 +1513,8 @@ void AddWhoReactedAction(
|
|||
not_null<QWidget*> context,
|
||||
not_null<HistoryItem*> item,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings->showViewsPanelInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings.showViewsPanelInContextMenu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -646,8 +646,8 @@ void Reply::paint(
|
|||
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
||||
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->simpleQuotesAndReplies && backgroundEmoji) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||
ValidateBackgroundEmoji(
|
||||
backgroundEmojiId,
|
||||
backgroundEmoji,
|
||||
|
|
|
@ -67,8 +67,8 @@ bool SendActionPainter::updateNeedsAnimating(
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideFromBlocked) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideFromBlocked) {
|
||||
if (user->isBlocked()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -788,8 +788,8 @@ void TopBarWidget::infoClicked() {
|
|||
|
||||
void TopBarWidget::backClicked() {
|
||||
if (_activeChat.key.folder()) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideAllChatsFolder) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideAllChatsFolder) {
|
||||
const auto filters = &_controller->session().data().chatsFilters();
|
||||
const auto lookupId = filters->lookupId(_controller->session().premium() ? 0 : 1);
|
||||
_controller->setActiveChatsFilter(lookupId);
|
||||
|
@ -1156,11 +1156,11 @@ void TopBarWidget::updateControlsVisibility() {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
_clear->show();
|
||||
_delete->setVisible(_canDelete);
|
||||
_messageShot->setVisible(settings->showMessageShot);
|
||||
_messageShot->setVisible(settings.showMessageShot);
|
||||
_forward->setVisible(_canForward);
|
||||
_sendNow->setVisible(_canSendNow);
|
||||
|
||||
|
@ -1337,19 +1337,19 @@ void TopBarWidget::updateMembersShowArea() {
|
|||
}
|
||||
|
||||
bool TopBarWidget::showSelectedState() const {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
return (_selectedCount > 0)
|
||||
&& (_canDelete || _canForward || _canSendNow || settings->showMessageShot);
|
||||
&& (_canDelete || _canForward || _canSendNow || settings.showMessageShot);
|
||||
}
|
||||
|
||||
void TopBarWidget::showSelected(SelectedState state) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto canDelete = (state.count > 0 && state.count == state.canDeleteCount);
|
||||
auto canForward = (state.count > 0 && state.count == state.canForwardCount);
|
||||
auto canSendNow = (state.count > 0 && state.count == state.canSendNowCount);
|
||||
auto count = (!canDelete && !canForward && !canSendNow && !settings->showMessageShot) ? 0 : state.count;
|
||||
auto count = (!canDelete && !canForward && !canSendNow && !settings.showMessageShot) ? 0 : state.count;
|
||||
if (_selectedCount == count
|
||||
&& _canDelete == canDelete
|
||||
&& _canForward == canForward
|
||||
|
|
|
@ -325,8 +325,8 @@ Document::Document(
|
|||
const auto &data = &_parent->data()->history()->owner();
|
||||
_parent->data()->removeFromSharedMediaIndex();
|
||||
setDocumentLinks(_data, realParent, [=] {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->saveDeletedMessages) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.saveDeletedMessages) {
|
||||
_openl = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -936,8 +936,8 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||
Ui::Text::ValidateQuotePaintCache(*cache, _st);
|
||||
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->simpleQuotesAndReplies && backgroundEmoji) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||
ValidateBackgroundEmoji(
|
||||
backgroundEmojiId,
|
||||
backgroundEmoji,
|
||||
|
|
|
@ -1189,8 +1189,8 @@ bool AdjustMenuGeometryForSelector(
|
|||
not_null<Ui::PopupMenu*> menu,
|
||||
QPoint desiredPosition,
|
||||
not_null<Selector*> selector) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings->showReactionsPanelInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1357,8 +1357,8 @@ AttachSelectorResult AttachSelectorToMenu(
|
|||
Fn<void(ChosenReaction)> chosen,
|
||||
TextWithEntities about,
|
||||
IconFactory iconFactory) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings->showReactionsPanelInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||
return AttachSelectorResult::Skipped;
|
||||
}
|
||||
|
||||
|
@ -1409,8 +1409,8 @@ auto AttachSelectorToMenu(
|
|||
IconFactory iconFactory,
|
||||
Fn<bool()> paused)
|
||||
-> base::expected<not_null<Selector*>, AttachSelectorResult> {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings->showReactionsPanelInContextMenu)) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||
return base::make_unexpected(AttachSelectorResult::Skipped);
|
||||
}
|
||||
|
||||
|
|
|
@ -505,8 +505,8 @@ void TopBar::updateControlsVisibility(anim::type animated) {
|
|||
|
||||
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableStories) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1191,7 +1191,7 @@ bool SetClickContext(
|
|||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto result = object_ptr<Ui::VerticalLayout>(_wrap);
|
||||
auto tracker = Ui::MultiSlideTracker();
|
||||
|
@ -1501,7 +1501,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
).text->setLinksTrusted();
|
||||
}
|
||||
|
||||
if (settings->showPeerId != 0) {
|
||||
if (settings.showPeerId != 0) {
|
||||
const auto dataCenter = getPeerDC(_peer);
|
||||
const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter;
|
||||
|
||||
|
@ -1637,7 +1637,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
addTranslateToMenu(about.text, AboutWithAdvancedValue(_peer));
|
||||
}
|
||||
|
||||
if (settings->showPeerId != 0 && !_topic) {
|
||||
if (settings.showPeerId != 0 && !_topic) {
|
||||
const auto dataCenter = getPeerDC(_peer);
|
||||
const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter;
|
||||
|
||||
|
@ -1665,7 +1665,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
});
|
||||
}
|
||||
|
||||
if (settings->showPeerId != 0 && _topic) {
|
||||
if (settings.showPeerId != 0 && _topic) {
|
||||
auto idDrawableText = IDValue(
|
||||
_peer->forumTopicFor(topicRootId)->topicRootId()
|
||||
) | rpl::map([](TextWithEntities &&text)
|
||||
|
|
|
@ -140,7 +140,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
|||
using namespace rpl::mappers;
|
||||
using MediaType = Media::Type;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
auto content = object_ptr<Ui::VerticalLayout>(parent);
|
||||
auto tracker = Ui::MultiSlideTracker();
|
||||
|
@ -176,7 +176,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
|||
const auto addSimilarPeersButton = [&](
|
||||
not_null<PeerData*> peer,
|
||||
const style::icon &icon) {
|
||||
if (settings->hideSimilarChannels) {
|
||||
if (settings.hideSimilarChannels) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -765,8 +765,8 @@ void BotAction::handleKeyPress(not_null<QKeyEvent*> e) {
|
|||
}
|
||||
|
||||
QString WebviewPlatform() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
return settings->spoofWebviewAsAndroid ? "android" : "tdesktop";
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
return settings.spoofWebviewAsAndroid ? "android" : "tdesktop";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -319,8 +319,8 @@ rpl::producer<> Session::downloaderTaskFinished() const {
|
|||
}
|
||||
|
||||
bool Session::premium() const {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -328,8 +328,8 @@ bool Session::premium() const {
|
|||
}
|
||||
|
||||
bool Session::premiumPossible() const {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -351,8 +351,8 @@ rpl::producer<bool> Session::premiumPossibleValue() const {
|
|||
return _user->isPremium();
|
||||
});
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
premium = rpl::single(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ void RepostView::draw(Painter &p, int x, int y, int availableWidth) {
|
|||
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
||||
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->simpleQuotesAndReplies && backgroundEmoji) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||
using namespace HistoryView;
|
||||
if (backgroundEmoji->firstFrameMask.isNull()
|
||||
&& !backgroundEmoji->emoji) {
|
||||
|
|
|
@ -512,10 +512,10 @@ void MainWindow::unreadCounterChangedHook() {
|
|||
}
|
||||
|
||||
void MainWindow::updateTaskbarAndIconCounters() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto counter = settings->hideNotificationBadge ? 0 : Core::App().unreadBadge();
|
||||
const auto muted = settings->hideNotificationBadge ? 0 : Core::App().unreadBadgeMuted();
|
||||
const auto counter = settings.hideNotificationBadge ? 0 : Core::App().unreadBadge();
|
||||
const auto muted = settings.hideNotificationBadge ? 0 : Core::App().unreadBadgeMuted();
|
||||
const auto controller = sessionController();
|
||||
const auto session = controller ? &controller->session() : nullptr;
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ bool DarkTasbarValueValid/* = false*/;
|
|||
ScaledLogoLight = base::flat_map<int, QImage>();
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationBadge) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideNotificationBadge) {
|
||||
args.count = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1042,8 +1042,8 @@ QPointer<Ui::RpWidget> Premium::createPinnedToTop(
|
|||
}
|
||||
}
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (settings->localPremium) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.localPremium) {
|
||||
return tr::ayu_LocalPremiumNotice(Ui::Text::RichLangValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ void Tray::rebuildMenu() {
|
|||
[=] { toggleSoundNotifications(); });
|
||||
}
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (settings->showGhostToggleInTray) {
|
||||
if (settings.showGhostToggleInTray) {
|
||||
auto turnGhostModeText = _textUpdates.events(
|
||||
) | rpl::map(
|
||||
[=]
|
||||
|
@ -121,13 +121,13 @@ void Tray::rebuildMenu() {
|
|||
{
|
||||
bool ghostMode = AyuSettings::isGhostModeActive();
|
||||
|
||||
settings->set_ghostModeEnabled(!ghostMode);
|
||||
AyuSettings::set_ghostModeEnabled(!ghostMode);
|
||||
|
||||
AyuSettings::save();
|
||||
});
|
||||
}
|
||||
|
||||
if (settings->showStreamerToggleInTray) {
|
||||
if (settings.showStreamerToggleInTray) {
|
||||
auto turnStreamerModeText = _textUpdates.events(
|
||||
) | rpl::map(
|
||||
[=]
|
||||
|
|
|
@ -386,12 +386,12 @@ Panel::Panel(Args &&args)
|
|||
, _allowClipboardRead(args.allowClipboardRead) {
|
||||
_widget->setWindowFlag(Qt::WindowStaysOnTopHint, false);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
auto size = QSize(st::botWebViewPanelSize);
|
||||
if (settings->increaseWebviewHeight) {
|
||||
if (settings.increaseWebviewHeight) {
|
||||
size.setHeight(st::botWebViewPanelHeightIncreased);
|
||||
}
|
||||
if (settings->increaseWebviewWidth) {
|
||||
if (settings.increaseWebviewWidth) {
|
||||
size.setWidth(st::botWebViewPanelWidthIncreased);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ void EnsureBlockquoteCache(
|
|||
cache->outlines = colors.outlines;
|
||||
cache->icon = colors.name;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->simpleQuotesAndReplies) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.simpleQuotesAndReplies) {
|
||||
cache->bg = QColor(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,8 +339,8 @@ System::Timing System::countTiming(
|
|||
delay = config.notifyDefaultDelay;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableNotificationsDelay) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.disableNotificationsDelay) {
|
||||
delay = minimalDelay;
|
||||
}
|
||||
|
||||
|
|
|
@ -482,9 +482,9 @@ auto ChatThemeValueFromPeer(
|
|||
peer
|
||||
) | rpl::map([=](ResolvedTheme resolved)
|
||||
-> rpl::producer<std::shared_ptr<Ui::ChatTheme>> {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
// this check ensures that background is not a pattern wallpaper in a private chat
|
||||
if (settings->disableCustomBackgrounds && resolved.paper && resolved.paper->media) {
|
||||
if (settings.disableCustomBackgrounds && resolved.paper && resolved.paper->media) {
|
||||
resolved.paper = std::nullopt;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ void FiltersMenu::setupMainMenuIcon() {
|
|||
? &st::windowFiltersMainMenuUnread
|
||||
: &st::windowFiltersMainMenuUnreadMuted;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationCounters) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideNotificationCounters) {
|
||||
icon = nullptr;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ void FiltersMenu::scrollToButton(not_null<Ui::RpWidget*> widget) {
|
|||
|
||||
void FiltersMenu::refresh() {
|
||||
// AyuGram hideAllChatsFolder
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto filters = &_session->session().data().chatsFilters();
|
||||
if (!filters->has() || _ignoreRefresh) {
|
||||
|
@ -194,7 +194,7 @@ void FiltersMenu::refresh() {
|
|||
const auto maxLimit = (reorderAll ? 1 : 0)
|
||||
+ Data::PremiumLimits(&_session->session()).dialogFiltersCurrent();
|
||||
const auto premiumFrom = (reorderAll ? 0 : 1) + maxLimit;
|
||||
if (!reorderAll && !settings->hideAllChatsFolder) {
|
||||
if (!reorderAll && !settings.hideAllChatsFolder) {
|
||||
_reorder->addPinnedInterval(0, 1);
|
||||
}
|
||||
_reorder->addPinnedInterval(
|
||||
|
@ -229,7 +229,7 @@ void FiltersMenu::refresh() {
|
|||
// Also check for session content existance, because it may be null
|
||||
// and there will be an exception in `Window::SessionController::showPeerHistory`
|
||||
// because `SessionController::content()` == nullptr
|
||||
if (settings->hideAllChatsFolder && _session->widget()->sessionContent()) {
|
||||
if (settings.hideAllChatsFolder && _session->widget()->sessionContent()) {
|
||||
const auto lookupId = filters->lookupId(0);
|
||||
_session->setActiveChatsFilter(lookupId);
|
||||
}
|
||||
|
@ -310,8 +310,8 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
|||
auto count = (chats + state.marks)
|
||||
- (includeMuted ? 0 : muted);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationCounters) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (settings.hideNotificationCounters) {
|
||||
count = 0;
|
||||
muted = 0;
|
||||
}
|
||||
|
@ -457,11 +457,11 @@ void FiltersMenu::applyReorder(
|
|||
}
|
||||
|
||||
// AyuGram hideAllChatsFolder
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto filters = &_session->session().data().chatsFilters();
|
||||
const auto &list = filters->list();
|
||||
if (!settings->hideAllChatsFolder && !premium()) {
|
||||
if (!settings.hideAllChatsFolder && !premium()) {
|
||||
if (list[0].id() != FilterId()) {
|
||||
filters->moveAllToFront();
|
||||
}
|
||||
|
|
|
@ -639,7 +639,7 @@ void MainMenu::showFinished() {
|
|||
void MainMenu::setupMenu() {
|
||||
using namespace Settings;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
const auto controller = _controller;
|
||||
const auto addAction = [&](
|
||||
|
@ -706,28 +706,28 @@ void MainMenu::setupMenu() {
|
|||
controller->showPeerHistory(controller->session().user());
|
||||
});
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
|
||||
if (settings->showLReadToggleInDrawer) {
|
||||
if (settings.showLReadToggleInDrawer) {
|
||||
addAction(
|
||||
tr::ayu_LReadMessages(),
|
||||
{&st::ayuLReadMenuIcon}
|
||||
)->setClickedCallback([=]
|
||||
{
|
||||
auto prev = settings->sendReadMessages;
|
||||
settings->set_sendReadMessages(false);
|
||||
auto prev = settings.sendReadMessages;
|
||||
AyuSettings::set_sendReadMessages(false);
|
||||
|
||||
auto chats = controller->session().data().chatsList();
|
||||
MarkAsReadChatList(chats);
|
||||
|
||||
settings->set_sendReadMessages(prev);
|
||||
AyuSettings::set_sendReadMessages(prev);
|
||||
});
|
||||
}
|
||||
|
||||
if (settings->showSReadToggleInDrawer) {
|
||||
if (settings.showSReadToggleInDrawer) {
|
||||
auto callback = [=](Fn<void()> &&close) {
|
||||
auto prev = settings->sendReadMessages;
|
||||
settings->set_sendReadMessages(true);
|
||||
auto prev = settings.sendReadMessages;
|
||||
AyuSettings::set_sendReadMessages(true);
|
||||
|
||||
auto chats = controller->session().data().chatsList();
|
||||
MarkAsReadChatList(chats);
|
||||
|
@ -735,7 +735,7 @@ void MainMenu::setupMenu() {
|
|||
// slight delay for forums to send packets
|
||||
dispatchToMainThread([=]
|
||||
{
|
||||
settings->set_sendReadMessages(prev);
|
||||
AyuSettings::set_sendReadMessages(prev);
|
||||
}, 200);
|
||||
close();
|
||||
};
|
||||
|
@ -814,7 +814,7 @@ void MainMenu::setupMenu() {
|
|||
toggle);
|
||||
}, _nightThemeToggle->lifetime());
|
||||
|
||||
if (settings->showGhostToggleInDrawer) {
|
||||
if (settings.showGhostToggleInDrawer) {
|
||||
_ghostModeToggle = addAction(
|
||||
tr::ayu_GhostModeToggle(),
|
||||
{&st::ayuGhostIcon}
|
||||
|
@ -824,13 +824,13 @@ void MainMenu::setupMenu() {
|
|||
) | rpl::start_with_next(
|
||||
[=](bool ghostMode)
|
||||
{
|
||||
settings->set_ghostModeEnabled(ghostMode);
|
||||
AyuSettings::set_ghostModeEnabled(ghostMode);
|
||||
AyuSettings::save();
|
||||
},
|
||||
_ghostModeToggle->lifetime());
|
||||
}
|
||||
|
||||
if (settings->showStreamerToggleInDrawer) {
|
||||
if (settings.showStreamerToggleInDrawer) {
|
||||
_streamerModeToggle = addAction(
|
||||
tr::ayu_StreamerModeToggle(),
|
||||
{&st::ayuStreamerModeMenuIcon}
|
||||
|
|
|
@ -1794,8 +1794,8 @@ void SessionController::activateFirstChatsFilter() {
|
|||
}
|
||||
_filtersActivated = true;
|
||||
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->hideAllChatsFolder) {
|
||||
const auto& settings = AyuSettings::getInstance();
|
||||
if (!settings.hideAllChatsFolder) {
|
||||
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue