mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-09-01 17:43:03 +02:00
Merge branch 'dev' into Hide-button-near-posts-in-channels
This commit is contained in:
commit
2cd97caf5e
78 changed files with 3300 additions and 1945 deletions
14
README-RU.md
14
README-RU.md
|
@ -67,12 +67,24 @@ brew install --cask ayugram
|
||||||
|
|
||||||
### Arch Linux
|
### 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
|
### NixOS
|
||||||
|
|
||||||
Попробуйте [этот репозиторий](https://github.com/ayugram-port/ayugram-desktop).
|
Попробуйте [этот репозиторий](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).
|
Следуйте [официальному руководству](https://github.com/AyuGram/AyuGramDesktop/blob/dev/docs/building-linux.md).
|
||||||
|
|
14
README.md
14
README.md
|
@ -68,12 +68,24 @@ brew install --cask ayugram
|
||||||
|
|
||||||
### Arch Linux
|
### 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
|
### NixOS
|
||||||
|
|
||||||
See [this repository](https://github.com/ayugram-port/ayugram-desktop) for installation manual.
|
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
|
### Any other Linux distro
|
||||||
|
|
||||||
Follow the [official guide](https://github.com/AyuGram/AyuGramDesktop/blob/dev/docs/building-linux.md).
|
Follow the [official guide](https://github.com/AyuGram/AyuGramDesktop/blob/dev/docs/building-linux.md).
|
||||||
|
|
|
@ -129,8 +129,6 @@ set(ayugram_files
|
||||||
ayu/ui/ayu_logo.h
|
ayu/ui/ayu_logo.h
|
||||||
ayu/ui/utils/ayu_profile_values.cpp
|
ayu/ui/utils/ayu_profile_values.cpp
|
||||||
ayu/ui/utils/ayu_profile_values.h
|
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.cpp
|
||||||
ayu/ui/settings/settings_ayu.h
|
ayu/ui/settings/settings_ayu.h
|
||||||
ayu/ui/context_menu/context_menu.cpp
|
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_item.h
|
||||||
ayu/ui/message_history/history_section.cpp
|
ayu/ui/message_history/history_section.cpp
|
||||||
ayu/ui/message_history/history_section.h
|
ayu/ui/message_history/history_section.h
|
||||||
ayu/ui/boxes/edit_deleted_mark.cpp
|
ayu/ui/boxes/edit_mark_box.cpp
|
||||||
ayu/ui/boxes/edit_deleted_mark.h
|
ayu/ui/boxes/edit_mark_box.h
|
||||||
ayu/ui/boxes/edit_edited_mark.cpp
|
|
||||||
ayu/ui/boxes/edit_edited_mark.h
|
|
||||||
ayu/ui/boxes/font_selector.cpp
|
ayu/ui/boxes/font_selector.cpp
|
||||||
ayu/ui/boxes/font_selector.h
|
ayu/ui/boxes/font_selector.h
|
||||||
ayu/ui/boxes/theme_selector_box.cpp
|
ayu/ui/boxes/theme_selector_box.cpp
|
||||||
|
@ -155,6 +151,8 @@ set(ayugram_files
|
||||||
ayu/ui/boxes/message_shot_box.h
|
ayu/ui/boxes/message_shot_box.h
|
||||||
ayu/ui/components/image_view.cpp
|
ayu/ui/components/image_view.cpp
|
||||||
ayu/ui/components/image_view.h
|
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.hpp
|
||||||
ayu/libs/json_ext.hpp
|
ayu/libs/json_ext.hpp
|
||||||
ayu/libs/sqlite/sqlite3.c
|
ayu/libs/sqlite/sqlite3.c
|
||||||
|
|
|
@ -171,7 +171,7 @@ void Polls::sendVotes(
|
||||||
hideSending();
|
hideSending();
|
||||||
_session->updates().applyUpdates(result);
|
_session->updates().applyUpdates(result);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && settings.markReadAfterAction && item)
|
if (!settings.sendReadMessages && settings.markReadAfterAction && item)
|
||||||
{
|
{
|
||||||
readHistory(item);
|
readHistory(item);
|
||||||
|
|
|
@ -118,7 +118,7 @@ void SendProgressManager::send(const Key &key, int progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AyuGram sendUploadProgress
|
// AyuGram sendUploadProgress
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendUploadProgress)
|
if (!settings.sendUploadProgress)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(("[AyuGram] Don't send upload progress"));
|
DEBUG_LOG(("[AyuGram] Don't send upload progress"));
|
||||||
|
|
|
@ -998,7 +998,7 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// AyuGram sendOnlinePackets
|
// AyuGram sendOnlinePackets
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto& config = _session->serverConfig();
|
const auto& config = _session->serverConfig();
|
||||||
bool isOnlineOrig = Core::App().hasActiveWindow(&session());
|
bool isOnlineOrig = Core::App().hasActiveWindow(&session());
|
||||||
bool isOnline = settings.sendOnlinePackets && isOnlineOrig;
|
bool isOnline = settings.sendOnlinePackets && isOnlineOrig;
|
||||||
|
|
|
@ -426,7 +426,7 @@ void ApiWrap::toggleHistoryArchived(
|
||||||
if (archived) {
|
if (archived) {
|
||||||
history->setFolder(_session->data().folder(archiveId));
|
history->setFolder(_session->data().folder(archiveId));
|
||||||
} else {
|
} else {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideAllChatsFolder) {
|
if (settings.hideAllChatsFolder) {
|
||||||
if (const auto window = Core::App().activeWindow()) {
|
if (const auto window = Core::App().activeWindow()) {
|
||||||
if (const auto controller = window->sessionController()) {
|
if (const auto controller = window->sessionController()) {
|
||||||
|
@ -1303,7 +1303,7 @@ void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
||||||
|
|
||||||
void ApiWrap::markContentsRead(
|
void ApiWrap::markContentsRead(
|
||||||
const base::flat_set<not_null<HistoryItem*>> &items) {
|
const base::flat_set<not_null<HistoryItem*>> &items) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto markedIds = QVector<MTPint>();
|
auto markedIds = QVector<MTPint>();
|
||||||
auto channelMarkedIds = base::flat_map<
|
auto channelMarkedIds = base::flat_map<
|
||||||
|
@ -1349,7 +1349,7 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && !passthrough) {
|
if (!settings.sendReadMessages && !passthrough) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1752,7 +1752,7 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
||||||
using Flag = ChannelDataFlag;
|
using Flag = ChannelDataFlag;
|
||||||
chatParticipants().loadSimilarPeers(channel);
|
chatParticipants().loadSimilarPeers(channel);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.collapseSimilarChannels) {
|
if (!settings.collapseSimilarChannels) {
|
||||||
channel->setFlags(channel->flags() | Flag::SimilarExpanded);
|
channel->setFlags(channel->flags() | Flag::SimilarExpanded);
|
||||||
}
|
}
|
||||||
|
@ -3380,7 +3380,7 @@ void ApiWrap::forwardMessages(
|
||||||
shared->callback();
|
shared->callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
||||||
{
|
{
|
||||||
readHistory(history->lastMessage());
|
readHistory(history->lastMessage());
|
||||||
|
|
|
@ -28,7 +28,7 @@ void initLang() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initUiSettings() {
|
void initUiSettings() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
AyuUiSettings::setMonoFont(settings.monoFont);
|
AyuUiSettings::setMonoFont(settings.monoFont);
|
||||||
AyuUiSettings::setWideMultiplier(settings.wideMultiplier);
|
AyuUiSettings::setWideMultiplier(settings.wideMultiplier);
|
||||||
|
|
|
@ -419,8 +419,8 @@ void set_localPremium(bool val) {
|
||||||
settings->localPremium = val;
|
settings->localPremium = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_appIcon(QString val) {
|
void set_appIcon(const QString &val) {
|
||||||
settings->appIcon = std::move(val);
|
settings->appIcon = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_simpleQuotesAndReplies(bool val) {
|
void set_simpleQuotesAndReplies(bool val) {
|
||||||
|
@ -431,13 +431,13 @@ void set_replaceBottomInfoWithIcons(bool val) {
|
||||||
settings->replaceBottomInfoWithIcons = val;
|
settings->replaceBottomInfoWithIcons = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_deletedMark(QString val) {
|
void set_deletedMark(const QString &val) {
|
||||||
settings->deletedMark = std::move(val);
|
settings->deletedMark = val;
|
||||||
deletedMarkReactive = settings->deletedMark;
|
deletedMarkReactive = settings->deletedMark;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_editedMark(QString val) {
|
void set_editedMark(const QString &val) {
|
||||||
settings->editedMark = std::move(val);
|
settings->editedMark = val;
|
||||||
editedMarkReactive = settings->editedMark;
|
editedMarkReactive = settings->editedMark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ void set_showStreamerToggleInTray(bool val) {
|
||||||
settings->showStreamerToggleInTray = val;
|
settings->showStreamerToggleInTray = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_monoFont(QString val) {
|
void set_monoFont(const QString &val) {
|
||||||
settings->monoFont = val;
|
settings->monoFont = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,33 @@
|
||||||
|
|
||||||
#include "ayu/libs/json.hpp"
|
#include "ayu/libs/json.hpp"
|
||||||
#include "ayu/libs/json_ext.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"
|
#include "rpl/producer.h"
|
||||||
|
|
||||||
namespace AyuSettings {
|
namespace AyuSettings {
|
||||||
|
@ -133,11 +160,11 @@ void set_increaseWebviewWidth(bool val);
|
||||||
void set_disableNotificationsDelay(bool val);
|
void set_disableNotificationsDelay(bool val);
|
||||||
void set_localPremium(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_simpleQuotesAndReplies(bool val);
|
||||||
void set_replaceBottomInfoWithIcons(bool val);
|
void set_replaceBottomInfoWithIcons(bool val);
|
||||||
void set_deletedMark(QString val);
|
void set_deletedMark(const QString &val);
|
||||||
void set_editedMark(QString val);
|
void set_editedMark(const QString &val);
|
||||||
void set_recentStickersCount(int val);
|
void set_recentStickersCount(int val);
|
||||||
|
|
||||||
void set_showReactionsPanelInContextMenu(int val);
|
void set_showReactionsPanelInContextMenu(int val);
|
||||||
|
@ -163,7 +190,7 @@ void set_showStreamerToggleInDrawer(bool val);
|
||||||
void set_showGhostToggleInTray(bool val);
|
void set_showGhostToggleInTray(bool val);
|
||||||
void set_showStreamerToggleInTray(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_hideNotificationCounters(bool val);
|
||||||
void set_hideNotificationBadge(bool val);
|
void set_hideNotificationBadge(bool val);
|
||||||
|
|
|
@ -42,7 +42,7 @@ void runOnce() {
|
||||||
lateInit();
|
lateInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendOfflinePacketAfterOnline) {
|
if (!settings.sendOfflinePacketAfterOnline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -133,7 +133,7 @@ extern "C" {
|
||||||
**
|
**
|
||||||
** Since [version 3.6.18] ([dateof:3.6.18]),
|
** Since [version 3.6.18] ([dateof:3.6.18]),
|
||||||
** SQLite source code has been stored in the
|
** 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
|
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
||||||
** a string which identifies a particular check-in of SQLite
|
** a string which identifies a particular check-in of SQLite
|
||||||
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
||||||
|
@ -146,9 +146,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.49.1"
|
#define SQLITE_VERSION "3.50.0"
|
||||||
#define SQLITE_VERSION_NUMBER 3049001
|
#define SQLITE_VERSION_NUMBER 3050000
|
||||||
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70"
|
#define SQLITE_SOURCE_ID "2025-05-29 14:26:00 dfc790f998f450d9c35e3ba1c8c89c17466cb559f87b0239e4aab9d34e28f742"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** 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
|
** the value that M is to be set to. Before returning, the 32-bit signed
|
||||||
** integer is overwritten with the previous value of M.
|
** 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]]
|
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
||||||
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
** 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.
|
** 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_CKSM_FILE 41
|
||||||
#define SQLITE_FCNTL_RESET_CACHE 42
|
#define SQLITE_FCNTL_RESET_CACHE 42
|
||||||
#define SQLITE_FCNTL_NULL_IO 43
|
#define SQLITE_FCNTL_NULL_IO 43
|
||||||
|
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
|
||||||
|
|
||||||
/* deprecated names */
|
/* deprecated names */
|
||||||
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
||||||
|
@ -1989,13 +1996,16 @@ struct sqlite3_mem_methods {
|
||||||
**
|
**
|
||||||
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
** <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
|
** The first argument is the
|
||||||
** size of each lookaside buffer slot and the second is the number of
|
** size of each lookaside buffer slot ("sz") and the second is the number of
|
||||||
** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
|
** slots allocated to each database connection ("cnt").)^
|
||||||
** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
|
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
|
||||||
** option to [sqlite3_db_config()] can be used to change the lookaside
|
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
|
||||||
** configuration on individual connections.)^ </dd>
|
** 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>
|
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
||||||
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
||||||
|
@ -2232,31 +2242,50 @@ struct sqlite3_mem_methods {
|
||||||
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
||||||
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
||||||
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
** <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.
|
** connection.
|
||||||
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
||||||
** in the [DBCONFIG arguments|usual format].
|
** in the [DBCONFIG arguments|usual format].
|
||||||
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
||||||
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
||||||
** should have a total of five parameters.
|
** 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.
|
** pointer to a memory buffer to use for lookaside memory.
|
||||||
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
|
** The first argument may be NULL in which case SQLite will allocate the
|
||||||
** may be NULL in which case SQLite will allocate the
|
** lookaside buffer itself using [sqlite3_malloc()].
|
||||||
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
|
** <li><P>The second argument ("sz") is the
|
||||||
** size of each lookaside buffer slot. ^The third argument is the number of
|
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
|
||||||
** slots. The size of the buffer in the first argument must be greater than
|
** is less than 8. The "sz" argument should be a multiple of 8 less than
|
||||||
** or equal to the product of the second and third arguments. The buffer
|
** 65536. If "sz" does not meet this constraint, it is reduced in size until
|
||||||
** must be aligned to an 8-byte boundary. ^If the second argument to
|
** it does.
|
||||||
** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
|
** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
|
||||||
** rounded down to the next smaller multiple of 8. ^(The lookaside memory
|
** 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
|
** configuration for a database connection can only be changed when that
|
||||||
** connection is not currently using lookaside memory, or in other words
|
** connection is not currently using lookaside memory, or in other words
|
||||||
** when the "current value" returned by
|
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
|
||||||
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
|
|
||||||
** Any attempt to change the lookaside memory configuration when lookaside
|
** Any attempt to change the lookaside memory configuration when lookaside
|
||||||
** memory is in use leaves the configuration unchanged and returns
|
** 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]]
|
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
||||||
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
** <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);
|
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
|
** CAPI3REF: Convenience Routines For Running Queries
|
||||||
** METHOD: sqlite3
|
** 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
|
** other than [SQLITE_ROW] before any subsequent invocation of
|
||||||
** sqlite3_step(). Failure to reset the prepared statement using
|
** sqlite3_step(). Failure to reset the prepared statement using
|
||||||
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
** [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
|
** sqlite3_step() began
|
||||||
** calling [sqlite3_reset()] automatically in this circumstance rather
|
** calling [sqlite3_reset()] automatically in this circumstance rather
|
||||||
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
** 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
|
** ^The second argument is a pointer to the function to invoke when a
|
||||||
** row is updated, inserted or deleted in a rowid table.
|
** 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
|
** ^The first argument to the callback is a copy of the third argument
|
||||||
** to sqlite3_update_hook().
|
** to sqlite3_update_hook().
|
||||||
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
** ^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
|
** 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
|
** 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.
|
** 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
|
** Or, if one field of a row is updated while a session is enabled, and
|
||||||
** another field of the same row is updated while the session is enabled, the
|
** then another field of the same row is updated while the session is disabled,
|
||||||
** resulting changeset will contain an UPDATE change that updates both fields.
|
** the resulting changeset will contain an UPDATE change that updates both
|
||||||
|
** fields.
|
||||||
*/
|
*/
|
||||||
SQLITE_API int sqlite3session_changeset(
|
SQLITE_API int sqlite3session_changeset(
|
||||||
sqlite3_session *pSession, /* Session object */
|
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
|
** database zFrom the contents of the two compatible tables would be
|
||||||
** identical.
|
** identical.
|
||||||
**
|
**
|
||||||
** It an error if database zFrom does not exist or does not contain the
|
** Unless the call to this function is a no-op as described above, it is an
|
||||||
** required compatible table.
|
** 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
|
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
||||||
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
** 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
|
** The following flags may passed via the 4th parameter to
|
||||||
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
** [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
|
** Invert the changeset while iterating through it. This is equivalent to
|
||||||
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
||||||
** It is an error to specify this flag with a patchset.
|
** 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 */
|
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
|
** CAPI3REF: Changegroup Handle
|
||||||
**
|
**
|
||||||
|
|
|
@ -14,7 +14,7 @@ static QImage LAST_LOADED_NO_MARGIN;
|
||||||
namespace AyuAssets {
|
namespace AyuAssets {
|
||||||
|
|
||||||
void loadAppIco() {
|
void loadAppIco() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
QString appDataPath = QDir::fromNativeSeparators(qgetenv("APPDATA"));
|
QString appDataPath = QDir::fromNativeSeparators(qgetenv("APPDATA"));
|
||||||
QString tempIconPath = appDataPath + "/AyuGram.ico";
|
QString tempIconPath = appDataPath + "/AyuGram.ico";
|
||||||
|
@ -30,7 +30,7 @@ void loadAppIco() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadIcons() {
|
void loadIcons() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (LAST_LOADED_NAME != settings.appIcon) {
|
if (LAST_LOADED_NAME != settings.appIcon) {
|
||||||
LAST_LOADED_NAME = settings.appIcon;
|
LAST_LOADED_NAME = settings.appIcon;
|
||||||
|
|
||||||
|
@ -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));
|
return QImage(qsl(":/gui/art/ayu/%1/app_preview.png").arg(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ ICON(EXTERA2, "extera2");
|
||||||
|
|
||||||
void loadAppIco();
|
void loadAppIco();
|
||||||
|
|
||||||
QImage loadPreview(QString name);
|
QImage loadPreview(const QString& name);
|
||||||
|
|
||||||
QString currentAppLogoName();
|
QString currentAppLogoName();
|
||||||
QImage currentAppLogo();
|
QImage currentAppLogo();
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
};
|
|
|
@ -4,7 +4,9 @@
|
||||||
// but be respectful and credit the original author.
|
// but be respectful and credit the original author.
|
||||||
//
|
//
|
||||||
// Copyright @Radolyn, 2025
|
// Copyright @Radolyn, 2025
|
||||||
#include "edit_deleted_mark.h"
|
#include "edit_mark_box.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -17,19 +19,25 @@
|
||||||
|
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
EditDeletedMarkBox::EditDeletedMarkBox(QWidget *)
|
EditMarkBox::EditMarkBox(QWidget *,
|
||||||
: _text(
|
rpl::producer<QString> title,
|
||||||
this,
|
const QString ¤tValue,
|
||||||
st::defaultInputField,
|
QString defaultValue,
|
||||||
tr::ayu_DeletedMarkText(),
|
const Fn<void(const QString &)> &saveCallback)
|
||||||
AyuSettings::getInstance().deletedMark) {
|
: _title(title)
|
||||||
|
, _defaultValue(std::move(defaultValue))
|
||||||
|
, _saveCallback(saveCallback)
|
||||||
|
, _text(
|
||||||
|
this,
|
||||||
|
st::defaultInputField,
|
||||||
|
title,
|
||||||
|
currentValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDeletedMarkBox::prepare() {
|
void EditMarkBox::prepare() {
|
||||||
const auto defaultDeletedMark = "🧹";
|
|
||||||
auto newHeight = st::contactPadding.top() + _text->height();
|
auto newHeight = st::contactPadding.top() + _text->height();
|
||||||
|
|
||||||
setTitle(tr::ayu_DeletedMarkText());
|
setTitle(_title);
|
||||||
|
|
||||||
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
|
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
|
||||||
setDimensions(st::boxWidth, newHeight);
|
setDimensions(st::boxWidth, newHeight);
|
||||||
|
@ -37,7 +45,7 @@ void EditDeletedMarkBox::prepare() {
|
||||||
addLeftButton(tr::ayu_BoxActionReset(),
|
addLeftButton(tr::ayu_BoxActionReset(),
|
||||||
[=]
|
[=]
|
||||||
{
|
{
|
||||||
_text->setText(defaultDeletedMark);
|
_text->setText(_defaultValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton(tr::lng_settings_save(),
|
addButton(tr::lng_settings_save(),
|
||||||
|
@ -59,11 +67,11 @@ void EditDeletedMarkBox::prepare() {
|
||||||
) | rpl::start_with_next(submitted, _text->lifetime());
|
) | rpl::start_with_next(submitted, _text->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDeletedMarkBox::setInnerFocus() {
|
void EditMarkBox::setInnerFocus() {
|
||||||
_text->setFocusFast();
|
_text->setFocusFast();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDeletedMarkBox::submit() {
|
void EditMarkBox::submit() {
|
||||||
if (_text->getLastText().trimmed().isEmpty()) {
|
if (_text->getLastText().trimmed().isEmpty()) {
|
||||||
_text->setFocus();
|
_text->setFocus();
|
||||||
_text->showError();
|
_text->showError();
|
||||||
|
@ -72,7 +80,7 @@ void EditDeletedMarkBox::submit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDeletedMarkBox::resizeEvent(QResizeEvent *e) {
|
void EditMarkBox::resizeEvent(QResizeEvent *e) {
|
||||||
BoxContent::resizeEvent(e);
|
BoxContent::resizeEvent(e);
|
||||||
|
|
||||||
_text->resize(
|
_text->resize(
|
||||||
|
@ -86,9 +94,7 @@ void EditDeletedMarkBox::resizeEvent(QResizeEvent *e) {
|
||||||
_text->moveToLeft(left, st::contactPadding.top());
|
_text->moveToLeft(left, st::contactPadding.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDeletedMarkBox::save() {
|
void EditMarkBox::save() {
|
||||||
AyuSettings::set_deletedMark(_text->getLastText());
|
_saveCallback(_text->getLastText());
|
||||||
AyuSettings::save();
|
|
||||||
|
|
||||||
closeBox();
|
closeBox();
|
||||||
}
|
}
|
|
@ -9,10 +9,14 @@
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
class EditDeletedMarkBox : public Ui::BoxContent
|
namespace Ui {
|
||||||
|
class InputField;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EditMarkBox : public Ui::BoxContent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditDeletedMarkBox(QWidget *);
|
EditMarkBox(QWidget *, rpl::producer<QString> title, const QString& currentValue, QString defaultValue, const Fn<void(const QString&)> &saveCallback);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
@ -23,5 +27,9 @@ private:
|
||||||
void submit();
|
void submit();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
rpl::producer<QString> _title;
|
||||||
|
QString _defaultValue;
|
||||||
|
Fn<void(const QString&)> _saveCallback;
|
||||||
|
|
||||||
object_ptr<Ui::InputField> _text;
|
object_ptr<Ui::InputField> _text;
|
||||||
};
|
};
|
|
@ -38,7 +38,7 @@ void MessageShotBox::prepare() {
|
||||||
void MessageShotBox::setupContent() {
|
void MessageShotBox::setupContent() {
|
||||||
_selectedPalette = std::make_shared<style::palette>();
|
_selectedPalette = std::make_shared<style::palette>();
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto savedShowColorfulReplies = !settings.simpleQuotesAndReplies;
|
const auto savedShowColorfulReplies = !settings.simpleQuotesAndReplies;
|
||||||
|
|
||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
|
|
|
@ -121,7 +121,7 @@ void IconPicker::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconPicker::mousePressEvent(QMouseEvent *e) {
|
void IconPicker::mousePressEvent(QMouseEvent *e) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
auto changed = false;
|
auto changed = false;
|
||||||
|
|
||||||
auto x = e->pos().x();
|
auto x = e->pos().x();
|
|
@ -197,7 +197,7 @@ void AddHistoryAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!needToShowItem(settings.showHideMessageInContextMenu)) {
|
if (!needToShowItem(settings.showHideMessageInContextMenu)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -207,20 +207,25 @@ void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto history = item->history();
|
const auto history = item->history();
|
||||||
|
const auto owner = &history->owner();
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
tr::ayu_ContextHideMessage(tr::now),
|
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();
|
history->requestChatListMessage();
|
||||||
|
|
||||||
AyuState::hide(item);
|
|
||||||
},
|
},
|
||||||
&st::menuIconClear);
|
&st::menuIconClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!needToShowItem(settings.showUserMessagesInContextMenu)) {
|
if (!needToShowItem(settings.showUserMessagesInContextMenu)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +250,7 @@ void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddMessageDetailsAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
void AddMessageDetailsAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!needToShowItem(settings.showMessageDetailsInContextMenu)) {
|
if (!needToShowItem(settings.showMessageDetailsInContextMenu)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +469,7 @@ void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.sendReadMessages) {
|
if (settings.sendReadMessages) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
#include "settings_ayu.h"
|
#include "settings_ayu.h"
|
||||||
|
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
#include "ayu/ui/boxes/edit_deleted_mark.h"
|
#include "ayu/ui/boxes/edit_mark_box.h"
|
||||||
#include "ayu/ui/boxes/edit_edited_mark.h"
|
|
||||||
#include "ayu/ui/boxes/font_selector.h"
|
#include "ayu/ui/boxes/font_selector.h"
|
||||||
|
|
||||||
#include "lang_auto.h"
|
#include "lang_auto.h"
|
||||||
|
@ -28,7 +27,7 @@
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
|
|
||||||
#include "icon_picker.h"
|
#include "../components/icon_picker.h"
|
||||||
#include "tray.h"
|
#include "tray.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_domain.h"
|
#include "main/main_domain.h"
|
||||||
|
@ -38,7 +37,6 @@
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/boxes/single_choice_box.h"
|
#include "ui/boxes/single_choice_box.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/toast/toast.h"
|
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/continuous_sliders.h"
|
#include "ui/widgets/continuous_sliders.h"
|
||||||
|
@ -465,41 +463,41 @@ Ayu::Ayu(
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
|
void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
|
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
|
||||||
|
|
||||||
std::vector checkboxes{
|
std::vector checkboxes{
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_DontReadMessages(tr::now), !settings.sendReadMessages, [=](bool enabled)
|
tr::ayu_DontReadMessages(tr::now), !settings->sendReadMessages, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_sendReadMessages(!enabled);
|
AyuSettings::set_sendReadMessages(!enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_DontReadStories(tr::now), !settings.sendReadStories, [=](bool enabled)
|
tr::ayu_DontReadStories(tr::now), !settings->sendReadStories, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_sendReadStories(!enabled);
|
AyuSettings::set_sendReadStories(!enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_DontSendOnlinePackets(tr::now), !settings.sendOnlinePackets, [=](bool enabled)
|
tr::ayu_DontSendOnlinePackets(tr::now), !settings->sendOnlinePackets, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_sendOnlinePackets(!enabled);
|
AyuSettings::set_sendOnlinePackets(!enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_DontSendUploadProgress(tr::now), !settings.sendUploadProgress, [=](bool enabled)
|
tr::ayu_DontSendUploadProgress(tr::now), !settings->sendUploadProgress, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_sendUploadProgress(!enabled);
|
AyuSettings::set_sendUploadProgress(!enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_SendOfflinePacketAfterOnline(tr::now), settings.sendOfflinePacketAfterOnline, [=](bool enabled)
|
tr::ayu_SendOfflinePacketAfterOnline(tr::now), settings->sendOfflinePacketAfterOnline, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_sendOfflinePacketAfterOnline(enabled);
|
AyuSettings::set_sendOfflinePacketAfterOnline(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
|
@ -511,13 +509,14 @@ void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
SetupGhostModeToggle(container);
|
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<
|
auto useScheduledMessagesVal = container->lifetime().make_state<rpl::variable<
|
||||||
bool>>(settings.useScheduledMessages);
|
bool>>(settings->useScheduledMessages);
|
||||||
|
|
||||||
AddButtonWithIcon(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
|
@ -529,7 +528,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.sendOfflinePacketAfterOnline);
|
return (enabled != settings->markReadAfterAction);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -556,7 +555,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.useScheduledMessages);
|
return (enabled != settings->useScheduledMessages);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -578,12 +577,12 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_SendWithoutSoundByDefault(),
|
tr::ayu_SendWithoutSoundByDefault(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.sendWithoutSound)
|
rpl::single(settings->sendWithoutSound)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.sendWithoutSound);
|
return (enabled != settings->sendWithoutSound);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -596,7 +595,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupSpyEssentials(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());
|
AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader());
|
||||||
|
|
||||||
|
@ -605,12 +604,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_SaveDeletedMessages(),
|
tr::ayu_SaveDeletedMessages(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.saveDeletedMessages)
|
rpl::single(settings->saveDeletedMessages)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.saveDeletedMessages);
|
return (enabled != settings->saveDeletedMessages);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -624,12 +623,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_SaveMessagesHistory(),
|
tr::ayu_SaveMessagesHistory(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.saveMessagesHistory)
|
rpl::single(settings->saveMessagesHistory)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.saveMessagesHistory);
|
return (enabled != settings->saveMessagesHistory);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -647,12 +646,12 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_MessageSavingSaveForBots(),
|
tr::ayu_MessageSavingSaveForBots(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.saveForBots)
|
rpl::single(settings->saveForBots)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.saveForBots);
|
return (enabled != settings->saveForBots);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -663,7 +662,7 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupMessageFilters(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());
|
AddSubsectionTitle(container, tr::ayu_RegexFilters());
|
||||||
|
|
||||||
|
@ -672,12 +671,12 @@ void SetupMessageFilters(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_FiltersHideFromBlocked(),
|
tr::ayu_FiltersHideFromBlocked(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.hideFromBlocked)
|
rpl::single(settings->hideFromBlocked)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.hideFromBlocked);
|
return (enabled != settings->hideFromBlocked);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -688,7 +687,7 @@ void SetupMessageFilters(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupQoLToggles(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());
|
AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader());
|
||||||
|
|
||||||
|
@ -697,12 +696,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_DisableAds(),
|
tr::ayu_DisableAds(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.disableAds)
|
rpl::single(settings->disableAds)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.disableAds);
|
return (enabled != settings->disableAds);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -716,12 +715,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_DisableStories(),
|
tr::ayu_DisableStories(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.disableStories)
|
rpl::single(settings->disableStories)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.disableStories);
|
return (enabled != settings->disableStories);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -735,12 +734,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_DisableCustomBackgrounds(),
|
tr::ayu_DisableCustomBackgrounds(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.disableCustomBackgrounds)
|
rpl::single(settings->disableCustomBackgrounds)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.disableCustomBackgrounds);
|
return (enabled != settings->disableCustomBackgrounds);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -754,12 +753,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_SimpleQuotesAndReplies(),
|
tr::ayu_SimpleQuotesAndReplies(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.simpleQuotesAndReplies)
|
rpl::single(settings->simpleQuotesAndReplies)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.simpleQuotesAndReplies);
|
return (enabled != settings->simpleQuotesAndReplies);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -770,14 +769,14 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
std::vector checkboxes = {
|
std::vector checkboxes = {
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_CollapseSimilarChannels(tr::now), settings.collapseSimilarChannels, [=](bool enabled)
|
tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_collapseSimilarChannels(enabled);
|
AyuSettings::set_collapseSimilarChannels(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_HideSimilarChannelsTab(tr::now), settings.hideSimilarChannels, [=](bool enabled)
|
tr::ayu_HideSimilarChannelsTab(tr::now), settings->hideSimilarChannels, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_hideSimilarChannels(enabled);
|
AyuSettings::set_hideSimilarChannels(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
|
@ -796,12 +795,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_DisableNotificationsDelay(),
|
tr::ayu_DisableNotificationsDelay(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.disableNotificationsDelay)
|
rpl::single(settings->disableNotificationsDelay)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.disableNotificationsDelay);
|
return (enabled != settings->disableNotificationsDelay);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -815,12 +814,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_ShowOnlyAddedEmojisAndStickers(),
|
tr::ayu_ShowOnlyAddedEmojisAndStickers(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showOnlyAddedEmojisAndStickers)
|
rpl::single(settings->showOnlyAddedEmojisAndStickers)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showOnlyAddedEmojisAndStickers);
|
return (enabled != settings->showOnlyAddedEmojisAndStickers);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -834,12 +833,12 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_LocalPremium(),
|
tr::ayu_LocalPremium(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.localPremium)
|
rpl::single(settings->localPremium)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.localPremium);
|
return (enabled != settings->localPremium);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -857,7 +856,7 @@ void SetupAppIcon(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||||
not_null<Window::SessionController*> controller) {
|
not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_ContextMenuElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_ContextMenuElementsHeader());
|
||||||
|
@ -871,7 +870,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||||
AddChooseButtonWithIconAndRightText(
|
AddChooseButtonWithIconAndRightText(
|
||||||
container,
|
container,
|
||||||
controller,
|
controller,
|
||||||
settings.showReactionsPanelInContextMenu,
|
settings->showReactionsPanelInContextMenu,
|
||||||
options,
|
options,
|
||||||
tr::ayu_SettingsContextMenuReactionsPanel(),
|
tr::ayu_SettingsContextMenuReactionsPanel(),
|
||||||
tr::ayu_SettingsContextMenuTitle(),
|
tr::ayu_SettingsContextMenuTitle(),
|
||||||
|
@ -884,7 +883,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||||
AddChooseButtonWithIconAndRightText(
|
AddChooseButtonWithIconAndRightText(
|
||||||
container,
|
container,
|
||||||
controller,
|
controller,
|
||||||
settings.showViewsPanelInContextMenu,
|
settings->showViewsPanelInContextMenu,
|
||||||
options,
|
options,
|
||||||
tr::ayu_SettingsContextMenuViewsPanel(),
|
tr::ayu_SettingsContextMenuViewsPanel(),
|
||||||
tr::ayu_SettingsContextMenuTitle(),
|
tr::ayu_SettingsContextMenuTitle(),
|
||||||
|
@ -972,7 +971,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||||
AddChooseButtonWithIconAndRightText(
|
AddChooseButtonWithIconAndRightText(
|
||||||
container,
|
container,
|
||||||
controller,
|
controller,
|
||||||
settings.showMessageDetailsInContextMenu,
|
settings->showMessageDetailsInContextMenu,
|
||||||
options,
|
options,
|
||||||
tr::ayu_MessageDetailsPC(),
|
tr::ayu_MessageDetailsPC(),
|
||||||
tr::ayu_SettingsContextMenuTitle(),
|
tr::ayu_SettingsContextMenuTitle(),
|
||||||
|
@ -988,7 +987,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_MessageFieldElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_MessageFieldElementsHeader());
|
||||||
|
@ -999,12 +998,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldAttachIcon}
|
{&st::messageFieldAttachIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showAttachButtonInMessageField)
|
rpl::single(settings->showAttachButtonInMessageField)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showAttachButtonInMessageField);
|
return (enabled != settings->showAttachButtonInMessageField);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1019,12 +1018,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldCommandsIcon}
|
{&st::messageFieldCommandsIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showCommandsButtonInMessageField)
|
rpl::single(settings->showCommandsButtonInMessageField)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showCommandsButtonInMessageField);
|
return (enabled != settings->showCommandsButtonInMessageField);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1039,12 +1038,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldTTLIcon}
|
{&st::messageFieldTTLIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showAutoDeleteButtonInMessageField)
|
rpl::single(settings->showAutoDeleteButtonInMessageField)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showAutoDeleteButtonInMessageField);
|
return (enabled != settings->showAutoDeleteButtonInMessageField);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1059,12 +1058,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldEmojiIcon}
|
{&st::messageFieldEmojiIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showEmojiButtonInMessageField)
|
rpl::single(settings->showEmojiButtonInMessageField)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showEmojiButtonInMessageField);
|
return (enabled != settings->showEmojiButtonInMessageField);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1079,12 +1078,12 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldVoiceIcon}
|
{&st::messageFieldVoiceIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showMicrophoneButtonInMessageField)
|
rpl::single(settings->showMicrophoneButtonInMessageField)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showMicrophoneButtonInMessageField);
|
return (enabled != settings->showMicrophoneButtonInMessageField);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1098,7 +1097,7 @@ void SetupMessageFieldElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
|
void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_MessageFieldPopupsHeader());
|
AddSubsectionTitle(container, tr::ayu_MessageFieldPopupsHeader());
|
||||||
|
@ -1109,12 +1108,12 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldAttachIcon}
|
{&st::messageFieldAttachIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showAttachPopup)
|
rpl::single(settings->showAttachPopup)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showAttachPopup);
|
return (enabled != settings->showAttachPopup);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1129,12 +1128,12 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::messageFieldEmojiIcon}
|
{&st::messageFieldEmojiIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showEmojiPopup)
|
rpl::single(settings->showEmojiPopup)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showEmojiPopup);
|
return (enabled != settings->showEmojiPopup);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1148,7 +1147,7 @@ void SetupMessageFieldPopups(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_DrawerElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_DrawerElementsHeader());
|
||||||
|
@ -1159,12 +1158,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::ayuLReadMenuIcon}
|
{&st::ayuLReadMenuIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showLReadToggleInDrawer)
|
rpl::single(settings->showLReadToggleInDrawer)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showLReadToggleInDrawer);
|
return (enabled != settings->showLReadToggleInDrawer);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1179,12 +1178,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::ayuSReadMenuIcon}
|
{&st::ayuSReadMenuIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showSReadToggleInDrawer)
|
rpl::single(settings->showSReadToggleInDrawer)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showSReadToggleInDrawer);
|
return (enabled != settings->showSReadToggleInDrawer);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1199,12 +1198,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::ayuGhostIcon}
|
{&st::ayuGhostIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showGhostToggleInDrawer)
|
rpl::single(settings->showGhostToggleInDrawer)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showGhostToggleInDrawer);
|
return (enabled != settings->showGhostToggleInDrawer);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1220,12 +1219,12 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
st::settingsButton,
|
st::settingsButton,
|
||||||
{&st::ayuStreamerModeMenuIcon}
|
{&st::ayuStreamerModeMenuIcon}
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showStreamerToggleInDrawer)
|
rpl::single(settings->showStreamerToggleInDrawer)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showStreamerToggleInDrawer);
|
return (enabled != settings->showStreamerToggleInDrawer);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1237,7 +1236,7 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddSubsectionTitle(container, tr::ayu_TrayElementsHeader());
|
AddSubsectionTitle(container, tr::ayu_TrayElementsHeader());
|
||||||
|
@ -1247,12 +1246,12 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_EnableGhostModeTray(),
|
tr::ayu_EnableGhostModeTray(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showGhostToggleInTray)
|
rpl::single(settings->showGhostToggleInTray)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showGhostToggleInTray);
|
return (enabled != settings->showGhostToggleInTray);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1267,12 +1266,12 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_EnableStreamerModeTray(),
|
tr::ayu_EnableStreamerModeTray(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showStreamerToggleInTray)
|
rpl::single(settings->showStreamerToggleInTray)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showStreamerToggleInTray);
|
return (enabled != settings->showStreamerToggleInTray);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1285,7 +1284,7 @@ void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
|
void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
|
||||||
not_null<Window::SessionController*> controller) {
|
not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto options = std::vector{
|
const auto options = std::vector{
|
||||||
QString(tr::ayu_SettingsShowID_Hide(tr::now)),
|
QString(tr::ayu_SettingsShowID_Hide(tr::now)),
|
||||||
|
@ -1319,7 +1318,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
|
||||||
{
|
{
|
||||||
.title = tr::ayu_SettingsShowID(),
|
.title = tr::ayu_SettingsShowID(),
|
||||||
.options = options,
|
.options = options,
|
||||||
.initialSelection = settings.showPeerId,
|
.initialSelection = settings->showPeerId,
|
||||||
.callback = save,
|
.callback = save,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -1327,7 +1326,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
container->add(
|
container->add(
|
||||||
object_ptr<Button>(container,
|
object_ptr<Button>(container,
|
||||||
|
@ -1349,7 +1348,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
||||||
{
|
{
|
||||||
label->setText(QString::number(amount));
|
label->setText(QString::number(amount));
|
||||||
};
|
};
|
||||||
updateLabel(settings.recentStickersCount);
|
updateLabel(settings->recentStickersCount);
|
||||||
|
|
||||||
slider->setPseudoDiscrete(
|
slider->setPseudoDiscrete(
|
||||||
200 + 1,
|
200 + 1,
|
||||||
|
@ -1358,7 +1357,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
||||||
{
|
{
|
||||||
return amount;
|
return amount;
|
||||||
},
|
},
|
||||||
settings.recentStickersCount,
|
settings->recentStickersCount,
|
||||||
[=](int amount)
|
[=](int amount)
|
||||||
{
|
{
|
||||||
updateLabel(amount);
|
updateLabel(amount);
|
||||||
|
@ -1374,7 +1373,7 @@ void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
|
void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
|
||||||
not_null<Window::SessionController*> controller) {
|
not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
container->add(
|
container->add(
|
||||||
object_ptr<Button>(container,
|
object_ptr<Button>(container,
|
||||||
|
@ -1409,12 +1408,12 @@ void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
|
||||||
return kMinSize + index * kStep;
|
return kMinSize + index * kStep;
|
||||||
};
|
};
|
||||||
|
|
||||||
updateLabel(settings.wideMultiplier);
|
updateLabel(settings->wideMultiplier);
|
||||||
|
|
||||||
slider->setPseudoDiscrete(
|
slider->setPseudoDiscrete(
|
||||||
kSizeAmount,
|
kSizeAmount,
|
||||||
[=](int index) { return index; },
|
[=](int index) { return index; },
|
||||||
valueToIndex(settings.wideMultiplier),
|
valueToIndex(settings->wideMultiplier),
|
||||||
[=](int index)
|
[=](int index)
|
||||||
{
|
{
|
||||||
updateLabel(indexToValue(index));
|
updateLabel(indexToValue(index));
|
||||||
|
@ -1443,13 +1442,13 @@ void SetupWideMultiplierSlider(not_null<Ui::VerticalLayout*> container,
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupFonts(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
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(
|
const auto monoButton = AddButtonWithLabel(
|
||||||
container,
|
container,
|
||||||
tr::ayu_MonospaceFont(),
|
tr::ayu_MonospaceFont(),
|
||||||
rpl::single(
|
rpl::single(
|
||||||
settings.monoFont.isEmpty() ? tr::ayu_FontDefault(tr::now) : settings.monoFont
|
settings->monoFont.isEmpty() ? tr::ayu_FontDefault(tr::now) : settings->monoFont
|
||||||
),
|
),
|
||||||
st::settingsButtonNoIcon);
|
st::settingsButtonNoIcon);
|
||||||
const auto monoGuard = Ui::CreateChild<base::binary_guard>(monoButton.get());
|
const auto monoGuard = Ui::CreateChild<base::binary_guard>(monoButton.get());
|
||||||
|
@ -1468,7 +1467,7 @@ void SetupFonts(not_null<Ui::VerticalLayout*> container, not_null<Window::Sessio
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
|
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
|
||||||
|
|
||||||
|
@ -1477,12 +1476,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_StickerConfirmation(),
|
tr::ayu_StickerConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.stickerConfirmation)
|
rpl::single(settings->stickerConfirmation)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.stickerConfirmation);
|
return (enabled != settings->stickerConfirmation);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1496,12 +1495,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_GIFConfirmation(),
|
tr::ayu_GIFConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.gifConfirmation)
|
rpl::single(settings->gifConfirmation)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.gifConfirmation);
|
return (enabled != settings->gifConfirmation);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1515,12 +1514,12 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_VoiceConfirmation(),
|
tr::ayu_VoiceConfirmation(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.voiceConfirmation)
|
rpl::single(settings->voiceConfirmation)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.voiceConfirmation);
|
return (enabled != settings->voiceConfirmation);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1531,19 +1530,19 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddButtonWithIcon(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_ReplaceMarksWithIcons(),
|
tr::ayu_ReplaceMarksWithIcons(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.replaceBottomInfoWithIcons)
|
rpl::single(settings->replaceBottomInfoWithIcons)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.replaceBottomInfoWithIcons);
|
return (enabled != settings->replaceBottomInfoWithIcons);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1560,7 +1559,16 @@ void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
||||||
)->addClickHandler(
|
)->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));
|
Ui::show(std::move(box));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1572,25 +1580,34 @@ void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
||||||
)->addClickHandler(
|
)->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));
|
Ui::show(std::move(box));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddButtonWithIcon(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_HideNotificationCounters(),
|
tr::ayu_HideNotificationCounters(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.hideNotificationCounters)
|
rpl::single(settings->hideNotificationCounters)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.hideNotificationCounters);
|
return (enabled != settings->hideNotificationCounters);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1606,12 +1623,12 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
|
||||||
tr::ayu_HideNotificationBadge(),
|
tr::ayu_HideNotificationBadge(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.hideNotificationBadge)
|
rpl::single(settings->hideNotificationBadge)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.hideNotificationBadge);
|
return (enabled != settings->hideNotificationBadge);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1630,12 +1647,12 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
|
||||||
tr::ayu_HideAllChats(),
|
tr::ayu_HideAllChats(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.hideAllChatsFolder)
|
rpl::single(settings->hideAllChatsFolder)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.hideAllChatsFolder);
|
return (enabled != settings->hideAllChatsFolder);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1646,7 +1663,7 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout*> container, not_null<Windo
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
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{
|
const auto options = std::vector{
|
||||||
tr::ayu_ChannelBottomButtonHide(tr::now),
|
tr::ayu_ChannelBottomButtonHide(tr::now),
|
||||||
|
@ -1657,7 +1674,7 @@ void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Wind
|
||||||
AddChooseButtonWithIconAndRightText(
|
AddChooseButtonWithIconAndRightText(
|
||||||
container,
|
container,
|
||||||
controller,
|
controller,
|
||||||
settings.channelBottomButton,
|
settings->channelBottomButton,
|
||||||
options,
|
options,
|
||||||
tr::ayu_ChannelBottomButton(),
|
tr::ayu_ChannelBottomButton(),
|
||||||
tr::ayu_ChannelBottomButton(),
|
tr::ayu_ChannelBottomButton(),
|
||||||
|
@ -1669,7 +1686,7 @@ void SetupChannelSettings(not_null<Ui::VerticalLayout*> container, not_null<Wind
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
SetupShowPeerId(container, controller);
|
SetupShowPeerId(container, controller);
|
||||||
|
|
||||||
|
@ -1678,12 +1695,12 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
|
||||||
tr::ayu_SettingsShowMessageSeconds(),
|
tr::ayu_SettingsShowMessageSeconds(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showMessageSeconds)
|
rpl::single(settings->showMessageSeconds)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showMessageSeconds);
|
return (enabled != settings->showMessageSeconds);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1697,12 +1714,12 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
|
||||||
tr::ayu_SettingsShowMessageShot(),
|
tr::ayu_SettingsShowMessageShot(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.showMessageShot)
|
rpl::single(settings->showMessageShot)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.showMessageShot);
|
return (enabled != settings->showMessageShot);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1713,7 +1730,7 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
|
void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
auto *settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSubsectionTitle(container, rpl::single(QString("Webview")));
|
AddSubsectionTitle(container, rpl::single(QString("Webview")));
|
||||||
|
|
||||||
|
@ -1722,12 +1739,12 @@ void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
|
||||||
tr::ayu_SettingsSpoofWebviewAsAndroid(),
|
tr::ayu_SettingsSpoofWebviewAsAndroid(),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->toggleOn(
|
)->toggleOn(
|
||||||
rpl::single(settings.spoofWebviewAsAndroid)
|
rpl::single(settings->spoofWebviewAsAndroid)
|
||||||
)->toggledValue(
|
)->toggledValue(
|
||||||
) | rpl::filter(
|
) | rpl::filter(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
return (enabled != settings.spoofWebviewAsAndroid);
|
return (enabled != settings->spoofWebviewAsAndroid);
|
||||||
}) | start_with_next(
|
}) | start_with_next(
|
||||||
[=](bool enabled)
|
[=](bool enabled)
|
||||||
{
|
{
|
||||||
|
@ -1738,14 +1755,14 @@ void SetupWebviewSettings(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
std::vector checkboxes = {
|
std::vector checkboxes = {
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_SettingsIncreaseWebviewHeight(tr::now), settings.increaseWebviewHeight, [=](bool enabled)
|
tr::ayu_SettingsIncreaseWebviewHeight(tr::now), settings->increaseWebviewHeight, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_increaseWebviewHeight(enabled);
|
AyuSettings::set_increaseWebviewHeight(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_SettingsIncreaseWebviewWidth(tr::now), settings.increaseWebviewWidth, [=](bool enabled)
|
tr::ayu_SettingsIncreaseWebviewWidth(tr::now), settings->increaseWebviewWidth, [=](bool enabled)
|
||||||
{
|
{
|
||||||
AyuSettings::set_increaseWebviewWidth(enabled);
|
AyuSettings::set_increaseWebviewWidth(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
|
|
|
@ -15,7 +15,7 @@ constexpr auto kMaxChannelId = -1000000000000;
|
||||||
QString IDString(not_null<PeerData*> peer) {
|
QString IDString(not_null<PeerData*> peer) {
|
||||||
auto resultId = QString::number(getBareID(peer));
|
auto resultId = QString::number(getBareID(peer));
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.showPeerId == 2) {
|
if (settings.showPeerId == 2) {
|
||||||
if (peer->isChannel()) {
|
if (peer->isChannel()) {
|
||||||
resultId = QString::number(peerToChannel(peer->id).bare - kMaxChannelId).prepend("-");
|
resultId = QString::number(peerToChannel(peer->id).bare - kMaxChannelId).prepend("-");
|
||||||
|
|
|
@ -108,7 +108,7 @@ bool isMessageHidden(const not_null<HistoryItem*> item) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideFromBlocked) {
|
if (settings.hideFromBlocked) {
|
||||||
if (item->from()->isUser() &&
|
if (item->from()->isUser() &&
|
||||||
item->from()->asUser()->isBlocked()) {
|
item->from()->asUser()->isBlocked()) {
|
||||||
|
@ -513,7 +513,7 @@ int getScheduleTime(int64 sumSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isMessageSavable(const not_null<HistoryItem *> item) {
|
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;
|
return false;
|
||||||
|
|
|
@ -1731,7 +1731,7 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
if (!settings.sendReadMessages && settings.markReadAfterAction && history->lastMessage())
|
||||||
{
|
{
|
||||||
readHistory(history->lastMessage());
|
readHistory(history->lastMessage());
|
||||||
|
|
|
@ -791,7 +791,7 @@ void StickerSetBox::updateButtons() {
|
||||||
searchById(
|
searchById(
|
||||||
innerId,
|
innerId,
|
||||||
session,
|
session,
|
||||||
[session, weak](const QString &username, UserData *user)
|
[session, weak, innerId](const QString &username, UserData *user)
|
||||||
{
|
{
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
return;
|
return;
|
||||||
|
@ -803,7 +803,8 @@ void StickerSetBox::updateButtons() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
strongInner->showToast(tr::ayu_UserNotFoundMessage(tr::now));
|
QGuiApplication::clipboard()->setText(QString::number(innerId));
|
||||||
|
strongInner->showToast(tr::ayu_IDCopiedToast(tr::now));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2259,7 +2259,7 @@ void EmojiListWidget::refreshCustom() {
|
||||||
&& !_allowWithoutPremium;
|
&& !_allowWithoutPremium;
|
||||||
const auto owner = &session->data();
|
const auto owner = &session->data();
|
||||||
const auto &sets = owner->stickers().sets();
|
const auto &sets = owner->stickers().sets();
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto push = [&](uint64 setId, bool installed) {
|
const auto push = [&](uint64 setId, bool installed) {
|
||||||
const auto megagroup = _megagroupSet
|
const auto megagroup = _megagroupSet
|
||||||
&& (setId == Data::Stickers::MegagroupSetId);
|
&& (setId == Data::Stickers::MegagroupSetId);
|
||||||
|
|
|
@ -408,7 +408,7 @@ bool FieldAutocomplete::clearFilteredBotCommands() {
|
||||||
FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() {
|
FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() {
|
||||||
const auto data = &_session->data().stickers();
|
const auto data = &_session->data().stickers();
|
||||||
const auto list = data->getListByEmoji({ _emoji }, _stickersSeed);
|
const auto list = data->getListByEmoji({ _emoji }, _stickersSeed);
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
auto result = ranges::views::all(
|
auto result = ranges::views::all(
|
||||||
list
|
list
|
||||||
) | ranges::views::filter([&](not_null<DocumentData*> sticker) {
|
) | ranges::views::filter([&](not_null<DocumentData*> sticker) {
|
||||||
|
|
|
@ -502,7 +502,7 @@ void GifsListWidget::selectInlineResult(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (AyuSettings::isUseScheduledMessages()) {
|
if (AyuSettings::isUseScheduledMessages()) {
|
||||||
auto current = base::unixtime::now();
|
auto current = base::unixtime::now();
|
||||||
options.scheduled = current + 12;
|
options.scheduled = current + 12;
|
||||||
|
|
|
@ -763,7 +763,7 @@ void StickersListWidget::fillFilteredStickersRow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListWidget::addSearchRow(not_null<StickersSet*> set) {
|
void StickersListWidget::addSearchRow(not_null<StickersSet*> set) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) {
|
if (settings.showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1910,7 +1910,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
&& (e->modifiers() & Qt::ControlModifier)) {
|
&& (e->modifiers() & Qt::ControlModifier)) {
|
||||||
showStickerSetBox(document, set.id);
|
showStickerSetBox(document, set.id);
|
||||||
} else {
|
} else {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
auto from = messageSentAnimationInfo(
|
auto from = messageSentAnimationInfo(
|
||||||
sticker->section,
|
sticker->section,
|
||||||
sticker->index,
|
sticker->index,
|
||||||
|
@ -2339,7 +2339,7 @@ auto StickersListWidget::collectRecentStickers() -> std::vector<Sticker> {
|
||||||
result.reserve(cloudCount + recent.size() + customCount);
|
result.reserve(cloudCount + recent.size() + customCount);
|
||||||
_custom.reserve(cloudCount + recent.size() + customCount);
|
_custom.reserve(cloudCount + recent.size() + customCount);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto add = [&](not_null<DocumentData*> document, bool custom) {
|
auto add = [&](not_null<DocumentData*> document, bool custom) {
|
||||||
if (result.size() >= settings.recentStickersCount) {
|
if (result.size() >= settings.recentStickersCount) {
|
||||||
|
|
|
@ -474,7 +474,7 @@ void TabbedPanel::showStarted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabbedPanel::eventFilter(QObject *obj, QEvent *e) {
|
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;
|
return false;
|
||||||
|
|
|
@ -195,7 +195,7 @@ PreviewWrap::PreviewWrap(
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto close = Ui::CreateChild<Ui::RoundButton>(
|
const auto close = Ui::CreateChild<Ui::RoundButton>(
|
||||||
|
|
|
@ -115,7 +115,7 @@ void PromoSuggestions::refreshTopPromotion() {
|
||||||
|= _dismissedSuggestions.emplace(qs(suggestion)).second;
|
|= _dismissedSuggestions.emplace(qs(suggestion)).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableAds) {
|
if (settings.disableAds) {
|
||||||
setTopPromoted(nullptr, QString(), QString());
|
setTopPromoted(nullptr, QString(), QString());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -228,7 +228,7 @@ void SponsoredMessages::inject(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableAds) {
|
if (settings.disableAds) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ bool SponsoredMessages::canHaveFor(not_null<History*> history) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
|
bool SponsoredMessages::isTopBarFor(not_null<History*> history) const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableAds) {
|
if (settings.disableAds) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,7 +484,7 @@ void ChatFilters::requestToggleTags(bool value, Fn<void()> fail) {
|
||||||
|
|
||||||
void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
||||||
// AyuGram hideAllChatsFolder
|
// AyuGram hideAllChatsFolder
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto position = 0;
|
auto position = 0;
|
||||||
auto changed = false;
|
auto changed = false;
|
||||||
|
@ -526,7 +526,7 @@ void ChatFilters::received(const QVector<MTPDialogFilter> &list) {
|
||||||
|
|
||||||
void ChatFilters::apply(const MTPUpdate &update) {
|
void ChatFilters::apply(const MTPUpdate &update) {
|
||||||
// AyuGram hideAllChatsFolder
|
// AyuGram hideAllChatsFolder
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
update.match([&](const MTPDupdateDialogFilter &data) {
|
update.match([&](const MTPDupdateDialogFilter &data) {
|
||||||
if (const auto filter = data.vfilter()) {
|
if (const auto filter = data.vfilter()) {
|
||||||
|
@ -912,7 +912,7 @@ FilterId ChatFilters::lookupId(int index) const {
|
||||||
return FilterId(); // AyuGram: fix crash when using `hideAllChatsFolder`
|
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();
|
return _list[index].id();
|
||||||
|
|
|
@ -627,7 +627,7 @@ void Histories::sendReadRequests() {
|
||||||
DEBUG_LOG(("Reading: send requests with count %1.").arg(_states.size()));
|
DEBUG_LOG(("Reading: send requests with count %1.").arg(_states.size()));
|
||||||
|
|
||||||
// AyuGram sendReadMessages
|
// AyuGram sendReadMessages
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages) {
|
if (!settings.sendReadMessages) {
|
||||||
DEBUG_LOG(("[AyuGram] Don't read messages"));
|
DEBUG_LOG(("[AyuGram] Don't read messages"));
|
||||||
_states.clear();
|
_states.clear();
|
||||||
|
|
|
@ -1491,7 +1491,7 @@ void Reactions::send(not_null<HistoryItem*> item, bool addToRecent) {
|
||||||
_sentRequests.remove(id);
|
_sentRequests.remove(id);
|
||||||
_owner->session().api().applyUpdates(result);
|
_owner->session().api().applyUpdates(result);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && settings.markReadAfterAction && item) {
|
if (!settings.sendReadMessages && settings.markReadAfterAction && item) {
|
||||||
readHistory(item);
|
readHistory(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ rpl::producer<bool> PeerPremiumValue(not_null<PeerData*> peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
|
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
return rpl::single(true);
|
return rpl::single(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1005,7 +1005,7 @@ void RepliesList::sendReadTillRequest() {
|
||||||
const auto api = &_history->session().api();
|
const auto api = &_history->session().api();
|
||||||
api->request(base::take(_readRequestId)).cancel();
|
api->request(base::take(_readRequestId)).cancel();
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages) {
|
if (!settings.sendReadMessages) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,7 @@ Session::Session(not_null<Main::Session*> session)
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
// AyuGram disableStories
|
// AyuGram disableStories
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.disableStories) {
|
if (!settings.disableStories) {
|
||||||
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
||||||
}
|
}
|
||||||
|
@ -2486,7 +2486,7 @@ void Session::updateEditedMessage(const MTPMessage &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AyuGram saveMessagesHistory
|
// AyuGram saveMessagesHistory
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
HistoryMessageEdition edit;
|
HistoryMessageEdition edit;
|
||||||
|
|
||||||
if (data.type() != mtpc_message) {
|
if (data.type() != mtpc_message) {
|
||||||
|
@ -2638,7 +2638,7 @@ void Session::unregisterMessageTTL(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::checkTTLs() {
|
void Session::checkTTLs() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
_ttlCheckTimer.cancel();
|
_ttlCheckTimer.cancel();
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
|
|
|
@ -1120,7 +1120,7 @@ void Stories::markAsRead(FullStoryId id, bool viewed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadStories) {
|
if (!settings.sendReadStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1270,7 @@ void Stories::toggleHidden(
|
||||||
void Stories::sendMarkAsReadRequest(
|
void Stories::sendMarkAsReadRequest(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
StoryId tillId) {
|
StoryId tillId) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadStories) {
|
if (!settings.sendReadStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1305,7 @@ void Stories::checkQuitPreventFinished() {
|
||||||
void Stories::sendMarkAsReadRequests() {
|
void Stories::sendMarkAsReadRequests() {
|
||||||
_markReadTimer.cancel();
|
_markReadTimer.cancel();
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadStories) {
|
if (!settings.sendReadStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1329,7 +1329,7 @@ void Stories::sendIncrementViewsRequests() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadStories) {
|
if (!settings.sendReadStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1941,7 +1941,7 @@ bool Stories::isQuitPrevent() {
|
||||||
sendIncrementViewsRequests();
|
sendIncrementViewsRequests();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadStories || _markReadRequests.empty() && _incrementViewsRequests.empty()) {
|
if (!settings.sendReadStories || _markReadRequests.empty() && _incrementViewsRequests.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ bool UserData::isFake() const {
|
||||||
|
|
||||||
bool UserData::isPremium() const {
|
bool UserData::isPremium() const {
|
||||||
if (id) {
|
if (id) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
if (getSession(id.value)) {
|
if (getSession(id.value)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -553,7 +553,7 @@ void Row::paintUserpic(
|
||||||
updateCornerBadgeShown(peer, nullptr, hasUnreadBadgesAbove);
|
updateCornerBadgeShown(peer, nullptr, hasUnreadBadgesAbove);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||||
? _cornerBadgeShown
|
? _cornerBadgeShown
|
||||||
|
|
|
@ -1307,7 +1307,7 @@ void Widget::setupMainMenuToggle() {
|
||||||
? &st::dialogsMenuToggleUnread
|
? &st::dialogsMenuToggleUnread
|
||||||
: &st::dialogsMenuToggleUnreadMuted;
|
: &st::dialogsMenuToggleUnreadMuted;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideNotificationCounters) {
|
if (settings.hideNotificationCounters) {
|
||||||
icon = nullptr;
|
icon = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1318,7 @@ void Widget::setupMainMenuToggle() {
|
||||||
|
|
||||||
void Widget::setupStories() {
|
void Widget::setupStories() {
|
||||||
// AyuGram disableStories
|
// AyuGram disableStories
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableStories) {
|
if (settings.disableStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2277,7 +2277,7 @@ void Widget::updateStoriesVisibility() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableStories) {
|
if (settings.disableStories) {
|
||||||
_stories->setVisible(false);
|
_stories->setVisible(false);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ void HistoryItem::setCommentsItemId(FullMsgId id) {
|
||||||
void HistoryItem::setServiceText(PreparedServiceText &&prepared) {
|
void HistoryItem::setServiceText(PreparedServiceText &&prepared) {
|
||||||
auto text = std::move(prepared.text);
|
auto text = std::move(prepared.text);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (date() > 0) {
|
if (date() > 0) {
|
||||||
const auto timeString = QString(" (%1)").arg(QLocale().toString(
|
const auto timeString = QString(" (%1)").arg(QLocale().toString(
|
||||||
base::unixtime::parse(_date),
|
base::unixtime::parse(_date),
|
||||||
|
@ -2182,6 +2182,12 @@ void HistoryItem::clearMediaAsExpired() {
|
||||||
if (!media || !media->ttlSeconds()) {
|
if (!media || !media->ttlSeconds()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
if (settings.saveDeletedMessages) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (const auto document = media->document()) {
|
if (const auto document = media->document()) {
|
||||||
applyEditionToHistoryCleared();
|
applyEditionToHistoryCleared();
|
||||||
auto text = (document->isVideoFile()
|
auto text = (document->isVideoFile()
|
||||||
|
@ -3183,7 +3189,7 @@ void HistoryItem::setDeleted() {
|
||||||
_deleted = true;
|
_deleted = true;
|
||||||
|
|
||||||
if (isService()) {
|
if (isService()) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
setAyuHint(settings.deletedMark);
|
setAyuHint(settings.deletedMark);
|
||||||
} else {
|
} else {
|
||||||
history()->owner().requestItemViewRefresh(this);
|
history()->owner().requestItemViewRefresh(this);
|
||||||
|
|
|
@ -484,7 +484,7 @@ void HistoryMessageReply::updateData(
|
||||||
&& (asExternal || _fields.manualQuote);
|
&& (asExternal || _fields.manualQuote);
|
||||||
_multiline = !_fields.storyId && (asExternal || nonEmptyQuote);
|
_multiline = !_fields.storyId && (asExternal || nonEmptyQuote);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto author = resolvedMessage
|
const auto author = resolvedMessage
|
||||||
? resolvedMessage->from().get()
|
? resolvedMessage->from().get()
|
||||||
: resolvedStory
|
: resolvedStory
|
||||||
|
|
|
@ -525,7 +525,7 @@ QString NewMessagePostAuthor(const Api::SendAction &action) {
|
||||||
bool ShouldSendSilent(
|
bool ShouldSendSilent(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const Api::SendOptions &options) {
|
const Api::SendOptions &options) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.sendWithoutSound) {
|
if (settings.sendWithoutSound) {
|
||||||
return !options.silent;
|
return !options.silent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,7 +510,7 @@ HistoryWidget::HistoryWidget(
|
||||||
|
|
||||||
_fieldCharsCountManager.limitExceeds(
|
_fieldCharsCountManager.limitExceeds(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
const auto hide = _fieldCharsCountManager.isLimitExceeded();
|
const auto hide = _fieldCharsCountManager.isLimitExceeded();
|
||||||
if (_silent) {
|
if (_silent) {
|
||||||
_silent->setVisible(!hide);
|
_silent->setVisible(!hide);
|
||||||
|
@ -1980,7 +1980,7 @@ void HistoryWidget::fileChosen(ChatHelpers::FileChosen &&data) {
|
||||||
Data::InsertCustomEmoji(_field.data(), data.document);
|
Data::InsertCustomEmoji(_field.data(), data.document);
|
||||||
}
|
}
|
||||||
} else if (_history) {
|
} else if (_history) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.sendReadMessages && settings.markReadAfterAction) {
|
if (!settings.sendReadMessages && settings.markReadAfterAction) {
|
||||||
if (const auto lastMessage = history()->lastMessage()) {
|
if (const auto lastMessage = history()->lastMessage()) {
|
||||||
readHistory(lastMessage);
|
readHistory(lastMessage);
|
||||||
|
@ -2789,7 +2789,7 @@ void HistoryWidget::setHistory(History *history) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto was = _attachBotsMenu && _history && _history->peer->isUser();
|
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;
|
||||||
|
@ -2875,7 +2875,7 @@ void HistoryWidget::refreshAttachBotsMenu() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
_attachBotsMenu = InlineBots::MakeAttachBotsMenu(
|
_attachBotsMenu = InlineBots::MakeAttachBotsMenu(
|
||||||
this,
|
this,
|
||||||
|
@ -3201,7 +3201,7 @@ bool HistoryWidget::canWriteMessage() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateControlsVisibility() {
|
void HistoryWidget::updateControlsVisibility() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto fieldDisabledRemoved = (_fieldDisabled != nullptr);
|
auto fieldDisabledRemoved = (_fieldDisabled != nullptr);
|
||||||
const auto hideExtraButtons = _fieldCharsCountManager.isLimitExceeded();
|
const auto hideExtraButtons = _fieldCharsCountManager.isLimitExceeded();
|
||||||
|
@ -4583,7 +4583,7 @@ void HistoryWidget::sendVoice(const VoiceToSend &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::send(Api::SendOptions options) {
|
void HistoryWidget::send(Api::SendOptions options) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (AyuSettings::isUseScheduledMessages() && !options.scheduled) {
|
if (AyuSettings::isUseScheduledMessages() && !options.scheduled) {
|
||||||
auto current = base::unixtime::now();
|
auto current = base::unixtime::now();
|
||||||
options.scheduled = current + 12;
|
options.scheduled = current + 12;
|
||||||
|
@ -4784,7 +4784,7 @@ void HistoryWidget::goToDiscussionGroup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryWidget::hasDiscussionGroup() const {
|
bool HistoryWidget::hasDiscussionGroup() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.channelBottomButton != 2) {
|
if (settings.channelBottomButton != 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5377,7 +5377,7 @@ bool HistoryWidget::isChoosingTheme() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryWidget::isMuteUnmute() const {
|
bool HistoryWidget::isMuteUnmute() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.channelBottomButton == 0) {
|
if (settings.channelBottomButton == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5394,7 +5394,7 @@ bool HistoryWidget::isSearching() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryWidget::showRecordButton() const {
|
bool HistoryWidget::showRecordButton() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.showMicrophoneButtonInMessageField) {
|
if (!settings.showMicrophoneButtonInMessageField) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5637,7 +5637,7 @@ void HistoryWidget::showKeyboardHideButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::toggleKeyboard(bool manual) {
|
void HistoryWidget::toggleKeyboard(bool manual) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto fieldEnabled = canWriteMessage() && !_showAnimation;
|
const auto fieldEnabled = canWriteMessage() && !_showAnimation;
|
||||||
if (_kbShown || _kbReplyTo) {
|
if (_kbShown || _kbReplyTo) {
|
||||||
|
@ -5865,7 +5865,7 @@ bool HistoryWidget::fieldOrDisabledShown() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::moveFieldControls() {
|
void HistoryWidget::moveFieldControls() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto keyboardHeight = 0;
|
auto keyboardHeight = 0;
|
||||||
auto bottom = height();
|
auto bottom = height();
|
||||||
|
@ -5966,7 +5966,7 @@ void HistoryWidget::moveFieldControls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateFieldSize() {
|
void HistoryWidget::updateFieldSize() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup();
|
const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup();
|
||||||
auto fieldWidth = width()
|
auto fieldWidth = width()
|
||||||
|
@ -7105,7 +7105,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto wasVisible = _kbShown || _kbReplyTo;
|
const auto wasVisible = _kbShown || _kbReplyTo;
|
||||||
const auto wasMsgId = _keyboard->forMsgId();
|
const auto wasMsgId = _keyboard->forMsgId();
|
||||||
|
|
|
@ -2129,7 +2129,7 @@ void VoiceRecordBar::stopRecording(StopType type, bool ttlBeforeHide) {
|
||||||
: 0),
|
: 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (AyuSettings::isUseScheduledMessages()) {
|
if (AyuSettings::isUseScheduledMessages()) {
|
||||||
auto current = base::unixtime::now();
|
auto current = base::unixtime::now();
|
||||||
options.scheduled = current + 12 + 5;
|
options.scheduled = current + 12 + 5;
|
||||||
|
@ -2221,7 +2221,7 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
|
||||||
options.ttlSeconds = std::numeric_limits<int>::max();
|
options.ttlSeconds = std::numeric_limits<int>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (AyuSettings::isUseScheduledMessages()) {
|
if (AyuSettings::isUseScheduledMessages()) {
|
||||||
auto current = base::unixtime::now();
|
auto current = base::unixtime::now();
|
||||||
options.scheduled = current + 12 + 5;
|
options.scheduled = current + 12 + 5;
|
||||||
|
|
|
@ -415,7 +415,7 @@ void BottomInfo::layout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BottomInfo::layoutDateText() {
|
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)
|
const auto deleted = (_data.flags & Data::Flag::AyuDeleted)
|
||||||
|
|
|
@ -1513,7 +1513,7 @@ void AddWhoReactedAction(
|
||||||
not_null<QWidget*> context,
|
not_null<QWidget*> context,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
not_null<Window::SessionController*> controller) {
|
not_null<Window::SessionController*> controller) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!AyuUi::needToShowItem(settings.showViewsPanelInContextMenu)) {
|
if (!AyuUi::needToShowItem(settings.showViewsPanelInContextMenu)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,7 @@ void Reply::paint(
|
||||||
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
||||||
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||||
ValidateBackgroundEmoji(
|
ValidateBackgroundEmoji(
|
||||||
backgroundEmojiId,
|
backgroundEmojiId,
|
||||||
|
|
|
@ -67,7 +67,7 @@ bool SendActionPainter::updateNeedsAnimating(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideFromBlocked) {
|
if (settings.hideFromBlocked) {
|
||||||
if (user->isBlocked()) {
|
if (user->isBlocked()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -788,7 +788,7 @@ void TopBarWidget::infoClicked() {
|
||||||
|
|
||||||
void TopBarWidget::backClicked() {
|
void TopBarWidget::backClicked() {
|
||||||
if (_activeChat.key.folder()) {
|
if (_activeChat.key.folder()) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideAllChatsFolder) {
|
if (settings.hideAllChatsFolder) {
|
||||||
const auto filters = &_controller->session().data().chatsFilters();
|
const auto filters = &_controller->session().data().chatsFilters();
|
||||||
const auto lookupId = filters->lookupId(_controller->session().premium() ? 0 : 1);
|
const auto lookupId = filters->lookupId(_controller->session().premium() ? 0 : 1);
|
||||||
|
@ -1156,7 +1156,7 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
_clear->show();
|
_clear->show();
|
||||||
_delete->setVisible(_canDelete);
|
_delete->setVisible(_canDelete);
|
||||||
|
@ -1337,14 +1337,14 @@ void TopBarWidget::updateMembersShowArea() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TopBarWidget::showSelectedState() const {
|
bool TopBarWidget::showSelectedState() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
return (_selectedCount > 0)
|
return (_selectedCount > 0)
|
||||||
&& (_canDelete || _canForward || _canSendNow || settings.showMessageShot);
|
&& (_canDelete || _canForward || _canSendNow || settings.showMessageShot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::showSelected(SelectedState state) {
|
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 canDelete = (state.count > 0 && state.count == state.canDeleteCount);
|
||||||
auto canForward = (state.count > 0 && state.count == state.canForwardCount);
|
auto canForward = (state.count > 0 && state.count == state.canForwardCount);
|
||||||
|
|
|
@ -325,7 +325,7 @@ Document::Document(
|
||||||
const auto &data = &_parent->data()->history()->owner();
|
const auto &data = &_parent->data()->history()->owner();
|
||||||
_parent->data()->removeFromSharedMediaIndex();
|
_parent->data()->removeFromSharedMediaIndex();
|
||||||
setDocumentLinks(_data, realParent, [=] {
|
setDocumentLinks(_data, realParent, [=] {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.saveDeletedMessages) {
|
if (!settings.saveDeletedMessages) {
|
||||||
_openl = nullptr;
|
_openl = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -936,7 +936,7 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
||||||
Ui::Text::ValidateQuotePaintCache(*cache, _st);
|
Ui::Text::ValidateQuotePaintCache(*cache, _st);
|
||||||
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
|
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||||
ValidateBackgroundEmoji(
|
ValidateBackgroundEmoji(
|
||||||
backgroundEmojiId,
|
backgroundEmojiId,
|
||||||
|
|
|
@ -1189,7 +1189,7 @@ bool AdjustMenuGeometryForSelector(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
QPoint desiredPosition,
|
QPoint desiredPosition,
|
||||||
not_null<Selector*> selector) {
|
not_null<Selector*> selector) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1357,7 @@ AttachSelectorResult AttachSelectorToMenu(
|
||||||
Fn<void(ChosenReaction)> chosen,
|
Fn<void(ChosenReaction)> chosen,
|
||||||
TextWithEntities about,
|
TextWithEntities about,
|
||||||
IconFactory iconFactory) {
|
IconFactory iconFactory) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||||
return AttachSelectorResult::Skipped;
|
return AttachSelectorResult::Skipped;
|
||||||
}
|
}
|
||||||
|
@ -1409,7 +1409,7 @@ auto AttachSelectorToMenu(
|
||||||
IconFactory iconFactory,
|
IconFactory iconFactory,
|
||||||
Fn<bool()> paused)
|
Fn<bool()> paused)
|
||||||
-> base::expected<not_null<Selector*>, AttachSelectorResult> {
|
-> base::expected<not_null<Selector*>, AttachSelectorResult> {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
if (!AyuUi::needToShowItem(settings.showReactionsPanelInContextMenu)) {
|
||||||
return base::make_unexpected(AttachSelectorResult::Skipped);
|
return base::make_unexpected(AttachSelectorResult::Skipped);
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@ void TopBar::updateControlsVisibility(anim::type animated) {
|
||||||
|
|
||||||
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
||||||
// AyuGram disableStories
|
// AyuGram disableStories
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableStories) {
|
if (settings.disableStories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1193,7 +1193,7 @@ bool SetClickContext(
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto result = object_ptr<Ui::VerticalLayout>(_wrap);
|
auto result = object_ptr<Ui::VerticalLayout>(_wrap);
|
||||||
auto tracker = Ui::MultiSlideTracker();
|
auto tracker = Ui::MultiSlideTracker();
|
||||||
|
@ -1524,8 +1524,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
const auto idText = IDString(user);
|
const auto idText = IDString(user);
|
||||||
if (!idText.isEmpty()) {
|
if (!idText.isEmpty()) {
|
||||||
QGuiApplication::clipboard()->setText(idText);
|
QGuiApplication::clipboard()->setText(idText);
|
||||||
const auto msg = tr::ayu_IDCopiedToast(tr::now);
|
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
|
||||||
controller->showToast(msg);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -1660,8 +1659,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
const auto idText = IDString(peer);
|
const auto idText = IDString(peer);
|
||||||
if (!idText.isEmpty()) {
|
if (!idText.isEmpty()) {
|
||||||
QGuiApplication::clipboard()->setText(idText);
|
QGuiApplication::clipboard()->setText(idText);
|
||||||
const auto msg = tr::ayu_IDCopiedToast(tr::now);
|
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
|
||||||
controller->showToast(msg);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -1685,8 +1683,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
const auto idText = IDString(peer->forumTopicFor(topicRootId)->topicRootId());
|
const auto idText = IDString(peer->forumTopicFor(topicRootId)->topicRootId());
|
||||||
if (!idText.isEmpty()) {
|
if (!idText.isEmpty()) {
|
||||||
QGuiApplication::clipboard()->setText(idText);
|
QGuiApplication::clipboard()->setText(idText);
|
||||||
const auto msg = tr::ayu_IDCopiedToast(tr::now);
|
controller->showToast(tr::ayu_IDCopiedToast(tr::now));
|
||||||
controller->showToast(msg);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -140,7 +140,7 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
using MediaType = Media::Type;
|
using MediaType = Media::Type;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
auto content = object_ptr<Ui::VerticalLayout>(parent);
|
auto content = object_ptr<Ui::VerticalLayout>(parent);
|
||||||
auto tracker = Ui::MultiSlideTracker();
|
auto tracker = Ui::MultiSlideTracker();
|
||||||
|
|
|
@ -765,7 +765,7 @@ void BotAction::handleKeyPress(not_null<QKeyEvent*> e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebviewPlatform() {
|
QString WebviewPlatform() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
return settings.spoofWebviewAsAndroid ? "android" : "tdesktop";
|
return settings.spoofWebviewAsAndroid ? "android" : "tdesktop";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ rpl::producer<> Session::downloaderTaskFinished() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::premium() const {
|
bool Session::premium() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ bool Session::premium() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::premiumPossible() const {
|
bool Session::premiumPossible() const {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ rpl::producer<bool> Session::premiumPossibleValue() const {
|
||||||
return _user->isPremium();
|
return _user->isPremium();
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
premium = rpl::single(true);
|
premium = rpl::single(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ void RepostView::draw(Painter &p, int x, int y, int availableWidth) {
|
||||||
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
Ui::Text::ValidateQuotePaintCache(*cache, quoteSt);
|
||||||
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
Ui::Text::FillQuotePaint(p, rect, *cache, quoteSt);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
if (!settings.simpleQuotesAndReplies && backgroundEmoji) {
|
||||||
using namespace HistoryView;
|
using namespace HistoryView;
|
||||||
if (backgroundEmoji->firstFrameMask.isNull()
|
if (backgroundEmoji->firstFrameMask.isNull()
|
||||||
|
|
|
@ -226,6 +226,12 @@ void AddDownloadFilesAction(
|
||||||
return;
|
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)] {
|
const auto done = [weak = Ui::MakeWeak(list)] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.data()) {
|
||||||
strong->cancelSelection();
|
strong->cancelSelection();
|
||||||
|
@ -249,6 +255,12 @@ void AddDownloadFilesAction(
|
||||||
return;
|
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)] {
|
const auto done = [weak = Ui::MakeWeak(list)] {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.data()) {
|
||||||
strong->clearSelected();
|
strong->clearSelected();
|
||||||
|
|
|
@ -694,7 +694,7 @@ FillMenuResult FillSendMenu(
|
||||||
: st::defaultComposeIcons;
|
: st::defaultComposeIcons;
|
||||||
|
|
||||||
if (sending && type != Type::Reminder) {
|
if (sending && type != Type::Reminder) {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
settings.sendWithoutSound ? tr::ayu_SendWithSound(tr::now) : tr::lng_send_silent_message(tr::now),
|
settings.sendWithoutSound ? tr::ayu_SendWithSound(tr::now) : tr::lng_send_silent_message(tr::now),
|
||||||
[=] { action({ Api::SendOptions{ .silent = true } }, details); },
|
[=] { action({ Api::SendOptions{ .silent = true } }, details); },
|
||||||
|
|
|
@ -512,7 +512,7 @@ void MainWindow::unreadCounterChangedHook() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateTaskbarAndIconCounters() {
|
void MainWindow::updateTaskbarAndIconCounters() {
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto counter = settings.hideNotificationBadge ? 0 : Core::App().unreadBadge();
|
const auto counter = settings.hideNotificationBadge ? 0 : Core::App().unreadBadge();
|
||||||
const auto muted = settings.hideNotificationBadge ? 0 : Core::App().unreadBadgeMuted();
|
const auto muted = settings.hideNotificationBadge ? 0 : Core::App().unreadBadgeMuted();
|
||||||
|
|
|
@ -142,7 +142,7 @@ bool DarkTasbarValueValid/* = false*/;
|
||||||
ScaledLogoLight = base::flat_map<int, QImage>();
|
ScaledLogoLight = base::flat_map<int, QImage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideNotificationBadge) {
|
if (settings.hideNotificationBadge) {
|
||||||
args.count = 0;
|
args.count = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1042,7 +1042,7 @@ QPointer<Ui::RpWidget> Premium::createPinnedToTop(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.localPremium) {
|
if (settings.localPremium) {
|
||||||
return tr::ayu_LocalPremiumNotice(Ui::Text::RichLangValue);
|
return tr::ayu_LocalPremiumNotice(Ui::Text::RichLangValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ void Tray::rebuildMenu() {
|
||||||
[=] { toggleSoundNotifications(); });
|
[=] { toggleSoundNotifications(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
if (settings.showGhostToggleInTray) {
|
if (settings.showGhostToggleInTray) {
|
||||||
auto turnGhostModeText = _textUpdates.events(
|
auto turnGhostModeText = _textUpdates.events(
|
||||||
|
|
|
@ -386,7 +386,7 @@ Panel::Panel(Args &&args)
|
||||||
, _allowClipboardRead(args.allowClipboardRead) {
|
, _allowClipboardRead(args.allowClipboardRead) {
|
||||||
_widget->setWindowFlag(Qt::WindowStaysOnTopHint, false);
|
_widget->setWindowFlag(Qt::WindowStaysOnTopHint, false);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
auto size = QSize(st::botWebViewPanelSize);
|
auto size = QSize(st::botWebViewPanelSize);
|
||||||
if (settings.increaseWebviewHeight) {
|
if (settings.increaseWebviewHeight) {
|
||||||
size.setHeight(st::botWebViewPanelHeightIncreased);
|
size.setHeight(st::botWebViewPanelHeightIncreased);
|
||||||
|
|
|
@ -48,7 +48,7 @@ void EnsureBlockquoteCache(
|
||||||
cache->outlines = colors.outlines;
|
cache->outlines = colors.outlines;
|
||||||
cache->icon = colors.name;
|
cache->icon = colors.name;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.simpleQuotesAndReplies) {
|
if (settings.simpleQuotesAndReplies) {
|
||||||
cache->bg = QColor(0, 0, 0, 0);
|
cache->bg = QColor(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ System::Timing System::countTiming(
|
||||||
delay = config.notifyDefaultDelay;
|
delay = config.notifyDefaultDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.disableNotificationsDelay) {
|
if (settings.disableNotificationsDelay) {
|
||||||
delay = minimalDelay;
|
delay = minimalDelay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,7 +482,7 @@ auto ChatThemeValueFromPeer(
|
||||||
peer
|
peer
|
||||||
) | rpl::map([=](ResolvedTheme resolved)
|
) | rpl::map([=](ResolvedTheme resolved)
|
||||||
-> rpl::producer<std::shared_ptr<Ui::ChatTheme>> {
|
-> 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
|
// 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;
|
resolved.paper = std::nullopt;
|
||||||
|
|
|
@ -140,7 +140,7 @@ void FiltersMenu::setupMainMenuIcon() {
|
||||||
? &st::windowFiltersMainMenuUnread
|
? &st::windowFiltersMainMenuUnread
|
||||||
: &st::windowFiltersMainMenuUnreadMuted;
|
: &st::windowFiltersMainMenuUnreadMuted;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideNotificationCounters) {
|
if (settings.hideNotificationCounters) {
|
||||||
icon = nullptr;
|
icon = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ void FiltersMenu::scrollToButton(not_null<Ui::RpWidget*> widget) {
|
||||||
|
|
||||||
void FiltersMenu::refresh() {
|
void FiltersMenu::refresh() {
|
||||||
// AyuGram hideAllChatsFolder
|
// AyuGram hideAllChatsFolder
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto filters = &_session->session().data().chatsFilters();
|
const auto filters = &_session->session().data().chatsFilters();
|
||||||
if (!filters->has() || _ignoreRefresh) {
|
if (!filters->has() || _ignoreRefresh) {
|
||||||
|
@ -310,7 +310,7 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
||||||
auto count = (chats + state.marks)
|
auto count = (chats + state.marks)
|
||||||
- (includeMuted ? 0 : muted);
|
- (includeMuted ? 0 : muted);
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (settings.hideNotificationCounters) {
|
if (settings.hideNotificationCounters) {
|
||||||
count = 0;
|
count = 0;
|
||||||
muted = 0;
|
muted = 0;
|
||||||
|
@ -457,7 +457,7 @@ void FiltersMenu::applyReorder(
|
||||||
}
|
}
|
||||||
|
|
||||||
// AyuGram hideAllChatsFolder
|
// AyuGram hideAllChatsFolder
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto filters = &_session->session().data().chatsFilters();
|
const auto filters = &_session->session().data().chatsFilters();
|
||||||
const auto &list = filters->list();
|
const auto &list = filters->list();
|
||||||
|
|
|
@ -639,7 +639,7 @@ void MainMenu::showFinished() {
|
||||||
void MainMenu::setupMenu() {
|
void MainMenu::setupMenu() {
|
||||||
using namespace Settings;
|
using namespace Settings;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto controller = _controller;
|
const auto controller = _controller;
|
||||||
const auto addAction = [&](
|
const auto addAction = [&](
|
||||||
|
@ -706,7 +706,7 @@ void MainMenu::setupMenu() {
|
||||||
controller->showPeerHistory(controller->session().user());
|
controller->showPeerHistory(controller->session().user());
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
|
|
||||||
if (settings.showLReadToggleInDrawer) {
|
if (settings.showLReadToggleInDrawer) {
|
||||||
addAction(
|
addAction(
|
||||||
|
|
|
@ -1794,7 +1794,7 @@ void SessionController::activateFirstChatsFilter() {
|
||||||
}
|
}
|
||||||
_filtersActivated = true;
|
_filtersActivated = true;
|
||||||
|
|
||||||
const auto& settings = AyuSettings::getInstance();
|
const auto &settings = AyuSettings::getInstance();
|
||||||
if (!settings.hideAllChatsFolder) {
|
if (!settings.hideAllChatsFolder) {
|
||||||
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
setActiveChatsFilter(session().data().chatsFilters().defaultId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue