mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 21:27:07 +02:00
chore: sync database schema & refactor & reformat
This commit is contained in:
parent
adb5abf4fb
commit
d4a22a5110
49 changed files with 601 additions and 549 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -14,7 +14,7 @@ void hide(PeerId peerId, MsgId messageId) {
|
|||
hiddenMessages[peerId].insert(messageId);
|
||||
}
|
||||
|
||||
void hide(not_null<HistoryItem *> item) {
|
||||
void hide(not_null<HistoryItem*> item) {
|
||||
hide(item->history()->peer->id, item->id);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ bool isHidden(PeerId peerId, MsgId messageId) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool isHidden(not_null<HistoryItem *> item) {
|
||||
bool isHidden(not_null<HistoryItem*> item) {
|
||||
return isHidden(item->history()->peer->id, item->id);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace AyuState {
|
||||
|
||||
void hide(PeerId peerId, MsgId messageId);
|
||||
void hide(not_null<HistoryItem *> item);
|
||||
void hide(not_null<HistoryItem*> item);
|
||||
bool isHidden(PeerId peerId, MsgId messageId);
|
||||
bool isHidden(not_null<HistoryItem *> item);
|
||||
bool isHidden(not_null<HistoryItem*> item);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<ID, bool> state;
|
||||
|
||||
void markAsOnline(not_null<Main::Session *> session) {
|
||||
void markAsOnline(not_null<Main::Session*> session) {
|
||||
state[session->userId().bare] = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace AyuWorker {
|
||||
|
||||
void markAsOnline(not_null<Main::Session *> session);
|
||||
void markAsOnline(not_null<Main::Session*> session);
|
||||
void initialize();
|
||||
|
||||
}
|
||||
|
|
210
Telegram/SourceFiles/ayu/data/ayu_database.cpp
Normal file
210
Telegram/SourceFiles/ayu/data/ayu_database.cpp
Normal file
|
@ -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 <ranges>
|
||||
|
||||
#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<EditedMessage> getEditedMessages(ID userId, ID dialogId, ID messageId) {
|
||||
return storage.get_all<EditedMessage>(
|
||||
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<EditedMessage>(
|
||||
where(
|
||||
c(&EditedMessage::userId) == userId and
|
||||
c(&EditedMessage::dialogId) == dialogId and
|
||||
c(&EditedMessage::messageId) == messageId
|
||||
)
|
||||
) > 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,8 +7,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "entities.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
|
||||
namespace AyuDatabase {
|
||||
|
|
@ -36,6 +36,7 @@ public:
|
|||
ID replyPeerId;
|
||||
int replyTopId;
|
||||
bool replyForumTopic;
|
||||
std::vector<char> replySerialized;
|
||||
int entityCreateDate;
|
||||
std::string text;
|
||||
std::vector<char> textEntities;
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
};
|
||||
|
||||
using DeletedMessage = AyuMessageBase<struct DeletedMessageTag>;
|
||||
|
||||
using EditedMessage = AyuMessageBase<struct EditedMessageTag>;
|
||||
|
||||
class DeletedDialog
|
||||
|
@ -58,8 +60,47 @@ public:
|
|||
ID userId;
|
||||
ID dialogId;
|
||||
ID peerId;
|
||||
std::unique_ptr<int> folderId; // nullable
|
||||
int topMessage;
|
||||
int lastMessageDate;
|
||||
int flags;
|
||||
int entityCreateDate;
|
||||
};
|
||||
|
||||
class RegexFilter
|
||||
{
|
||||
public:
|
||||
std::vector<char> id;
|
||||
std::string text;
|
||||
bool enabled;
|
||||
bool caseInsensitive;
|
||||
std::unique_ptr<ID> dialogId; // nullable
|
||||
};
|
||||
|
||||
class RegexFilterGlobalExclusion
|
||||
{
|
||||
public:
|
||||
ID fakeId;
|
||||
ID dialogId;
|
||||
std::vector<char> 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;
|
||||
};
|
|
@ -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<AyuMessagesController> controller = std::nullopt;
|
||||
|
||||
void initialize() {
|
||||
if (controller.has_value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
controller = AyuMessagesController();
|
||||
}
|
||||
|
||||
AyuMessagesController &getInstance() {
|
||||
initialize();
|
||||
return controller.value();
|
||||
}
|
||||
|
||||
void map(HistoryMessageEdition &edition, not_null<HistoryItem *> item, EditedMessage &message) {
|
||||
void map(HistoryMessageEdition &edition, not_null<HistoryItem*> 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<HistoryItem *> 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<HistoryItem *> item, EditedMes
|
|||
// message.mimeType;
|
||||
}
|
||||
|
||||
void AyuMessagesController::addEditedMessage(HistoryMessageEdition &edition, not_null<HistoryItem *> item) {
|
||||
void addEditedMessage(HistoryMessageEdition &edition, not_null<HistoryItem*> item) {
|
||||
EditedMessage message;
|
||||
map(edition, item, message);
|
||||
|
||||
AyuDatabase::addEditedMessage(message);
|
||||
}
|
||||
|
||||
std::vector<EditedMessage> AyuMessagesController::getEditedMessages(HistoryItem *item) {
|
||||
std::vector<EditedMessage> getEditedMessages(not_null<HistoryItem*> 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<EditedMessage> AyuMessagesController::getEditedMessages(HistoryItem
|
|||
return AyuDatabase::getEditedMessages(userId, dialogId, msgId);
|
||||
}
|
||||
|
||||
bool AyuMessagesController::hasRevisions(not_null<HistoryItem *> item) {
|
||||
bool hasRevisions(not_null<HistoryItem*> item) {
|
||||
auto userId = item->history()->owner().session().userId().bare;
|
||||
auto dialogId = getDialogIdFromPeer(item->history()->peer);
|
||||
auto msgId = item->id.bare;
|
19
Telegram/SourceFiles/ayu/data/messages_storage.h
Normal file
19
Telegram/SourceFiles/ayu/data/messages_storage.h
Normal file
|
@ -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<HistoryItem*> item);
|
||||
std::vector<EditedMessage> getEditedMessages(not_null<HistoryItem*> item);
|
||||
bool hasRevisions(not_null<HistoryItem*> item);
|
||||
|
||||
}
|
|
@ -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<EditedMessage> getEditedMessages(ID userId, ID dialogId, ID messageId) {
|
||||
return storage.get_all<EditedMessage>(
|
||||
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<EditedMessage>(
|
||||
where(
|
||||
c(&EditedMessage::userId) == userId and
|
||||
c(&EditedMessage::dialogId) == dialogId and
|
||||
c(&EditedMessage::messageId) == messageId
|
||||
)
|
||||
) > 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -146,23 +146,23 @@ class MessageShotDelegate final : public HistoryView::DefaultElementDelegate
|
|||
{
|
||||
public:
|
||||
MessageShotDelegate(
|
||||
not_null<QWidget *> parent,
|
||||
not_null<Ui::ChatStyle *> st,
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Ui::ChatStyle*> st,
|
||||
Fn<void()> update);
|
||||
|
||||
bool elementAnimationsPaused() override;
|
||||
not_null<Ui::PathShiftGradient *> elementPathShiftGradient() override;
|
||||
not_null<Ui::PathShiftGradient*> elementPathShiftGradient() override;
|
||||
HistoryView::Context elementContext() override;
|
||||
bool elementIsChatWide() override;
|
||||
|
||||
private:
|
||||
const not_null<QWidget *> _parent;
|
||||
const not_null<QWidget*> _parent;
|
||||
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
||||
};
|
||||
|
||||
MessageShotDelegate::MessageShotDelegate(
|
||||
not_null<QWidget *> parent,
|
||||
not_null<Ui::ChatStyle *> st,
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Ui::ChatStyle*> st,
|
||||
Fn<void()> update)
|
||||
: _parent(parent)
|
||||
, _pathGradient(HistoryView::MakePathShiftGradient(st, update)) {
|
||||
|
@ -173,7 +173,7 @@ bool MessageShotDelegate::elementAnimationsPaused() {
|
|||
}
|
||||
|
||||
auto MessageShotDelegate::elementPathShiftGradient()
|
||||
-> not_null<Ui::PathShiftGradient *> {
|
||||
-> not_null<Ui::PathShiftGradient*> {
|
||||
return _pathGradient.get();
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ QImage addPadding(const QImage &original, int padding) {
|
|||
return paddedImage;
|
||||
}
|
||||
|
||||
QImage Make(not_null<QWidget *> box, const ShotConfig &config) {
|
||||
QImage Make(not_null<QWidget*> 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<QWidget *> box, const ShotConfig &config) {
|
|||
box->update();
|
||||
});
|
||||
|
||||
std::unordered_map<not_null<HistoryItem *>, std::shared_ptr<HistoryView::Element>> createdViews;
|
||||
std::unordered_map<not_null<HistoryItem*>, std::shared_ptr<HistoryView::Element>> createdViews;
|
||||
createdViews.reserve(messages.size());
|
||||
for (const auto &message : messages) {
|
||||
createdViews.emplace(message, message->createView(delegate.get()));
|
||||
}
|
||||
|
||||
auto getView = [=](not_null<HistoryItem *> msg)
|
||||
auto getView = [=](not_null<HistoryItem*> msg)
|
||||
{
|
||||
return createdViews.at(msg).get();
|
||||
};
|
||||
|
@ -357,7 +357,7 @@ QImage Make(not_null<QWidget *> box, const ShotConfig &config) {
|
|||
return overlay;
|
||||
}
|
||||
|
||||
void Wrapper(not_null<HistoryView::ListWidget *> widget) {
|
||||
void Wrapper(not_null<HistoryView::ListWidget*> widget) {
|
||||
const auto items = widget->getSelectedIds();
|
||||
if (items.empty()) {
|
||||
return;
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace AyuFeatures::MessageShot {
|
|||
|
||||
struct ShotConfig
|
||||
{
|
||||
not_null<Window::SessionController *> controller;
|
||||
not_null<Window::SessionController*> controller;
|
||||
std::shared_ptr<Ui::ChatStyle> st;
|
||||
std::vector<not_null<HistoryItem *>> messages;
|
||||
std::vector<not_null<HistoryItem*>> messages;
|
||||
|
||||
bool showDate;
|
||||
bool showReactions;
|
||||
|
@ -63,8 +63,8 @@ rpl::producer<Data::CloudTheme> themeChosen();
|
|||
void setPalette(style::palette &palette);
|
||||
rpl::producer<style::palette> paletteChosen();
|
||||
|
||||
QImage Make(not_null<QWidget *> box, const ShotConfig &config);
|
||||
QImage Make(not_null<QWidget*> box, const ShotConfig &config);
|
||||
|
||||
void Wrapper(not_null<HistoryView::ListWidget *> widget);
|
||||
void Wrapper(not_null<HistoryView::ListWidget*> widget);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<HistoryItem *> item);
|
||||
std::vector<EditedMessage> getEditedMessages(HistoryItem *item);
|
||||
bool hasRevisions(not_null<HistoryItem *> item);
|
||||
};
|
||||
|
||||
AyuMessagesController &getInstance();
|
||||
|
||||
}
|
|
@ -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;
|
|
@ -128,18 +128,18 @@ private:
|
|||
Selection selected) const;
|
||||
|
||||
std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
|
||||
not_null<Row *> row,
|
||||
not_null<Row*> row,
|
||||
Selection selected);
|
||||
|
||||
[[maybe_unused]] const std::unique_ptr<Ui::RippleAnimation> &rippleBySelection(
|
||||
not_null<const Row *> row,
|
||||
not_null<const Row*> row,
|
||||
Selection selected) const;
|
||||
|
||||
void addRipple(Selection selected, QPoint position);
|
||||
|
||||
void ensureRippleBySelection(Selection selected);
|
||||
|
||||
void ensureRippleBySelection(not_null<Row *> row, Selection selected);
|
||||
void ensureRippleBySelection(not_null<Row*> row, Selection selected);
|
||||
|
||||
int indexFromSelection(Selection selected) const;
|
||||
|
||||
|
@ -153,16 +153,16 @@ private:
|
|||
|
||||
void repaint(const Row &row);
|
||||
|
||||
void repaintChecked(not_null<const Row *> row);
|
||||
void repaintChecked(not_null<const Row*> row);
|
||||
|
||||
void activateByIndex(int index);
|
||||
|
||||
void setForceRippled(not_null<Row *> row, bool rippled);
|
||||
void setForceRippled(not_null<Row*> row, bool rippled);
|
||||
|
||||
void restore(not_null<Row *> row);
|
||||
void restore(not_null<Row*> row);
|
||||
|
||||
std::vector<Row> _rows;
|
||||
std::vector<not_null<Row *>> _filtered;
|
||||
std::vector<not_null<Row*>> _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 *> row, Selection selected) {
|
||||
void Rows::ensureRippleBySelection(not_null<Row*> 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 *> row) {
|
||||
void Rows::restore(not_null<Row*> row) {
|
||||
row->removed = false;
|
||||
}
|
||||
|
||||
void Rows::setForceRippled(not_null<Row *> row, bool rippled) {
|
||||
void Rows::setForceRippled(not_null<Row*> 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<const Row *> row) {
|
||||
void Rows::repaintChecked(not_null<const Row*> row) {
|
||||
const auto found = (ranges::find(_filtered, row) != end(_filtered));
|
||||
if (_query.isEmpty() || found) {
|
||||
repaint(*row);
|
||||
|
@ -542,16 +542,16 @@ const std::unique_ptr<Ui::RippleAnimation> &Rows::rippleBySelection(
|
|||
}
|
||||
|
||||
std::unique_ptr<Ui::RippleAnimation> &Rows::rippleBySelection(
|
||||
not_null<Row *> row,
|
||||
not_null<Row*> row,
|
||||
Selection selected) {
|
||||
return row->ripple;
|
||||
}
|
||||
|
||||
const std::unique_ptr<Ui::RippleAnimation> &Rows::rippleBySelection(
|
||||
not_null<const Row *> row,
|
||||
not_null<const Row*> row,
|
||||
Selection selected) const {
|
||||
return const_cast<Rows *>(this)->rippleBySelection(
|
||||
const_cast<Row *>(row.get()),
|
||||
return const_cast<Rows*>(this)->rippleBySelection(
|
||||
const_cast<Row*>(row.get()),
|
||||
selected);
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ void Content::setupContent(
|
|||
const auto add = [&](const std::vector<Font> &list)
|
||||
{
|
||||
if (list.empty()) {
|
||||
return (Rows *)nullptr;
|
||||
return (Rows*) nullptr;
|
||||
}
|
||||
const auto wrap = content->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
|
@ -964,7 +964,7 @@ void AyuUi::FontSelectorBox::prepare() {
|
|||
};
|
||||
}
|
||||
|
||||
void AyuUi::FontSelectorBox::setupTop(not_null<Ui::VerticalLayout *> container) {
|
||||
void AyuUi::FontSelectorBox::setupTop(not_null<Ui::VerticalLayout*> container) {
|
||||
if (!_controller) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
private:
|
||||
void setupTop(not_null<Ui::VerticalLayout *> container);
|
||||
void setupTop(not_null<Ui::VerticalLayout*> container);
|
||||
[[nodiscard]] int rowsInPage() const;
|
||||
|
||||
Window::SessionController *_controller = nullptr;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace AyuUi {
|
|||
|
||||
ServerReadConfirmationBox::ServerReadConfirmationBox(
|
||||
QWidget *,
|
||||
not_null<Window::SessionController *> controller)
|
||||
not_null<Window::SessionController*> controller)
|
||||
: _controller(controller) {
|
||||
//
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace AyuUi {
|
|||
class ServerReadConfirmationBox : public Ui::BoxContent
|
||||
{
|
||||
public:
|
||||
ServerReadConfirmationBox(QWidget *, not_null<Window::SessionController *> controller);
|
||||
ServerReadConfirmationBox(QWidget *, not_null<Window::SessionController*> controller);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -24,7 +24,7 @@ protected:
|
|||
private:
|
||||
void ReadAllPeers();
|
||||
|
||||
not_null<Window::SessionController *> _controller;
|
||||
not_null<Window::SessionController*> _controller;
|
||||
object_ptr<Ui::FlatLabel> _text = {nullptr};
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
ThemeSelectorBox::ThemeSelectorBox(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller)
|
||||
not_null<Window::SessionController*> controller)
|
||||
: _controller(controller) {
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using Callback = Fn<void(style::palette &)>;
|
|||
class ThemeSelectorBox : public Ui::BoxContent
|
||||
{
|
||||
public:
|
||||
ThemeSelectorBox(QWidget *parent, not_null<Window::SessionController *> controller);
|
||||
ThemeSelectorBox(QWidget *parent, not_null<Window::SessionController*> controller);
|
||||
|
||||
rpl::producer<style::palette> paletteSelected();
|
||||
rpl::producer<QString> themeNameChanged();
|
||||
|
@ -26,7 +26,7 @@ protected:
|
|||
private:
|
||||
void setupContent();
|
||||
|
||||
not_null<Window::SessionController *> _controller;
|
||||
not_null<Window::SessionController*> _controller;
|
||||
|
||||
rpl::event_stream<style::palette> _palettes;
|
||||
rpl::event_stream<QString> _themeNames;
|
||||
|
|
|
@ -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<Ui::PopupMenu *> menu, HistoryItem *item) {
|
||||
if (AyuMessages::getInstance().hasRevisions(item)) {
|
||||
void AddHistoryAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
if (AyuMessages::hasRevisions(item)) {
|
||||
menu->addAction(tr::ayu_EditsHistoryMenuText(tr::now),
|
||||
[=]
|
||||
{
|
||||
|
@ -48,7 +48,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();
|
||||
if (!needToShowItem(settings->showHideMessageInContextMenu)) {
|
||||
return;
|
||||
|
@ -66,7 +66,7 @@ void AddHideMessageAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item) {
|
|||
&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();
|
||||
if (!needToShowItem(settings->showUserMessagesInContextMenu)) {
|
||||
return;
|
||||
|
@ -92,7 +92,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();
|
||||
if (!needToShowItem(settings->showMessageDetailsInContextMenu)) {
|
||||
return;
|
||||
|
@ -150,7 +150,7 @@ void AddMessageDetailsAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
|||
.text = tr::ayu_MessageDetailsPC(tr::now),
|
||||
.handler = nullptr,
|
||||
.icon = &st::menuIconInfo,
|
||||
.fillSubmenu = [&](not_null<Ui::PopupMenu *> menu2)
|
||||
.fillSubmenu = [&](not_null<Ui::PopupMenu*> menu2)
|
||||
{
|
||||
if (hasAnyPostField) {
|
||||
if (!messageViews.isEmpty()) {
|
||||
|
@ -278,7 +278,7 @@ void AddMessageDetailsAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
|||
});
|
||||
}
|
||||
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item) {
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||
if (item->isLocal()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace AyuUi {
|
|||
|
||||
bool needToShowItem(int state);
|
||||
|
||||
void AddHistoryAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
void AddHideMessageAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
void AddUserMessagesAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
void AddMessageDetailsAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item);
|
||||
void AddHistoryAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item);
|
||||
void AddHideMessageAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item);
|
||||
void AddUserMessagesAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item);
|
||||
void AddMessageDetailsAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item);
|
||||
void AddReadUntilAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<RpWidget *> parent,
|
||||
not_null<RpWidget*> parent,
|
||||
const style::Menu &st,
|
||||
const style::icon &icon,
|
||||
Fn<void()> callback,
|
||||
|
@ -38,9 +38,9 @@ public:
|
|||
QString subtext);
|
||||
|
||||
bool isEnabled() const override;
|
||||
not_null<QAction *> action() const override;
|
||||
not_null<QAction*> action() const override;
|
||||
|
||||
void handleKeyPress(not_null<QKeyEvent *> e) override;
|
||||
void handleKeyPress(not_null<QKeyEvent*> e) override;
|
||||
|
||||
protected:
|
||||
QPoint prepareRippleStartPosition() const override;
|
||||
|
@ -51,7 +51,7 @@ protected:
|
|||
void prepare(const QString &title);
|
||||
void paint(Painter &p);
|
||||
|
||||
const not_null<QAction *> _dummyAction;
|
||||
const not_null<QAction*> _dummyAction;
|
||||
const style::Menu &_st;
|
||||
const style::icon &_icon;
|
||||
|
||||
|
@ -65,10 +65,10 @@ protected:
|
|||
class ActionStickerPackAuthor final : public ActionWithSubText
|
||||
{
|
||||
public:
|
||||
ActionStickerPackAuthor(not_null<Menu::Menu *> menu, not_null<Main::Session *> session, ID authorId);
|
||||
ActionStickerPackAuthor(not_null<Menu::Menu*> menu, not_null<Main::Session*> session, ID authorId);
|
||||
|
||||
private:
|
||||
not_null<Main::Session *> _session;
|
||||
not_null<Main::Session*> _session;
|
||||
|
||||
void searchAuthor(ID authorId);
|
||||
};
|
||||
|
@ -81,7 +81,7 @@ TextParseOptions MenuTextOptions = {
|
|||
};
|
||||
|
||||
ActionWithSubText::ActionWithSubText(
|
||||
not_null<RpWidget *> parent,
|
||||
not_null<RpWidget*> parent,
|
||||
const style::Menu &st,
|
||||
const style::icon &icon,
|
||||
Fn<void()> callback,
|
||||
|
@ -176,7 +176,7 @@ bool ActionWithSubText::isEnabled() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
not_null<QAction *> ActionWithSubText::action() const {
|
||||
not_null<QAction*> ActionWithSubText::action() const {
|
||||
return _dummyAction;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ int ActionWithSubText::contentHeight() const {
|
|||
return _height;
|
||||
}
|
||||
|
||||
void ActionWithSubText::handleKeyPress(not_null<QKeyEvent *> e) {
|
||||
void ActionWithSubText::handleKeyPress(not_null<QKeyEvent*> e) {
|
||||
if (!isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ void ActionWithSubText::handleKeyPress(not_null<QKeyEvent *> e) {
|
|||
}
|
||||
}
|
||||
|
||||
ActionStickerPackAuthor::ActionStickerPackAuthor(not_null<Menu::Menu *> menu,
|
||||
not_null<Main::Session *> session,
|
||||
ActionStickerPackAuthor::ActionStickerPackAuthor(not_null<Menu::Menu*> menu,
|
||||
not_null<Main::Session*> session,
|
||||
ID authorId)
|
||||
: ActionWithSubText(menu,
|
||||
menu->st(),
|
||||
|
@ -273,7 +273,7 @@ void ActionStickerPackAuthor::searchAuthor(ID authorId) {
|
|||
} // namespace
|
||||
|
||||
base::unique_qptr<Menu::ItemBase> ContextActionWithSubText(
|
||||
not_null<Menu::Menu *> menu,
|
||||
not_null<Menu::Menu*> menu,
|
||||
const style::icon &icon,
|
||||
const QString &title,
|
||||
const QString &subtext,
|
||||
|
@ -295,8 +295,8 @@ base::unique_qptr<Menu::ItemBase> ContextActionWithSubText(
|
|||
}
|
||||
|
||||
base::unique_qptr<Menu::ItemBase> ContextActionStickerAuthor(
|
||||
not_null<Menu::Menu *> menu,
|
||||
not_null<Main::Session *> session,
|
||||
not_null<Menu::Menu*> menu,
|
||||
not_null<Main::Session*> session,
|
||||
ID authorId) {
|
||||
return base::make_unique_q<ActionStickerPackAuthor>(menu, session, authorId);
|
||||
}
|
||||
|
|
|
@ -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<Menu::ItemBase> ContextActionWithSubText(
|
||||
not_null<Menu::Menu *> menu,
|
||||
not_null<Menu::Menu*> menu,
|
||||
const style::icon &icon,
|
||||
const QString &title,
|
||||
const QString &subtext,
|
||||
Fn<void()> callback = nullptr);
|
||||
|
||||
[[nodiscard]] base::unique_qptr<Menu::ItemBase> ContextActionStickerAuthor(
|
||||
not_null<Menu::Menu *> menu,
|
||||
not_null<Main::Session *> session,
|
||||
not_null<Menu::Menu*> menu,
|
||||
not_null<Main::Session*> session,
|
||||
ID authorId);
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -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 <ayu/messages/ayu_messages_controller.h>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
|
@ -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<Element *> view, int itemtop, int itembottom)
|
||||
auto userpicCallback = [&](not_null<Element*> 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<Element *> view, int itemtop, int itembottom)
|
||||
auto dateCallback = [&](not_null<Element*> 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<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer,
|
||||
not_null<HistoryItem *> item)
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<HistoryItem*> item)
|
||||
: RpWidget(parent),
|
||||
_controller(controller),
|
||||
_peer(peer),
|
||||
|
@ -319,7 +319,7 @@ InnerWidget::InnerWidget(
|
|||
},
|
||||
lifetime());
|
||||
session().data().itemDataChanges(
|
||||
) | rpl::start_with_next([=](not_null<HistoryItem *> item)
|
||||
) | rpl::start_with_next([=](not_null<HistoryItem*> item)
|
||||
{
|
||||
if (const auto view = viewForItem(item)) {
|
||||
view->itemDataChanged();
|
||||
|
@ -519,7 +519,7 @@ HistoryView::Context InnerWidget::elementContext() {
|
|||
}
|
||||
|
||||
bool InnerWidget::elementUnderCursor(
|
||||
not_null<const HistoryView::Element *> view) {
|
||||
not_null<const HistoryView::Element*> view) {
|
||||
return (Element::Hovered() == view);
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ bool InnerWidget::elementInSelectionMode() {
|
|||
}
|
||||
|
||||
bool InnerWidget::elementIntersectsRange(
|
||||
not_null<const Element *> view,
|
||||
not_null<const Element*> 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<const Element *> view) {
|
||||
void InnerWidget::elementStartStickerLoop(not_null<const Element*> view) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementShowPollResults(
|
||||
not_null<PollData *> poll,
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId context) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementOpenPhoto(
|
||||
not_null<PhotoData *> photo,
|
||||
not_null<PhotoData*> photo,
|
||||
FullMsgId context) {
|
||||
_controller->openPhoto(photo, {context});
|
||||
}
|
||||
|
||||
void InnerWidget::elementOpenDocument(
|
||||
not_null<DocumentData *> document,
|
||||
not_null<DocumentData*> 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<const Element *> view) {
|
||||
bool InnerWidget::elementHideReply(not_null<const Element*> view) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InnerWidget::elementShownUnread(not_null<const Element *> view) {
|
||||
bool InnerWidget::elementShownUnread(not_null<const Element*> view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -592,36 +592,36 @@ void InnerWidget::elementSearchInList(
|
|||
const FullMsgId &context) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementHandleViaClick(not_null<UserData *> bot) {
|
||||
void InnerWidget::elementHandleViaClick(not_null<UserData*> bot) {
|
||||
}
|
||||
|
||||
bool InnerWidget::elementIsChatWide() {
|
||||
return _isChatWide;
|
||||
}
|
||||
|
||||
not_null<Ui::PathShiftGradient *> InnerWidget::elementPathShiftGradient() {
|
||||
not_null<Ui::PathShiftGradient*> InnerWidget::elementPathShiftGradient() {
|
||||
return _pathGradient.get();
|
||||
}
|
||||
|
||||
void InnerWidget::elementReplyTo(const FullReplyTo &to) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementStartInteraction(not_null<const Element *> view) {
|
||||
void InnerWidget::elementStartInteraction(not_null<const Element*> view) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementStartPremium(
|
||||
not_null<const Element *> view,
|
||||
not_null<const Element*> view,
|
||||
Element *replacing) {
|
||||
}
|
||||
|
||||
void InnerWidget::elementCancelPremium(not_null<const Element *> view) {
|
||||
void InnerWidget::elementCancelPremium(not_null<const Element*> view) {
|
||||
}
|
||||
|
||||
QString InnerWidget::elementAuthorRank(not_null<const Element *> view) {
|
||||
QString InnerWidget::elementAuthorRank(not_null<const Element*> view) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void InnerWidget::saveState(not_null<SectionMemento *> memento) {
|
||||
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
||||
if (!_filterChanged) {
|
||||
for (auto &item : _items) {
|
||||
item.clearView();
|
||||
|
@ -636,7 +636,7 @@ void InnerWidget::saveState(not_null<SectionMemento *> memento) {
|
|||
_upLoaded = _downLoaded = true; // Don't load or handle anything anymore.
|
||||
}
|
||||
|
||||
void InnerWidget::restoreState(not_null<SectionMemento *> memento) {
|
||||
void InnerWidget::restoreState(not_null<SectionMemento*> memento) {
|
||||
_items = memento->takeItems();
|
||||
for (auto &item : _items) {
|
||||
item.refreshView(this);
|
||||
|
@ -650,7 +650,7 @@ void InnerWidget::restoreState(not_null<SectionMemento *> 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<Element *> view, int userpicTop)
|
||||
enumerateUserpics([&](not_null<Element*> 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<Element *> view, int itemtop, int dateTop)
|
||||
enumerateDates([&](not_null<Element*> 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<const Ui::ChatStyle *> st) {
|
||||
void InnerWidget::paintEmpty(Painter &p, not_null<const Ui::ChatStyle*> 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<PhotoData *>(
|
||||
? reinterpret_cast<PhotoData*>(
|
||||
link->property(kPhotoLinkMediaProperty).toULongLong())
|
||||
: nullptr;
|
||||
const auto lnkDocument = link
|
||||
? reinterpret_cast<DocumentData *>(
|
||||
? reinterpret_cast<DocumentData*>(
|
||||
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<PhotoData *> photo) {
|
||||
void InnerWidget::savePhotoToFile(not_null<PhotoData*> photo) {
|
||||
const auto media = photo->activeMediaView();
|
||||
if (photo->isNull() || !media || !media->loaded()) {
|
||||
return;
|
||||
|
@ -1200,14 +1200,14 @@ void InnerWidget::savePhotoToFile(not_null<PhotoData *> photo) {
|
|||
}));
|
||||
}
|
||||
|
||||
void InnerWidget::saveDocumentToFile(not_null<DocumentData *> document) {
|
||||
void InnerWidget::saveDocumentToFile(not_null<DocumentData*> document) {
|
||||
DocumentSaveClickHandler::Save(
|
||||
Data::FileOrigin(),
|
||||
document,
|
||||
DocumentSaveClickHandler::Mode::ToNewFile);
|
||||
}
|
||||
|
||||
void InnerWidget::copyContextImage(not_null<PhotoData *> photo) {
|
||||
void InnerWidget::copyContextImage(not_null<PhotoData*> 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<DocumentData *> document) {
|
||||
void InnerWidget::showStickerPackInfo(not_null<DocumentData*> document) {
|
||||
StickerSetBox::Show(_controller->uiShow(), document);
|
||||
}
|
||||
|
||||
void InnerWidget::cancelContextDownload(not_null<DocumentData *> document) {
|
||||
void InnerWidget::cancelContextDownload(not_null<DocumentData*> document) {
|
||||
document->cancel();
|
||||
}
|
||||
|
||||
void InnerWidget::showContextInFolder(not_null<DocumentData *> document) {
|
||||
void InnerWidget::showContextInFolder(not_null<DocumentData*> 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<Element *> view, int userpicTop)
|
||||
enumerateUserpics([&](not_null<Element*> 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<const Element *> view) const {
|
||||
int InnerWidget::itemTop(not_null<const Element*> 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<Element *> view) {
|
||||
void InnerWidget::resizeItem(not_null<Element*> view) {
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void InnerWidget::refreshItem(not_null<const Element *> view) {
|
||||
void InnerWidget::refreshItem(not_null<const Element*> view) {
|
||||
// No need to refresh views in admin log.
|
||||
// sogl
|
||||
}
|
||||
|
|
|
@ -50,19 +50,19 @@ class InnerWidget final
|
|||
public:
|
||||
InnerWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer,
|
||||
not_null<HistoryItem *> item);
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<HistoryItem*> item);
|
||||
|
||||
[[nodiscard]] Main::Session &session() const;
|
||||
|
||||
[[nodiscard]] not_null<Ui::ChatTheme *> theme() const {
|
||||
[[nodiscard]] not_null<Ui::ChatTheme*> theme() const {
|
||||
return _theme.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] rpl::producer<int> scrollToSignal() const;
|
||||
|
||||
[[nodiscard]] not_null<PeerData *> channel() const {
|
||||
[[nodiscard]] not_null<PeerData*> channel() const {
|
||||
return _peer;
|
||||
}
|
||||
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
return TWidget::resizeToWidth(newWidth);
|
||||
}
|
||||
|
||||
void saveState(not_null<SectionMemento *> memento);
|
||||
void restoreState(not_null<SectionMemento *> memento);
|
||||
void saveState(not_null<SectionMemento*> memento);
|
||||
void restoreState(not_null<SectionMemento*> memento);
|
||||
|
||||
// Ui::AbstractTooltipShower interface.
|
||||
QString tooltipText() const override;
|
||||
|
@ -85,22 +85,22 @@ public:
|
|||
// HistoryView::ElementDelegate interface.
|
||||
HistoryView::Context elementContext() override;
|
||||
bool elementUnderCursor(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
bool elementInSelectionMode() override;
|
||||
bool elementIntersectsRange(
|
||||
not_null<const HistoryView::Element *> view,
|
||||
not_null<const HistoryView::Element*> view,
|
||||
int from,
|
||||
int till) override;
|
||||
void elementStartStickerLoop(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
void elementShowPollResults(
|
||||
not_null<PollData *> poll,
|
||||
not_null<PollData*> poll,
|
||||
FullMsgId context) override;
|
||||
void elementOpenPhoto(
|
||||
not_null<PhotoData *> photo,
|
||||
not_null<PhotoData*> photo,
|
||||
FullMsgId context) override;
|
||||
void elementOpenDocument(
|
||||
not_null<DocumentData *> document,
|
||||
not_null<DocumentData*> document,
|
||||
FullMsgId context,
|
||||
bool showInMediaView = false) override;
|
||||
void elementCancelUpload(const FullMsgId &context) override;
|
||||
|
@ -109,28 +109,28 @@ public:
|
|||
Fn<void()> hiddenCallback) override;
|
||||
bool elementAnimationsPaused() override;
|
||||
bool elementHideReply(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
bool elementShownUnread(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
void elementSendBotCommand(
|
||||
const QString &command,
|
||||
const FullMsgId &context) override;
|
||||
void elementSearchInList(
|
||||
const QString &query,
|
||||
const FullMsgId &context) override;
|
||||
void elementHandleViaClick(not_null<UserData *> bot) override;
|
||||
void elementHandleViaClick(not_null<UserData*> bot) override;
|
||||
bool elementIsChatWide() override;
|
||||
not_null<Ui::PathShiftGradient *> elementPathShiftGradient() override;
|
||||
not_null<Ui::PathShiftGradient*> elementPathShiftGradient() override;
|
||||
void elementReplyTo(const FullReplyTo &to) override;
|
||||
void elementStartInteraction(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
void elementStartPremium(
|
||||
not_null<const HistoryView::Element *> view,
|
||||
not_null<const HistoryView::Element*> view,
|
||||
HistoryView::Element *replacing) override;
|
||||
void elementCancelPremium(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
QString elementAuthorRank(
|
||||
not_null<const HistoryView::Element *> view) override;
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
|
||||
~InnerWidget();
|
||||
|
||||
|
@ -186,19 +186,19 @@ private:
|
|||
void mouseActionCancel();
|
||||
void updateSelected();
|
||||
void performDrag();
|
||||
int itemTop(not_null<const Element *> view) const;
|
||||
int itemTop(not_null<const Element*> view) const;
|
||||
void repaintItem(const Element *view);
|
||||
void refreshItem(not_null<const Element *> view);
|
||||
void resizeItem(not_null<Element *> view);
|
||||
void refreshItem(not_null<const Element*> view);
|
||||
void resizeItem(not_null<Element*> view);
|
||||
QPoint mapPointToItem(QPoint point, const Element *view) const;
|
||||
|
||||
void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false);
|
||||
void savePhotoToFile(not_null<PhotoData *> photo);
|
||||
void saveDocumentToFile(not_null<DocumentData *> document);
|
||||
void copyContextImage(not_null<PhotoData *> photo);
|
||||
void showStickerPackInfo(not_null<DocumentData *> document);
|
||||
void cancelContextDownload(not_null<DocumentData *> document);
|
||||
void showContextInFolder(not_null<DocumentData *> document);
|
||||
void savePhotoToFile(not_null<PhotoData*> photo);
|
||||
void saveDocumentToFile(not_null<DocumentData*> document);
|
||||
void copyContextImage(not_null<PhotoData*> photo);
|
||||
void showStickerPackInfo(not_null<DocumentData*> document);
|
||||
void cancelContextDownload(not_null<DocumentData*> document);
|
||||
void showContextInFolder(not_null<DocumentData*> 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<const Ui::ChatStyle *> st);
|
||||
void paintEmpty(Painter &p, not_null<const Ui::ChatStyle*> st);
|
||||
void addEvents(Direction direction);
|
||||
Element *viewForItem(const HistoryItem *item);
|
||||
|
||||
|
@ -243,10 +243,10 @@ private:
|
|||
template<typename Method>
|
||||
void enumerateDates(Method method);
|
||||
|
||||
const not_null<Window::SessionController *> _controller;
|
||||
const not_null<PeerData *> _peer;
|
||||
const not_null<HistoryItem *> _item;
|
||||
const not_null<History *> _history;
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
const not_null<PeerData*> _peer;
|
||||
const not_null<HistoryItem*> _item;
|
||||
const not_null<History*> _history;
|
||||
MTP::Sender _api;
|
||||
|
||||
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
||||
|
@ -254,11 +254,11 @@ private:
|
|||
|
||||
std::vector<OwnedItem> _items;
|
||||
std::set<uint64> _eventIds;
|
||||
std::map<not_null<const HistoryItem *>, not_null<Element *>> _itemsByData;
|
||||
base::flat_map<not_null<const HistoryItem *>, TimeId> _itemDates;
|
||||
std::map<not_null<const HistoryItem*>, not_null<Element*>> _itemsByData;
|
||||
base::flat_map<not_null<const HistoryItem*>, TimeId> _itemDates;
|
||||
base::flat_set<FullMsgId> _animatedStickersPlayed;
|
||||
base::flat_map<not_null<PeerData *>, Ui::PeerUserpicView> _userpics;
|
||||
base::flat_map<not_null<PeerData *>, Ui::PeerUserpicView> _userpicsCache;
|
||||
base::flat_map<not_null<PeerData*>, Ui::PeerUserpicView> _userpics;
|
||||
base::flat_map<not_null<PeerData*>, Ui::PeerUserpicView> _userpicsCache;
|
||||
int _itemsTop = 0;
|
||||
int _itemsWidth = 0;
|
||||
int _itemsHeight = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
// Copyright @Radolyn, 2023
|
||||
#include "ayu/ui/sections/edited/edited_log_item.h"
|
||||
#include <ayu/database/entities.h>
|
||||
#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<ChannelData *> channel,
|
||||
not_null<ChannelData*> channel,
|
||||
const TextWithEntities &user,
|
||||
ChatAdminRightsInfo newRights,
|
||||
ChatAdminRightsInfo prevRights) {
|
||||
|
@ -363,7 +363,7 @@ TextWithEntities GenerateInviteLinkChangeText(
|
|||
};
|
||||
|
||||
auto GenerateParticipantString(
|
||||
not_null<Main::Session *> session,
|
||||
not_null<Main::Session*> 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<ChannelData *> channel,
|
||||
not_null<ChannelData*> channel,
|
||||
const Api::ChatParticipant &participant,
|
||||
std::optional<Api::ChatParticipant> oldParticipant = std::nullopt) {
|
||||
using Type = Api::ChatParticipant::Type;
|
||||
|
@ -501,7 +501,7 @@ auto GenerateParticipantChangeText(
|
|||
}
|
||||
|
||||
TextWithEntities GenerateParticipantChangeText(
|
||||
not_null<ChannelData *> channel,
|
||||
not_null<ChannelData*> channel,
|
||||
const MTPChannelParticipant &participant,
|
||||
std::optional<MTPChannelParticipant> oldParticipant = std::nullopt) {
|
||||
return GenerateParticipantChangeText(
|
||||
|
@ -515,7 +515,7 @@ TextWithEntities GenerateParticipantChangeText(
|
|||
}
|
||||
|
||||
TextWithEntities GenerateDefaultBannedRightsChangeText(
|
||||
not_null<ChannelData *> channel,
|
||||
not_null<ChannelData*> channel,
|
||||
ChatRestrictionsInfo rights,
|
||||
ChatRestrictionsInfo oldRights) {
|
||||
auto result = TextWithEntities{
|
||||
|
@ -553,7 +553,7 @@ TextWithEntities GenerateDefaultBannedRightsChangeText(
|
|||
}
|
||||
|
||||
[[nodiscard]] TextWithEntities GenerateTopicLink(
|
||||
not_null<ChannelData *> channel,
|
||||
not_null<ChannelData*> channel,
|
||||
const MTPForumTopic &topic) {
|
||||
return topic.match([&](const MTPDforumTopic &data)
|
||||
{
|
||||
|
@ -578,8 +578,8 @@ OwnedItem::OwnedItem(std::nullptr_t) {
|
|||
}
|
||||
|
||||
OwnedItem::OwnedItem(
|
||||
not_null<HistoryView::ElementDelegate *> delegate,
|
||||
not_null<HistoryItem *> data)
|
||||
not_null<HistoryView::ElementDelegate*> delegate,
|
||||
not_null<HistoryItem*> data)
|
||||
: _data(data), _view(_data->createView(delegate)) {
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ OwnedItem::~OwnedItem() {
|
|||
}
|
||||
|
||||
void OwnedItem::refreshView(
|
||||
not_null<HistoryView::ElementDelegate *> delegate) {
|
||||
not_null<HistoryView::ElementDelegate*> delegate) {
|
||||
_view = _data->createView(delegate);
|
||||
}
|
||||
|
||||
|
@ -610,8 +610,8 @@ void OwnedItem::clearView() {
|
|||
}
|
||||
|
||||
void GenerateItems(
|
||||
not_null<HistoryView::ElementDelegate *> delegate,
|
||||
not_null<History *> history,
|
||||
not_null<HistoryView::ElementDelegate*> delegate,
|
||||
not_null<History*> history,
|
||||
EditedMessage message,
|
||||
Fn<void(OwnedItem item, TimeId sentDate, MsgId)> callback) {
|
||||
const auto session = &history->session();
|
||||
|
@ -621,14 +621,14 @@ void GenerateItems(
|
|||
from = history->owner().channelLoaded(message.fromId);
|
||||
}
|
||||
if (!from) {
|
||||
from = reinterpret_cast<PeerData *>(history->owner().chatLoaded(message.fromId));
|
||||
from = reinterpret_cast<PeerData*>(history->owner().chatLoaded(message.fromId));
|
||||
}
|
||||
if (!from) {
|
||||
return;
|
||||
}
|
||||
const auto date = message.entityCreateDate;
|
||||
const auto addPart = [&](
|
||||
not_null<HistoryItem *> item,
|
||||
not_null<HistoryItem*> item,
|
||||
TimeId sentDate = 0,
|
||||
MsgId realId = MsgId())
|
||||
{
|
||||
|
|
|
@ -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<HistoryView::ElementDelegate *> delegate,
|
||||
not_null<History *> history,
|
||||
not_null<HistoryView::ElementDelegate*> delegate,
|
||||
not_null<History*> history,
|
||||
EditedMessage message,
|
||||
Fn<void(OwnedItem item, TimeId sentDate, MsgId)> callback);
|
||||
|
||||
|
@ -31,8 +31,8 @@ class OwnedItem
|
|||
public:
|
||||
OwnedItem(std::nullptr_t = nullptr);
|
||||
OwnedItem(
|
||||
not_null<HistoryView::ElementDelegate *> delegate,
|
||||
not_null<HistoryItem *> data);
|
||||
not_null<HistoryView::ElementDelegate*> delegate,
|
||||
not_null<HistoryItem*> 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<HistoryView::ElementDelegate *> delegate);
|
||||
void refreshView(not_null<HistoryView::ElementDelegate*> delegate);
|
||||
void clearView();
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,8 +32,8 @@ class FixedBar final : public TWidget
|
|||
public:
|
||||
FixedBar(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer);
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> 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<Window::SessionController *> _controller;
|
||||
not_null<PeerData *> _peer;
|
||||
not_null<Window::SessionController*> _controller;
|
||||
not_null<PeerData*> _peer;
|
||||
object_ptr<Profile::BackButton> _backButton;
|
||||
object_ptr<Ui::CrossButton> _cancel;
|
||||
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
|
||||
object_ptr<Window::SectionWidget> SectionMemento::createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<Window::SessionController*> controller,
|
||||
Window::Column column,
|
||||
const QRect &geometry) {
|
||||
if (column == Window::Column::Third) {
|
||||
|
@ -70,8 +70,8 @@ object_ptr<Window::SectionWidget> SectionMemento::createWidget(
|
|||
|
||||
FixedBar::FixedBar(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer)
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> 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<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer,
|
||||
not_null<HistoryItem *> item)
|
||||
: Window::SectionWidget(parent, controller, rpl::single<PeerData *>(peer)),
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<HistoryItem*> item)
|
||||
: Window::SectionWidget(parent, controller, rpl::single<PeerData*>(peer)),
|
||||
_scroll(this, st::historyScroll, false),
|
||||
_fixedBar(this, controller, peer),
|
||||
_fixedBarShadow(this),
|
||||
|
@ -189,7 +189,7 @@ void Widget::updateAdaptiveLayout() {
|
|||
_fixedBar->height());
|
||||
}
|
||||
|
||||
not_null<PeerData *> Widget::channel() const {
|
||||
not_null<PeerData*> Widget::channel() const {
|
||||
return _inner->channel();
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,9 @@ void Widget::doSetInnerFocus() {
|
|||
}
|
||||
|
||||
bool Widget::showInternal(
|
||||
not_null<Window::SectionMemento *> memento,
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (auto logMemento = dynamic_cast<SectionMemento *>(memento.get())) {
|
||||
if (auto logMemento = dynamic_cast<SectionMemento*>(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<SectionMemento *> memento) {
|
||||
void Widget::setInternalState(const QRect &geometry, not_null<SectionMemento*> memento) {
|
||||
setGeometry(geometry);
|
||||
Ui::SendPendingMoveResizeEvents(this);
|
||||
restoreState(memento);
|
||||
|
@ -239,12 +239,12 @@ std::shared_ptr<Window::SectionMemento> Widget::createMemento() {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Widget::saveState(not_null<SectionMemento *> memento) {
|
||||
void Widget::saveState(not_null<SectionMemento*> memento) {
|
||||
memento->setScrollTop(_scroll->scrollTop());
|
||||
_inner->saveState(memento);
|
||||
}
|
||||
|
||||
void Widget::restoreState(not_null<SectionMemento *> memento) {
|
||||
void Widget::restoreState(not_null<SectionMemento*> memento) {
|
||||
_inner->restoreState(memento);
|
||||
auto scrollTop = memento->getScrollTop();
|
||||
_scroll->scrollToY(scrollTop);
|
||||
|
|
|
@ -33,11 +33,11 @@ class Widget final : public Window::SectionWidget
|
|||
public:
|
||||
Widget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<PeerData *> peer,
|
||||
not_null<HistoryItem *> item);
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<HistoryItem*> item);
|
||||
|
||||
not_null<PeerData *> channel() const;
|
||||
not_null<PeerData*> 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<Window::SectionMemento *> memento,
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::shared_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
void setInternalState(const QRect &geometry, not_null<SectionMemento *> memento);
|
||||
void setInternalState(const QRect &geometry, not_null<SectionMemento*> memento);
|
||||
|
||||
// Float player interface.
|
||||
bool floatPlayerHandleWheelEvent(QEvent *e) override;
|
||||
|
@ -69,15 +69,15 @@ protected:
|
|||
private:
|
||||
void onScroll();
|
||||
void updateAdaptiveLayout();
|
||||
void saveState(not_null<SectionMemento *> memento);
|
||||
void restoreState(not_null<SectionMemento *> memento);
|
||||
void saveState(not_null<SectionMemento*> memento);
|
||||
void restoreState(not_null<SectionMemento*> memento);
|
||||
void setupShortcuts();
|
||||
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
QPointer<InnerWidget> _inner;
|
||||
object_ptr<FixedBar> _fixedBar;
|
||||
object_ptr<Ui::PlainShadow> _fixedBarShadow;
|
||||
not_null<HistoryItem *> _item;
|
||||
not_null<HistoryItem*> _item;
|
||||
|
||||
};
|
||||
|
||||
|
@ -86,18 +86,18 @@ class SectionMemento : public Window::SectionMemento
|
|||
public:
|
||||
using Element = HistoryView::Element;
|
||||
|
||||
SectionMemento(not_null<PeerData *> peer, not_null<HistoryItem *> item)
|
||||
SectionMemento(not_null<PeerData*> peer, not_null<HistoryItem*> item)
|
||||
: _peer(peer),
|
||||
_item(item) {
|
||||
}
|
||||
|
||||
object_ptr<Window::SectionWidget> createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller,
|
||||
not_null<Window::SessionController*> controller,
|
||||
Window::Column column,
|
||||
const QRect &geometry) override;
|
||||
|
||||
not_null<PeerData *> getPeer() const {
|
||||
not_null<PeerData*> getPeer() const {
|
||||
return _peer;
|
||||
}
|
||||
|
||||
|
@ -137,11 +137,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
not_null<PeerData *> _peer;
|
||||
not_null<HistoryItem *> _item;
|
||||
not_null<PeerData*> _peer;
|
||||
not_null<HistoryItem*> _item;
|
||||
int _scrollTop = 0;
|
||||
std::vector<not_null<UserData *>> _admins;
|
||||
std::vector<not_null<UserData *>> _adminsCanEdit;
|
||||
std::vector<not_null<UserData*>> _admins;
|
||||
std::vector<not_null<UserData*>> _adminsCanEdit;
|
||||
std::vector<OwnedItem> _items;
|
||||
std::set<uint64> _eventIds;
|
||||
bool _upLoaded = false;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
|
||||
class PainterHighQualityEnabler;
|
||||
|
||||
not_null<Ui::RpWidget *> AddInnerToggle(not_null<Ui::VerticalLayout *> container,
|
||||
const style::SettingsButton &st,
|
||||
std::vector<not_null<Ui::AbstractCheckView *>> innerCheckViews,
|
||||
not_null<Ui::SlideWrap<> *> wrap,
|
||||
rpl::producer<QString> buttonLabel,
|
||||
bool toggledWhenAll) {
|
||||
not_null<Ui::RpWidget*> AddInnerToggle(not_null<Ui::VerticalLayout*> container,
|
||||
const style::SettingsButton &st,
|
||||
std::vector<not_null<Ui::AbstractCheckView*>> innerCheckViews,
|
||||
not_null<Ui::SlideWrap<>*> wrap,
|
||||
rpl::producer<QString> buttonLabel,
|
||||
bool toggledWhenAll) {
|
||||
const auto button = container->add(object_ptr<Ui::SettingsButton>(
|
||||
container,
|
||||
nullptr,
|
||||
|
@ -66,7 +66,7 @@ not_null<Ui::RpWidget *> AddInnerToggle(not_null<Ui::VerticalLayout *> container
|
|||
Ui::ToggleView checkView;
|
||||
Ui::Animations::Simple animation;
|
||||
rpl::event_stream<> anyChanges;
|
||||
std::vector<not_null<Ui::AbstractCheckView *>> innerChecks;
|
||||
std::vector<not_null<Ui::AbstractCheckView*>> innerChecks;
|
||||
};
|
||||
const auto state = button->lifetime().make_state<State>(
|
||||
st.toggle,
|
||||
|
@ -257,16 +257,16 @@ struct NestedEntry
|
|||
std::function<void(bool)> callback;
|
||||
};
|
||||
|
||||
void AddCollapsibleToggle(not_null<Ui::VerticalLayout *> container,
|
||||
void AddCollapsibleToggle(not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> title,
|
||||
std::vector<NestedEntry> checkboxes,
|
||||
bool toggledWhenAll) {
|
||||
const auto addCheckbox = [&](
|
||||
not_null<Ui::VerticalLayout *> verticalLayout,
|
||||
not_null<Ui::VerticalLayout*> verticalLayout,
|
||||
const QString &label,
|
||||
const bool isCheckedOrig)
|
||||
{
|
||||
const auto checkView = [&]() -> not_null<Ui::AbstractCheckView *>
|
||||
const auto checkView = [&]() -> not_null<Ui::AbstractCheckView*>
|
||||
{
|
||||
const auto checkbox = verticalLayout->add(
|
||||
object_ptr<Ui::Checkbox>(
|
||||
|
@ -311,7 +311,7 @@ void AddCollapsibleToggle(not_null<Ui::VerticalLayout *> container,
|
|||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container));
|
||||
const auto verticalLayout = wrap->entity();
|
||||
auto innerChecks = std::vector<not_null<Ui::AbstractCheckView *>>();
|
||||
auto innerChecks = std::vector<not_null<Ui::AbstractCheckView*>>();
|
||||
for (const auto &entry : checkboxes) {
|
||||
const auto c = addCheckbox(verticalLayout, entry.checkboxLabel, entry.initial);
|
||||
c->checkedValue(
|
||||
|
@ -341,8 +341,8 @@ void AddCollapsibleToggle(not_null<Ui::VerticalLayout *> container,
|
|||
raw->lifetime());
|
||||
}
|
||||
|
||||
void AddChooseButtonWithIconAndRightText(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller,
|
||||
void AddChooseButtonWithIconAndRightText(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller,
|
||||
int initialState,
|
||||
std::vector<QString> options,
|
||||
rpl::producer<QString> text,
|
||||
|
@ -366,7 +366,7 @@ void AddChooseButtonWithIconAndRightText(not_null<Ui::VerticalLayout *> containe
|
|||
[=]
|
||||
{
|
||||
controller->show(Box(
|
||||
[=](not_null<Ui::GenericBox *> box)
|
||||
[=](not_null<Ui::GenericBox*> box)
|
||||
{
|
||||
const auto save = [=](int index) mutable
|
||||
{
|
||||
|
@ -393,12 +393,12 @@ rpl::producer<QString> Ayu::title() {
|
|||
|
||||
Ayu::Ayu(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController *> controller)
|
||||
not_null<Window::SessionController*> controller)
|
||||
: Section(parent) {
|
||||
setupContent(controller);
|
||||
}
|
||||
|
||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
|
||||
|
@ -444,7 +444,7 @@ void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container) {
|
|||
AddCollapsibleToggle(container, tr::ayu_GhostEssentialsHeader(), checkboxes, true);
|
||||
}
|
||||
|
||||
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
std::vector checkboxes{
|
||||
|
@ -474,7 +474,7 @@ void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container) {
|
|||
AddCollapsibleToggle(container, tr::ayu_MarkReadAfterAction(), checkboxes, false);
|
||||
}
|
||||
|
||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
SetupGhostModeToggle(container);
|
||||
|
@ -504,7 +504,7 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout *> container) {
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupSpyEssentials(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupSpyEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSubsectionTitle(container, tr::ayu_SpyEssentialsHeader());
|
||||
|
@ -552,7 +552,7 @@ void SetupSpyEssentials(not_null<Ui::VerticalLayout *> container) {
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupQoLToggles(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSubsectionTitle(container, tr::ayu_QoLTogglesHeader());
|
||||
|
@ -718,14 +718,14 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout *> container) {
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupAppIcon(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupAppIcon(not_null<Ui::VerticalLayout*> container) {
|
||||
container->add(
|
||||
object_ptr<IconPicker>(container),
|
||||
st::settingsCheckboxPadding);
|
||||
}
|
||||
|
||||
void SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller) {
|
||||
void SetupContextMenuElements(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSkip(container);
|
||||
|
@ -808,7 +808,7 @@ void SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
|||
AddDividerText(container, tr::ayu_SettingsContextMenuDescription());
|
||||
}
|
||||
|
||||
void SetupDrawerElements(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupDrawerElements(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSkip(container);
|
||||
|
@ -897,7 +897,7 @@ void SetupDrawerElements(not_null<Ui::VerticalLayout *> container) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetupTrayElements(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupTrayElements(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSkip(container);
|
||||
|
@ -944,8 +944,8 @@ void SetupTrayElements(not_null<Ui::VerticalLayout *> container) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller) {
|
||||
void SetupShowPeerId(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
const auto options = std::vector{
|
||||
|
@ -969,7 +969,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
|||
[=]
|
||||
{
|
||||
controller->show(Box(
|
||||
[=](not_null<Ui::GenericBox *> box)
|
||||
[=](not_null<Ui::GenericBox*> box)
|
||||
{
|
||||
const auto save = [=](int index)
|
||||
{
|
||||
|
@ -987,7 +987,7 @@ void SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
|||
});
|
||||
}
|
||||
|
||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
container->add(
|
||||
|
@ -1033,7 +1033,7 @@ void SetupRecentStickersLimitSlider(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();
|
||||
|
||||
const auto commonButton = AddButtonWithLabel(
|
||||
|
@ -1081,7 +1081,7 @@ void SetupFonts(not_null<Ui::VerticalLayout *> container, not_null<Window::Sessi
|
|||
});
|
||||
}
|
||||
|
||||
void SetupSendConfirmations(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
|
||||
|
@ -1144,7 +1144,7 @@ void SetupSendConfirmations(not_null<Ui::VerticalLayout *> container) {
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupMarks(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupMarks(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddButtonWithLabel(
|
||||
|
@ -1172,7 +1172,7 @@ void SetupMarks(not_null<Ui::VerticalLayout *> container) {
|
|||
});
|
||||
}
|
||||
|
||||
void SetupFolderSettings(not_null<Ui::VerticalLayout *> container) {
|
||||
void SetupFolderSettings(not_null<Ui::VerticalLayout*> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddButtonWithIcon(
|
||||
|
@ -1214,7 +1214,7 @@ void SetupFolderSettings(not_null<Ui::VerticalLayout *> container) {
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupNerdSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
||||
void SetupNerdSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> controller) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
SetupShowPeerId(container, controller);
|
||||
|
@ -1258,8 +1258,8 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout *> container, not_null<Window
|
|||
container->lifetime());
|
||||
}
|
||||
|
||||
void SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller) {
|
||||
void SetupCustomization(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
AddSubsectionTitle(container, tr::ayu_CustomizationHeader());
|
||||
|
||||
SetupAppIcon(container);
|
||||
|
@ -1299,8 +1299,8 @@ void SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
|||
SetupFonts(container, controller);
|
||||
}
|
||||
|
||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller) {
|
||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
AddSkip(container);
|
||||
SetupGhostEssentials(container);
|
||||
AddSkip(container);
|
||||
|
@ -1332,7 +1332,7 @@ void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container,
|
|||
AddDividerText(container, tr::ayu_SettingsWatermark());
|
||||
}
|
||||
|
||||
void Ayu::setupContent(not_null<Window::SessionController *> controller) {
|
||||
void Ayu::setupContent(not_null<Window::SessionController*> controller) {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
SetupAyuGramSettings(content, controller);
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace Settings {
|
|||
class Ayu : public Section<Ayu>
|
||||
{
|
||||
public:
|
||||
Ayu(QWidget *parent, not_null<Window::SessionController *> controller);
|
||||
Ayu(QWidget *parent, not_null<Window::SessionController*> controller);
|
||||
|
||||
[[nodiscard]] rpl::producer<QString> title() override;
|
||||
|
||||
private:
|
||||
void setupContent(not_null<Window::SessionController *> controller);
|
||||
void setupContent(not_null<Window::SessionController*> controller);
|
||||
};
|
||||
|
||||
} // namespace Settings
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
constexpr auto kMaxChannelId = -1000000000000;
|
||||
|
||||
QString IDString(not_null<PeerData *> peer) {
|
||||
QString IDString(not_null<PeerData*> 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<TextWithEntities> IDValue(not_null<PeerData *> peer) {
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData*> peer) {
|
||||
return rpl::single(IDString(peer)) | Ui::Text::ToWithEntities();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
// Copyright @Radolyn, 2023
|
||||
#pragma once
|
||||
|
||||
QString IDString(not_null<PeerData *> peer);
|
||||
QString IDString(not_null<PeerData*> peer);
|
||||
QString IDString(MsgId topic_root_id);
|
||||
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData *> peer);
|
||||
rpl::producer<TextWithEntities> IDValue(not_null<PeerData*> peer);
|
||||
rpl::producer<TextWithEntities> IDValue(MsgId topicRootId);
|
||||
|
|
|
@ -12,11 +12,22 @@
|
|||
|
||||
namespace AyuMapper {
|
||||
|
||||
int mapItemFlagsToMTPFlags(not_null<HistoryItem *> item) {
|
||||
std::pair<std::string, std::vector<char>> serializeTextWithEntities(not_null<HistoryItem*> item) {
|
||||
if (item->emptyText()) {
|
||||
return std::make_pair("", std::vector<char>());
|
||||
}
|
||||
|
||||
auto textWithEntities = item->originalText();
|
||||
std::vector<char> entities; // todo: implement writing to buffer
|
||||
|
||||
return std::make_pair(textWithEntities.text.toStdString(), entities);
|
||||
}
|
||||
|
||||
int mapItemFlagsToMTPFlags(not_null<HistoryItem*> 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) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace AyuMapper {
|
||||
|
||||
int mapItemFlagsToMTPFlags(not_null<HistoryItem *> item);
|
||||
std::pair<std::string, std::vector<char>> serializeTextWithEntities(not_null<HistoryItem*> item);
|
||||
int mapItemFlagsToMTPFlags(not_null<HistoryItem*> item);
|
||||
|
||||
} // namespace AyuMapper
|
||||
|
|
|
@ -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<void()> callback, int delay) {
|
|||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, delay));
|
||||
}
|
||||
|
||||
not_null<History *> getHistoryFromDialogId(ID dialogId, Main::Session *session) {
|
||||
not_null<History*> getHistoryFromDialogId(ID dialogId, Main::Session *session) {
|
||||
if (dialogId > 0) {
|
||||
return session->data().history(peerFromUser(dialogId));
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ not_null<History *> getHistoryFromDialogId(ID dialogId, Main::Session *session)
|
|||
return session->data().history(peerFromChat(abs(dialogId)));
|
||||
}
|
||||
|
||||
ID getDialogIdFromPeer(not_null<PeerData *> peer) {
|
||||
ID getDialogIdFromPeer(not_null<PeerData*> peer) {
|
||||
auto peerId = peerIsUser(peer->id)
|
||||
? peerToUser(peer->id).bare
|
||||
: peerIsChat(peer->id)
|
||||
|
@ -139,30 +139,7 @@ ID getDialogIdFromPeer(not_null<PeerData *> peer) {
|
|||
return peerId;
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> serializeTextWithEntities(not_null<HistoryItem *> 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<char *>(buff.data()), buff.size()));
|
||||
}
|
||||
|
||||
ID getBareID(not_null<PeerData *> peer) {
|
||||
ID getBareID(not_null<PeerData*> 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<Dialogs::MainList *> list) {
|
||||
auto mark = std::vector<not_null<History *>>();
|
||||
void MarkAsReadChatList(not_null<Dialogs::MainList*> list) {
|
||||
auto mark = std::vector<not_null<History*>>();
|
||||
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<Data::Thread> weakThread) {
|
|||
}).send();
|
||||
}
|
||||
|
||||
void MarkAsReadThread(not_null<Data::Thread *> thread) {
|
||||
const auto readHistory = [&](not_null<History *> history)
|
||||
void MarkAsReadThread(not_null<Data::Thread*> thread) {
|
||||
const auto readHistory = [&](not_null<History*> history)
|
||||
{
|
||||
history->owner().histories().readInbox(history);
|
||||
};
|
||||
const auto sendReadMentions = [=](
|
||||
not_null<Data::Thread *> thread)
|
||||
not_null<Data::Thread*> thread)
|
||||
{
|
||||
readMentions(base::make_weak(thread));
|
||||
};
|
||||
const auto sendReadReactions = [=](
|
||||
not_null<Data::Thread *> thread)
|
||||
not_null<Data::Thread*> thread)
|
||||
{
|
||||
readReactions(base::make_weak(thread));
|
||||
};
|
||||
|
@ -261,7 +238,7 @@ void MarkAsReadThread(not_null<Data::Thread *> thread) {
|
|||
if (thread->chatListBadgesState().unread) {
|
||||
if (const auto forum = thread->asForum()) {
|
||||
forum->enumerateTopics([](
|
||||
not_null<Data::ForumTopic *> topic)
|
||||
not_null<Data::ForumTopic*> topic)
|
||||
{
|
||||
MarkAsReadThread(topic);
|
||||
});
|
||||
|
@ -286,7 +263,7 @@ void MarkAsReadThread(not_null<Data::Thread *> thread) {
|
|||
AyuWorker::markAsOnline(&thread->session());
|
||||
}
|
||||
|
||||
void readHistory(not_null<HistoryItem *> message) {
|
||||
void readHistory(not_null<HistoryItem*> 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<HistoryItem *> message) {
|
||||
QString getMediaSize(not_null<HistoryItem*> message) {
|
||||
if (!message->media()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -410,7 +387,7 @@ QString getMediaSize(not_null<HistoryItem *> message) {
|
|||
return Ui::FormatSizeText(size);
|
||||
}
|
||||
|
||||
QString getMediaMime(not_null<HistoryItem *> message) {
|
||||
QString getMediaMime(not_null<HistoryItem*> message) {
|
||||
if (!message->media()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -434,7 +411,7 @@ QString getMediaMime(not_null<HistoryItem *> message) {
|
|||
return {};
|
||||
}
|
||||
|
||||
QString getMediaName(not_null<HistoryItem *> message) {
|
||||
QString getMediaName(not_null<HistoryItem*> message) {
|
||||
if (!message->media()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -450,7 +427,7 @@ QString getMediaName(not_null<HistoryItem *> message) {
|
|||
return {};
|
||||
}
|
||||
|
||||
QString getMediaResolution(not_null<HistoryItem *> message) {
|
||||
QString getMediaResolution(not_null<HistoryItem*> message) {
|
||||
if (!message->media()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -485,7 +462,7 @@ QString getMediaResolution(not_null<HistoryItem *> message) {
|
|||
return {};
|
||||
}
|
||||
|
||||
QString getMediaDC(not_null<HistoryItem *> message) {
|
||||
QString getMediaDC(not_null<HistoryItem*> message) {
|
||||
if (!message->media()) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -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<void(const QString &, UserData *)>;
|
|||
Main::Session *getSession(ID userId);
|
||||
bool accountExists(ID userId);
|
||||
void dispatchToMainThread(std::function<void()> callback, int delay = 0);
|
||||
not_null<History *> getHistoryFromDialogId(ID dialogId, Main::Session *session);
|
||||
ID getDialogIdFromPeer(not_null<PeerData *> peer);
|
||||
std::pair<std::string, std::string> serializeTextWithEntities(not_null<HistoryItem *> item);
|
||||
not_null<History*> getHistoryFromDialogId(ID dialogId, Main::Session *session);
|
||||
ID getDialogIdFromPeer(not_null<PeerData*> peer);
|
||||
|
||||
ID getBareID(not_null<PeerData *> peer);
|
||||
ID getBareID(not_null<PeerData*> peer);
|
||||
|
||||
bool isAyuGramRelated(ID peerId);
|
||||
bool isExteraRelated(ID peerId);
|
||||
|
||||
void MarkAsReadChatList(not_null<Dialogs::MainList *> list);
|
||||
void MarkAsReadThread(not_null<Data::Thread *> thread);
|
||||
void MarkAsReadChatList(not_null<Dialogs::MainList*> list);
|
||||
void MarkAsReadThread(not_null<Data::Thread*> thread);
|
||||
|
||||
void readHistory(not_null<HistoryItem *> message);
|
||||
void readHistory(not_null<HistoryItem*> message);
|
||||
|
||||
QString formatTTL(int time);
|
||||
QString formatDateTime(const QDateTime &date);
|
||||
|
||||
QString getDCName(int dc);
|
||||
|
||||
QString getMediaSize(not_null<HistoryItem *> message);
|
||||
QString getMediaMime(not_null<HistoryItem *> message);
|
||||
QString getMediaName(not_null<HistoryItem *> message);
|
||||
QString getMediaResolution(not_null<HistoryItem *> message);
|
||||
QString getMediaDC(not_null<HistoryItem *> message);
|
||||
QString getMediaSize(not_null<HistoryItem*> message);
|
||||
QString getMediaMime(not_null<HistoryItem*> message);
|
||||
QString getMediaName(not_null<HistoryItem*> message);
|
||||
QString getMediaResolution(not_null<HistoryItem*> message);
|
||||
QString getMediaDC(not_null<HistoryItem*> message);
|
||||
|
||||
void searchById(ID userId, Main::Session *session, bool retry, const Callback &callback);
|
||||
void searchById(ID userId, Main::Session *session, const Callback &callback);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QBuffer>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ui/ayu_assets.h"
|
||||
#include "ayu/ui/ayu_logo.h"
|
||||
#include "ui/painter.h"
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <kurlmimedata.h>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ui/ayu_assets.h"
|
||||
#include "ayu/ui/ayu_logo.h"
|
||||
|
||||
|
||||
namespace Window {
|
||||
|
|
Loading…
Add table
Reference in a new issue