From 460eaa878fc5370024be83b946dd9ceaca54a759 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 24 Oct 2020 02:05:49 +0300 Subject: [PATCH 1/2] Don't pass primitive data as a const reference It just doesn't make any sense. Reference (essentially a pointer) can't be smaller than a primitive type, except for 64-bit numbers on a 32-bit platform. In terms of performance, an additional indirection can't be better than picking the value directly from the stack, let alone a register. --- src/tdlibreceiver.cpp | 2 +- src/tdlibreceiver.h | 12 ++++++------ src/tdlibwrapper.cpp | 32 +++++++++++++++---------------- src/tdlibwrapper.h | 44 +++++++++++++++++++++---------------------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index cb80fe1..80580f0 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -118,7 +118,7 @@ TDLibReceiver::TDLibReceiver(void *tdLibClient, QObject *parent) : QThread(paren handlers.insert("updateChatTitle", &TDLibReceiver::processUpdateChatTitle); } -void TDLibReceiver::setActive(const bool &active) +void TDLibReceiver::setActive(bool active) { if (active) { LOG("Activating receiver loop..."); diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index a8eb27a..9d75584 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -33,7 +33,7 @@ class TDLibReceiver : public QThread } public: explicit TDLibReceiver(void *tdLibClient, QObject *parent = nullptr); - void setActive(const bool &active); + void setActive(bool active); signals: void versionDetected(const QString &version); @@ -48,12 +48,12 @@ signals: void unreadChatCountUpdated(const QVariantMap &chatCountInformation); void chatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); void chatOrderUpdated(const QString &chatId, const QString &order); - void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, const int &unreadCount); + void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void basicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void superGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); - void chatOnlineMemberCountUpdated(const QString &chatId, const int &onlineMemberCount); - void messagesReceived(const QVariantList &messages, const int &totalCount); + void chatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); + void messagesReceived(const QVariantList &messages, int totalCount); void newMessageReceived(const QString &chatId, const QVariantMap &message); void messageInformation(const QString &messageId, const QVariantMap &message); void messageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); @@ -70,14 +70,14 @@ signals: void installedStickerSetsUpdated(const QVariantList &stickerSetIds); void stickerSets(const QVariantList &stickerSets); void stickerSet(const QVariantMap &stickerSet); - void chatMembers(const QString &extra, const QVariantList &members, const int &totalMembers); + void chatMembers(const QString &extra, const QVariantList &members, int totalMembers); void userFullInfo(const QVariantMap &userFullInfo); void userFullInfoUpdated(const QString &userId,const QVariantMap &userFullInfo); void basicGroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); void basicGroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); void supergroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); void supergroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); - void userProfilePhotos(const QString &extra, const QVariantList &photos, const int &totalPhotos); + void userProfilePhotos(const QString &extra, const QVariantList &photos, int totalPhotos); void chatPermissionsUpdated(const QString &chatId, const QVariantMap &chatPermissions); void chatTitleUpdated(const QString &chatId, const QString &title); private: diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index c1d6ffc..5c90cdb 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -245,7 +245,7 @@ void TDLibWrapper::leaveChat(const QString &chatId) this->sendRequest(requestObject); } -void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMessageId, const int &offset, const int &limit, const bool &onlyLocal) +void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMessageId, int offset, int limit, bool onlyLocal) { LOG("Retrieving chat history" << chatId << fromMessageId << offset << limit << onlyLocal); QVariantMap requestObject; @@ -258,7 +258,7 @@ void TDLibWrapper::getChatHistory(const QString &chatId, const qlonglong &fromMe this->sendRequest(requestObject); } -void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId, const bool &force = false) +void TDLibWrapper::viewMessage(const QString &chatId, const QString &messageId, bool force) { LOG("Mark message as viewed" << chatId << messageId); QVariantMap requestObject; @@ -394,7 +394,7 @@ void TDLibWrapper::getMessage(const QString &chatId, const QString &messageId) this->sendRequest(requestObject); } -void TDLibWrapper::setOptionInteger(const QString &optionName, const int &optionValue) +void TDLibWrapper::setOptionInteger(const QString &optionName, int optionValue) { LOG("Setting integer option" << optionName << optionValue); QVariantMap requestObject; @@ -444,7 +444,7 @@ void TDLibWrapper::deleteMessages(const QString &chatId, const QVariantList mess this->sendRequest(requestObject); } -void TDLibWrapper::getMapThumbnailFile(const QString &chatId, const double &latitude, const double &longitude, const int &width, const int &height) +void TDLibWrapper::getMapThumbnailFile(const QString &chatId, double latitude, double longitude, int width, int height) { LOG("Getting Map Thumbnail File" << chatId); QVariantMap location; @@ -491,7 +491,7 @@ void TDLibWrapper::getStickerSet(const QString &setId) requestObject.insert("set_id", setId); this->sendRequest(requestObject); } -void TDLibWrapper::getSupergroupMembers(const QString &groupId, const int &limit = 200, const int &offset = 0) +void TDLibWrapper::getSupergroupMembers(const QString &groupId, int limit, int offset) { LOG("Retrieving SupergroupMembers"); QVariantMap requestObject; @@ -503,7 +503,7 @@ void TDLibWrapper::getSupergroupMembers(const QString &groupId, const int &limit this->sendRequest(requestObject); } -void TDLibWrapper::getGroupFullInfo(const QString &groupId, const bool &isSuperGroup) +void TDLibWrapper::getGroupFullInfo(const QString &groupId, bool isSuperGroup) { LOG("Retrieving GroupFullInfo"); QVariantMap requestObject; @@ -538,7 +538,7 @@ void TDLibWrapper::createPrivateChat(const QString &userId) this->sendRequest(requestObject); } -void TDLibWrapper::getGroupsInCommon(const QString &userId, const int &limit, const int &offset) +void TDLibWrapper::getGroupsInCommon(const QString &userId, int limit, int offset) { LOG("Retrieving Groups in Common"); QVariantMap requestObject; @@ -550,7 +550,7 @@ void TDLibWrapper::getGroupsInCommon(const QString &userId, const int &limit, co this->sendRequest(requestObject); } -void TDLibWrapper::getUserProfilePhotos(const QString &userId, const int &limit, const int &offset) +void TDLibWrapper::getUserProfilePhotos(const QString &userId, int limit, int offset) { LOG("Retrieving User Profile Photos"); QVariantMap requestObject; @@ -573,7 +573,7 @@ void TDLibWrapper::setChatPermissions(const QString &chatId, const QVariantMap & this->sendRequest(requestObject); } -void TDLibWrapper::setChatSlowModeDelay(const QString &chatId, const int &delay) +void TDLibWrapper::setChatSlowModeDelay(const QString &chatId, int delay) { LOG("Setting Chat Slow Mode Delay"); @@ -613,7 +613,7 @@ void TDLibWrapper::setBio(const QString &bio) this->sendRequest(requestObject); } -void TDLibWrapper::toggleSupergroupIsAllHistoryAvailable(const QString &groupId, const bool &isAllHistoryAvailable) +void TDLibWrapper::toggleSupergroupIsAllHistoryAvailable(const QString &groupId, bool isAllHistoryAvailable) { LOG("Toggling SupergroupIsAllHistoryAvailable"); QVariantMap requestObject; @@ -717,7 +717,7 @@ void TDLibWrapper::openFileOnDevice(const QString &filePath) } } -void TDLibWrapper::controlScreenSaver(const bool &enabled) +void TDLibWrapper::controlScreenSaver(bool enabled) { LOG("Controlling device screen saver" << enabled); QDBusConnection dbusConnection = QDBusConnection::connectToBus(QDBusConnection::SystemBus, "system"); @@ -888,7 +888,7 @@ void TDLibWrapper::handleChatOrderUpdated(const QString &chatId, const QString & emit chatOrderUpdated(chatId, order); } -void TDLibWrapper::handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, const int &unreadCount) +void TDLibWrapper::handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount) { emit chatReadInboxUpdated(chatId, lastReadInboxMessageId, unreadCount); } @@ -908,12 +908,12 @@ void TDLibWrapper::handleSuperGroupUpdated(qlonglong groupId, const QVariantMap emit superGroupUpdated(updateGroup(groupId, groupInformation, &superGroups)->groupId); } -void TDLibWrapper::handleChatOnlineMemberCountUpdated(const QString &chatId, const int &onlineMemberCount) +void TDLibWrapper::handleChatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount) { emit chatOnlineMemberCountUpdated(chatId, onlineMemberCount); } -void TDLibWrapper::handleMessagesReceived(const QVariantList &messages, const int &totalCount) +void TDLibWrapper::handleMessagesReceived(const QVariantList &messages, int totalCount) { emit messagesReceived(messages, totalCount); } @@ -1009,7 +1009,7 @@ void TDLibWrapper::handleEmojiSearchCompleted(const QString &queryString, const emit emojiSearchSuccessful(resultList); } -void TDLibWrapper::handleChatMembers(const QString &extra, const QVariantList &members, const int &totalMembers) +void TDLibWrapper::handleChatMembers(const QString &extra, const QVariantList &members, int totalMembers) { emit this->chatMembersReceived(extra, members, totalMembers); } @@ -1044,7 +1044,7 @@ void TDLibWrapper::handleSupergroupFullInfoUpdated(const QString &groupId, const emit this->supergroupFullInfoUpdated(groupId, groupFullInfo); } -void TDLibWrapper::handleUserProfilePhotos(const QString &extra, const QVariantList &photos, const int &totalPhotos) +void TDLibWrapper::handleUserProfilePhotos(const QString &extra, const QVariantList &photos, int totalPhotos) { emit this->userProfilePhotosReceived(extra, photos, totalPhotos); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index d440b04..2d967d5 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -99,7 +99,7 @@ public: Q_INVOKABLE QVariantMap getChat(const QString &chatId); Q_INVOKABLE void copyFileToDownloads(const QString &filePath); Q_INVOKABLE void openFileOnDevice(const QString &filePath); - Q_INVOKABLE void controlScreenSaver(const bool &enabled); + Q_INVOKABLE void controlScreenSaver(bool enabled); DBusAdaptor *getDBusAdaptor(); @@ -114,34 +114,34 @@ public: Q_INVOKABLE void openChat(const QString &chatId); Q_INVOKABLE void closeChat(const QString &chatId); Q_INVOKABLE void leaveChat(const QString &chatId); - Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, const int &offset = 0, const int &limit = 50, const bool &onlyLocal = false); - Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, const bool &force); + Q_INVOKABLE void getChatHistory(const QString &chatId, const qlonglong &fromMessageId = 0, int offset = 0, int limit = 50, bool onlyLocal = false); + Q_INVOKABLE void viewMessage(const QString &chatId, const QString &messageId, bool force); Q_INVOKABLE void sendTextMessage(const QString &chatId, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0"); Q_INVOKABLE void getMessage(const QString &chatId, const QString &messageId); - Q_INVOKABLE void setOptionInteger(const QString &optionName, const int &optionValue); + Q_INVOKABLE void setOptionInteger(const QString &optionName, int optionValue); Q_INVOKABLE void setChatNotificationSettings(const QString &chatId, const QVariantMap ¬ificationSettings); Q_INVOKABLE void editMessageText(const QString &chatId, const QString &messageId, const QString &message); Q_INVOKABLE void deleteMessages(const QString &chatId, const QVariantList messageIds); - Q_INVOKABLE void getMapThumbnailFile(const QString &chatId, const double &latitude, const double &longitude, const int &width, const int &height); + Q_INVOKABLE void getMapThumbnailFile(const QString &chatId, double latitude, double longitude, int width, int height); Q_INVOKABLE void getRecentStickers(); Q_INVOKABLE void getInstalledStickerSets(); Q_INVOKABLE void getStickerSet(const QString &setId); - Q_INVOKABLE void getSupergroupMembers(const QString &groupId, const int &limit, const int &offset); - Q_INVOKABLE void getGroupFullInfo(const QString &groupId, const bool &isSuperGroup); + Q_INVOKABLE void getSupergroupMembers(const QString &groupId, int limit, int offset); + Q_INVOKABLE void getGroupFullInfo(const QString &groupId, bool isSuperGroup); Q_INVOKABLE void getUserFullInfo(const QString &userId); Q_INVOKABLE void createPrivateChat(const QString &userId); - Q_INVOKABLE void getGroupsInCommon(const QString &userId, const int &limit, const int &offset); - Q_INVOKABLE void getUserProfilePhotos(const QString &userId, const int &limit, const int &offset); + Q_INVOKABLE void getGroupsInCommon(const QString &userId, int limit, int offset); + Q_INVOKABLE void getUserProfilePhotos(const QString &userId, int limit, int offset); Q_INVOKABLE void setChatPermissions(const QString &chatId, const QVariantMap &chatPermissions); - Q_INVOKABLE void setChatSlowModeDelay(const QString &chatId, const int &delay); + Q_INVOKABLE void setChatSlowModeDelay(const QString &chatId, int delay); Q_INVOKABLE void setChatDescription(const QString &chatId, const QString &description); Q_INVOKABLE void setChatTitle(const QString &chatId, const QString &title); Q_INVOKABLE void setBio(const QString &bio); - Q_INVOKABLE void toggleSupergroupIsAllHistoryAvailable(const QString &groupId, const bool &isAllHistoryAvailable); + Q_INVOKABLE void toggleSupergroupIsAllHistoryAvailable(const QString &groupId, bool isAllHistoryAvailable); // Others (candidates for extraction ;)) Q_INVOKABLE void searchEmoji(const QString &queryString); @@ -156,19 +156,19 @@ signals: void authorizationStateChanged(const TDLibWrapper::AuthorizationState &authorizationState, const QVariantMap &authorizationStateData); void optionUpdated(const QString &optionName, const QVariant &optionValue); void connectionStateChanged(const TDLibWrapper::ConnectionState &connectionState); - void fileUpdated(const int fileId, const QVariantMap &fileInformation); + void fileUpdated(int fileId, const QVariantMap &fileInformation); void newChatDiscovered(const QString &chatId, const QVariantMap &chatInformation); void unreadMessageCountUpdated(const QVariantMap &messageCountInformation); void unreadChatCountUpdated(const QVariantMap &chatCountInformation); void chatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); void chatOrderUpdated(const QString &chatId, const QString &order); - void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, const int &unreadCount); + void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void userUpdated(const QString &userId, const QVariantMap &userInformation); void basicGroupUpdated(qlonglong groupId); void superGroupUpdated(qlonglong groupId); - void chatOnlineMemberCountUpdated(const QString &chatId, const int &onlineMemberCount); - void messagesReceived(const QVariantList &messages, const int &totalCount); + void chatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); + void messagesReceived(const QVariantList &messages, int totalCount); void newMessageReceived(const QString &chatId, const QVariantMap &message); void copyToDownloadsSuccessful(const QString &fileName, const QString &filePath); void copyToDownloadsError(const QString &fileName, const QString &filePath); @@ -188,14 +188,14 @@ signals: void stickerSetsReceived(const QVariantList &stickerSets); void stickerSetReceived(const QVariantMap &stickerSet); void emojiSearchSuccessful(const QVariantList &result); - void chatMembersReceived(const QString &extra, const QVariantList &members, const int &totalMembers); + void chatMembersReceived(const QString &extra, const QVariantList &members, int totalMembers); void userFullInfoReceived(const QVariantMap &userFullInfo); void userFullInfoUpdated(const QString &userId, const QVariantMap &userFullInfo); void basicGroupFullInfoReceived(const QString &groupId, const QVariantMap &groupFullInfo); void supergroupFullInfoReceived(const QString &groupId, const QVariantMap &groupFullInfo); void basicGroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); void supergroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); - void userProfilePhotosReceived(const QString &extra, const QVariantList &photos, const int &totalPhotos); + void userProfilePhotosReceived(const QString &extra, const QVariantList &photos, int totalPhotos); void chatPermissionsUpdated(const QString &chatId, const QVariantMap &permissions); void chatTitleUpdated(const QString &chatId, const QString &title); @@ -212,12 +212,12 @@ public slots: void handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation); void handleChatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); void handleChatOrderUpdated(const QString &chatId, const QString &order); - void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, const int &unreadCount); + void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void handleSuperGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); - void handleChatOnlineMemberCountUpdated(const QString &chatId, const int &onlineMemberCount); - void handleMessagesReceived(const QVariantList &messages, const int &totalCount); + void handleChatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); + void handleMessagesReceived(const QVariantList &messages, int totalCount); void handleNewMessageReceived(const QString &chatId, const QVariantMap &message); void handleMessageInformation(const QString &messageId, const QVariantMap &message); void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); @@ -235,14 +235,14 @@ public slots: void handleStickerSets(const QVariantList &stickerSets); void handleStickerSet(const QVariantMap &stickerSet); void handleEmojiSearchCompleted(const QString &queryString, const QVariantList &resultList); - void handleChatMembers(const QString &extra, const QVariantList &members, const int &totalMembers); + void handleChatMembers(const QString &extra, const QVariantList &members, int totalMembers); void handleUserFullInfo(const QVariantMap &userFullInfo); void handleUserFullInfoUpdated(const QString &userId, const QVariantMap &userFullInfo); void handleBasicGroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); void handleBasicGroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); void handleSupergroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); void handleSupergroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); - void handleUserProfilePhotos(const QString &extra, const QVariantList &photos, const int &totalPhotos); + void handleUserProfilePhotos(const QString &extra, const QVariantList &photos, int totalPhotos); void handleChatPermissionsUpdated(const QString &chatId, const QVariantMap permissions); void handleChatTitleUpdated(const QString &chatId, const QString title); From 080244ecb1bdd2cbb7acc345ef24de9b90c7d766 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 24 Oct 2020 03:24:26 +0300 Subject: [PATCH 2/2] Removed useless slots from TDLibWrapper Signals can be connected directly to signals. --- src/tdlibwrapper.cpp | 219 ++++++------------------------------------- src/tdlibwrapper.h | 31 ------ 2 files changed, 31 insertions(+), 219 deletions(-) diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 5c90cdb..65c40d1 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -70,42 +70,40 @@ TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent) connect(this->tdLibReceiver, SIGNAL(newChatDiscovered(QVariantMap)), this, SLOT(handleNewChatDiscovered(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(unreadMessageCountUpdated(QVariantMap)), this, SLOT(handleUnreadMessageCountUpdated(QVariantMap))); connect(this->tdLibReceiver, SIGNAL(unreadChatCountUpdated(QVariantMap)), this, SLOT(handleUnreadChatCountUpdated(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chatLastMessageUpdated(QString, QString, QVariantMap)), this, SLOT(handleChatLastMessageUpdated(QString, QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chatOrderUpdated(QString, QString)), this, SLOT(handleChatOrderUpdated(QString, QString))); - connect(this->tdLibReceiver, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SLOT(handleChatReadInboxUpdated(QString, QString, int))); - connect(this->tdLibReceiver, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SLOT(handleChatReadOutboxUpdated(QString, QString))); + connect(this->tdLibReceiver, SIGNAL(chatLastMessageUpdated(QString, QString, QVariantMap)), this, SIGNAL(chatLastMessageUpdated(QString, QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(chatOrderUpdated(QString, QString)), this, SIGNAL(chatOrderUpdated(QString, QString))); + connect(this->tdLibReceiver, SIGNAL(chatReadInboxUpdated(QString, QString, int)), this, SIGNAL(chatReadInboxUpdated(QString, QString, int))); + connect(this->tdLibReceiver, SIGNAL(chatReadOutboxUpdated(QString, QString)), this, SIGNAL(chatReadOutboxUpdated(QString, QString))); connect(this->tdLibReceiver, SIGNAL(basicGroupUpdated(qlonglong, QVariantMap)), this, SLOT(handleBasicGroupUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(superGroupUpdated(qlonglong, QVariantMap)), this, SLOT(handleSuperGroupUpdated(qlonglong, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chatOnlineMemberCountUpdated(QString, int)), this, SLOT(handleChatOnlineMemberCountUpdated(QString, int))); - connect(this->tdLibReceiver, SIGNAL(messagesReceived(QVariantList, int)), this, SLOT(handleMessagesReceived(QVariantList, int))); - connect(this->tdLibReceiver, SIGNAL(newMessageReceived(QString, QVariantMap)), this, SLOT(handleNewMessageReceived(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(messageInformation(QString, QVariantMap)), this, SLOT(handleMessageInformation(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SLOT(handleMessageSendSucceeded(QString, QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(activeNotificationsUpdated(QVariantList)), this, SLOT(handleUpdateActiveNotifications(QVariantList))); - connect(this->tdLibReceiver, SIGNAL(notificationGroupUpdated(QVariantMap)), this, SLOT(handleUpdateNotificationGroup(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(notificationUpdated(QVariantMap)), this, SLOT(handleUpdateNotification(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SLOT(handleChatNotificationSettingsUpdated(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(messageContentUpdated(QString, QString, QVariantMap)), this, SLOT(handleMessageContentUpdated(QString, QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(messagesDeleted(QString, QVariantList)), this, SLOT(handleMessagesDeleted(QString, QVariantList))); - connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SLOT(handleChats(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chat(QVariantMap)), this, SLOT(handleChat(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(recentStickersUpdated(QVariantList)), this, SLOT(handleRecentStickersUpdated(QVariantList))); - connect(this->tdLibReceiver, SIGNAL(stickers(QVariantList)), this, SLOT(handleStickers(QVariantList))); - connect(this->tdLibReceiver, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SLOT(handleInstalledStickerSetsUpdated(QVariantList))); + connect(this->tdLibReceiver, SIGNAL(chatOnlineMemberCountUpdated(QString, int)), this, SIGNAL(chatOnlineMemberCountUpdated(QString, int))); + connect(this->tdLibReceiver, SIGNAL(messagesReceived(QVariantList, int)), this, SIGNAL(messagesReceived(QVariantList, int))); + connect(this->tdLibReceiver, SIGNAL(newMessageReceived(QString, QVariantMap)), this, SIGNAL(newMessageReceived(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(messageInformation(QString, QVariantMap)), this, SIGNAL(receivedMessage(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap)), this, SIGNAL(messageSendSucceeded(QString, QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(activeNotificationsUpdated(QVariantList)), this, SIGNAL(activeNotificationsUpdated(QVariantList))); + connect(this->tdLibReceiver, SIGNAL(notificationGroupUpdated(QVariantMap)), this, SIGNAL(notificationGroupUpdated(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(notificationUpdated(QVariantMap)), this, SIGNAL(notificationUpdated(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap)), this, SIGNAL(chatNotificationSettingsUpdated(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(messageContentUpdated(QString, QString, QVariantMap)), this, SIGNAL(messageContentUpdated(QString, QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(messagesDeleted(QString, QVariantList)), this, SIGNAL(messagesDeleted(QString, QVariantList))); + connect(this->tdLibReceiver, SIGNAL(chats(QVariantMap)), this, SIGNAL(chatsReceived(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(chat(QVariantMap)), this, SIGNAL(chatReceived(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(recentStickersUpdated(QVariantList)), this, SIGNAL(recentStickersUpdated(QVariantList))); + connect(this->tdLibReceiver, SIGNAL(stickers(QVariantList)), this, SIGNAL(stickersReceived(QVariantList))); + connect(this->tdLibReceiver, SIGNAL(installedStickerSetsUpdated(QVariantList)), this, SIGNAL(installedStickerSetsUpdated(QVariantList))); connect(this->tdLibReceiver, SIGNAL(stickerSets(QVariantList)), this, SLOT(handleStickerSets(QVariantList))); - connect(this->tdLibReceiver, SIGNAL(stickerSet(QVariantMap)), this, SLOT(handleStickerSet(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(chatMembers(QString, QVariantList, int)), this, SLOT(handleChatMembers(QString, QVariantList, int))); - connect(this->tdLibReceiver, SIGNAL(userFullInfo(QVariantMap)), this, SLOT(handleUserFullInfo(QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(userFullInfoUpdated(QString, QVariantMap)), this, SLOT(handleUserFullInfoUpdated(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(basicGroupFullInfo(QString, QVariantMap)), this, SLOT(handleBasicGroupFullInfo(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(basicGroupFullInfoUpdated(QString, QVariantMap)), this, SLOT(handleBasicGroupFullInfoUpdated(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(supergroupFullInfo(QString, QVariantMap)), this, SLOT(handleSupergroupFullInfo(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(supergroupFullInfoUpdated(QString, QVariantMap)), this, SLOT(handleSupergroupFullInfoUpdated(QString, QVariantMap))); - connect(this->tdLibReceiver, SIGNAL(userProfilePhotos(QString, QVariantList, int)), this, SLOT(handleUserProfilePhotos(QString, QVariantList, int))); - connect(this->tdLibReceiver, SIGNAL(userProfilePhotos(QString, QVariantList, int)), this, SLOT(handleUserProfilePhotos(QString, QVariantList, int))); - connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SLOT(handleChatPermissionsUpdated(QString, QVariantMap))); - - connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SLOT(handleChatTitleUpdated(QString, QString))); + connect(this->tdLibReceiver, SIGNAL(stickerSet(QVariantMap)), this, SIGNAL(stickerSetReceived(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(chatMembers(QString, QVariantList, int)), this, SIGNAL(chatMembersReceived(QString, QVariantList, int))); + connect(this->tdLibReceiver, SIGNAL(userFullInfo(QVariantMap)), this, SIGNAL(userFullInfoReceived(QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(userFullInfoUpdated(QString, QVariantMap)), this, SIGNAL(userFullInfoUpdated(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(basicGroupFullInfo(QString, QVariantMap)), this, SIGNAL(basicGroupFullInfoReceived(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(basicGroupFullInfoUpdated(QString, QVariantMap)), this, SIGNAL(basicGroupFullInfoUpdated(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(supergroupFullInfo(QString, QVariantMap)), this, SIGNAL(supergroupFullInfoReceived(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(supergroupFullInfoUpdated(QString, QVariantMap)), this, SIGNAL(supergroupFullInfoUpdated(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(userProfilePhotos(QString, QVariantList, int)), this, SIGNAL(userProfilePhotosReceived(QString, QVariantList, int))); + connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SIGNAL(chatPermissionsUpdated(QString, QVariantMap))); + connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SIGNAL(chatTitleUpdated(QString, QString))); connect(&emojiSearchWorker, SIGNAL(searchCompleted(QString, QVariantList)), this, SLOT(handleEmojiSearchCompleted(QString, QVariantList))); @@ -878,26 +876,6 @@ void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInfo } } -void TDLibWrapper::handleChatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage) -{ - emit chatLastMessageUpdated(chatId, order, lastMessage); -} - -void TDLibWrapper::handleChatOrderUpdated(const QString &chatId, const QString &order) -{ - emit chatOrderUpdated(chatId, order); -} - -void TDLibWrapper::handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount) -{ - emit chatReadInboxUpdated(chatId, lastReadInboxMessageId, unreadCount); -} - -void TDLibWrapper::handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId) -{ - emit chatReadOutboxUpdated(chatId, lastReadOutboxMessageId); -} - void TDLibWrapper::handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation) { emit basicGroupUpdated(updateGroup(groupId, groupInformation, &basicGroups)->groupId); @@ -908,86 +886,6 @@ void TDLibWrapper::handleSuperGroupUpdated(qlonglong groupId, const QVariantMap emit superGroupUpdated(updateGroup(groupId, groupInformation, &superGroups)->groupId); } -void TDLibWrapper::handleChatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount) -{ - emit chatOnlineMemberCountUpdated(chatId, onlineMemberCount); -} - -void TDLibWrapper::handleMessagesReceived(const QVariantList &messages, int totalCount) -{ - emit messagesReceived(messages, totalCount); -} - -void TDLibWrapper::handleNewMessageReceived(const QString &chatId, const QVariantMap &message) -{ - emit newMessageReceived(chatId, message); -} - -void TDLibWrapper::handleMessageInformation(const QString &messageId, const QVariantMap &message) -{ - emit receivedMessage(messageId, message); -} - -void TDLibWrapper::handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message) -{ - emit messageSendSucceeded(messageId, oldMessageId, message); -} - -void TDLibWrapper::handleUpdateActiveNotifications(const QVariantList notificationGroups) -{ - emit activeNotificationsUpdated(notificationGroups); -} - -void TDLibWrapper::handleUpdateNotificationGroup(const QVariantMap notificationGroupUpdate) -{ - emit notificationGroupUpdated(notificationGroupUpdate); -} - -void TDLibWrapper::handleUpdateNotification(const QVariantMap updatedNotification) -{ - emit notificationUpdated(updatedNotification); -} - -void TDLibWrapper::handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings) -{ - emit chatNotificationSettingsUpdated(chatId, chatNotificationSettings); -} - -void TDLibWrapper::handleMessageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent) -{ - emit messageContentUpdated(chatId, messageId, newContent); -} - -void TDLibWrapper::handleMessagesDeleted(const QString &chatId, const QVariantList &messageIds) -{ - emit messagesDeleted(chatId, messageIds); -} - -void TDLibWrapper::handleChats(const QVariantMap &chats) -{ - emit this->chatsReceived(chats); -} - -void TDLibWrapper::handleChat(const QVariantMap &chat) -{ - emit this->chatReceived(chat); -} - -void TDLibWrapper::handleRecentStickersUpdated(const QVariantList &stickerIds) -{ - emit this->recentStickersUpdated(stickerIds); -} - -void TDLibWrapper::handleStickers(const QVariantList &stickers) -{ - emit this->stickersReceived(stickers); -} - -void TDLibWrapper::handleInstalledStickerSetsUpdated(const QVariantList &stickerSetIds) -{ - emit this->installedStickerSetsUpdated(stickerSetIds); -} - void TDLibWrapper::handleStickerSets(const QVariantList &stickerSets) { QListIterator stickerSetIterator(stickerSets); @@ -998,67 +896,12 @@ void TDLibWrapper::handleStickerSets(const QVariantList &stickerSets) emit this->stickerSetsReceived(stickerSets); } -void TDLibWrapper::handleStickerSet(const QVariantMap &stickerSet) -{ - emit stickerSetReceived(stickerSet); -} - void TDLibWrapper::handleEmojiSearchCompleted(const QString &queryString, const QVariantList &resultList) { LOG("Emoji search completed" << queryString); emit emojiSearchSuccessful(resultList); } -void TDLibWrapper::handleChatMembers(const QString &extra, const QVariantList &members, int totalMembers) -{ - emit this->chatMembersReceived(extra, members, totalMembers); -} - -void TDLibWrapper::handleUserFullInfo(const QVariantMap &userFullInfo) -{ - emit this->userFullInfoReceived(userFullInfo); -} - -void TDLibWrapper::handleUserFullInfoUpdated(const QString &userId, const QVariantMap &userFullInfo) -{ - emit this->userFullInfoUpdated(userId, userFullInfo); -} - -void TDLibWrapper::handleBasicGroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo) -{ - emit this->basicGroupFullInfoReceived(groupId, groupFullInfo); -} - -void TDLibWrapper::handleBasicGroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo) -{ - emit this->basicGroupFullInfoUpdated(groupId, groupFullInfo); -} - -void TDLibWrapper::handleSupergroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo) -{ - emit this->supergroupFullInfoReceived(groupId, groupFullInfo); -} - -void TDLibWrapper::handleSupergroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo) -{ - emit this->supergroupFullInfoUpdated(groupId, groupFullInfo); -} - -void TDLibWrapper::handleUserProfilePhotos(const QString &extra, const QVariantList &photos, int totalPhotos) -{ - emit this->userProfilePhotosReceived(extra, photos, totalPhotos); -} - -void TDLibWrapper::handleChatPermissionsUpdated(const QString &chatId, const QVariantMap permissions) -{ - emit this->chatPermissionsUpdated(chatId, permissions); -} - -void TDLibWrapper::handleChatTitleUpdated(const QString &chatId, const QString title) -{ - emit this->chatTitleUpdated(chatId, title); -} - void TDLibWrapper::setInitialParameters() { LOG("Sending initial parameters to TD Lib"); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 2d967d5..b603f82 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -210,41 +210,10 @@ public slots: void handleNewChatDiscovered(const QVariantMap &chatInformation); void handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation); void handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation); - void handleChatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); - void handleChatOrderUpdated(const QString &chatId, const QString &order); - void handleChatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); - void handleChatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void handleBasicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); void handleSuperGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); - void handleChatOnlineMemberCountUpdated(const QString &chatId, int onlineMemberCount); - void handleMessagesReceived(const QVariantList &messages, int totalCount); - void handleNewMessageReceived(const QString &chatId, const QVariantMap &message); - void handleMessageInformation(const QString &messageId, const QVariantMap &message); - void handleMessageSendSucceeded(const QString &messageId, const QString &oldMessageId, const QVariantMap &message); - void handleUpdateActiveNotifications(const QVariantList notificationGroups); - void handleUpdateNotificationGroup(const QVariantMap notificationGroupUpdate); - void handleUpdateNotification(const QVariantMap updatedNotification); - void handleChatNotificationSettingsUpdated(const QString &chatId, const QVariantMap &chatNotificationSettings); - void handleMessageContentUpdated(const QString &chatId, const QString &messageId, const QVariantMap &newContent); - void handleMessagesDeleted(const QString &chatId, const QVariantList &messageIds); - void handleChats(const QVariantMap &chats); - void handleChat(const QVariantMap &chat); - void handleRecentStickersUpdated(const QVariantList &stickerIds); - void handleStickers(const QVariantList &stickers); - void handleInstalledStickerSetsUpdated(const QVariantList &stickerSetIds); void handleStickerSets(const QVariantList &stickerSets); - void handleStickerSet(const QVariantMap &stickerSet); void handleEmojiSearchCompleted(const QString &queryString, const QVariantList &resultList); - void handleChatMembers(const QString &extra, const QVariantList &members, int totalMembers); - void handleUserFullInfo(const QVariantMap &userFullInfo); - void handleUserFullInfoUpdated(const QString &userId, const QVariantMap &userFullInfo); - void handleBasicGroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); - void handleBasicGroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); - void handleSupergroupFullInfo(const QString &groupId, const QVariantMap &groupFullInfo); - void handleSupergroupFullInfoUpdated(const QString &groupId, const QVariantMap &groupFullInfo); - void handleUserProfilePhotos(const QString &extra, const QVariantList &photos, int totalPhotos); - void handleChatPermissionsUpdated(const QString &chatId, const QVariantMap permissions); - void handleChatTitleUpdated(const QString &chatId, const QString title); private: void setInitialParameters();