Merge branch 'refs/heads/dev' into fork/bleizix/dev

This commit is contained in:
AlexeyZavar 2025-07-05 21:45:20 +03:00
commit e834d88c38
78 changed files with 3426 additions and 2009 deletions

View file

@ -67,12 +67,24 @@ brew install --cask ayugram
### Arch Linux
Вы можете установить `ayugram-desktop` из [AUR](https://aur.archlinux.org/packages?O=0&K=ayugram).
#### Из исходников (рекомендованный способ)
Установите `ayugram-desktop` из [AUR](https://aur.archlinux.org/packages/ayugram-desktop).
#### Готовые бинарники
Установите `ayugram-desktop-bin` из [AUR](https://aur.archlinux.org/packages/ayugram-desktop-bin).
Примечание: данный пакет собирается не нами.
### NixOS
Попробуйте [этот репозиторий](https://github.com/ayugram-port/ayugram-desktop).
### ALT Linux
[Sisyphus](https://packages.altlinux.org/en/sisyphus/srpms/ayugram-desktop/)
### Любой другой Линукс дистрибутив
Следуйте [официальному руководству](https://github.com/AyuGram/AyuGramDesktop/blob/dev/docs/building-linux.md).

View file

@ -68,12 +68,24 @@ brew install --cask ayugram
### Arch Linux
You can install `ayugram-desktop` from [AUR](https://aur.archlinux.org/packages?O=0&K=ayugram).
#### From source (recommended)
Install `ayugram-desktop` from [AUR](https://aur.archlinux.org/packages/ayugram-desktop).
#### Prebuilt binaries
Install `ayugram-desktop-bin` from [AUR](https://aur.archlinux.org/packages/ayugram-desktop-bin).
Note: these binaries aren't officially maintained by us.
### NixOS
See [this repository](https://github.com/ayugram-port/ayugram-desktop) for installation manual.
### ALT Linux
[Sisyphus](https://packages.altlinux.org/en/sisyphus/srpms/ayugram-desktop/)
### Any other Linux distro
Follow the [official guide](https://github.com/AyuGram/AyuGramDesktop/blob/dev/docs/building-linux.md).

View file

@ -129,8 +129,6 @@ set(ayugram_files
ayu/ui/ayu_logo.h
ayu/ui/utils/ayu_profile_values.cpp
ayu/ui/utils/ayu_profile_values.h
ayu/ui/settings/icon_picker.cpp
ayu/ui/settings/icon_picker.h
ayu/ui/settings/settings_ayu.cpp
ayu/ui/settings/settings_ayu.h
ayu/ui/context_menu/context_menu.cpp
@ -143,10 +141,8 @@ set(ayugram_files
ayu/ui/message_history/history_item.h
ayu/ui/message_history/history_section.cpp
ayu/ui/message_history/history_section.h
ayu/ui/boxes/edit_deleted_mark.cpp
ayu/ui/boxes/edit_deleted_mark.h
ayu/ui/boxes/edit_edited_mark.cpp
ayu/ui/boxes/edit_edited_mark.h
ayu/ui/boxes/edit_mark_box.cpp
ayu/ui/boxes/edit_mark_box.h
ayu/ui/boxes/font_selector.cpp
ayu/ui/boxes/font_selector.h
ayu/ui/boxes/theme_selector_box.cpp
@ -155,6 +151,8 @@ set(ayugram_files
ayu/ui/boxes/message_shot_box.h
ayu/ui/components/image_view.cpp
ayu/ui/components/image_view.h
ayu/ui/components/icon_picker.cpp
ayu/ui/components/icon_picker.h
ayu/libs/json.hpp
ayu/libs/json_ext.hpp
ayu/libs/sqlite/sqlite3.c

View file

@ -417,8 +417,8 @@ void set_localPremium(bool val) {
settings->localPremium = val;
}
void set_appIcon(QString val) {
settings->appIcon = std::move(val);
void set_appIcon(const QString &val) {
settings->appIcon = val;
}
void set_simpleQuotesAndReplies(bool val) {
@ -429,13 +429,13 @@ void set_replaceBottomInfoWithIcons(bool val) {
settings->replaceBottomInfoWithIcons = val;
}
void set_deletedMark(QString val) {
settings->deletedMark = std::move(val);
void set_deletedMark(const QString &val) {
settings->deletedMark = val;
deletedMarkReactive = settings->deletedMark;
}
void set_editedMark(QString val) {
settings->editedMark = std::move(val);
void set_editedMark(const QString &val) {
settings->editedMark = val;
editedMarkReactive = settings->editedMark;
}
@ -522,7 +522,7 @@ void set_showStreamerToggleInTray(bool val) {
settings->showStreamerToggleInTray = val;
}
void set_monoFont(QString val) {
void set_monoFont(const QString &val) {
settings->monoFont = val;
}

View file

@ -8,6 +8,33 @@
#include "ayu/libs/json.hpp"
#include "ayu/libs/json_ext.hpp"
// json.hpp in some build environments may not provide helper macros.
// To ensure successful compilation, define them here when missing.
#ifndef NLOHMANN_JSON_TO
#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1;
#endif
#ifndef NLOHMANN_JSON_FROM
#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1);
#endif
#ifndef NLOHMANN_JSON_FROM_WITH_DEFAULT
#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) \
nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1);
#endif
#ifndef NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, \
const Type& nlohmann_json_t) { \
NLOHMANN_JSON_EXPAND( \
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
} \
inline void from_json(const nlohmann::json& nlohmann_json_j, \
Type& nlohmann_json_t) { \
const Type nlohmann_json_default_obj{}; \
NLOHMANN_JSON_EXPAND( \
NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) \
}
#endif
#include "rpl/producer.h"
namespace AyuSettings {
@ -132,11 +159,11 @@ void set_increaseWebviewWidth(bool val);
void set_disableNotificationsDelay(bool val);
void set_localPremium(bool val);
void set_appIcon(QString val);
void set_appIcon(const QString &val);
void set_simpleQuotesAndReplies(bool val);
void set_replaceBottomInfoWithIcons(bool val);
void set_deletedMark(QString val);
void set_editedMark(QString val);
void set_deletedMark(const QString &val);
void set_editedMark(const QString &val);
void set_recentStickersCount(int val);
void set_showReactionsPanelInContextMenu(int val);
@ -162,7 +189,7 @@ void set_showStreamerToggleInDrawer(bool val);
void set_showGhostToggleInTray(bool val);
void set_showStreamerToggleInTray(bool val);
void set_monoFont(QString val);
void set_monoFont(const QString &val);
void set_hideNotificationCounters(bool val);
void set_hideNotificationBadge(bool val);
@ -178,68 +205,130 @@ void set_stickerConfirmation(bool val);
void set_gifConfirmation(bool val);
void set_voiceConfirmation(bool val);
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
AyuGramSettings,
sendReadMessages,
sendReadStories,
sendOnlinePackets,
sendUploadProgress,
sendOfflinePacketAfterOnline,
markReadAfterAction,
useScheduledMessages,
sendWithoutSound,
saveDeletedMessages,
saveMessagesHistory,
saveForBots,
hideFromBlocked,
disableAds,
disableStories,
disableCustomBackgrounds,
showOnlyAddedEmojisAndStickers,
collapseSimilarChannels,
hideSimilarChannels,
wideMultiplier,
spoofWebviewAsAndroid,
increaseWebviewHeight,
increaseWebviewWidth,
disableNotificationsDelay,
localPremium,
appIcon,
simpleQuotesAndReplies,
replaceBottomInfoWithIcons,
deletedMark,
editedMark,
recentStickersCount,
showReactionsPanelInContextMenu,
showViewsPanelInContextMenu,
showHideMessageInContextMenu,
showUserMessagesInContextMenu,
showMessageDetailsInContextMenu,
showAttachButtonInMessageField,
showCommandsButtonInMessageField,
showEmojiButtonInMessageField,
showMicrophoneButtonInMessageField,
showAutoDeleteButtonInMessageField,
showAttachPopup,
showEmojiPopup,
showLReadToggleInDrawer,
showSReadToggleInDrawer,
showGhostToggleInDrawer,
showStreamerToggleInDrawer,
showGhostToggleInTray,
showStreamerToggleInTray,
monoFont,
hideNotificationCounters,
hideNotificationBadge,
hideAllChatsFolder,
channelBottomButton,
showPeerId,
showMessageSeconds,
showMessageShot,
stickerConfirmation,
gifConfirmation,
voiceConfirmation
);
inline void to_json(nlohmann::json &nlohmann_json_j, const AyuGramSettings &nlohmann_json_t) {
NLOHMANN_JSON_TO(sendReadMessages)
NLOHMANN_JSON_TO(sendReadStories)
NLOHMANN_JSON_TO(sendOnlinePackets)
NLOHMANN_JSON_TO(sendUploadProgress)
NLOHMANN_JSON_TO(sendOfflinePacketAfterOnline)
NLOHMANN_JSON_TO(markReadAfterAction)
NLOHMANN_JSON_TO(useScheduledMessages)
NLOHMANN_JSON_TO(sendWithoutSound)
NLOHMANN_JSON_TO(saveDeletedMessages)
NLOHMANN_JSON_TO(saveMessagesHistory)
NLOHMANN_JSON_TO(saveForBots)
NLOHMANN_JSON_TO(hideFromBlocked)
NLOHMANN_JSON_TO(disableAds)
NLOHMANN_JSON_TO(disableStories)
NLOHMANN_JSON_TO(disableCustomBackgrounds)
NLOHMANN_JSON_TO(showOnlyAddedEmojisAndStickers)
NLOHMANN_JSON_TO(collapseSimilarChannels)
NLOHMANN_JSON_TO(hideSimilarChannels)
NLOHMANN_JSON_TO(wideMultiplier)
NLOHMANN_JSON_TO(spoofWebviewAsAndroid)
NLOHMANN_JSON_TO(increaseWebviewHeight)
NLOHMANN_JSON_TO(increaseWebviewWidth)
NLOHMANN_JSON_TO(disableNotificationsDelay)
NLOHMANN_JSON_TO(localPremium)
NLOHMANN_JSON_TO(appIcon)
NLOHMANN_JSON_TO(simpleQuotesAndReplies)
NLOHMANN_JSON_TO(replaceBottomInfoWithIcons)
NLOHMANN_JSON_TO(deletedMark)
NLOHMANN_JSON_TO(editedMark)
NLOHMANN_JSON_TO(recentStickersCount)
NLOHMANN_JSON_TO(showReactionsPanelInContextMenu)
NLOHMANN_JSON_TO(showViewsPanelInContextMenu)
NLOHMANN_JSON_TO(showHideMessageInContextMenu)
NLOHMANN_JSON_TO(showUserMessagesInContextMenu)
NLOHMANN_JSON_TO(showMessageDetailsInContextMenu)
NLOHMANN_JSON_TO(showAttachButtonInMessageField)
NLOHMANN_JSON_TO(showCommandsButtonInMessageField)
NLOHMANN_JSON_TO(showEmojiButtonInMessageField)
NLOHMANN_JSON_TO(showMicrophoneButtonInMessageField)
NLOHMANN_JSON_TO(showAutoDeleteButtonInMessageField)
NLOHMANN_JSON_TO(showAttachPopup)
NLOHMANN_JSON_TO(showEmojiPopup)
NLOHMANN_JSON_TO(showLReadToggleInDrawer)
NLOHMANN_JSON_TO(showSReadToggleInDrawer)
NLOHMANN_JSON_TO(showGhostToggleInDrawer)
NLOHMANN_JSON_TO(showStreamerToggleInDrawer)
NLOHMANN_JSON_TO(showGhostToggleInTray)
NLOHMANN_JSON_TO(showStreamerToggleInTray)
NLOHMANN_JSON_TO(monoFont)
NLOHMANN_JSON_TO(hideNotificationCounters)
NLOHMANN_JSON_TO(hideNotificationBadge)
NLOHMANN_JSON_TO(hideAllChatsFolder)
NLOHMANN_JSON_TO(channelBottomButton)
NLOHMANN_JSON_TO(showPeerId)
NLOHMANN_JSON_TO(showMessageSeconds)
NLOHMANN_JSON_TO(showMessageShot)
NLOHMANN_JSON_TO(stickerConfirmation)
NLOHMANN_JSON_TO(gifConfirmation)
NLOHMANN_JSON_TO(voiceConfirmation)
}
inline void from_json(const nlohmann::json &nlohmann_json_j, AyuGramSettings &nlohmann_json_t) {
const AyuGramSettings nlohmann_json_default_obj{};
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendReadMessages)
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendReadStories)
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendOnlinePackets)
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendUploadProgress)
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendOfflinePacketAfterOnline)
NLOHMANN_JSON_FROM_WITH_DEFAULT(markReadAfterAction)
NLOHMANN_JSON_FROM_WITH_DEFAULT(useScheduledMessages)
NLOHMANN_JSON_FROM_WITH_DEFAULT(sendWithoutSound)
NLOHMANN_JSON_FROM_WITH_DEFAULT(saveDeletedMessages)
NLOHMANN_JSON_FROM_WITH_DEFAULT(saveMessagesHistory)
NLOHMANN_JSON_FROM_WITH_DEFAULT(saveForBots)
NLOHMANN_JSON_FROM_WITH_DEFAULT(hideFromBlocked)
NLOHMANN_JSON_FROM_WITH_DEFAULT(disableAds)
NLOHMANN_JSON_FROM_WITH_DEFAULT(disableStories)
NLOHMANN_JSON_FROM_WITH_DEFAULT(disableCustomBackgrounds)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showOnlyAddedEmojisAndStickers)
NLOHMANN_JSON_FROM_WITH_DEFAULT(collapseSimilarChannels)
NLOHMANN_JSON_FROM_WITH_DEFAULT(hideSimilarChannels)
NLOHMANN_JSON_FROM_WITH_DEFAULT(wideMultiplier)
NLOHMANN_JSON_FROM_WITH_DEFAULT(spoofWebviewAsAndroid)
NLOHMANN_JSON_FROM_WITH_DEFAULT(increaseWebviewHeight)
NLOHMANN_JSON_FROM_WITH_DEFAULT(increaseWebviewWidth)
NLOHMANN_JSON_FROM_WITH_DEFAULT(disableNotificationsDelay)
NLOHMANN_JSON_FROM_WITH_DEFAULT(localPremium)
NLOHMANN_JSON_FROM_WITH_DEFAULT(appIcon)
NLOHMANN_JSON_FROM_WITH_DEFAULT(simpleQuotesAndReplies)
NLOHMANN_JSON_FROM_WITH_DEFAULT(replaceBottomInfoWithIcons)
NLOHMANN_JSON_FROM_WITH_DEFAULT(deletedMark)
NLOHMANN_JSON_FROM_WITH_DEFAULT(editedMark)
NLOHMANN_JSON_FROM_WITH_DEFAULT(recentStickersCount)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showReactionsPanelInContextMenu)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showViewsPanelInContextMenu)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showHideMessageInContextMenu)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showUserMessagesInContextMenu)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showMessageDetailsInContextMenu)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showAttachButtonInMessageField)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showCommandsButtonInMessageField)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showEmojiButtonInMessageField)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showMicrophoneButtonInMessageField)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showAutoDeleteButtonInMessageField)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showAttachPopup)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showEmojiPopup)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showLReadToggleInDrawer)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showSReadToggleInDrawer)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showGhostToggleInDrawer)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showStreamerToggleInDrawer)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showGhostToggleInTray)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showStreamerToggleInTray)
NLOHMANN_JSON_FROM_WITH_DEFAULT(monoFont)
NLOHMANN_JSON_FROM_WITH_DEFAULT(hideNotificationCounters)
NLOHMANN_JSON_FROM_WITH_DEFAULT(hideNotificationBadge)
NLOHMANN_JSON_FROM_WITH_DEFAULT(hideAllChatsFolder)
NLOHMANN_JSON_FROM_WITH_DEFAULT(channelBottomButton)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showPeerId)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showMessageSeconds)
NLOHMANN_JSON_FROM_WITH_DEFAULT(showMessageShot)
NLOHMANN_JSON_FROM_WITH_DEFAULT(stickerConfirmation)
NLOHMANN_JSON_FROM_WITH_DEFAULT(gifConfirmation)
NLOHMANN_JSON_FROM_WITH_DEFAULT(voiceConfirmation)
}
AyuGramSettings &getInstance();

File diff suppressed because it is too large Load diff

View file

@ -133,7 +133,7 @@ extern "C" {
**
** Since [version 3.6.18] ([dateof:3.6.18]),
** SQLite source code has been stored in the
** <a href="http://www.fossil-scm.org/">Fossil configuration management
** <a href="http://fossil-scm.org/">Fossil configuration management
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system. ^The SQLITE_SOURCE_ID
@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.49.1"
#define SQLITE_VERSION_NUMBER 3049001
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70"
#define SQLITE_VERSION "3.50.0"
#define SQLITE_VERSION_NUMBER 3050000
#define SQLITE_SOURCE_ID "2025-05-29 14:26:00 dfc790f998f450d9c35e3ba1c8c89c17466cb559f87b0239e4aab9d34e28f742"
/*
** CAPI3REF: Run-Time Library Version Numbers
@ -1163,6 +1163,12 @@ struct sqlite3_io_methods {
** the value that M is to be set to. Before returning, the 32-bit signed
** integer is overwritten with the previous value of M.
**
** <li>[[SQLITE_FCNTL_BLOCK_ON_CONNECT]]
** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the
** VFS to block when taking a SHARED lock to connect to a wal mode database.
** This is used to implement the functionality associated with
** SQLITE_SETLK_BLOCK_ON_CONNECT.
**
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
** a database file. The argument is a pointer to a 32-bit unsigned integer.
@ -1259,6 +1265,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_CKSM_FILE 41
#define SQLITE_FCNTL_RESET_CACHE 42
#define SQLITE_FCNTL_NULL_IO 43
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@ -1989,13 +1996,16 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
** the default size of lookaside memory on each [database connection].
** the default size of [lookaside memory] on each [database connection].
** The first argument is the
** size of each lookaside buffer slot and the second is the number of
** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
** option to [sqlite3_db_config()] can be used to change the lookaside
** configuration on individual connections.)^ </dd>
** size of each lookaside buffer slot ("sz") and the second is the number of
** slots allocated to each database connection ("cnt").)^
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
** be used to change the lookaside configuration on individual connections.)^
** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
** default lookaside configuration at compile-time.
** </dd>
**
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
@ -2232,31 +2242,50 @@ struct sqlite3_mem_methods {
** [[SQLITE_DBCONFIG_LOOKASIDE]]
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
** configuration of the lookaside memory allocator within a database
** configuration of the [lookaside memory allocator] within a database
** connection.
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
** in the [DBCONFIG arguments|usual format].
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
** should have a total of five parameters.
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
** <ol>
** <li><p>The first argument ("buf") is a
** pointer to a memory buffer to use for lookaside memory.
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
** may be NULL in which case SQLite will allocate the
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
** size of each lookaside buffer slot. ^The third argument is the number of
** slots. The size of the buffer in the first argument must be greater than
** or equal to the product of the second and third arguments. The buffer
** must be aligned to an 8-byte boundary. ^If the second argument to
** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
** rounded down to the next smaller multiple of 8. ^(The lookaside memory
** The first argument may be NULL in which case SQLite will allocate the
** lookaside buffer itself using [sqlite3_malloc()].
** <li><P>The second argument ("sz") is the
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
** is less than 8. The "sz" argument should be a multiple of 8 less than
** 65536. If "sz" does not meet this constraint, it is reduced in size until
** it does.
** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
** parameter is usually chosen so that the product of "sz" and "cnt" is less
** than 1,000,000.
** </ol>
** <p>If the "buf" argument is not NULL, then it must
** point to a memory buffer with a size that is greater than
** or equal to the product of "sz" and "cnt".
** The buffer must be aligned to an 8-byte boundary.
** The lookaside memory
** configuration for a database connection can only be changed when that
** connection is not currently using lookaside memory, or in other words
** when the "current value" returned by
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
** Any attempt to change the lookaside memory configuration when lookaside
** memory is in use leaves the configuration unchanged and returns
** [SQLITE_BUSY].)^</dd>
** [SQLITE_BUSY].
** If the "buf" argument is NULL and an attempt
** to allocate memory based on "sz" and "cnt" fails, then
** lookaside is silently disabled.
** <p>
** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
** default lookaside configuration at initialization. The
** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
** configuration at compile-time. Typical values for lookaside are 1200 for
** "sz" and 40 to 100 for "cnt".
** </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
@ -2993,6 +3022,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
*/
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
/*
** CAPI3REF: Set the Setlk Timeout
** METHOD: sqlite3
**
** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If
** the VFS supports blocking locks, it sets the timeout in ms used by
** eligible locks taken on wal mode databases by the specified database
** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does
** not support blocking locks, this function is a no-op.
**
** Passing 0 to this function disables blocking locks altogether. Passing
** -1 to this function requests that the VFS blocks for a long time -
** indefinitely if possible. The results of passing any other negative value
** are undefined.
**
** Internally, each SQLite database handle store two timeout values - the
** busy-timeout (used for rollback mode databases, or if the VFS does not
** support blocking locks) and the setlk-timeout (used for blocking locks
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
** values, this function sets only the setlk-timeout value. Therefore,
** to configure separate busy-timeout and setlk-timeout values for a single
** database handle, call sqlite3_busy_timeout() followed by this function.
**
** Whenever the number of connections to a wal mode database falls from
** 1 to 0, the last connection takes an exclusive lock on the database,
** then checkpoints and deletes the wal file. While it is doing this, any
** new connection that tries to read from the database fails with an
** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is
** passed to this API, the new connection blocks until the exclusive lock
** has been released.
*/
SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
/*
** CAPI3REF: Flags for sqlite3_setlk_timeout()
*/
#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01
/*
** CAPI3REF: Convenience Routines For Running Queries
** METHOD: sqlite3
@ -5108,7 +5175,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** other than [SQLITE_ROW] before any subsequent invocation of
** sqlite3_step(). Failure to reset the prepared statement using
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
** sqlite3_step() began
** calling [sqlite3_reset()] automatically in this circumstance rather
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
@ -7004,6 +7071,8 @@ SQLITE_API int sqlite3_autovacuum_pages(
**
** ^The second argument is a pointer to the function to invoke when a
** row is updated, inserted or deleted in a rowid table.
** ^The update hook is disabled by invoking sqlite3_update_hook()
** with a NULL pointer as the second parameter.
** ^The first argument to the callback is a copy of the third argument
** to sqlite3_update_hook().
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
@ -11486,9 +11555,10 @@ SQLITE_API void sqlite3session_table_filter(
** is inserted while a session object is enabled, then later deleted while
** the same session object is disabled, no INSERT record will appear in the
** changeset, even though the delete took place while the session was disabled.
** Or, if one field of a row is updated while a session is disabled, and
** another field of the same row is updated while the session is enabled, the
** resulting changeset will contain an UPDATE change that updates both fields.
** Or, if one field of a row is updated while a session is enabled, and
** then another field of the same row is updated while the session is disabled,
** the resulting changeset will contain an UPDATE change that updates both
** fields.
*/
SQLITE_API int sqlite3session_changeset(
sqlite3_session *pSession, /* Session object */
@ -11560,8 +11630,9 @@ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession
** database zFrom the contents of the two compatible tables would be
** identical.
**
** It an error if database zFrom does not exist or does not contain the
** required compatible table.
** Unless the call to this function is a no-op as described above, it is an
** error if database zFrom does not exist or does not contain the required
** compatible table.
**
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
@ -11696,7 +11767,7 @@ SQLITE_API int sqlite3changeset_start_v2(
** The following flags may passed via the 4th parameter to
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
**
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
** <dt>SQLITE_CHANGESETSTART_INVERT <dd>
** Invert the changeset while iterating through it. This is equivalent to
** inverting a changeset using sqlite3changeset_invert() before applying it.
** It is an error to specify this flag with a patchset.
@ -12011,19 +12082,6 @@ SQLITE_API int sqlite3changeset_concat(
void **ppOut /* OUT: Buffer containing output changeset */
);
/*
** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
*/
SQLITE_API int sqlite3changeset_upgrade(
sqlite3 *db,
const char *zDb,
int nIn, const void *pIn, /* Input changeset */
int *pnOut, void **ppOut /* OUT: Inverse of input */
);
/*
** CAPI3REF: Changegroup Handle
**

View file

@ -43,7 +43,7 @@ void loadIcons() {
}
}
QImage loadPreview(QString name) {
QImage loadPreview(const QString& name) {
return QImage(qsl(":/gui/art/ayu/%1/app_preview.png").arg(name));
}

View file

@ -26,7 +26,7 @@ ICON(EXTERA2, "extera2");
void loadAppIco();
QImage loadPreview(QString name);
QImage loadPreview(const QString& name);
QString currentAppLogoName();
QImage currentAppLogo();

View file

@ -1,93 +0,0 @@
// This is the source code of AyuGram for Desktop.
//
// We do not and cannot prevent the use of our code,
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2025
#include "edit_edited_mark.h"
#include "boxes/peer_list_controllers.h"
#include "lang/lang_keys.h"
#include "styles/style_boxes.h"
#include "styles/style_layers.h"
#include "styles/style_widgets.h"
#include "ui/widgets/popup_menu.h"
#include "ui/widgets/fields/input_field.h"
#include "ui/widgets/fields/special_fields.h"
#include "ayu/ayu_settings.h"
EditEditedMarkBox::EditEditedMarkBox(QWidget *)
: _text(
this,
st::defaultInputField,
tr::ayu_EditedMarkText(),
AyuSettings::getInstance().editedMark) {
}
void EditEditedMarkBox::prepare() {
const auto defaultEditedMark = tr::lng_edited(tr::now);
auto newHeight = st::contactPadding.top() + _text->height();
setTitle(tr::ayu_EditedMarkText());
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
setDimensions(st::boxWidth, newHeight);
addLeftButton(tr::ayu_BoxActionReset(),
[=]
{
_text->setText(defaultEditedMark);
});
addButton(tr::lng_settings_save(),
[=]
{
save();
});
addButton(tr::lng_cancel(),
[=]
{
closeBox();
});
const auto submitted = [=]
{
submit();
};
_text->submits(
) | rpl::start_with_next(submitted, _text->lifetime());
}
void EditEditedMarkBox::setInnerFocus() {
_text->setFocusFast();
}
void EditEditedMarkBox::submit() {
if (_text->getLastText().trimmed().isEmpty()) {
_text->setFocus();
_text->showError();
} else {
save();
}
}
void EditEditedMarkBox::resizeEvent(QResizeEvent *e) {
BoxContent::resizeEvent(e);
_text->resize(
width()
- st::boxPadding.left()
- st::newGroupInfoPadding.left()
- st::boxPadding.right(),
_text->height());
const auto left = st::boxPadding.left() + st::newGroupInfoPadding.left();
_text->moveToLeft(left, st::contactPadding.top());
}
void EditEditedMarkBox::save() {
AyuSettings::set_editedMark(_text->getLastText());
AyuSettings::save();
closeBox();
}

View file

@ -1,28 +0,0 @@
// This is the source code of AyuGram for Desktop.
//
// We do not and cannot prevent the use of our code,
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2025
#pragma once
#include "base/timer.h"
#include "boxes/abstract_box.h"
#include "mtproto/sender.h"
class EditEditedMarkBox : public Ui::BoxContent
{
public:
EditEditedMarkBox(QWidget *);
protected:
void setInnerFocus() override;
void prepare() override;
void resizeEvent(QResizeEvent *e) override;
private:
void submit();
void save();
object_ptr<Ui::InputField> _text;
};

View file

@ -4,7 +4,9 @@
// but be respectful and credit the original author.
//
// Copyright @Radolyn, 2025
#include "edit_deleted_mark.h"
#include "edit_mark_box.h"
#include <utility>
#include "boxes/peer_list_controllers.h"
#include "lang/lang_keys.h"
@ -17,19 +19,25 @@
#include "ayu/ayu_settings.h"
EditDeletedMarkBox::EditDeletedMarkBox(QWidget *)
: _text(
EditMarkBox::EditMarkBox(QWidget *,
rpl::producer<QString> title,
const QString &currentValue,
QString defaultValue,
const Fn<void(const QString &)> &saveCallback)
: _title(title)
, _defaultValue(std::move(defaultValue))
, _saveCallback(saveCallback)
, _text(
this,
st::defaultInputField,
tr::ayu_DeletedMarkText(),
AyuSettings::getInstance().deletedMark) {
title,
currentValue) {
}
void EditDeletedMarkBox::prepare() {
const auto defaultDeletedMark = "🧹";
void EditMarkBox::prepare() {
auto newHeight = st::contactPadding.top() + _text->height();
setTitle(tr::ayu_DeletedMarkText());
setTitle(_title);
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
setDimensions(st::boxWidth, newHeight);
@ -37,7 +45,7 @@ void EditDeletedMarkBox::prepare() {
addLeftButton(tr::ayu_BoxActionReset(),
[=]
{
_text->setText(defaultDeletedMark);
_text->setText(_defaultValue);
});
addButton(tr::lng_settings_save(),
@ -59,11 +67,11 @@ void EditDeletedMarkBox::prepare() {
) | rpl::start_with_next(submitted, _text->lifetime());
}
void EditDeletedMarkBox::setInnerFocus() {
void EditMarkBox::setInnerFocus() {
_text->setFocusFast();
}
void EditDeletedMarkBox::submit() {
void EditMarkBox::submit() {
if (_text->getLastText().trimmed().isEmpty()) {
_text->setFocus();
_text->showError();
@ -72,7 +80,7 @@ void EditDeletedMarkBox::submit() {
}
}
void EditDeletedMarkBox::resizeEvent(QResizeEvent *e) {
void EditMarkBox::resizeEvent(QResizeEvent *e) {
BoxContent::resizeEvent(e);
_text->resize(
@ -86,9 +94,7 @@ void EditDeletedMarkBox::resizeEvent(QResizeEvent *e) {
_text->moveToLeft(left, st::contactPadding.top());
}
void EditDeletedMarkBox::save() {
AyuSettings::set_deletedMark(_text->getLastText());
AyuSettings::save();
void EditMarkBox::save() {
_saveCallback(_text->getLastText());
closeBox();
}

View file

@ -9,10 +9,14 @@
#include "base/timer.h"
#include "boxes/abstract_box.h"
class EditDeletedMarkBox : public Ui::BoxContent
namespace Ui {
class InputField;
}
class EditMarkBox : public Ui::BoxContent
{
public:
EditDeletedMarkBox(QWidget *);
EditMarkBox(QWidget *, rpl::producer<QString> title, const QString& currentValue, QString defaultValue, const Fn<void(const QString&)> &saveCallback);
protected:
void setInnerFocus() override;
@ -23,5 +27,9 @@ private:
void submit();
void save();
rpl::producer<QString> _title;
QString _defaultValue;
Fn<void(const QString&)> _saveCallback;
object_ptr<Ui::InputField> _text;
};

View file

@ -207,14 +207,19 @@ void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
}
const auto history = item->history();
const auto owner = &history->owner();
menu->addAction(
tr::ayu_ContextHideMessage(tr::now),
[=]()
{
item->destroy();
const auto ids = owner->itemOrItsGroup(item);
for (const auto &fullId : ids) {
if (const auto current = owner->message(fullId)) {
current->destroy();
AyuState::hide(current);
}
}
history->requestChatListMessage();
AyuState::hide(item);
},
&st::menuIconClear);
}

View file

@ -7,8 +7,7 @@
#include "settings_ayu.h"
#include "ayu/ayu_settings.h"
#include "ayu/ui/boxes/edit_deleted_mark.h"
#include "ayu/ui/boxes/edit_edited_mark.h"
#include "ayu/ui/boxes/edit_mark_box.h"
#include "ayu/ui/boxes/font_selector.h"
#include "lang_auto.h"
@ -27,7 +26,7 @@
#include "styles/style_settings.h"
#include "styles/style_widgets.h"
#include "icon_picker.h"
#include "../components/icon_picker.h"
#include "tray.h"
#include "core/application.h"
#include "main/main_domain.h"
@ -37,7 +36,6 @@
#include "ui/boxes/confirm_box.h"
#include "ui/boxes/single_choice_box.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/continuous_sliders.h"
@ -464,41 +462,41 @@ Ayu::Ayu(
}
void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
std::vector checkboxes{
NestedEntry{
tr::ayu_DontReadMessages(tr::now), !settings.sendReadMessages, [=](bool enabled)
tr::ayu_DontReadMessages(tr::now), !settings->sendReadMessages, [=](bool enabled)
{
AyuSettings::set_sendReadMessages(!enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_DontReadStories(tr::now), !settings.sendReadStories, [=](bool enabled)
tr::ayu_DontReadStories(tr::now), !settings->sendReadStories, [=](bool enabled)
{
AyuSettings::set_sendReadStories(!enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_DontSendOnlinePackets(tr::now), !settings.sendOnlinePackets, [=](bool enabled)
tr::ayu_DontSendOnlinePackets(tr::now), !settings->sendOnlinePackets, [=](bool enabled)
{
AyuSettings::set_sendOnlinePackets(!enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_DontSendUploadProgress(tr::now), !settings.sendUploadProgress, [=](bool enabled)
tr::ayu_DontSendUploadProgress(tr::now), !settings->sendUploadProgress, [=](bool enabled)
{
AyuSettings::set_sendUploadProgress(!enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_SendOfflinePacketAfterOnline(tr::now), settings.sendOfflinePacketAfterOnline, [=](bool enabled)
tr::ayu_SendOfflinePacketAfterOnline(tr::now), settings->sendOfflinePacketAfterOnline, [=](bool enabled)
{
AyuSettings::set_sendOfflinePacketAfterOnline(enabled);
AyuSettings::save();
@ -510,13 +508,14 @@ void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
}
void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
SetupGhostModeToggle(container);
auto markReadAfterActionVal = container->lifetime().make_state<rpl::variable<bool>>(settings.sendOfflinePacketAfterOnline);
auto markReadAfterActionVal = container->lifetime().make_state<rpl::variable<bool>>(
settings->markReadAfterAction);
auto useScheduledMessagesVal = container->lifetime().make_state<rpl::variable<
bool>>(settings.useScheduledMessages);
bool>>(settings->useScheduledMessages);
AddButtonWithIcon(
container,
@ -528,7 +527,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.sendOfflinePacketAfterOnline);
return (enabled != settings->markReadAfterAction);
}) | start_with_next(
[=](bool enabled)
{
@ -555,7 +554,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.useScheduledMessages);
return (enabled != settings->useScheduledMessages);
}) | start_with_next(
[=](bool enabled)
{
@ -577,12 +576,12 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
tr::ayu_SendWithoutSoundByDefault(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.sendWithoutSound)
rpl::single(settings->sendWithoutSound)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.sendWithoutSound);
return (enabled != settings->sendWithoutSound);
}) | start_with_next(
[=](bool enabled)
{
@ -595,7 +594,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
}
void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader());
@ -604,12 +603,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
tr::ayu_SaveDeletedMessages(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.saveDeletedMessages)
rpl::single(settings->saveDeletedMessages)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.saveDeletedMessages);
return (enabled != settings->saveDeletedMessages);
}) | start_with_next(
[=](bool enabled)
{
@ -623,12 +622,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
tr::ayu_SaveMessagesHistory(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.saveMessagesHistory)
rpl::single(settings->saveMessagesHistory)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.saveMessagesHistory);
return (enabled != settings->saveMessagesHistory);
}) | start_with_next(
[=](bool enabled)
{
@ -646,12 +645,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
tr::ayu_MessageSavingSaveForBots(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.saveForBots)
rpl::single(settings->saveForBots)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.saveForBots);
return (enabled != settings->saveForBots);
}) | start_with_next(
[=](bool enabled)
{
@ -662,7 +661,7 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
}
void SetupMessageFilters(not_null<Ui::VerticalLayout*> container) {
auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_RegexFilters());
@ -671,12 +670,12 @@ void SetupMessageFilters(not_null<Ui::VerticalLayout*> container) {
tr::ayu_FiltersHideFromBlocked(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.hideFromBlocked)
rpl::single(settings->hideFromBlocked)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.hideFromBlocked);
return (enabled != settings->hideFromBlocked);
}) | start_with_next(
[=](bool enabled)
{
@ -687,7 +686,7 @@ void SetupMessageFilters(not_null<Ui::VerticalLayout*> container) {
}
void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader());
@ -696,12 +695,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_DisableAds(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.disableAds)
rpl::single(settings->disableAds)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.disableAds);
return (enabled != settings->disableAds);
}) | start_with_next(
[=](bool enabled)
{
@ -715,12 +714,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_DisableStories(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.disableStories)
rpl::single(settings->disableStories)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.disableStories);
return (enabled != settings->disableStories);
}) | start_with_next(
[=](bool enabled)
{
@ -734,12 +733,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_DisableCustomBackgrounds(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.disableCustomBackgrounds)
rpl::single(settings->disableCustomBackgrounds)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.disableCustomBackgrounds);
return (enabled != settings->disableCustomBackgrounds);
}) | start_with_next(
[=](bool enabled)
{
@ -753,12 +752,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_SimpleQuotesAndReplies(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.simpleQuotesAndReplies)
rpl::single(settings->simpleQuotesAndReplies)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.simpleQuotesAndReplies);
return (enabled != settings->simpleQuotesAndReplies);
}) | start_with_next(
[=](bool enabled)
{
@ -769,14 +768,14 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
std::vector checkboxes = {
NestedEntry{
tr::ayu_CollapseSimilarChannels(tr::now), settings.collapseSimilarChannels, [=](bool enabled)
tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled)
{
AyuSettings::set_collapseSimilarChannels(enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_HideSimilarChannelsTab(tr::now), settings.hideSimilarChannels, [=](bool enabled)
tr::ayu_HideSimilarChannelsTab(tr::now), settings->hideSimilarChannels, [=](bool enabled)
{
AyuSettings::set_hideSimilarChannels(enabled);
AyuSettings::save();
@ -795,12 +794,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_DisableNotificationsDelay(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.disableNotificationsDelay)
rpl::single(settings->disableNotificationsDelay)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.disableNotificationsDelay);
return (enabled != settings->disableNotificationsDelay);
}) | start_with_next(
[=](bool enabled)
{
@ -814,12 +813,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_ShowOnlyAddedEmojisAndStickers(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showOnlyAddedEmojisAndStickers)
rpl::single(settings->showOnlyAddedEmojisAndStickers)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showOnlyAddedEmojisAndStickers);
return (enabled != settings->showOnlyAddedEmojisAndStickers);
}) | start_with_next(
[=](bool enabled)
{
@ -833,12 +832,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
tr::ayu_LocalPremium(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.localPremium)
rpl::single(settings->localPremium)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.localPremium);
return (enabled != settings->localPremium);
}) | start_with_next(
[=](bool enabled)
{
@ -856,7 +855,7 @@ void SetupAppIcon(not_null<Ui::VerticalLayout*> container) {
void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSkip(container);
AddSubsectionTitle(container, tr::ayu_ContextMenuElementsHeader());
@ -870,7 +869,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.showReactionsPanelInContextMenu,
settings->showReactionsPanelInContextMenu,
options,
tr::ayu_SettingsContextMenuReactionsPanel(),
tr::ayu_SettingsContextMenuTitle(),
@ -883,7 +882,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.showViewsPanelInContextMenu,
settings->showViewsPanelInContextMenu,
options,
tr::ayu_SettingsContextMenuViewsPanel(),
tr::ayu_SettingsContextMenuTitle(),
@ -897,7 +896,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.showHideMessageInContextMenu,
settings->showHideMessageInContextMenu,
options,
tr::ayu_ContextHideMessage(),
tr::ayu_SettingsContextMenuTitle(),
@ -910,7 +909,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.showUserMessagesInContextMenu,
settings->showUserMessagesInContextMenu,
options,
tr::ayu_UserMessagesMenuText(),
tr::ayu_SettingsContextMenuTitle(),
@ -923,7 +922,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.showMessageDetailsInContextMenu,
settings->showMessageDetailsInContextMenu,
options,
tr::ayu_MessageDetailsPC(),
tr::ayu_SettingsContextMenuTitle(),
@ -939,7 +938,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
}
void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSkip(container);
AddSubsectionTitle(container, tr::ayu_MessageFieldElementsHeader());
@ -950,12 +949,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldAttachIcon}
)->toggleOn(
rpl::single(settings.showAttachButtonInMessageField)
rpl::single(settings->showAttachButtonInMessageField)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showAttachButtonInMessageField);
return (enabled != settings->showAttachButtonInMessageField);
}) | start_with_next(
[=](bool enabled)
{
@ -970,12 +969,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldCommandsIcon}
)->toggleOn(
rpl::single(settings.showCommandsButtonInMessageField)
rpl::single(settings->showCommandsButtonInMessageField)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showCommandsButtonInMessageField);
return (enabled != settings->showCommandsButtonInMessageField);
}) | start_with_next(
[=](bool enabled)
{
@ -990,12 +989,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldTTLIcon}
)->toggleOn(
rpl::single(settings.showAutoDeleteButtonInMessageField)
rpl::single(settings->showAutoDeleteButtonInMessageField)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showAutoDeleteButtonInMessageField);
return (enabled != settings->showAutoDeleteButtonInMessageField);
}) | start_with_next(
[=](bool enabled)
{
@ -1010,12 +1009,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldEmojiIcon}
)->toggleOn(
rpl::single(settings.showEmojiButtonInMessageField)
rpl::single(settings->showEmojiButtonInMessageField)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showEmojiButtonInMessageField);
return (enabled != settings->showEmojiButtonInMessageField);
}) | start_with_next(
[=](bool enabled)
{
@ -1030,12 +1029,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldVoiceIcon}
)->toggleOn(
rpl::single(settings.showMicrophoneButtonInMessageField)
rpl::single(settings->showMicrophoneButtonInMessageField)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showMicrophoneButtonInMessageField);
return (enabled != settings->showMicrophoneButtonInMessageField);
}) | start_with_next(
[=](bool enabled)
{
@ -1049,7 +1048,7 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
}
void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSkip(container);
AddSubsectionTitle(container, tr::ayu_MessageFieldPopupsHeader());
@ -1060,12 +1059,12 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldAttachIcon}
)->toggleOn(
rpl::single(settings.showAttachPopup)
rpl::single(settings->showAttachPopup)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showAttachPopup);
return (enabled != settings->showAttachPopup);
}) | start_with_next(
[=](bool enabled)
{
@ -1080,12 +1079,12 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::messageFieldEmojiIcon}
)->toggleOn(
rpl::single(settings.showEmojiPopup)
rpl::single(settings->showEmojiPopup)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showEmojiPopup);
return (enabled != settings->showEmojiPopup);
}) | start_with_next(
[=](bool enabled)
{
@ -1099,7 +1098,7 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
}
void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSkip(container);
AddSubsectionTitle(container, tr::ayu_DrawerElementsHeader());
@ -1110,12 +1109,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::ayuLReadMenuIcon}
)->toggleOn(
rpl::single(settings.showLReadToggleInDrawer)
rpl::single(settings->showLReadToggleInDrawer)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showLReadToggleInDrawer);
return (enabled != settings->showLReadToggleInDrawer);
}) | start_with_next(
[=](bool enabled)
{
@ -1130,12 +1129,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::ayuSReadMenuIcon}
)->toggleOn(
rpl::single(settings.showSReadToggleInDrawer)
rpl::single(settings->showSReadToggleInDrawer)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showSReadToggleInDrawer);
return (enabled != settings->showSReadToggleInDrawer);
}) | start_with_next(
[=](bool enabled)
{
@ -1150,12 +1149,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::ayuGhostIcon}
)->toggleOn(
rpl::single(settings.showGhostToggleInDrawer)
rpl::single(settings->showGhostToggleInDrawer)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showGhostToggleInDrawer);
return (enabled != settings->showGhostToggleInDrawer);
}) | start_with_next(
[=](bool enabled)
{
@ -1171,12 +1170,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
st::settingsButton,
{&st::ayuStreamerModeMenuIcon}
)->toggleOn(
rpl::single(settings.showStreamerToggleInDrawer)
rpl::single(settings->showStreamerToggleInDrawer)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showStreamerToggleInDrawer);
return (enabled != settings->showStreamerToggleInDrawer);
}) | start_with_next(
[=](bool enabled)
{
@ -1188,7 +1187,7 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
}
void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSkip(container);
AddSubsectionTitle(container, tr::ayu_TrayElementsHeader());
@ -1198,12 +1197,12 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
tr::ayu_EnableGhostModeTray(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showGhostToggleInTray)
rpl::single(settings->showGhostToggleInTray)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showGhostToggleInTray);
return (enabled != settings->showGhostToggleInTray);
}) | start_with_next(
[=](bool enabled)
{
@ -1218,12 +1217,12 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
tr::ayu_EnableStreamerModeTray(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showStreamerToggleInTray)
rpl::single(settings->showStreamerToggleInTray)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showStreamerToggleInTray);
return (enabled != settings->showStreamerToggleInTray);
}) | start_with_next(
[=](bool enabled)
{
@ -1236,7 +1235,7 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
const auto options = std::vector{
QString(tr::ayu_SettingsShowID_Hide(tr::now)),
@ -1270,7 +1269,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
{
.title = tr::ayu_SettingsShowID(),
.options = options,
.initialSelection = settings.showPeerId,
.initialSelection = settings->showPeerId,
.callback = save,
});
}));
@ -1278,7 +1277,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
}
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
container->add(
object_ptr<Button>(container,
@ -1300,7 +1299,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
{
label->setText(QString::number(amount));
};
updateLabel(settings.recentStickersCount);
updateLabel(settings->recentStickersCount);
slider->setPseudoDiscrete(
200 + 1,
@ -1309,7 +1308,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
{
return amount;
},
settings.recentStickersCount,
settings->recentStickersCount,
[=](int amount)
{
updateLabel(amount);
@ -1325,7 +1324,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
container->add(
object_ptr<Button>(container,
@ -1360,12 +1359,12 @@ void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
return kMinSize + index * kStep;
};
updateLabel(settings.wideMultiplier);
updateLabel(settings->wideMultiplier);
slider->setPseudoDiscrete(
kSizeAmount,
[=](int index) { return index; },
valueToIndex(settings.wideMultiplier),
valueToIndex(settings->wideMultiplier),
[=](int index)
{
updateLabel(indexToValue(index));
@ -1394,13 +1393,13 @@ void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
}
void SetupFonts(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
const auto monoButton = AddButtonWithLabel(
container,
tr::ayu_MonospaceFont(),
rpl::single(
settings.monoFont.isEmpty() ? tr::ayu_FontDefault(tr::now) : settings.monoFont
settings->monoFont.isEmpty() ? tr::ayu_FontDefault(tr::now) : settings->monoFont
),
st::settingsButtonNoIcon);
const auto monoGuard = Ui::CreateChild<base::binary_guard>(monoButton.get());
@ -1419,7 +1418,7 @@ void SetupFonts(not_null<Ui::VerticalLayout*> container, not_null<Window::Sessio
}
void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
@ -1428,12 +1427,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
tr::ayu_StickerConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.stickerConfirmation)
rpl::single(settings->stickerConfirmation)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.stickerConfirmation);
return (enabled != settings->stickerConfirmation);
}) | start_with_next(
[=](bool enabled)
{
@ -1447,12 +1446,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
tr::ayu_GIFConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.gifConfirmation)
rpl::single(settings->gifConfirmation)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.gifConfirmation);
return (enabled != settings->gifConfirmation);
}) | start_with_next(
[=](bool enabled)
{
@ -1466,12 +1465,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
tr::ayu_VoiceConfirmation(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.voiceConfirmation)
rpl::single(settings->voiceConfirmation)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.voiceConfirmation);
return (enabled != settings->voiceConfirmation);
}) | start_with_next(
[=](bool enabled)
{
@ -1482,19 +1481,19 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
}
void SetupMarks(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddButtonWithIcon(
container,
tr::ayu_ReplaceMarksWithIcons(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.replaceBottomInfoWithIcons)
rpl::single(settings->replaceBottomInfoWithIcons)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.replaceBottomInfoWithIcons);
return (enabled != settings->replaceBottomInfoWithIcons);
}) | start_with_next(
[=](bool enabled)
{
@ -1511,7 +1510,16 @@ void SetupMarks(not_null<Ui::VerticalLayout*> container) {
)->addClickHandler(
[=]()
{
auto box = Box<EditDeletedMarkBox>();
auto box = Box<EditMarkBox>(
tr::ayu_DeletedMarkText(),
settings->deletedMark,
QString("🧹"),
[=](const QString &value)
{
AyuSettings::set_deletedMark(value);
AyuSettings::save();
}
);
Ui::show(std::move(box));
});
@ -1523,25 +1531,34 @@ void SetupMarks(not_null<Ui::VerticalLayout*> container) {
)->addClickHandler(
[=]()
{
auto box = Box<EditEditedMarkBox>();
auto box = Box<EditMarkBox>(
tr::ayu_EditedMarkText(),
settings->editedMark,
tr::lng_edited(tr::now),
[=](const QString &value)
{
AyuSettings::set_editedMark(value);
AyuSettings::save();
}
);
Ui::show(std::move(box));
});
}
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddButtonWithIcon(
container,
tr::ayu_HideNotificationCounters(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.hideNotificationCounters)
rpl::single(settings->hideNotificationCounters)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.hideNotificationCounters);
return (enabled != settings->hideNotificationCounters);
}) | start_with_next(
[=](bool enabled)
{
@ -1557,12 +1574,12 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
tr::ayu_HideNotificationBadge(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.hideNotificationBadge)
rpl::single(settings->hideNotificationBadge)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.hideNotificationBadge);
return (enabled != settings->hideNotificationBadge);
}) | start_with_next(
[=](bool enabled)
{
@ -1581,12 +1598,12 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
tr::ayu_HideAllChats(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.hideAllChatsFolder)
rpl::single(settings->hideAllChatsFolder)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.hideAllChatsFolder);
return (enabled != settings->hideAllChatsFolder);
}) | start_with_next(
[=](bool enabled)
{
@ -1597,7 +1614,7 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
}
void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
const auto options = std::vector{
tr::ayu_ChannelBottomButtonHide(tr::now),
@ -1608,7 +1625,7 @@ void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Wind
AddChooseButtonWithIconAndRightText(
container,
controller,
settings.channelBottomButton,
settings->channelBottomButton,
options,
tr::ayu_ChannelBottomButton(),
tr::ayu_ChannelBottomButton(),
@ -1620,7 +1637,7 @@ void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Wind
}
void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
SetupShowPeerId(container, controller);
@ -1629,12 +1646,12 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
tr::ayu_SettingsShowMessageSeconds(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showMessageSeconds)
rpl::single(settings->showMessageSeconds)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showMessageSeconds);
return (enabled != settings->showMessageSeconds);
}) | start_with_next(
[=](bool enabled)
{
@ -1648,12 +1665,12 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
tr::ayu_SettingsShowMessageShot(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showMessageShot)
rpl::single(settings->showMessageShot)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showMessageShot);
return (enabled != settings->showMessageShot);
}) | start_with_next(
[=](bool enabled)
{
@ -1664,7 +1681,7 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
}
void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
const auto& settings = AyuSettings::getInstance();
auto *settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, rpl::single(QString("Webview")));
@ -1673,12 +1690,12 @@ void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
tr::ayu_SettingsSpoofWebviewAsAndroid(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.spoofWebviewAsAndroid)
rpl::single(settings->spoofWebviewAsAndroid)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.spoofWebviewAsAndroid);
return (enabled != settings->spoofWebviewAsAndroid);
}) | start_with_next(
[=](bool enabled)
{
@ -1689,14 +1706,14 @@ void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
std::vector checkboxes = {
NestedEntry{
tr::ayu_SettingsIncreaseWebviewHeight(tr::now), settings.increaseWebviewHeight, [=](bool enabled)
tr::ayu_SettingsIncreaseWebviewHeight(tr::now), settings->increaseWebviewHeight, [=](bool enabled)
{
AyuSettings::set_increaseWebviewHeight(enabled);
AyuSettings::save();
}
},
NestedEntry{
tr::ayu_SettingsIncreaseWebviewWidth(tr::now), settings.increaseWebviewWidth, [=](bool enabled)
tr::ayu_SettingsIncreaseWebviewWidth(tr::now), settings->increaseWebviewWidth, [=](bool enabled)
{
AyuSettings::set_increaseWebviewWidth(enabled);
AyuSettings::save();

View file

@ -791,7 +791,7 @@ void StickerSetBox::updateButtons() {
searchById(
innerId,
session,
[session, weak](const QString &username, UserData *user)
[session, weak, innerId](const QString &username, UserData *user)
{
if (!weak) {
return;
@ -803,7 +803,8 @@ void StickerSetBox::updateButtons() {
}
if (!user) {
strongInner->showToast(tr::ayu_UserNotFoundMessage(tr::now));
QGuiApplication::clipboard()->setText(QString::number(innerId));
strongInner->showToast(tr::ayu_IDCopiedToast(tr::now));
return;
}

View file

@ -2185,6 +2185,12 @@ void HistoryItem::clearMediaAsExpired() {
if (!media || !media->ttlSeconds()) {
return;
}
const auto &settings = AyuSettings::getInstance();
if (settings.saveDeletedMessages) {
return;
}
if (const auto document = media->document()) {
applyEditionToHistoryCleared();
auto text = (document->isVideoFile()

View file

@ -1524,8 +1524,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
const auto idText = IDString(user);
if (!idText.isEmpty()) {
QGuiApplication::clipboard()->setText(idText);
const auto msg = tr::ayu_IDCopiedToast(tr::now);
controller->showToast(msg);
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
}
return false;
});
@ -1660,8 +1659,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
const auto idText = IDString(peer);
if (!idText.isEmpty()) {
QGuiApplication::clipboard()->setText(idText);
const auto msg = tr::ayu_IDCopiedToast(tr::now);
controller->showToast(msg);
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
}
return false;
});
@ -1685,8 +1683,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
const auto idText = IDString(peer->forumTopicFor(topicRootId)->topicRootId());
if (!idText.isEmpty()) {
QGuiApplication::clipboard()->setText(idText);
const auto msg = tr::ayu_IDCopiedToast(tr::now);
controller->showToast(msg);
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
}
return false;
});

View file

@ -226,6 +226,12 @@ void AddDownloadFilesAction(
return;
}
}
std::sort(docs.begin(), docs.end(), [](const auto &a, const auto &b) {
return a.second < b.second;
});
std::sort(photos.begin(), photos.end(), [](const auto &a, const auto &b) {
return a.second < b.second;
});
const auto done = [weak = Ui::MakeWeak(list)] {
if (const auto strong = weak.data()) {
strong->cancelSelection();
@ -249,6 +255,12 @@ void AddDownloadFilesAction(
return;
}
}
std::sort(docs.begin(), docs.end(), [](const auto &a, const auto &b) {
return a.second < b.second;
});
std::sort(photos.begin(), photos.end(), [](const auto &a, const auto &b) {
return a.second < b.second;
});
const auto done = [weak = Ui::MakeWeak(list)] {
if (const auto strong = weak.data()) {
strong->clearSelected();