diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 45b2d498d..46ff421e6 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -116,8 +116,8 @@ PRIVATE ayu/utils/telegram_helpers.h ayu/utils/windows_utils.cpp ayu/utils/windows_utils.h - ayu/ui/ayu_assets.cpp - ayu/ui/ayu_assets.h + ayu/ui/ayu_logo.cpp + ayu/ui/ayu_logo.h ayu/ui/utils/ayu_profile_values.cpp ayu/ui/utils/ayu_profile_values.h ayu/ui/settings/icon_picker.cpp @@ -148,8 +148,6 @@ PRIVATE ayu/ui/boxes/message_shot_box.h ayu/ui/components/image_view.cpp ayu/ui/components/image_view.h - ayu/messages/ayu_messages_controller.cpp - ayu/messages/ayu_messages_controller.h ayu/libs/json.hpp ayu/libs/json_ext.hpp ayu/libs/sqlite/sqlite3.c @@ -160,9 +158,11 @@ PRIVATE ayu/features/streamer_mode/streamer_mode.h ayu/features/messageshot/message_shot.cpp ayu/features/messageshot/message_shot.h - ayu/database/entities.h - ayu/database/ayu_database.cpp - ayu/database/ayu_database.h + ayu/data/messages_storage.cpp + ayu/data/messages_storage.h + ayu/data/entities.h + ayu/data/ayu_database.cpp + ayu/data/ayu_database.h api/api_attached_stickers.cpp api/api_attached_stickers.h diff --git a/Telegram/SourceFiles/ayu/ayu_infra.cpp b/Telegram/SourceFiles/ayu/ayu_infra.cpp index 30e3037bf..a28e8337f 100644 --- a/Telegram/SourceFiles/ayu/ayu_infra.cpp +++ b/Telegram/SourceFiles/ayu/ayu_infra.cpp @@ -9,7 +9,7 @@ #include "ayu_lang.h" #include "ayu_worker.h" #include "ayu/ayu_settings.h" -#include "ayu/database/ayu_database.h" +#include "ayu/data/ayu_database.h" #include "lang/lang_instance.h" namespace AyuInfra { diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index 1d439c04d..20be4925f 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -6,7 +6,7 @@ // Copyright @Radolyn, 2023 #include "ayu_settings.h" -#include "ayu/ui/ayu_assets.h" +#include "ayu/ui/ayu_logo.h" #include "lang_auto.h" #include "core/application.h" diff --git a/Telegram/SourceFiles/ayu/ayu_state.cpp b/Telegram/SourceFiles/ayu/ayu_state.cpp index a92e4ee78..7d8a2ddce 100644 --- a/Telegram/SourceFiles/ayu/ayu_state.cpp +++ b/Telegram/SourceFiles/ayu/ayu_state.cpp @@ -14,7 +14,7 @@ void hide(PeerId peerId, MsgId messageId) { hiddenMessages[peerId].insert(messageId); } -void hide(not_null item) { +void hide(not_null item) { hide(item->history()->peer->id, item->id); } @@ -26,7 +26,7 @@ bool isHidden(PeerId peerId, MsgId messageId) { return false; } -bool isHidden(not_null item) { +bool isHidden(not_null item) { return isHidden(item->history()->peer->id, item->id); } diff --git a/Telegram/SourceFiles/ayu/ayu_state.h b/Telegram/SourceFiles/ayu/ayu_state.h index 4486fc832..66a76ddd3 100644 --- a/Telegram/SourceFiles/ayu/ayu_state.h +++ b/Telegram/SourceFiles/ayu/ayu_state.h @@ -12,8 +12,8 @@ namespace AyuState { void hide(PeerId peerId, MsgId messageId); -void hide(not_null item); +void hide(not_null item); bool isHidden(PeerId peerId, MsgId messageId); -bool isHidden(not_null item); +bool isHidden(not_null item); } diff --git a/Telegram/SourceFiles/ayu/ayu_worker.cpp b/Telegram/SourceFiles/ayu/ayu_worker.cpp index a1e71d246..dad3d128d 100644 --- a/Telegram/SourceFiles/ayu/ayu_worker.cpp +++ b/Telegram/SourceFiles/ayu/ayu_worker.cpp @@ -11,7 +11,7 @@ #include "base/unixtime.h" #include "core/application.h" #include "data/data_user.h" -#include "database/entities.h" +#include "data/entities.h" #include "main/main_account.h" #include "main/main_domain.h" #include "main/main_session.h" @@ -20,7 +20,7 @@ namespace AyuWorker { std::unordered_map state; -void markAsOnline(not_null session) { +void markAsOnline(not_null session) { state[session->userId().bare] = true; } diff --git a/Telegram/SourceFiles/ayu/ayu_worker.h b/Telegram/SourceFiles/ayu/ayu_worker.h index 979a72ef9..97c26c999 100644 --- a/Telegram/SourceFiles/ayu/ayu_worker.h +++ b/Telegram/SourceFiles/ayu/ayu_worker.h @@ -10,7 +10,7 @@ namespace AyuWorker { -void markAsOnline(not_null session); +void markAsOnline(not_null session); void initialize(); } diff --git a/Telegram/SourceFiles/ayu/data/ayu_database.cpp b/Telegram/SourceFiles/ayu/data/ayu_database.cpp new file mode 100644 index 000000000..0437c01ed --- /dev/null +++ b/Telegram/SourceFiles/ayu/data/ayu_database.cpp @@ -0,0 +1,210 @@ +// This is the source code of AyuGram for Desktop. +// +// We do not and cannot prevent the use of our code, +// but be respectful and credit the original author. +// +// Copyright @Radolyn, 2023 +#include "ayu_database.h" + +#include + +#include "entities.h" +#include "ayu/libs/sqlite/sqlite_orm.h" + +#include "base/unixtime.h" + +using namespace sqlite_orm; +auto storage = make_storage( + "./tdata/ayudata.db", + make_table( + "DeletedMessage", + make_column("fakeId", &DeletedMessage::fakeId, primary_key().autoincrement()), + make_column("userId", &DeletedMessage::userId), + make_column("dialogId", &DeletedMessage::dialogId), + make_column("groupedId", &DeletedMessage::groupedId), + make_column("peerId", &DeletedMessage::peerId), + make_column("fromId", &DeletedMessage::fromId), + make_column("topicId", &DeletedMessage::topicId), + make_column("messageId", &DeletedMessage::messageId), + make_column("date", &DeletedMessage::date), + make_column("flags", &DeletedMessage::flags), + make_column("editDate", &DeletedMessage::editDate), + make_column("views", &DeletedMessage::views), + make_column("fwdFlags", &DeletedMessage::fwdFlags), + make_column("fwdFromId", &DeletedMessage::fwdFromId), + make_column("fwdName", &DeletedMessage::fwdName), + make_column("fwdDate", &DeletedMessage::fwdDate), + make_column("fwdPostAuthor", &DeletedMessage::fwdPostAuthor), + make_column("replyFlags", &DeletedMessage::replyFlags), + make_column("replyMessageId", &DeletedMessage::replyMessageId), + make_column("replyPeerId", &DeletedMessage::replyPeerId), + make_column("replyTopId", &DeletedMessage::replyTopId), + make_column("replyForumTopic", &DeletedMessage::replyForumTopic), + make_column("replySerialized", &DeletedMessage::replySerialized), + make_column("entityCreateDate", &DeletedMessage::entityCreateDate), + make_column("text", &DeletedMessage::text), + make_column("textEntities", &DeletedMessage::textEntities), + make_column("mediaPath", &DeletedMessage::mediaPath), + make_column("hqThumbPath", &DeletedMessage::hqThumbPath), + make_column("documentType", &DeletedMessage::documentType), + make_column("documentSerialized", &DeletedMessage::documentSerialized), + make_column("thumbsSerialized", &DeletedMessage::thumbsSerialized), + make_column("documentAttributesSerialized", &DeletedMessage::documentAttributesSerialized), + make_column("mimeType", &DeletedMessage::mimeType) + ), + make_table( + "EditedMessage", + make_column("fakeId", &EditedMessage::fakeId, primary_key().autoincrement()), + make_column("userId", &EditedMessage::userId), + make_column("dialogId", &EditedMessage::dialogId), + make_column("groupedId", &EditedMessage::groupedId), + make_column("peerId", &EditedMessage::peerId), + make_column("fromId", &EditedMessage::fromId), + make_column("topicId", &EditedMessage::topicId), + make_column("messageId", &EditedMessage::messageId), + make_column("date", &EditedMessage::date), + make_column("flags", &EditedMessage::flags), + make_column("editDate", &EditedMessage::editDate), + make_column("views", &EditedMessage::views), + make_column("fwdFlags", &EditedMessage::fwdFlags), + make_column("fwdFromId", &EditedMessage::fwdFromId), + make_column("fwdName", &EditedMessage::fwdName), + make_column("fwdDate", &EditedMessage::fwdDate), + make_column("fwdPostAuthor", &EditedMessage::fwdPostAuthor), + make_column("replyFlags", &EditedMessage::replyFlags), + make_column("replyMessageId", &EditedMessage::replyMessageId), + make_column("replyPeerId", &EditedMessage::replyPeerId), + make_column("replyTopId", &EditedMessage::replyTopId), + make_column("replyForumTopic", &EditedMessage::replyForumTopic), + make_column("replySerialized", &EditedMessage::replySerialized), + make_column("entityCreateDate", &EditedMessage::entityCreateDate), + make_column("text", &EditedMessage::text), + make_column("textEntities", &EditedMessage::textEntities), + make_column("mediaPath", &EditedMessage::mediaPath), + make_column("hqThumbPath", &EditedMessage::hqThumbPath), + make_column("documentType", &EditedMessage::documentType), + make_column("documentSerialized", &EditedMessage::documentSerialized), + make_column("thumbsSerialized", &EditedMessage::thumbsSerialized), + make_column("documentAttributesSerialized", &EditedMessage::documentAttributesSerialized), + make_column("mimeType", &EditedMessage::mimeType) + ), + make_table( + "DeletedDialog", + make_column("fakeId", &DeletedDialog::fakeId, primary_key().autoincrement()), + make_column("userId", &DeletedDialog::userId), + make_column("dialogId", &DeletedDialog::dialogId), + make_column("peerId", &DeletedDialog::peerId), + make_column("folderId", &DeletedDialog::folderId), + make_column("topMessage", &DeletedDialog::topMessage), + make_column("lastMessageDate", &DeletedDialog::lastMessageDate), + make_column("flags", &DeletedDialog::flags), + make_column("entityCreateDate", &DeletedDialog::entityCreateDate) + ), + make_table( + "RegexFilter", + make_column("id", &RegexFilter::id), + make_column("text", &RegexFilter::text), + make_column("enabled", &RegexFilter::enabled), + make_column("caseInsensitive", &RegexFilter::caseInsensitive), + make_column("dialogId", &RegexFilter::dialogId) + ), + make_table( + "RegexFilterGlobalExclusion", + make_column("fakeId", &RegexFilterGlobalExclusion::fakeId, primary_key().autoincrement()), + make_column("dialogId", &RegexFilterGlobalExclusion::dialogId), + make_column("filterId", &RegexFilterGlobalExclusion::filterId) + ), + make_table( + "SpyMessageRead", + make_column("fakeId", &SpyMessageRead::fakeId, primary_key().autoincrement()), + make_column("userId", &SpyMessageRead::userId), + make_column("dialogId", &SpyMessageRead::dialogId), + make_column("messageId", &SpyMessageRead::messageId), + make_column("entityCreateDate", &SpyMessageRead::entityCreateDate) + ), + make_table( + "SpyMessageContentsRead", + make_column("fakeId", &SpyMessageContentsRead::fakeId, primary_key().autoincrement()), + make_column("userId", &SpyMessageContentsRead::userId), + make_column("dialogId", &SpyMessageContentsRead::dialogId), + make_column("messageId", &SpyMessageContentsRead::messageId), + make_column("entityCreateDate", &SpyMessageContentsRead::entityCreateDate) + ) +); + +namespace AyuDatabase { + +void moveCurrentDatabase() { + auto time = base::unixtime::now(); + + if (std::filesystem::exists("./tdata/ayudata.db")) { + std::filesystem::rename("./tdata/ayudata.db", QString("./tdata/ayudata_%1.db").arg(time).toStdString()); + } + + if (std::filesystem::exists("./tdata/ayudata.db-shm")) { + std::filesystem::rename("./tdata/ayudata.db-shm", + QString("./tdata/ayudata_%1.db-shm").arg(time).toStdString()); + } + + if (std::filesystem::exists("./tdata/ayudata.db-wal")) { + std::filesystem::rename("./tdata/ayudata.db-wal", + QString("./tdata/ayudata_%1.db-wal").arg(time).toStdString()); + } +} + +void initialize() { + const auto res = storage.sync_schema_simulate(true); + auto movePrevious = false; + for (const auto val : res | std::views::values) { + if (val == sync_schema_result::dropped_and_recreated) { + movePrevious = true; + break; + } + } + + if (movePrevious) { + moveCurrentDatabase(); + } + + try { + storage.sync_schema(true); + } catch (...) { + LOG(("Failed to sync database schema")); + LOG(("Moving current database just in case")); + + moveCurrentDatabase(); + + storage.sync_schema(); + } + + storage.begin_transaction(); + storage.commit(); +} + +void addEditedMessage(const EditedMessage &message) { + storage.begin_transaction(); + storage.insert(message); + storage.commit(); +} + +std::vector getEditedMessages(ID userId, ID dialogId, ID messageId) { + return storage.get_all( + where( + c(&EditedMessage::userId) == userId and + c(&EditedMessage::dialogId) == dialogId and + c(&EditedMessage::messageId) == messageId + ) + ); +} + +bool hasRevisions(ID userId, ID dialogId, ID messageId) { + return storage.count( + where( + c(&EditedMessage::userId) == userId and + c(&EditedMessage::dialogId) == dialogId and + c(&EditedMessage::messageId) == messageId + ) + ) > 0; +} + +} diff --git a/Telegram/SourceFiles/ayu/database/ayu_database.h b/Telegram/SourceFiles/ayu/data/ayu_database.h similarity index 88% rename from Telegram/SourceFiles/ayu/database/ayu_database.h rename to Telegram/SourceFiles/ayu/data/ayu_database.h index 92c1aaf37..efc5c089d 100644 --- a/Telegram/SourceFiles/ayu/database/ayu_database.h +++ b/Telegram/SourceFiles/ayu/data/ayu_database.h @@ -7,8 +7,6 @@ #pragma once #include "entities.h" -#include "history/history.h" -#include "history/history_item.h" namespace AyuDatabase { diff --git a/Telegram/SourceFiles/ayu/database/entities.h b/Telegram/SourceFiles/ayu/data/entities.h similarity index 68% rename from Telegram/SourceFiles/ayu/database/entities.h rename to Telegram/SourceFiles/ayu/data/entities.h index 5e2c9b0e4..9ecebf358 100644 --- a/Telegram/SourceFiles/ayu/database/entities.h +++ b/Telegram/SourceFiles/ayu/data/entities.h @@ -36,6 +36,7 @@ public: ID replyPeerId; int replyTopId; bool replyForumTopic; + std::vector replySerialized; int entityCreateDate; std::string text; std::vector textEntities; @@ -49,6 +50,7 @@ public: }; using DeletedMessage = AyuMessageBase; + using EditedMessage = AyuMessageBase; class DeletedDialog @@ -58,8 +60,47 @@ public: ID userId; ID dialogId; ID peerId; + std::unique_ptr folderId; // nullable int topMessage; int lastMessageDate; int flags; int entityCreateDate; }; + +class RegexFilter +{ +public: + std::vector id; + std::string text; + bool enabled; + bool caseInsensitive; + std::unique_ptr dialogId; // nullable +}; + +class RegexFilterGlobalExclusion +{ +public: + ID fakeId; + ID dialogId; + std::vector filterId; +}; + +class SpyMessageRead +{ +public: + ID fakeId; + ID userId; + ID dialogId; + int messageId; + int entityCreateDate; +}; + +class SpyMessageContentsRead +{ +public: + ID fakeId; + ID userId; + ID dialogId; + int messageId; + int entityCreateDate; +}; diff --git a/Telegram/SourceFiles/ayu/messages/ayu_messages_controller.cpp b/Telegram/SourceFiles/ayu/data/messages_storage.cpp similarity index 71% rename from Telegram/SourceFiles/ayu/messages/ayu_messages_controller.cpp rename to Telegram/SourceFiles/ayu/data/messages_storage.cpp index d0d5ad3b7..5e60f1929 100644 --- a/Telegram/SourceFiles/ayu/messages/ayu_messages_controller.cpp +++ b/Telegram/SourceFiles/ayu/data/messages_storage.cpp @@ -4,10 +4,10 @@ // but be respectful and credit the original author. // // Copyright @Radolyn, 2023 -#include "ayu_messages_controller.h" +#include "messages_storage.h" #include "ayu/ayu_constants.h" -#include "ayu/database/ayu_database.h" +#include "ayu/data/ayu_database.h" #include "ayu/utils/ayu_mapper.h" #include "ayu/utils/telegram_helpers.h" @@ -24,22 +24,7 @@ namespace AyuMessages { -std::optional controller = std::nullopt; - -void initialize() { - if (controller.has_value()) { - return; - } - - controller = AyuMessagesController(); -} - -AyuMessagesController &getInstance() { - initialize(); - return controller.value(); -} - -void map(HistoryMessageEdition &edition, not_null item, EditedMessage &message) { +void map(HistoryMessageEdition &edition, not_null item, EditedMessage &message) { message.userId = item->history()->owner().session().userId().bare; message.dialogId = getDialogIdFromPeer(item->history()->peer); message.groupedId = item->groupId().value; @@ -61,11 +46,11 @@ void map(HistoryMessageEdition &edition, not_null item, EditedMes message.views = item->viewsCount(); message.entityCreateDate = base::unixtime::now(); // todo: rework - auto serializedText = serializeTextWithEntities(item); + auto serializedText = AyuMapper::serializeTextWithEntities(item); message.text = serializedText.first; - // message.textEntities = serializedText.second; + message.textEntities = serializedText.second; - // todo: + // todo: implement mapping message.mediaPath = "/"; message.documentType = DOCUMENT_TYPE_NONE; @@ -75,14 +60,14 @@ void map(HistoryMessageEdition &edition, not_null item, EditedMes // message.mimeType; } -void AyuMessagesController::addEditedMessage(HistoryMessageEdition &edition, not_null item) { +void addEditedMessage(HistoryMessageEdition &edition, not_null item) { EditedMessage message; map(edition, item, message); AyuDatabase::addEditedMessage(message); } -std::vector AyuMessagesController::getEditedMessages(HistoryItem *item) { +std::vector getEditedMessages(not_null item) { auto userId = item->history()->owner().session().userId().bare; auto dialogId = getDialogIdFromPeer(item->history()->peer); auto msgId = item->id.bare; @@ -90,7 +75,7 @@ std::vector AyuMessagesController::getEditedMessages(HistoryItem return AyuDatabase::getEditedMessages(userId, dialogId, msgId); } -bool AyuMessagesController::hasRevisions(not_null item) { +bool hasRevisions(not_null item) { auto userId = item->history()->owner().session().userId().bare; auto dialogId = getDialogIdFromPeer(item->history()->peer); auto msgId = item->id.bare; diff --git a/Telegram/SourceFiles/ayu/data/messages_storage.h b/Telegram/SourceFiles/ayu/data/messages_storage.h new file mode 100644 index 000000000..614678167 --- /dev/null +++ b/Telegram/SourceFiles/ayu/data/messages_storage.h @@ -0,0 +1,19 @@ +// This is the source code of AyuGram for Desktop. +// +// We do not and cannot prevent the use of our code, +// but be respectful and credit the original author. +// +// Copyright @Radolyn, 2023 +#pragma once + +#include "entities.h" + +#include "history/history_item_edition.h" + +namespace AyuMessages { + +void addEditedMessage(HistoryMessageEdition &edition, not_null item); +std::vector getEditedMessages(not_null item); +bool hasRevisions(not_null item); + +} diff --git a/Telegram/SourceFiles/ayu/database/ayu_database.cpp b/Telegram/SourceFiles/ayu/database/ayu_database.cpp deleted file mode 100644 index d680afa2d..000000000 --- a/Telegram/SourceFiles/ayu/database/ayu_database.cpp +++ /dev/null @@ -1,163 +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, 2023 -#include "ayu_database.h" - -#include "entities.h" -#include "ayu/libs/sqlite/sqlite_orm.h" - -#include "base/unixtime.h" - -using namespace sqlite_orm; - -auto storage = make_storage("./tdata/ayudata.db", - make_table("DeletedMessage", - make_column("userId", &DeletedMessage::userId), - make_column("dialogId", &DeletedMessage::dialogId), - make_column("groupedId", &DeletedMessage::groupedId), - make_column("peerId", &DeletedMessage::peerId), - make_column("fromId", &DeletedMessage::fromId), - make_column("topicId", &DeletedMessage::topicId), - make_column("messageId", &DeletedMessage::messageId), - make_column("date", &DeletedMessage::date), - make_column("flags", &DeletedMessage::flags), - make_column("editDate", &DeletedMessage::editDate), - make_column("views", &DeletedMessage::views), - make_column("fwdFlags", &DeletedMessage::fwdFlags), - make_column("fwdFromId", &DeletedMessage::fwdFromId), - make_column("fwdName", &DeletedMessage::fwdName), - make_column("fwdDate", &DeletedMessage::fwdDate), - make_column("fwdPostAuthor", &DeletedMessage::fwdPostAuthor), - make_column("replyFlags", &DeletedMessage::replyFlags), - make_column("replyMessageId", &DeletedMessage::replyMessageId), - make_column("replyPeerId", &DeletedMessage::replyPeerId), - make_column("replyTopId", &DeletedMessage::replyTopId), - make_column("replyForumTopic", &DeletedMessage::replyForumTopic), - make_column("entityCreateDate", &DeletedMessage::entityCreateDate), - make_column("text", &DeletedMessage::text), - make_column("textEntities", &DeletedMessage::textEntities), - make_column("mediaPath", &DeletedMessage::mediaPath), - make_column("hqThumbPath", &DeletedMessage::hqThumbPath), - make_column("documentType", &DeletedMessage::documentType), - make_column("documentSerialized", &DeletedMessage::documentSerialized), - make_column("thumbsSerialized", &DeletedMessage::thumbsSerialized), - make_column("documentAttributesSerialized", - &DeletedMessage::documentAttributesSerialized), - make_column("mimeType", &DeletedMessage::mimeType) - ), - make_table("EditedMessage", - make_column("userId", &EditedMessage::userId), - make_column("dialogId", &EditedMessage::dialogId), - make_column("groupedId", &EditedMessage::groupedId), - make_column("peerId", &EditedMessage::peerId), - make_column("fromId", &EditedMessage::fromId), - make_column("topicId", &EditedMessage::topicId), - make_column("messageId", &EditedMessage::messageId), - make_column("date", &EditedMessage::date), - make_column("flags", &EditedMessage::flags), - make_column("editDate", &EditedMessage::editDate), - make_column("views", &EditedMessage::views), - make_column("fwdFlags", &EditedMessage::fwdFlags), - make_column("fwdFromId", &EditedMessage::fwdFromId), - make_column("fwdName", &EditedMessage::fwdName), - make_column("fwdDate", &EditedMessage::fwdDate), - make_column("fwdPostAuthor", &EditedMessage::fwdPostAuthor), - make_column("replyFlags", &EditedMessage::replyFlags), - make_column("replyMessageId", &EditedMessage::replyMessageId), - make_column("replyPeerId", &EditedMessage::replyPeerId), - make_column("replyTopId", &EditedMessage::replyTopId), - make_column("replyForumTopic", &EditedMessage::replyForumTopic), - make_column("entityCreateDate", &EditedMessage::entityCreateDate), - make_column("text", &EditedMessage::text), - make_column("textEntities", &EditedMessage::textEntities), - make_column("mediaPath", &EditedMessage::mediaPath), - make_column("hqThumbPath", &EditedMessage::hqThumbPath), - make_column("documentType", &EditedMessage::documentType), - make_column("documentSerialized", &EditedMessage::documentSerialized), - make_column("thumbsSerialized", &EditedMessage::thumbsSerialized), - make_column("documentAttributesSerialized", - &EditedMessage::documentAttributesSerialized), - make_column("mimeType", &EditedMessage::mimeType) - ), - make_table("DeletedDialog", - make_column("userId", &DeletedDialog::userId), - make_column("dialogId", &DeletedDialog::dialogId), - make_column("peerId", &DeletedDialog::peerId), - make_column("topMessage", &DeletedDialog::topMessage), - make_column("lastMessageDate", &DeletedDialog::lastMessageDate), - make_column("flags", &DeletedDialog::flags), - make_column("entityCreateDate", &DeletedDialog::entityCreateDate) - ) -); - -namespace AyuDatabase { - -void initialize() { - // move to `tdata` from legacy version - if (std::filesystem::exists("ayugram.db")) { - try { - std::filesystem::rename("ayugram.db", "./tdata/ayudata.db"); - } catch (std::filesystem::filesystem_error &e) { - LOG(("Failed to move database: %1").arg(e.what())); - } - } - - try { - storage.sync_schema(); - } catch (...) { - auto time = base::unixtime::now(); - - LOG(("Failed to sync database schema")); - LOG(("Moving current database just in case")); - - if (std::filesystem::exists("./tdata/ayudata.db")) { - std::filesystem::rename("./tdata/ayudata.db", QString("./tdata/ayudata_%1.db").arg(time).toStdString()); - } - - if (std::filesystem::exists("./tdata/ayudata.db-shm")) { - std::filesystem::rename("./tdata/ayudata.db-shm", - QString("./tdata/ayudata_%1.db-shm").arg(time).toStdString()); - } - - if (std::filesystem::exists("./tdata/ayudata.db-wal")) { - std::filesystem::rename("./tdata/ayudata.db-wal", - QString("./tdata/ayudata_%1.db-wal").arg(time).toStdString()); - } - - storage.sync_schema(); - } - - storage.begin_transaction(); - storage.commit(); -} - -void addEditedMessage(const EditedMessage &message) { - storage.begin_transaction(); - storage.insert(message); - storage.commit(); -} - -std::vector getEditedMessages(ID userId, ID dialogId, ID messageId) { - return storage.get_all( - where( - c(&EditedMessage::userId) == userId and - c(&EditedMessage::dialogId) == dialogId and - c(&EditedMessage::messageId) == messageId - ) - ); -} - -bool hasRevisions(ID userId, ID dialogId, ID messageId) { - return storage.count( - where( - c(&EditedMessage::userId) == userId and - c(&EditedMessage::dialogId) == dialogId and - c(&EditedMessage::messageId) == messageId - ) - ) > 0; -} - -} diff --git a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp index 0d82b723b..42e8e9806 100644 --- a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp +++ b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp @@ -146,23 +146,23 @@ class MessageShotDelegate final : public HistoryView::DefaultElementDelegate { public: MessageShotDelegate( - not_null parent, - not_null st, + not_null parent, + not_null st, Fn update); bool elementAnimationsPaused() override; - not_null elementPathShiftGradient() override; + not_null elementPathShiftGradient() override; HistoryView::Context elementContext() override; bool elementIsChatWide() override; private: - const not_null _parent; + const not_null _parent; const std::unique_ptr _pathGradient; }; MessageShotDelegate::MessageShotDelegate( - not_null parent, - not_null st, + not_null parent, + not_null st, Fn update) : _parent(parent) , _pathGradient(HistoryView::MakePathShiftGradient(st, update)) { @@ -173,7 +173,7 @@ bool MessageShotDelegate::elementAnimationsPaused() { } auto MessageShotDelegate::elementPathShiftGradient() - -> not_null { + -> not_null { return _pathGradient.get(); } @@ -234,7 +234,7 @@ QImage addPadding(const QImage &original, int padding) { return paddedImage; } -QImage Make(not_null box, const ShotConfig &config) { +QImage Make(not_null box, const ShotConfig &config) { const auto controller = config.controller; const auto st = config.st; const auto messages = config.messages; @@ -252,13 +252,13 @@ QImage Make(not_null box, const ShotConfig &config) { box->update(); }); - std::unordered_map, std::shared_ptr> createdViews; + std::unordered_map, std::shared_ptr> createdViews; createdViews.reserve(messages.size()); for (const auto &message : messages) { createdViews.emplace(message, message->createView(delegate.get())); } - auto getView = [=](not_null msg) + auto getView = [=](not_null msg) { return createdViews.at(msg).get(); }; @@ -357,7 +357,7 @@ QImage Make(not_null box, const ShotConfig &config) { return overlay; } -void Wrapper(not_null widget) { +void Wrapper(not_null widget) { const auto items = widget->getSelectedIds(); if (items.empty()) { return; diff --git a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.h b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.h index 27e010f6e..db5796fcd 100644 --- a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.h +++ b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.h @@ -15,9 +15,9 @@ namespace AyuFeatures::MessageShot { struct ShotConfig { - not_null controller; + not_null controller; std::shared_ptr st; - std::vector> messages; + std::vector> messages; bool showDate; bool showReactions; @@ -63,8 +63,8 @@ rpl::producer themeChosen(); void setPalette(style::palette &palette); rpl::producer paletteChosen(); -QImage Make(not_null box, const ShotConfig &config); +QImage Make(not_null box, const ShotConfig &config); -void Wrapper(not_null widget); +void Wrapper(not_null widget); } diff --git a/Telegram/SourceFiles/ayu/messages/ayu_messages_controller.h b/Telegram/SourceFiles/ayu/messages/ayu_messages_controller.h deleted file mode 100644 index d2afe5bbc..000000000 --- a/Telegram/SourceFiles/ayu/messages/ayu_messages_controller.h +++ /dev/null @@ -1,25 +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, 2023 -#pragma once - -#include "ayu/database/entities.h" - -#include "history/history_item_edition.h" - -namespace AyuMessages { - -class AyuMessagesController -{ -public: - void addEditedMessage(HistoryMessageEdition &edition, not_null item); - std::vector getEditedMessages(HistoryItem *item); - bool hasRevisions(not_null item); -}; - -AyuMessagesController &getInstance(); - -} diff --git a/Telegram/SourceFiles/ayu/ui/ayu_assets.cpp b/Telegram/SourceFiles/ayu/ui/ayu_logo.cpp similarity index 98% rename from Telegram/SourceFiles/ayu/ui/ayu_assets.cpp rename to Telegram/SourceFiles/ayu/ui/ayu_logo.cpp index 7c8ccf13a..799c91ce3 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_assets.cpp +++ b/Telegram/SourceFiles/ayu/ui/ayu_logo.cpp @@ -4,7 +4,7 @@ // but be respectful and credit the original author. // // Copyright @Radolyn, 2023 -#include "ayu_assets.h" +#include "ayu_logo.h" #include "ayu/ayu_settings.h" static QString LAST_LOADED_NAME; diff --git a/Telegram/SourceFiles/ayu/ui/ayu_assets.h b/Telegram/SourceFiles/ayu/ui/ayu_logo.h similarity index 100% rename from Telegram/SourceFiles/ayu/ui/ayu_assets.h rename to Telegram/SourceFiles/ayu/ui/ayu_logo.h diff --git a/Telegram/SourceFiles/ayu/ui/boxes/font_selector.cpp b/Telegram/SourceFiles/ayu/ui/boxes/font_selector.cpp index d46393709..404de891c 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/font_selector.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/font_selector.cpp @@ -128,18 +128,18 @@ private: Selection selected) const; std::unique_ptr &rippleBySelection( - not_null row, + not_null row, Selection selected); [[maybe_unused]] const std::unique_ptr &rippleBySelection( - not_null row, + not_null row, Selection selected) const; void addRipple(Selection selected, QPoint position); void ensureRippleBySelection(Selection selected); - void ensureRippleBySelection(not_null row, Selection selected); + void ensureRippleBySelection(not_null row, Selection selected); int indexFromSelection(Selection selected) const; @@ -153,16 +153,16 @@ private: void repaint(const Row &row); - void repaintChecked(not_null row); + void repaintChecked(not_null row); void activateByIndex(int index); - void setForceRippled(not_null row, bool rippled); + void setForceRippled(not_null row, bool rippled); - void restore(not_null row); + void restore(not_null row); std::vector _rows; - std::vector> _filtered; + std::vector> _filtered; Selection _selected; Selection _pressed; QString _chosen; @@ -312,7 +312,7 @@ void Rows::ensureRippleBySelection(Selection selected) { ensureRippleBySelection(&rowBySelection(selected), selected); } -void Rows::ensureRippleBySelection(not_null row, Selection selected) { +void Rows::ensureRippleBySelection(not_null row, Selection selected) { auto &ripple = rippleBySelection(row, selected); if (ripple) { return; @@ -342,11 +342,11 @@ void Rows::mouseReleaseEvent(QMouseEvent *e) { } } -void Rows::restore(not_null row) { +void Rows::restore(not_null row) { row->removed = false; } -void Rows::setForceRippled(not_null row, bool rippled) { +void Rows::setForceRippled(not_null row, bool rippled) { repaint(*row); } @@ -483,7 +483,7 @@ void Rows::repaint(const Row &row) { update(0, row.top, width(), row.height); } -void Rows::repaintChecked(not_null row) { +void Rows::repaintChecked(not_null row) { const auto found = (ranges::find(_filtered, row) != end(_filtered)); if (_query.isEmpty() || found) { repaint(*row); @@ -542,16 +542,16 @@ const std::unique_ptr &Rows::rippleBySelection( } std::unique_ptr &Rows::rippleBySelection( - not_null row, + not_null row, Selection selected) { return row->ripple; } const std::unique_ptr &Rows::rippleBySelection( - not_null row, + not_null row, Selection selected) const { - return const_cast(this)->rippleBySelection( - const_cast(row.get()), + return const_cast(this)->rippleBySelection( + const_cast(row.get()), selected); } @@ -668,7 +668,7 @@ void Content::setupContent( const auto add = [&](const std::vector &list) { if (list.empty()) { - return (Rows *)nullptr; + return (Rows*) nullptr; } const auto wrap = content->add( object_ptr>( @@ -964,7 +964,7 @@ void AyuUi::FontSelectorBox::prepare() { }; } -void AyuUi::FontSelectorBox::setupTop(not_null container) { +void AyuUi::FontSelectorBox::setupTop(not_null container) { if (!_controller) { return; } diff --git a/Telegram/SourceFiles/ayu/ui/boxes/font_selector.h b/Telegram/SourceFiles/ayu/ui/boxes/font_selector.h index 4a4b99bad..b890f0457 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/font_selector.h +++ b/Telegram/SourceFiles/ayu/ui/boxes/font_selector.h @@ -44,7 +44,7 @@ protected: void keyPressEvent(QKeyEvent *e) override; private: - void setupTop(not_null container); + void setupTop(not_null container); [[nodiscard]] int rowsInPage() const; Window::SessionController *_controller = nullptr; diff --git a/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.cpp index eefd06884..874649bd1 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.cpp @@ -18,7 +18,7 @@ namespace AyuUi { ServerReadConfirmationBox::ServerReadConfirmationBox( QWidget *, - not_null controller) + not_null controller) : _controller(controller) { // } diff --git a/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.h b/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.h index 84a3a1d11..b9d400f8e 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.h +++ b/Telegram/SourceFiles/ayu/ui/boxes/server_read_confirmation_box.h @@ -14,7 +14,7 @@ namespace AyuUi { class ServerReadConfirmationBox : public Ui::BoxContent { public: - ServerReadConfirmationBox(QWidget *, not_null controller); + ServerReadConfirmationBox(QWidget *, not_null controller); protected: void prepare() override; @@ -24,7 +24,7 @@ protected: private: void ReadAllPeers(); - not_null _controller; + not_null _controller; object_ptr _text = {nullptr}; }; diff --git a/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.cpp index edb574acc..b935318ea 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.cpp @@ -26,7 +26,7 @@ ThemeSelectorBox::ThemeSelectorBox( QWidget *parent, - not_null controller) + not_null controller) : _controller(controller) { } diff --git a/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.h b/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.h index 08ad7632e..eac31c739 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.h +++ b/Telegram/SourceFiles/ayu/ui/boxes/theme_selector_box.h @@ -15,7 +15,7 @@ using Callback = Fn; class ThemeSelectorBox : public Ui::BoxContent { public: - ThemeSelectorBox(QWidget *parent, not_null controller); + ThemeSelectorBox(QWidget *parent, not_null controller); rpl::producer paletteSelected(); rpl::producer themeNameChanged(); @@ -26,7 +26,7 @@ protected: private: void setupContent(); - not_null _controller; + not_null _controller; rpl::event_stream _palettes; rpl::event_stream _themeNames; diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp index 81c8ad352..df163fa98 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp @@ -13,7 +13,7 @@ #include "mainwindow.h" #include "ayu/ayu_settings.h" #include "ayu/ayu_state.h" -#include "ayu/messages/ayu_messages_controller.h" +#include "../../data/messages_storage.h" #include "ayu/ui/context_menu/menu_item_subtext.h" #include "ayu/utils/qt_key_modifiers_extended.h" #include "history/history_item_components.h" @@ -36,8 +36,8 @@ bool needToShowItem(int state) { return state == 1 || state == 2 && base::IsExtendedContextMenuModifierPressed(); } -void AddHistoryAction(not_null menu, HistoryItem *item) { - if (AyuMessages::getInstance().hasRevisions(item)) { +void AddHistoryAction(not_null menu, HistoryItem *item) { + if (AyuMessages::hasRevisions(item)) { menu->addAction(tr::ayu_EditsHistoryMenuText(tr::now), [=] { @@ -48,7 +48,7 @@ void AddHistoryAction(not_null menu, HistoryItem *item) { } } -void AddHideMessageAction(not_null menu, HistoryItem *item) { +void AddHideMessageAction(not_null menu, HistoryItem *item) { const auto settings = &AyuSettings::getInstance(); if (!needToShowItem(settings->showHideMessageInContextMenu)) { return; @@ -66,7 +66,7 @@ void AddHideMessageAction(not_null menu, HistoryItem *item) { &st::menuIconClear); } -void AddUserMessagesAction(not_null menu, HistoryItem *item) { +void AddUserMessagesAction(not_null menu, HistoryItem *item) { const auto settings = &AyuSettings::getInstance(); if (!needToShowItem(settings->showUserMessagesInContextMenu)) { return; @@ -92,7 +92,7 @@ void AddUserMessagesAction(not_null menu, HistoryItem *item) { } } -void AddMessageDetailsAction(not_null menu, HistoryItem *item) { +void AddMessageDetailsAction(not_null menu, HistoryItem *item) { const auto settings = &AyuSettings::getInstance(); if (!needToShowItem(settings->showMessageDetailsInContextMenu)) { return; @@ -150,7 +150,7 @@ void AddMessageDetailsAction(not_null menu, HistoryItem *item) .text = tr::ayu_MessageDetailsPC(tr::now), .handler = nullptr, .icon = &st::menuIconInfo, - .fillSubmenu = [&](not_null menu2) + .fillSubmenu = [&](not_null menu2) { if (hasAnyPostField) { if (!messageViews.isEmpty()) { @@ -278,7 +278,7 @@ void AddMessageDetailsAction(not_null menu, HistoryItem *item) }); } -void AddReadUntilAction(not_null menu, HistoryItem *item) { +void AddReadUntilAction(not_null menu, HistoryItem *item) { if (item->isLocal()) { return; } diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.h b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.h index d73dce7d8..d1e9d8cd3 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.h +++ b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.h @@ -13,10 +13,10 @@ namespace AyuUi { bool needToShowItem(int state); -void AddHistoryAction(not_null menu, HistoryItem *item); -void AddHideMessageAction(not_null menu, HistoryItem *item); -void AddUserMessagesAction(not_null menu, HistoryItem *item); -void AddMessageDetailsAction(not_null menu, HistoryItem *item); -void AddReadUntilAction(not_null menu, HistoryItem *item); +void AddHistoryAction(not_null menu, HistoryItem *item); +void AddHideMessageAction(not_null menu, HistoryItem *item); +void AddUserMessagesAction(not_null menu, HistoryItem *item); +void AddMessageDetailsAction(not_null menu, HistoryItem *item); +void AddReadUntilAction(not_null menu, HistoryItem *item); } diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp index e99fc4c09..5f0580d02 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.cpp @@ -10,7 +10,7 @@ #include "mainwindow.h" #include "qguiapplication.h" -#include "ayu/database/entities.h" +#include "ayu/data/entities.h" #include "ayu/utils/telegram_helpers.h" #include "base/unixtime.h" @@ -30,7 +30,7 @@ class ActionWithSubText : public Menu::ItemBase { public: ActionWithSubText( - not_null parent, + not_null parent, const style::Menu &st, const style::icon &icon, Fn callback, @@ -38,9 +38,9 @@ public: QString subtext); bool isEnabled() const override; - not_null action() const override; + not_null action() const override; - void handleKeyPress(not_null e) override; + void handleKeyPress(not_null e) override; protected: QPoint prepareRippleStartPosition() const override; @@ -51,7 +51,7 @@ protected: void prepare(const QString &title); void paint(Painter &p); - const not_null _dummyAction; + const not_null _dummyAction; const style::Menu &_st; const style::icon &_icon; @@ -65,10 +65,10 @@ protected: class ActionStickerPackAuthor final : public ActionWithSubText { public: - ActionStickerPackAuthor(not_null menu, not_null session, ID authorId); + ActionStickerPackAuthor(not_null menu, not_null session, ID authorId); private: - not_null _session; + not_null _session; void searchAuthor(ID authorId); }; @@ -81,7 +81,7 @@ TextParseOptions MenuTextOptions = { }; ActionWithSubText::ActionWithSubText( - not_null parent, + not_null parent, const style::Menu &st, const style::icon &icon, Fn callback, @@ -176,7 +176,7 @@ bool ActionWithSubText::isEnabled() const { return true; } -not_null ActionWithSubText::action() const { +not_null ActionWithSubText::action() const { return _dummyAction; } @@ -192,7 +192,7 @@ int ActionWithSubText::contentHeight() const { return _height; } -void ActionWithSubText::handleKeyPress(not_null e) { +void ActionWithSubText::handleKeyPress(not_null e) { if (!isSelected()) { return; } @@ -202,8 +202,8 @@ void ActionWithSubText::handleKeyPress(not_null e) { } } -ActionStickerPackAuthor::ActionStickerPackAuthor(not_null menu, - not_null session, +ActionStickerPackAuthor::ActionStickerPackAuthor(not_null menu, + not_null session, ID authorId) : ActionWithSubText(menu, menu->st(), @@ -273,7 +273,7 @@ void ActionStickerPackAuthor::searchAuthor(ID authorId) { } // namespace base::unique_qptr ContextActionWithSubText( - not_null menu, + not_null menu, const style::icon &icon, const QString &title, const QString &subtext, @@ -295,8 +295,8 @@ base::unique_qptr ContextActionWithSubText( } base::unique_qptr ContextActionStickerAuthor( - not_null menu, - not_null session, + not_null menu, + not_null session, ID authorId) { return base::make_unique_q(menu, session, authorId); } diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.h b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.h index b8d197a0c..e45a683b6 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.h +++ b/Telegram/SourceFiles/ayu/ui/context_menu/menu_item_subtext.h @@ -6,7 +6,7 @@ // Copyright @Radolyn, 2023 #pragma once -#include "ayu/database/entities.h" +#include "ayu/data/entities.h" #include "main/main_session.h" #include "base/unique_qptr.h" @@ -20,15 +20,15 @@ class ItemBase; class PopupMenu; [[nodiscard]] base::unique_qptr ContextActionWithSubText( - not_null menu, + not_null menu, const style::icon &icon, const QString &title, const QString &subtext, Fn callback = nullptr); [[nodiscard]] base::unique_qptr ContextActionStickerAuthor( - not_null menu, - not_null session, + not_null menu, + not_null session, ID authorId); } // namespace Ui diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp index e022d521d..bdc8a5485 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.cpp @@ -10,6 +10,7 @@ #include "mainwidget.h" #include "mainwindow.h" #include "api/api_attached_stickers.h" +#include "ayu/data/messages_storage.h" #include "ayu/ui/sections/edited/edited_log_section.h" #include "base/call_delayed.h" #include "base/unixtime.h" @@ -53,7 +54,6 @@ #include "ui/widgets/popup_menu.h" #include "window/window_session_controller.h" -#include #include #include @@ -157,7 +157,7 @@ void InnerWidget::enumerateUserpics(Method method) { // -1 means we didn't find an attached to next message yet. int lowestAttachedItemTop = -1; - auto userpicCallback = [&](not_null view, int itemtop, int itembottom) + auto userpicCallback = [&](not_null view, int itemtop, int itembottom) { // Skip all service messages. if (view->data()->isService()) { @@ -205,7 +205,7 @@ void InnerWidget::enumerateDates(Method method) { // -1 means we didn't find a same-day with previous message yet. auto lowestInOneDayItemBottom = -1; - auto dateCallback = [&](not_null view, int itemtop, int itembottom) + auto dateCallback = [&](not_null view, int itemtop, int itembottom) { const auto item = view->data(); if (lowestInOneDayItemBottom < 0 && view->isInOneDayWithPrevious()) { @@ -245,9 +245,9 @@ void InnerWidget::enumerateDates(Method method) { InnerWidget::InnerWidget( QWidget *parent, - not_null controller, - not_null peer, - not_null item) + not_null controller, + not_null peer, + not_null item) : RpWidget(parent), _controller(controller), _peer(peer), @@ -319,7 +319,7 @@ InnerWidget::InnerWidget( }, lifetime()); session().data().itemDataChanges( - ) | rpl::start_with_next([=](not_null item) + ) | rpl::start_with_next([=](not_null item) { if (const auto view = viewForItem(item)) { view->itemDataChanged(); @@ -519,7 +519,7 @@ HistoryView::Context InnerWidget::elementContext() { } bool InnerWidget::elementUnderCursor( - not_null view) { + not_null view) { return (Element::Hovered() == view); } @@ -528,7 +528,7 @@ bool InnerWidget::elementInSelectionMode() { } bool InnerWidget::elementIntersectsRange( - not_null view, + not_null view, int from, int till) { Expects(view->delegate() == this); @@ -538,22 +538,22 @@ bool InnerWidget::elementIntersectsRange( return (top < till && bottom > from); } -void InnerWidget::elementStartStickerLoop(not_null view) { +void InnerWidget::elementStartStickerLoop(not_null view) { } void InnerWidget::elementShowPollResults( - not_null poll, + not_null poll, FullMsgId context) { } void InnerWidget::elementOpenPhoto( - not_null photo, + not_null photo, FullMsgId context) { _controller->openPhoto(photo, {context}); } void InnerWidget::elementOpenDocument( - not_null document, + not_null document, FullMsgId context, bool showInMediaView) { _controller->openDocument(document, showInMediaView, {context}); @@ -574,11 +574,11 @@ bool InnerWidget::elementAnimationsPaused() { return _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Any); } -bool InnerWidget::elementHideReply(not_null view) { +bool InnerWidget::elementHideReply(not_null view) { return true; } -bool InnerWidget::elementShownUnread(not_null view) { +bool InnerWidget::elementShownUnread(not_null view) { return false; } @@ -592,36 +592,36 @@ void InnerWidget::elementSearchInList( const FullMsgId &context) { } -void InnerWidget::elementHandleViaClick(not_null bot) { +void InnerWidget::elementHandleViaClick(not_null bot) { } bool InnerWidget::elementIsChatWide() { return _isChatWide; } -not_null InnerWidget::elementPathShiftGradient() { +not_null InnerWidget::elementPathShiftGradient() { return _pathGradient.get(); } void InnerWidget::elementReplyTo(const FullReplyTo &to) { } -void InnerWidget::elementStartInteraction(not_null view) { +void InnerWidget::elementStartInteraction(not_null view) { } void InnerWidget::elementStartPremium( - not_null view, + not_null view, Element *replacing) { } -void InnerWidget::elementCancelPremium(not_null view) { +void InnerWidget::elementCancelPremium(not_null view) { } -QString InnerWidget::elementAuthorRank(not_null view) { +QString InnerWidget::elementAuthorRank(not_null view) { return {}; } -void InnerWidget::saveState(not_null memento) { +void InnerWidget::saveState(not_null memento) { if (!_filterChanged) { for (auto &item : _items) { item.clearView(); @@ -636,7 +636,7 @@ void InnerWidget::saveState(not_null memento) { _upLoaded = _downLoaded = true; // Don't load or handle anything anymore. } -void InnerWidget::restoreState(not_null memento) { +void InnerWidget::restoreState(not_null memento) { _items = memento->takeItems(); for (auto &item : _items) { item.refreshView(this); @@ -650,7 +650,7 @@ void InnerWidget::restoreState(not_null memento) { } void InnerWidget::addEvents(Direction direction) { - auto messages = AyuMessages::getInstance().getEditedMessages(_item); + auto messages = AyuMessages::getEditedMessages(_item); if (messages.empty()) { return; } @@ -803,7 +803,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { context.translate(0, top); p.translate(0, -top); - enumerateUserpics([&](not_null view, int userpicTop) + enumerateUserpics([&](not_null view, int userpicTop) { // stop the enumeration if the userpic is below the painted rect if (userpicTop >= clip.top() + clip.height()) { @@ -826,7 +826,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top(); auto scrollDateOpacity = _scrollDateOpacity.value(_scrollDateShown ? 1. : 0.); - enumerateDates([&](not_null view, int itemtop, int dateTop) + enumerateDates([&](not_null view, int itemtop, int dateTop) { // stop the enumeration if the date is above the painted rect if (dateTop + dateHeight <= clip.top()) { @@ -883,7 +883,7 @@ auto InnerWidget::viewForItem(const HistoryItem *item) -> Element * { return nullptr; } -void InnerWidget::paintEmpty(Painter &p, not_null st) { +void InnerWidget::paintEmpty(Painter &p, not_null st) { auto rectWidth = st::historyAdminLogEmptyWidth; auto innerWidth = rectWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.right(); auto rectHeight = st::historyAdminLogEmptyPadding.top() + _emptyText.countHeight(innerWidth) @@ -987,11 +987,11 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { ? Element::Hovered() : Element::HoveredLink(); const auto lnkPhoto = link - ? reinterpret_cast( + ? reinterpret_cast( link->property(kPhotoLinkMediaProperty).toULongLong()) : nullptr; const auto lnkDocument = link - ? reinterpret_cast( + ? reinterpret_cast( link->property(kDocumentLinkMediaProperty).toULongLong()) : nullptr; auto lnkIsVideo = lnkDocument ? lnkDocument->isVideoFile() : false; @@ -1179,7 +1179,7 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } } -void InnerWidget::savePhotoToFile(not_null photo) { +void InnerWidget::savePhotoToFile(not_null photo) { const auto media = photo->activeMediaView(); if (photo->isNull() || !media || !media->loaded()) { return; @@ -1200,14 +1200,14 @@ void InnerWidget::savePhotoToFile(not_null photo) { })); } -void InnerWidget::saveDocumentToFile(not_null document) { +void InnerWidget::saveDocumentToFile(not_null document) { DocumentSaveClickHandler::Save( Data::FileOrigin(), document, DocumentSaveClickHandler::Mode::ToNewFile); } -void InnerWidget::copyContextImage(not_null photo) { +void InnerWidget::copyContextImage(not_null photo) { const auto media = photo->activeMediaView(); if (photo->isNull() || !media || !media->loaded()) { return; @@ -1219,15 +1219,15 @@ void InnerWidget::copySelectedText() { TextUtilities::SetClipboardText(getSelectedText()); } -void InnerWidget::showStickerPackInfo(not_null document) { +void InnerWidget::showStickerPackInfo(not_null document) { StickerSetBox::Show(_controller->uiShow(), document); } -void InnerWidget::cancelContextDownload(not_null document) { +void InnerWidget::cancelContextDownload(not_null document) { document->cancel(); } -void InnerWidget::showContextInFolder(not_null document) { +void InnerWidget::showContextInFolder(not_null document) { const auto filepath = document->filepath(true); if (!filepath.isEmpty()) { File::ShowInFolder(filepath); @@ -1406,7 +1406,7 @@ void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton but .elementDelegate = [weak = Ui::MakeWeak(this)] { return weak - ? (ElementDelegate *)weak + ? (ElementDelegate*) weak : nullptr; }, .sessionWindow = base::make_weak(_controller), @@ -1503,7 +1503,7 @@ void InnerWidget::updateSelected() { if (!dragState.link && itemPoint.x() >= st::historyPhotoLeft && itemPoint.x() < st::historyPhotoLeft + st::msgPhotoSize) { if (!item->isService() && view->hasFromPhoto()) { - enumerateUserpics([&](not_null view, int userpicTop) + enumerateUserpics([&](not_null view, int userpicTop) { // stop enumeration if the userpic is below our point if (userpicTop > point.y()) { @@ -1594,7 +1594,7 @@ void InnerWidget::performDrag() { if (_mouseAction != MouseAction::Dragging) return; } -int InnerWidget::itemTop(not_null view) const { +int InnerWidget::itemTop(not_null view) const { return _itemsTop + view->y(); } @@ -1607,11 +1607,11 @@ void InnerWidget::repaintItem(const Element *view) { update(0, top + range.top, width(), range.height); } -void InnerWidget::resizeItem(not_null view) { +void InnerWidget::resizeItem(not_null view) { updateSize(); } -void InnerWidget::refreshItem(not_null view) { +void InnerWidget::refreshItem(not_null view) { // No need to refresh views in admin log. // sogl } diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.h b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.h index 0cf898432..526f1fe19 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.h +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_inner.h @@ -50,19 +50,19 @@ class InnerWidget final public: InnerWidget( QWidget *parent, - not_null controller, - not_null peer, - not_null item); + not_null controller, + not_null peer, + not_null item); [[nodiscard]] Main::Session &session() const; - [[nodiscard]] not_null theme() const { + [[nodiscard]] not_null theme() const { return _theme.get(); } [[nodiscard]] rpl::producer scrollToSignal() const; - [[nodiscard]] not_null channel() const { + [[nodiscard]] not_null channel() const { return _peer; } @@ -74,8 +74,8 @@ public: return TWidget::resizeToWidth(newWidth); } - void saveState(not_null memento); - void restoreState(not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); // Ui::AbstractTooltipShower interface. QString tooltipText() const override; @@ -85,22 +85,22 @@ public: // HistoryView::ElementDelegate interface. HistoryView::Context elementContext() override; bool elementUnderCursor( - not_null view) override; + not_null view) override; bool elementInSelectionMode() override; bool elementIntersectsRange( - not_null view, + not_null view, int from, int till) override; void elementStartStickerLoop( - not_null view) override; + not_null view) override; void elementShowPollResults( - not_null poll, + not_null poll, FullMsgId context) override; void elementOpenPhoto( - not_null photo, + not_null photo, FullMsgId context) override; void elementOpenDocument( - not_null document, + not_null document, FullMsgId context, bool showInMediaView = false) override; void elementCancelUpload(const FullMsgId &context) override; @@ -109,28 +109,28 @@ public: Fn hiddenCallback) override; bool elementAnimationsPaused() override; bool elementHideReply( - not_null view) override; + not_null view) override; bool elementShownUnread( - not_null view) override; + not_null view) override; void elementSendBotCommand( const QString &command, const FullMsgId &context) override; void elementSearchInList( const QString &query, const FullMsgId &context) override; - void elementHandleViaClick(not_null bot) override; + void elementHandleViaClick(not_null bot) override; bool elementIsChatWide() override; - not_null elementPathShiftGradient() override; + not_null elementPathShiftGradient() override; void elementReplyTo(const FullReplyTo &to) override; void elementStartInteraction( - not_null view) override; + not_null view) override; void elementStartPremium( - not_null view, + not_null view, HistoryView::Element *replacing) override; void elementCancelPremium( - not_null view) override; + not_null view) override; QString elementAuthorRank( - not_null view) override; + not_null view) override; ~InnerWidget(); @@ -186,19 +186,19 @@ private: void mouseActionCancel(); void updateSelected(); void performDrag(); - int itemTop(not_null view) const; + int itemTop(not_null view) const; void repaintItem(const Element *view); - void refreshItem(not_null view); - void resizeItem(not_null view); + void refreshItem(not_null view); + void resizeItem(not_null view); QPoint mapPointToItem(QPoint point, const Element *view) const; void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false); - void savePhotoToFile(not_null photo); - void saveDocumentToFile(not_null document); - void copyContextImage(not_null photo); - void showStickerPackInfo(not_null document); - void cancelContextDownload(not_null document); - void showContextInFolder(not_null document); + void savePhotoToFile(not_null photo); + void saveDocumentToFile(not_null document); + void copyContextImage(not_null photo); + void showStickerPackInfo(not_null document); + void cancelContextDownload(not_null document); + void showContextInFolder(not_null document); void openContextGif(FullMsgId itemId); void copyContextText(FullMsgId itemId); void copySelectedText(); @@ -208,7 +208,7 @@ private: void itemsAdded(Direction direction, int addedCount); void updateSize(); void updateEmptyText(); - void paintEmpty(Painter &p, not_null st); + void paintEmpty(Painter &p, not_null st); void addEvents(Direction direction); Element *viewForItem(const HistoryItem *item); @@ -243,10 +243,10 @@ private: template void enumerateDates(Method method); - const not_null _controller; - const not_null _peer; - const not_null _item; - const not_null _history; + const not_null _controller; + const not_null _peer; + const not_null _item; + const not_null _history; MTP::Sender _api; const std::unique_ptr _pathGradient; @@ -254,11 +254,11 @@ private: std::vector _items; std::set _eventIds; - std::map, not_null> _itemsByData; - base::flat_map, TimeId> _itemDates; + std::map, not_null> _itemsByData; + base::flat_map, TimeId> _itemDates; base::flat_set _animatedStickersPlayed; - base::flat_map, Ui::PeerUserpicView> _userpics; - base::flat_map, Ui::PeerUserpicView> _userpicsCache; + base::flat_map, Ui::PeerUserpicView> _userpics; + base::flat_map, Ui::PeerUserpicView> _userpicsCache; int _itemsTop = 0; int _itemsWidth = 0; int _itemsHeight = 0; diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp index 6d2b362d7..0477865f3 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.cpp @@ -5,7 +5,7 @@ // // Copyright @Radolyn, 2023 #include "ayu/ui/sections/edited/edited_log_item.h" -#include +#include "ayu/data/entities.h" #include "api/api_chat_participants.h" #include "api/api_text_entities.h" @@ -51,7 +51,7 @@ const auto CollectChanges = []( }; TextWithEntities GenerateAdminChangeText( - not_null channel, + not_null channel, const TextWithEntities &user, ChatAdminRightsInfo newRights, ChatAdminRightsInfo prevRights) { @@ -363,7 +363,7 @@ TextWithEntities GenerateInviteLinkChangeText( }; auto GenerateParticipantString( - not_null session, + not_null session, PeerId participantId) { // User name in "User name (@username)" format with entities. const auto peer = session->data().peer(participantId); @@ -401,7 +401,7 @@ auto GenerateParticipantString( } auto GenerateParticipantChangeText( - not_null channel, + not_null channel, const Api::ChatParticipant &participant, std::optional oldParticipant = std::nullopt) { using Type = Api::ChatParticipant::Type; @@ -501,7 +501,7 @@ auto GenerateParticipantChangeText( } TextWithEntities GenerateParticipantChangeText( - not_null channel, + not_null channel, const MTPChannelParticipant &participant, std::optional oldParticipant = std::nullopt) { return GenerateParticipantChangeText( @@ -515,7 +515,7 @@ TextWithEntities GenerateParticipantChangeText( } TextWithEntities GenerateDefaultBannedRightsChangeText( - not_null channel, + not_null channel, ChatRestrictionsInfo rights, ChatRestrictionsInfo oldRights) { auto result = TextWithEntities{ @@ -553,7 +553,7 @@ TextWithEntities GenerateDefaultBannedRightsChangeText( } [[nodiscard]] TextWithEntities GenerateTopicLink( - not_null channel, + not_null channel, const MTPForumTopic &topic) { return topic.match([&](const MTPDforumTopic &data) { @@ -578,8 +578,8 @@ OwnedItem::OwnedItem(std::nullptr_t) { } OwnedItem::OwnedItem( - not_null delegate, - not_null data) + not_null delegate, + not_null data) : _data(data), _view(_data->createView(delegate)) { } @@ -601,7 +601,7 @@ OwnedItem::~OwnedItem() { } void OwnedItem::refreshView( - not_null delegate) { + not_null delegate) { _view = _data->createView(delegate); } @@ -610,8 +610,8 @@ void OwnedItem::clearView() { } void GenerateItems( - not_null delegate, - not_null history, + not_null delegate, + not_null history, EditedMessage message, Fn callback) { const auto session = &history->session(); @@ -621,14 +621,14 @@ void GenerateItems( from = history->owner().channelLoaded(message.fromId); } if (!from) { - from = reinterpret_cast(history->owner().chatLoaded(message.fromId)); + from = reinterpret_cast(history->owner().chatLoaded(message.fromId)); } if (!from) { return; } const auto date = message.entityCreateDate; const auto addPart = [&]( - not_null item, + not_null item, TimeId sentDate = 0, MsgId realId = MsgId()) { diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.h b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.h index cb4862c1e..be04dc1e1 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.h +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_item.h @@ -6,7 +6,7 @@ // Copyright @Radolyn, 2023 #pragma once -#include "ayu/database/entities.h" +#include "ayu/data/entities.h" class History; @@ -20,8 +20,8 @@ namespace EditedLog { class OwnedItem; void GenerateItems( - not_null delegate, - not_null history, + not_null delegate, + not_null history, EditedMessage message, Fn callback); @@ -31,8 +31,8 @@ class OwnedItem public: OwnedItem(std::nullptr_t = nullptr); OwnedItem( - not_null delegate, - not_null data); + not_null delegate, + not_null data); OwnedItem(const OwnedItem &other) = delete; OwnedItem &operator=(const OwnedItem &other) = delete; OwnedItem(OwnedItem &&other); @@ -47,11 +47,11 @@ public: return get(); } - [[nodiscard]] operator HistoryView::Element *() const { + [[nodiscard]] operator HistoryView::Element*() const { return get(); } - void refreshView(not_null delegate); + void refreshView(not_null delegate); void clearView(); private: diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp index ff9820b1f..273044248 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.cpp @@ -32,8 +32,8 @@ class FixedBar final : public TWidget public: FixedBar( QWidget *parent, - not_null controller, - not_null peer); + not_null controller, + not_null peer); // When animating mode is enabled the content is hidden and the // whole fixed bar acts like a back button. @@ -47,8 +47,8 @@ protected: int resizeGetHeight(int newWidth) override; private: - not_null _controller; - not_null _peer; + not_null _controller; + not_null _peer; object_ptr _backButton; object_ptr _cancel; @@ -57,7 +57,7 @@ private: object_ptr SectionMemento::createWidget( QWidget *parent, - not_null controller, + not_null controller, Window::Column column, const QRect &geometry) { if (column == Window::Column::Third) { @@ -70,8 +70,8 @@ object_ptr SectionMemento::createWidget( FixedBar::FixedBar( QWidget *parent, - not_null controller, - not_null peer) + not_null controller, + not_null peer) : TWidget(parent), _controller(controller), _peer(peer), _backButton( this, &controller->session(), @@ -140,10 +140,10 @@ void FixedBar::mousePressEvent(QMouseEvent *e) { Widget::Widget( QWidget *parent, - not_null controller, - not_null peer, - not_null item) - : Window::SectionWidget(parent, controller, rpl::single(peer)), + not_null controller, + not_null peer, + not_null item) + : Window::SectionWidget(parent, controller, rpl::single(peer)), _scroll(this, st::historyScroll, false), _fixedBar(this, controller, peer), _fixedBarShadow(this), @@ -189,7 +189,7 @@ void Widget::updateAdaptiveLayout() { _fixedBar->height()); } -not_null Widget::channel() const { +not_null Widget::channel() const { return _inner->channel(); } @@ -212,9 +212,9 @@ void Widget::doSetInnerFocus() { } bool Widget::showInternal( - not_null memento, + not_null memento, const Window::SectionShow ¶ms) { - if (auto logMemento = dynamic_cast(memento.get())) { + if (auto logMemento = dynamic_cast(memento.get())) { if (logMemento->getPeer() == channel()) { restoreState(logMemento); return true; @@ -223,7 +223,7 @@ bool Widget::showInternal( return false; } -void Widget::setInternalState(const QRect &geometry, not_null memento) { +void Widget::setInternalState(const QRect &geometry, not_null memento) { setGeometry(geometry); Ui::SendPendingMoveResizeEvents(this); restoreState(memento); @@ -239,12 +239,12 @@ std::shared_ptr Widget::createMemento() { return result; } -void Widget::saveState(not_null memento) { +void Widget::saveState(not_null memento) { memento->setScrollTop(_scroll->scrollTop()); _inner->saveState(memento); } -void Widget::restoreState(not_null memento) { +void Widget::restoreState(not_null memento) { _inner->restoreState(memento); auto scrollTop = memento->getScrollTop(); _scroll->scrollToY(scrollTop); diff --git a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h index edf7c0291..8d4c4bb9d 100644 --- a/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h +++ b/Telegram/SourceFiles/ayu/ui/sections/edited/edited_log_section.h @@ -33,11 +33,11 @@ class Widget final : public Window::SectionWidget public: Widget( QWidget *parent, - not_null controller, - not_null peer, - not_null item); + not_null controller, + not_null peer, + not_null item); - not_null channel() const; + not_null channel() const; Dialogs::RowDescriptor activeChat() const override; bool hasTopBarShadow() const override { @@ -47,11 +47,11 @@ public: QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override; bool showInternal( - not_null memento, + not_null memento, const Window::SectionShow ¶ms) override; std::shared_ptr createMemento() override; - void setInternalState(const QRect &geometry, not_null memento); + void setInternalState(const QRect &geometry, not_null memento); // Float player interface. bool floatPlayerHandleWheelEvent(QEvent *e) override; @@ -69,15 +69,15 @@ protected: private: void onScroll(); void updateAdaptiveLayout(); - void saveState(not_null memento); - void restoreState(not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); void setupShortcuts(); object_ptr _scroll; QPointer _inner; object_ptr _fixedBar; object_ptr _fixedBarShadow; - not_null _item; + not_null _item; }; @@ -86,18 +86,18 @@ class SectionMemento : public Window::SectionMemento public: using Element = HistoryView::Element; - SectionMemento(not_null peer, not_null item) + SectionMemento(not_null peer, not_null item) : _peer(peer), _item(item) { } object_ptr createWidget( QWidget *parent, - not_null controller, + not_null controller, Window::Column column, const QRect &geometry) override; - not_null getPeer() const { + not_null getPeer() const { return _peer; } @@ -137,11 +137,11 @@ public: } private: - not_null _peer; - not_null _item; + not_null _peer; + not_null _item; int _scrollTop = 0; - std::vector> _admins; - std::vector> _adminsCanEdit; + std::vector> _admins; + std::vector> _adminsCanEdit; std::vector _items; std::set _eventIds; bool _upLoaded = false; diff --git a/Telegram/SourceFiles/ayu/ui/settings/icon_picker.cpp b/Telegram/SourceFiles/ayu/ui/settings/icon_picker.cpp index 31179a10e..45eaf244c 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/icon_picker.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/icon_picker.cpp @@ -10,7 +10,7 @@ #include "core/application.h" #include "styles/style_layers.h" -#include "ayu/ui/ayu_assets.h" +#include "ayu/ui/ayu_logo.h" #include "main/main_domain.h" #include "styles/style_ayu_styles.h" #include "ui/painter.h" diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index 0d8e31cd6..b14f14ca2 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -41,12 +41,12 @@ class PainterHighQualityEnabler; -not_null AddInnerToggle(not_null container, - const style::SettingsButton &st, - std::vector> innerCheckViews, - not_null *> wrap, - rpl::producer buttonLabel, - bool toggledWhenAll) { +not_null AddInnerToggle(not_null container, + const style::SettingsButton &st, + std::vector> innerCheckViews, + not_null*> wrap, + rpl::producer buttonLabel, + bool toggledWhenAll) { const auto button = container->add(object_ptr( container, nullptr, @@ -66,7 +66,7 @@ not_null AddInnerToggle(not_null container Ui::ToggleView checkView; Ui::Animations::Simple animation; rpl::event_stream<> anyChanges; - std::vector> innerChecks; + std::vector> innerChecks; }; const auto state = button->lifetime().make_state( st.toggle, @@ -257,16 +257,16 @@ struct NestedEntry std::function callback; }; -void AddCollapsibleToggle(not_null container, +void AddCollapsibleToggle(not_null container, rpl::producer title, std::vector checkboxes, bool toggledWhenAll) { const auto addCheckbox = [&]( - not_null verticalLayout, + not_null verticalLayout, const QString &label, const bool isCheckedOrig) { - const auto checkView = [&]() -> not_null + const auto checkView = [&]() -> not_null { const auto checkbox = verticalLayout->add( object_ptr( @@ -311,7 +311,7 @@ void AddCollapsibleToggle(not_null container, container, object_ptr(container)); const auto verticalLayout = wrap->entity(); - auto innerChecks = std::vector>(); + auto innerChecks = std::vector>(); for (const auto &entry : checkboxes) { const auto c = addCheckbox(verticalLayout, entry.checkboxLabel, entry.initial); c->checkedValue( @@ -341,8 +341,8 @@ void AddCollapsibleToggle(not_null container, raw->lifetime()); } -void AddChooseButtonWithIconAndRightText(not_null container, - not_null controller, +void AddChooseButtonWithIconAndRightText(not_null container, + not_null controller, int initialState, std::vector options, rpl::producer text, @@ -366,7 +366,7 @@ void AddChooseButtonWithIconAndRightText(not_null containe [=] { controller->show(Box( - [=](not_null box) + [=](not_null box) { const auto save = [=](int index) mutable { @@ -393,12 +393,12 @@ rpl::producer Ayu::title() { Ayu::Ayu( QWidget *parent, - not_null controller) + not_null controller) : Section(parent) { setupContent(controller); } -void SetupGhostModeToggle(not_null container) { +void SetupGhostModeToggle(not_null container) { auto settings = &AyuSettings::getInstance(); AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader()); @@ -444,7 +444,7 @@ void SetupGhostModeToggle(not_null container) { AddCollapsibleToggle(container, tr::ayu_GhostEssentialsHeader(), checkboxes, true); } -void SetupReadAfterActionToggle(not_null container) { +void SetupReadAfterActionToggle(not_null container) { auto settings = &AyuSettings::getInstance(); std::vector checkboxes{ @@ -474,7 +474,7 @@ void SetupReadAfterActionToggle(not_null container) { AddCollapsibleToggle(container, tr::ayu_MarkReadAfterAction(), checkboxes, false); } -void SetupGhostEssentials(not_null container) { +void SetupGhostEssentials(not_null container) { auto settings = &AyuSettings::getInstance(); SetupGhostModeToggle(container); @@ -504,7 +504,7 @@ void SetupGhostEssentials(not_null container) { container->lifetime()); } -void SetupSpyEssentials(not_null container) { +void SetupSpyEssentials(not_null container) { auto settings = &AyuSettings::getInstance(); AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader()); @@ -552,7 +552,7 @@ void SetupSpyEssentials(not_null container) { container->lifetime()); } -void SetupQoLToggles(not_null container) { +void SetupQoLToggles(not_null container) { auto settings = &AyuSettings::getInstance(); AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader()); @@ -718,14 +718,14 @@ void SetupQoLToggles(not_null container) { container->lifetime()); } -void SetupAppIcon(not_null container) { +void SetupAppIcon(not_null container) { container->add( object_ptr(container), st::settingsCheckboxPadding); } -void SetupContextMenuElements(not_null container, - not_null controller) { +void SetupContextMenuElements(not_null container, + not_null controller) { auto settings = &AyuSettings::getInstance(); AddSkip(container); @@ -808,7 +808,7 @@ void SetupContextMenuElements(not_null container, AddDividerText(container, tr::ayu_SettingsContextMenuDescription()); } -void SetupDrawerElements(not_null container) { +void SetupDrawerElements(not_null container) { auto settings = &AyuSettings::getInstance(); AddSkip(container); @@ -897,7 +897,7 @@ void SetupDrawerElements(not_null container) { #endif } -void SetupTrayElements(not_null container) { +void SetupTrayElements(not_null container) { auto settings = &AyuSettings::getInstance(); AddSkip(container); @@ -944,8 +944,8 @@ void SetupTrayElements(not_null container) { #endif } -void SetupShowPeerId(not_null container, - not_null controller) { +void SetupShowPeerId(not_null container, + not_null controller) { auto settings = &AyuSettings::getInstance(); const auto options = std::vector{ @@ -969,7 +969,7 @@ void SetupShowPeerId(not_null container, [=] { controller->show(Box( - [=](not_null box) + [=](not_null box) { const auto save = [=](int index) { @@ -987,7 +987,7 @@ void SetupShowPeerId(not_null container, }); } -void SetupRecentStickersLimitSlider(not_null container) { +void SetupRecentStickersLimitSlider(not_null container) { auto settings = &AyuSettings::getInstance(); container->add( @@ -1033,7 +1033,7 @@ void SetupRecentStickersLimitSlider(not_null container) { }); } -void SetupFonts(not_null container, not_null controller) { +void SetupFonts(not_null container, not_null controller) { const auto settings = &AyuSettings::getInstance(); const auto commonButton = AddButtonWithLabel( @@ -1081,7 +1081,7 @@ void SetupFonts(not_null container, not_null container) { +void SetupSendConfirmations(not_null container) { auto settings = &AyuSettings::getInstance(); AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle()); @@ -1144,7 +1144,7 @@ void SetupSendConfirmations(not_null container) { container->lifetime()); } -void SetupMarks(not_null container) { +void SetupMarks(not_null container) { auto settings = &AyuSettings::getInstance(); AddButtonWithLabel( @@ -1172,7 +1172,7 @@ void SetupMarks(not_null container) { }); } -void SetupFolderSettings(not_null container) { +void SetupFolderSettings(not_null container) { auto settings = &AyuSettings::getInstance(); AddButtonWithIcon( @@ -1214,7 +1214,7 @@ void SetupFolderSettings(not_null container) { container->lifetime()); } -void SetupNerdSettings(not_null container, not_null controller) { +void SetupNerdSettings(not_null container, not_null controller) { auto settings = &AyuSettings::getInstance(); SetupShowPeerId(container, controller); @@ -1258,8 +1258,8 @@ void SetupNerdSettings(not_null container, not_nulllifetime()); } -void SetupCustomization(not_null container, - not_null controller) { +void SetupCustomization(not_null container, + not_null controller) { AddSubsectionTitle(container, tr::ayu_CustomizationHeader()); SetupAppIcon(container); @@ -1299,8 +1299,8 @@ void SetupCustomization(not_null container, SetupFonts(container, controller); } -void SetupAyuGramSettings(not_null container, - not_null controller) { +void SetupAyuGramSettings(not_null container, + not_null controller) { AddSkip(container); SetupGhostEssentials(container); AddSkip(container); @@ -1332,7 +1332,7 @@ void SetupAyuGramSettings(not_null container, AddDividerText(container, tr::ayu_SettingsWatermark()); } -void Ayu::setupContent(not_null controller) { +void Ayu::setupContent(not_null controller) { const auto content = Ui::CreateChild(this); SetupAyuGramSettings(content, controller); diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.h b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.h index e190cfa61..e5ffc0cd2 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.h +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.h @@ -21,12 +21,12 @@ namespace Settings { class Ayu : public Section { public: - Ayu(QWidget *parent, not_null controller); + Ayu(QWidget *parent, not_null controller); [[nodiscard]] rpl::producer title() override; private: - void setupContent(not_null controller); + void setupContent(not_null controller); }; } // namespace Settings diff --git a/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.cpp b/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.cpp index 5aafd3041..bd7a0e348 100644 --- a/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.cpp +++ b/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.cpp @@ -12,7 +12,7 @@ constexpr auto kMaxChannelId = -1000000000000; -QString IDString(not_null peer) { +QString IDString(not_null peer) { auto resultId = QString::number(getBareID(peer)); const auto settings = &AyuSettings::getInstance(); @@ -33,7 +33,7 @@ QString IDString(MsgId topic_root_id) { return resultId; } -rpl::producer IDValue(not_null peer) { +rpl::producer IDValue(not_null peer) { return rpl::single(IDString(peer)) | Ui::Text::ToWithEntities(); } diff --git a/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.h b/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.h index 683e2f506..1a496a903 100644 --- a/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.h +++ b/Telegram/SourceFiles/ayu/ui/utils/ayu_profile_values.h @@ -6,8 +6,8 @@ // Copyright @Radolyn, 2023 #pragma once -QString IDString(not_null peer); +QString IDString(not_null peer); QString IDString(MsgId topic_root_id); -rpl::producer IDValue(not_null peer); +rpl::producer IDValue(not_null peer); rpl::producer IDValue(MsgId topicRootId); diff --git a/Telegram/SourceFiles/ayu/utils/ayu_mapper.cpp b/Telegram/SourceFiles/ayu/utils/ayu_mapper.cpp index 05dcba3c4..8fe26c6ea 100644 --- a/Telegram/SourceFiles/ayu/utils/ayu_mapper.cpp +++ b/Telegram/SourceFiles/ayu/utils/ayu_mapper.cpp @@ -12,11 +12,22 @@ namespace AyuMapper { -int mapItemFlagsToMTPFlags(not_null item) { +std::pair> serializeTextWithEntities(not_null item) { + if (item->emptyText()) { + return std::make_pair("", std::vector()); + } + + auto textWithEntities = item->originalText(); + std::vector entities; // todo: implement writing to buffer + + return std::make_pair(textWithEntities.text.toStdString(), entities); +} + +int mapItemFlagsToMTPFlags(not_null item) { int flags = 0; const auto thread = item->topic() - ? (Data::Thread *)item->topic() + ? (Data::Thread*) item->topic() : item->history(); const auto unseen = item->unread(thread); if (unseen) { diff --git a/Telegram/SourceFiles/ayu/utils/ayu_mapper.h b/Telegram/SourceFiles/ayu/utils/ayu_mapper.h index 7407417f5..ad56efa5a 100644 --- a/Telegram/SourceFiles/ayu/utils/ayu_mapper.h +++ b/Telegram/SourceFiles/ayu/utils/ayu_mapper.h @@ -8,6 +8,7 @@ namespace AyuMapper { -int mapItemFlagsToMTPFlags(not_null item); +std::pair> serializeTextWithEntities(not_null item); +int mapItemFlagsToMTPFlags(not_null item); } // namespace AyuMapper diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp index c62e1892d..c9e894e9a 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp @@ -13,7 +13,7 @@ #include "lang_auto.h" #include "ayu/ayu_worker.h" -#include "ayu/database/entities.h" +#include "ayu/data/entities.h" #include "core/mime_type.h" #include "data/data_channel.h" #include "data/data_forum.h" @@ -110,7 +110,7 @@ void dispatchToMainThread(std::function callback, int delay) { QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, delay)); } -not_null getHistoryFromDialogId(ID dialogId, Main::Session *session) { +not_null getHistoryFromDialogId(ID dialogId, Main::Session *session) { if (dialogId > 0) { return session->data().history(peerFromUser(dialogId)); } @@ -123,7 +123,7 @@ not_null getHistoryFromDialogId(ID dialogId, Main::Session *session) return session->data().history(peerFromChat(abs(dialogId))); } -ID getDialogIdFromPeer(not_null peer) { +ID getDialogIdFromPeer(not_null peer) { auto peerId = peerIsUser(peer->id) ? peerToUser(peer->id).bare : peerIsChat(peer->id) @@ -139,30 +139,7 @@ ID getDialogIdFromPeer(not_null peer) { return peerId; } -std::pair serializeTextWithEntities(not_null item) { - if (item->emptyText()) { - return std::make_pair("", ""); - } - - auto textWithEntities = item->originalText(); - auto text = textWithEntities.text.toStdString(); - auto entities = EntitiesToMTP(&item->history()->owner().session(), - textWithEntities.entities, - Api::ConvertOption::SkipLocal); - - if (entities.v.isEmpty()) { - return std::make_pair(text, ""); - } - - auto buff = mtpBuffer(); - for (auto entity : entities.v) { - entity.write(buff); - } - - return std::make_pair(text, std::string(reinterpret_cast(buff.data()), buff.size())); -} - -ID getBareID(not_null peer) { +ID getBareID(not_null peer) { return peerIsUser(peer->id) ? peerToUser(peer->id).bare : peerIsChat(peer->id) @@ -180,8 +157,8 @@ bool isExteraRelated(ID peerId) { return extera_devs.contains(peerId) || extera_channels.contains(peerId); } -void MarkAsReadChatList(not_null list) { - auto mark = std::vector>(); +void MarkAsReadChatList(not_null list) { + auto mark = std::vector>(); for (const auto &row : list->indexed()->all()) { if (const auto history = row->history()) { mark.push_back(history); @@ -242,18 +219,18 @@ void readReactions(base::weak_ptr weakThread) { }).send(); } -void MarkAsReadThread(not_null thread) { - const auto readHistory = [&](not_null history) +void MarkAsReadThread(not_null thread) { + const auto readHistory = [&](not_null history) { history->owner().histories().readInbox(history); }; const auto sendReadMentions = [=]( - not_null thread) + not_null thread) { readMentions(base::make_weak(thread)); }; const auto sendReadReactions = [=]( - not_null thread) + not_null thread) { readReactions(base::make_weak(thread)); }; @@ -261,7 +238,7 @@ void MarkAsReadThread(not_null thread) { if (thread->chatListBadgesState().unread) { if (const auto forum = thread->asForum()) { forum->enumerateTopics([]( - not_null topic) + not_null topic) { MarkAsReadThread(topic); }); @@ -286,7 +263,7 @@ void MarkAsReadThread(not_null thread) { AyuWorker::markAsOnline(&thread->session()); } -void readHistory(not_null message) { +void readHistory(not_null message) { const auto history = message->history(); const auto tillId = message->id; @@ -369,7 +346,7 @@ QString formatDateTime(const QDateTime &date) { return datePart + getLocalizedAt() + timePart; } -QString getMediaSize(not_null message) { +QString getMediaSize(not_null message) { if (!message->media()) { return {}; } @@ -410,7 +387,7 @@ QString getMediaSize(not_null message) { return Ui::FormatSizeText(size); } -QString getMediaMime(not_null message) { +QString getMediaMime(not_null message) { if (!message->media()) { return {}; } @@ -434,7 +411,7 @@ QString getMediaMime(not_null message) { return {}; } -QString getMediaName(not_null message) { +QString getMediaName(not_null message) { if (!message->media()) { return {}; } @@ -450,7 +427,7 @@ QString getMediaName(not_null message) { return {}; } -QString getMediaResolution(not_null message) { +QString getMediaResolution(not_null message) { if (!message->media()) { return {}; } @@ -485,7 +462,7 @@ QString getMediaResolution(not_null message) { return {}; } -QString getMediaDC(not_null message) { +QString getMediaDC(not_null message) { if (!message->media()) { return {}; } diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.h b/Telegram/SourceFiles/ayu/utils/telegram_helpers.h index 01531dd68..c9586b573 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.h +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.h @@ -6,7 +6,7 @@ // Copyright @Radolyn, 2023 #pragma once -#include "ayu/database/entities.h" +#include "ayu/data/entities.h" #include "core/application.h" #include "dialogs/dialogs_main_list.h" @@ -17,30 +17,29 @@ using Callback = Fn; Main::Session *getSession(ID userId); bool accountExists(ID userId); void dispatchToMainThread(std::function callback, int delay = 0); -not_null getHistoryFromDialogId(ID dialogId, Main::Session *session); -ID getDialogIdFromPeer(not_null peer); -std::pair serializeTextWithEntities(not_null item); +not_null getHistoryFromDialogId(ID dialogId, Main::Session *session); +ID getDialogIdFromPeer(not_null peer); -ID getBareID(not_null peer); +ID getBareID(not_null peer); bool isAyuGramRelated(ID peerId); bool isExteraRelated(ID peerId); -void MarkAsReadChatList(not_null list); -void MarkAsReadThread(not_null thread); +void MarkAsReadChatList(not_null list); +void MarkAsReadThread(not_null thread); -void readHistory(not_null message); +void readHistory(not_null message); QString formatTTL(int time); QString formatDateTime(const QDateTime &date); QString getDCName(int dc); -QString getMediaSize(not_null message); -QString getMediaMime(not_null message); -QString getMediaName(not_null message); -QString getMediaResolution(not_null message); -QString getMediaDC(not_null message); +QString getMediaSize(not_null message); +QString getMediaMime(not_null message); +QString getMediaName(not_null message); +QString getMediaResolution(not_null message); +QString getMediaDC(not_null message); void searchById(ID userId, Main::Session *session, bool retry, const Callback &callback); void searchById(ID userId, Main::Session *session, const Callback &callback); diff --git a/Telegram/SourceFiles/ayu/utils/windows_utils.cpp b/Telegram/SourceFiles/ayu/utils/windows_utils.cpp index 4cfd19fa6..7004909da 100644 --- a/Telegram/SourceFiles/ayu/utils/windows_utils.cpp +++ b/Telegram/SourceFiles/ayu/utils/windows_utils.cpp @@ -27,9 +27,9 @@ void reloadAppIconFromTaskBar() { NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, - (void **)&pShellLink); + (void**) &pShellLink); if (SUCCEEDED(hr)) { - hr = pShellLink->QueryInterface(IID_IPersistFile, (void **)&pPersistFile); + hr = pShellLink->QueryInterface(IID_IPersistFile, (void**) &pPersistFile); if (SUCCEEDED(hr)) { WCHAR wszShortcutPath[MAX_PATH]; shortcut.toWCharArray(wszShortcutPath); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index f58607dcc..08a3800e5 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -78,8 +78,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/ayu_settings.h" -#include "ayu/database/ayu_database.h" -#include "ayu/messages/ayu_messages_controller.h" +#include "ayu/data/ayu_database.h" +#include "../ayu/data/messages_storage.h" #include "ayu/ayu_state.h" @@ -2309,12 +2309,11 @@ void Session::updateEditedMessage(const MTPMessage &data) { // AyuGram saveMessagesHistory const auto settings = &AyuSettings::getInstance(); - HistoryMessageEdition edit; if (data.type() != mtpc_message) { goto proceed; } - edit = HistoryMessageEdition(_session, data.c_message()); + HistoryMessageEdition edit = HistoryMessageEdition(_session, data.c_message()); if (settings->saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) { const auto msg = existing->originalText(); @@ -2322,7 +2321,7 @@ void Session::updateEditedMessage(const MTPMessage &data) { goto proceed; } - AyuMessages::getInstance().addEditedMessage(edit, existing); + AyuMessages::addEditedMessage(edit, existing); } proceed: diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 1bf300b4d..63dab7b96 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -87,8 +87,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/ayu_settings.h" -#include "ayu/database/ayu_database.h" -#include "ayu/messages/ayu_messages_controller.h" +#include "ayu/data/ayu_database.h" +#include "../../ayu/data/messages_storage.h" #include "ayu/ui/context_menu/context_menu.h" #include "ayu/ui/sections/edited/edited_log_section.h" diff --git a/Telegram/SourceFiles/intro/intro_step.cpp b/Telegram/SourceFiles/intro/intro_step.cpp index c02c9d9a8..0e3d3f4bb 100644 --- a/Telegram/SourceFiles/intro/intro_step.cpp +++ b/Telegram/SourceFiles/intro/intro_step.cpp @@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_window.h" // AyuGram includes -#include "ayu/ui/ayu_assets.h" +#include "ayu/ui/ayu_logo.h" namespace Intro { diff --git a/Telegram/SourceFiles/platform/win/tray_win.cpp b/Telegram/SourceFiles/platform/win/tray_win.cpp index fda287162..a0b171f71 100644 --- a/Telegram/SourceFiles/platform/win/tray_win.cpp +++ b/Telegram/SourceFiles/platform/win/tray_win.cpp @@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include // AyuGram includes -#include "ayu/ui/ayu_assets.h" +#include "ayu/ui/ayu_logo.h" #include "ui/painter.h" diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index ff93db527..770da434a 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -48,7 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include // AyuGram includes -#include "ayu/ui/ayu_assets.h" +#include "ayu/ui/ayu_logo.h" namespace Window {