summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-29 06:01:38 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-29 06:01:38 +0100
commit19dc6cadea0168f72daff7c0ed679ccdac71a7d5 (patch)
treeb10a86fcd0ab0f12f5e242996b307bb2cac97940 /src/timeline
parentReduce allocations required for the palette (diff)
downloadnheko-19dc6cadea0168f72daff7c0ed679ccdac71a7d5.tar.xz
Reserve size of some containers we are filling
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/CommunitiesModel.cpp1
-rw-r--r--src/timeline/EventStore.cpp1
-rw-r--r--src/timeline/InputBar.cpp12
-rw-r--r--src/timeline/RoomlistModel.cpp11
-rw-r--r--src/timeline/RoomlistModel.h3
-rw-r--r--src/timeline/TimelineModel.cpp87
-rw-r--r--src/timeline/TimelineModel.h1
-rw-r--r--src/timeline/TimelineViewManager.cpp72
8 files changed, 118 insertions, 70 deletions
diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp

index fec08d60..520a0372 100644 --- a/src/timeline/CommunitiesModel.cpp +++ b/src/timeline/CommunitiesModel.cpp
@@ -293,6 +293,7 @@ CommunitiesModel::FlatTree::storeCollapsed() int depth = -1; QStringList current; + elements.reserve(static_cast<int>(tree.size())); for (const auto &e : tree) { if (e.depth > depth) { diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index 0a19483d..209464b7 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp
@@ -527,6 +527,7 @@ EventStore::reactions(const std::string &event_id) } QVariantList temp; + temp.reserve(static_cast<int>(reactions.size())); for (auto &reaction : reactions) { const auto &agg = aggregation[reaction.key_.toStdString()]; reaction.count_ = agg.count; diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 832016e2..767dccc3 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -56,7 +56,8 @@ InputBar::insertMimeData(const QMimeData *md) if (!md) return; - nhlog::ui()->debug("Got mime formats: {}", md->formats().join(QStringLiteral(", ")).toStdString()); + nhlog::ui()->debug("Got mime formats: {}", + md->formats().join(QStringLiteral(", ")).toStdString()); const auto formats = md->formats().filter(QStringLiteral("/")); const auto image = formats.filter(QStringLiteral("image/"), Qt::CaseInsensitive); const auto audio = formats.filter(QStringLiteral("audio/"), Qt::CaseInsensitive); @@ -140,7 +141,8 @@ InputBar::updateAtRoom(const QString &t) auto start = finder.position(); finder.toNextBoundary(); auto end = finder.position(); - if (start > 0 && end - start >= 4 && t.mid(start, end - start) == QLatin1String("room") && + if (start > 0 && end - start >= 4 && + t.mid(start, end - start) == QLatin1String("room") && t.at(start - 1) == QChar('@')) { roomMention = true; break; @@ -660,13 +662,15 @@ InputBar::showPreview(const QMimeData &source, const QString &path, const QStrin previewDialog_->setAttribute(Qt::WA_DeleteOnClose); // Force SVG to _not_ be handled as an image, but as raw data - if (source.hasImage() && (formats.empty() || formats.front() != QLatin1String("image/svg+xml"))) { + if (source.hasImage() && + (formats.empty() || formats.front() != QLatin1String("image/svg+xml"))) { if (!formats.empty() && formats.front().startsWith(QLatin1String("image/"))) { // known format, keep as-is previewDialog_->setPreview(qvariant_cast<QImage>(source.imageData()), formats.front()); } else { // unknown image format, default to image/png - previewDialog_->setPreview(qvariant_cast<QImage>(source.imageData()), QStringLiteral("image/png")); + previewDialog_->setPreview(qvariant_cast<QImage>(source.imageData()), + QStringLiteral("image/png")); } } else if (!path.isEmpty()) previewDialog_->setPreview(path); diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 0757d27e..2dfe5d6f 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp
@@ -90,6 +90,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const if (role == Roles::ParentSpaces) { auto parents = cache::client()->getParentRoomIds(roomid.toStdString()); QStringList list; + list.reserve(static_cast<int>(parents.size())); for (const auto &t : parents) list.push_back(QString::fromStdString(t)); return list; @@ -98,7 +99,8 @@ RoomlistModel::data(const QModelIndex &index, int role) const } else if (role == Roles::IsDirect) { return directChatToUser.count(roomid) > 0; } else if (role == Roles::DirectChatOtherUserId) { - return directChatToUser.count(roomid) ? directChatToUser.at(roomid).front() : QLatin1String(""); + return directChatToUser.count(roomid) ? directChatToUser.at(roomid).front() + : QLatin1String(""); } if (models.contains(roomid)) { @@ -113,7 +115,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const case Roles::Time: return room->lastMessage().descriptiveTime; case Roles::Timestamp: - return QVariant(static_cast<quint64>(room->lastMessage().timestamp)); + return QVariant{static_cast<quint64>(room->lastMessage().timestamp)}; case Roles::HasUnreadMessages: return this->roomReadStatus.count(roomid) && this->roomReadStatus.at(roomid); case Roles::HasLoudNotification: @@ -129,6 +131,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const case Roles::Tags: { auto info = cache::singleRoomInfo(roomid.toStdString()); QStringList list; + list.reserve(static_cast<int>(info.tags.size())); for (const auto &t : info.tags) list.push_back(QString::fromStdString(t)); return list; @@ -148,7 +151,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const case Roles::Time: return QString(); case Roles::Timestamp: - return QVariant(static_cast<quint64>(0)); + return QVariant{static_cast<quint64>(0)}; case Roles::HasUnreadMessages: case Roles::HasLoudNotification: return false; @@ -177,7 +180,7 @@ RoomlistModel::data(const QModelIndex &index, int role) const case Roles::Time: return QString(); case Roles::Timestamp: - return QVariant(static_cast<quint64>(0)); + return QVariant{static_cast<quint64>(0)}; case Roles::HasUnreadMessages: case Roles::HasLoudNotification: return false; diff --git a/src/timeline/RoomlistModel.h b/src/timeline/RoomlistModel.h
index 8bffccc9..459b8788 100644 --- a/src/timeline/RoomlistModel.h +++ b/src/timeline/RoomlistModel.h
@@ -159,7 +159,8 @@ public slots: } void joinPreview(QString roomid) { - roomlistmodel->joinPreview(roomid, filterType == FilterBy::Space ? filterStr : QLatin1String("")); + roomlistmodel->joinPreview(roomid, + filterType == FilterBy::Space ? filterStr : QLatin1String("")); } void acceptInvite(QString roomid) { roomlistmodel->acceptInvite(roomid); } void declineInvite(QString roomid) { roomlistmodel->declineInvite(roomid); } diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index ae3094ab..a95339cc 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -503,7 +503,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r switch (role) { case IsSender: - return QVariant(acc::sender(event) == http::client()->user_id().to_string()); + return {acc::sender(event) == http::client()->user_id().to_string()}; case UserId: return QVariant(QString::fromStdString(acc::sender(event))); case UserName: @@ -512,12 +512,12 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r case Day: { QDateTime prevDate = origin_server_ts(event); prevDate.setTime(QTime()); - return QVariant(prevDate.toMSecsSinceEpoch()); + return {prevDate.toMSecsSinceEpoch()}; } case Timestamp: return QVariant(origin_server_ts(event)); case Type: - return QVariant(toRoomEventType(event)); + return {toRoomEventType(event)}; case TypeString: return QVariant(toRoomEventTypeString(event)); case IsOnlyEmoji: { @@ -530,17 +530,18 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r if (utils::codepointIsEmoji(code)) { emojiCount++; } else { - return QVariant(0); + return {0}; } } - return QVariant(emojiCount); + return {emojiCount}; } case Body: return QVariant(utils::replaceEmoji(QString::fromStdString(body(event)).toHtmlEscaped())); case FormattedBody: { const static QRegularExpression replyFallback( - QStringLiteral("<mx-reply>.*</mx-reply>"), QRegularExpression::DotMatchesEverythingOption); + QStringLiteral("<mx-reply>.*</mx-reply>"), + QRegularExpression::DotMatchesEverythingOption); auto ascent = QFontMetrics(UserSettings::instance()->font()).ascent(); @@ -574,7 +575,8 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r // Construct image parameters later used by MxcImageProvider. QString imgParams; if (curImg.contains(QLatin1String("height"))) { - const static QRegularExpression matchImgHeight(QStringLiteral("height=([\"\']?)(\\d+)([\"\']?)")); + const static QRegularExpression matchImgHeight( + QStringLiteral("height=([\"\']?)(\\d+)([\"\']?)")); // Make emoticons twice as high as the font. if (curImg.contains(QLatin1String("data-mx-emoticon"))) { imgReplacement = @@ -587,11 +589,11 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r // Replace src in current <img>. const static QRegularExpression matchImgUri(QStringLiteral("src=\"mxc://([^\"]*)\"")); imgReplacement.replace(matchImgUri, - QString("src=\"image://mxcImage/\\1%1\"").arg(imgParams)); + QStringLiteral(R"(src="image://mxcImage/\1%1")").arg(imgParams)); // Same regex but for single quotes around the src const static QRegularExpression matchImgUri2(QStringLiteral("src=\'mxc://([^\']*)\'")); imgReplacement.replace(matchImgUri2, - QString("src=\'image://mxcImage/\\1%1\'").arg(imgParams)); + QStringLiteral("src=\'image://mxcImage/\\1%1\'").arg(imgParams)); // Replace <img> in formattedBody_ with our new <img>. formattedBody_.replace(curImg, imgReplacement); @@ -623,7 +625,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r double prop = media_height(event) / (double)w; - return QVariant(prop > 0 ? prop : 1.); + return {prop > 0 ? prop : 1.}; } case EventId: { if (auto replaces = relations(event).replaces()) @@ -651,10 +653,10 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r return qml_mtx_events::Received; } case IsEdited: - return QVariant(relations(event).replaces().has_value()); + return {relations(event).replaces().has_value()}; case IsEditable: - return QVariant(!is_state_event(event) && - mtx::accessors::sender(event) == http::client()->user_id().to_string()); + return {!is_state_event(event) && + mtx::accessors::sender(event) == http::client()->user_id().to_string()}; case IsEncrypted: { auto id = event_id(event); auto encrypted_event = events.get(id, "", false); @@ -693,8 +695,10 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r return QVariant( utils::replaceEmoji(QString::fromStdString(room_name(event)).toHtmlEscaped())); case RoomTopic: - return QVariant(utils::replaceEmoji(utils::linkifyMessage( - QString::fromStdString(room_topic(event)).toHtmlEscaped().replace(QLatin1String("\n"), QLatin1String("<br>"))))); + return QVariant(utils::replaceEmoji( + utils::linkifyMessage(QString::fromStdString(room_topic(event)) + .toHtmlEscaped() + .replace(QLatin1String("\n"), QLatin1String("<br>"))))); case CallType: return QVariant(QString::fromStdString(call_type(event))); case Dump: { @@ -736,7 +740,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r case RelatedEventCacheBuster: return relatedEventCacheBuster; default: - return QVariant(); + return {}; } } @@ -746,7 +750,7 @@ TimelineModel::data(const QModelIndex &index, int role) const using namespace mtx::accessors; namespace acc = mtx::accessors; if (index.row() < 0 && index.row() >= rowCount()) - return QVariant(); + return {}; // HACK(Nico): fetchMore likes to break with dynamically sized delegates and reuseItems if (index.row() + 1 == rowCount() && !m_paginationInProgress) @@ -760,10 +764,10 @@ TimelineModel::data(const QModelIndex &index, int role) const if (role == PreviousMessageDay || role == PreviousMessageUserId) { int prevIdx = rowCount() - index.row() - 2; if (prevIdx < 0) - return QVariant(); + return {}; auto tempEv = events.get(prevIdx); if (!tempEv) - return QVariant(); + return {}; if (role == PreviousMessageUserId) return data(*tempEv, UserId); else @@ -778,7 +782,7 @@ TimelineModel::dataById(const QString &id, int role, const QString &relatedTo) { if (auto event = events.get(id.toStdString(), relatedTo.toStdString())) return data(*event, role); - return QVariant(); + return {}; } bool @@ -1623,7 +1627,7 @@ TimelineModel::cacheMedia(const QString &eventId, void TimelineModel::cacheMedia(const QString &eventId) { - cacheMedia(eventId, NULL); + cacheMedia(eventId, nullptr); } void @@ -1739,7 +1743,7 @@ TimelineModel::formatTypingUsers(const std::vector<QString> &users, const QColor (int)users.size()); if (users.empty()) { - return QString(); + return {}; } QStringList uidWithoutLast; @@ -1774,6 +1778,7 @@ TimelineModel::formatTypingUsers(const std::vector<QString> &users, const QColor return coloredUsername; }; + uidWithoutLast.reserve(static_cast<int>(users.size())); for (size_t i = 0; i + 1 < users.size(); i++) { uidWithoutLast.append(formatUser(users[i])); } @@ -1786,11 +1791,11 @@ TimelineModel::formatJoinRuleEvent(const QString &id) { mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), ""); if (!e) - return QString(); + return {}; auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::JoinRules>>(e); if (!event) - return QString(); + return {}; QString user = QString::fromStdString(event->sender); QString name = utils::replaceEmoji(displayName(user)); @@ -1814,7 +1819,7 @@ TimelineModel::formatJoinRuleEvent(const QString &id) } default: // Currently, knock and private are reserved keywords and not implemented in Matrix. - return QString(); + return {}; } } @@ -1823,11 +1828,11 @@ TimelineModel::formatGuestAccessEvent(const QString &id) { mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), ""); if (!e) - return QString(); + return {}; auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::GuestAccess>>(e); if (!event) - return QString(); + return {}; QString user = QString::fromStdString(event->sender); QString name = utils::replaceEmoji(displayName(user)); @@ -1838,7 +1843,7 @@ TimelineModel::formatGuestAccessEvent(const QString &id) case mtx::events::state::AccessState::Forbidden: return tr("%1 has closed the room to guest access.").arg(name); default: - return QString(); + return {}; } } @@ -1847,12 +1852,12 @@ TimelineModel::formatHistoryVisibilityEvent(const QString &id) { mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), ""); if (!e) - return QString(); + return {}; auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::HistoryVisibility>>(e); if (!event) - return QString(); + return {}; QString user = QString::fromStdString(event->sender); QString name = utils::replaceEmoji(displayName(user)); @@ -1870,7 +1875,7 @@ TimelineModel::formatHistoryVisibilityEvent(const QString &id) return tr("%1 set the room history visible to members since they joined the room.") .arg(name); default: - return QString(); + return {}; } } @@ -1879,7 +1884,7 @@ TimelineModel::formatPowerLevelEvent(const QString &id) { mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), ""); if (!e) - return QString(); + return {}; auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::PowerLevels>>(e); if (!event) @@ -1924,7 +1929,7 @@ TimelineModel::formatRedactedEvent(const QString &id) } else { pair[QStringLiteral("first")] = tr("Removed by %1 because: %2").arg(redactedName, reason); pair[QStringLiteral("second")] = tr("%1 (%2) removed this message at %3\nReason: %4") - .arg(redactedName, redactedUser, dateTime, reason); + .arg(redactedName, redactedUser, dateTime, reason); } return pair; @@ -1980,11 +1985,11 @@ TimelineModel::formatMemberEvent(const QString &id) { mtx::events::collections::TimelineEvents *e = events.get(id.toStdString(), ""); if (!e) - return QString(); + return {}; auto event = std::get_if<mtx::events::StateEvent<mtx::events::state::Member>>(e); if (!event) - return QString(); + return {}; mtx::events::StateEvent<mtx::events::state::Member> *prevEvent = nullptr; if (!event->unsigned_data.replaces_state.empty()) { @@ -2038,7 +2043,7 @@ TimelineModel::formatMemberEvent(const QString &id) break; case Membership::Leave: if (!prevEvent) // Should only ever happen temporarily - return QString(); + return {}; if (prevEvent->content.membership == Membership::Invite) { if (event->state_key == event->sender) @@ -2163,7 +2168,7 @@ TimelineModel::roomName() const auto info = cache::getRoomInfo({room_id_.toStdString()}); if (!info.count(room_id_)) - return QString(); + return {}; else return utils::replaceEmoji(QString::fromStdString(info[room_id_].name).toHtmlEscaped()); } @@ -2174,7 +2179,7 @@ TimelineModel::plainRoomName() const auto info = cache::getRoomInfo({room_id_.toStdString()}); if (!info.count(room_id_)) - return QString(); + return {}; else return QString::fromStdString(info[room_id_].name); } @@ -2185,7 +2190,7 @@ TimelineModel::roomAvatarUrl() const auto info = cache::getRoomInfo({room_id_.toStdString()}); if (!info.count(room_id_)) - return QString(); + return {}; else return QString::fromStdString(info[room_id_].avatar_url); } @@ -2196,7 +2201,7 @@ TimelineModel::roomTopic() const auto info = cache::getRoomInfo({room_id_.toStdString()}); if (!info.count(room_id_)) - return QString(); + return {}; else return utils::replaceEmoji( utils::linkifyMessage(QString::fromStdString(info[room_id_].topic).toHtmlEscaped())); @@ -2244,5 +2249,5 @@ TimelineModel::directChatOtherUserId() const id = member.user_id; return id; } else - return QString(); + return {}; } diff --git a/src/timeline/TimelineModel.h b/src/timeline/TimelineModel.h
index afb712da..b14c7a18 100644 --- a/src/timeline/TimelineModel.h +++ b/src/timeline/TimelineModel.h
@@ -286,6 +286,7 @@ public: { auto list = events.reactions(event_id); std::vector<::Reaction> vec; + vec.reserve(list.size()); for (const auto &r : list) vec.push_back(r.value<Reaction>()); return vec; diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 6928b95b..8e94989b 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp
@@ -103,10 +103,12 @@ TimelineViewManager::updateColorPalette() if (ChatPage::instance()->userSettings()->theme() == QLatin1String("light")) { view->rootContext()->setContextProperty(QStringLiteral("currentActivePalette"), QPalette()); - view->rootContext()->setContextProperty(QStringLiteral("currentInactivePalette"), QPalette()); + view->rootContext()->setContextProperty(QStringLiteral("currentInactivePalette"), + QPalette()); } else if (ChatPage::instance()->userSettings()->theme() == QLatin1String("dark")) { view->rootContext()->setContextProperty(QStringLiteral("currentActivePalette"), QPalette()); - view->rootContext()->setContextProperty(QStringLiteral("currentInactivePalette"), QPalette()); + view->rootContext()->setContextProperty(QStringLiteral("currentInactivePalette"), + QPalette()); } else { view->rootContext()->setContextProperty(QStringLiteral("currentActivePalette"), QPalette()); view->rootContext()->setContextProperty(QStringLiteral("currentInactivePalette"), nullptr); @@ -161,12 +163,20 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par qRegisterMetaType<std::vector<mtx::responses::PublicRoomsChunk>>(); - qmlRegisterUncreatableMetaObject( - qml_mtx_events::staticMetaObject, "im.nheko", 1, 0, "MtxEvent", QStringLiteral("Can't instantiate enum!")); + qmlRegisterUncreatableMetaObject(qml_mtx_events::staticMetaObject, + "im.nheko", + 1, + 0, + "MtxEvent", + QStringLiteral("Can't instantiate enum!")); qmlRegisterUncreatableMetaObject( olm::staticMetaObject, "im.nheko", 1, 0, "Olm", QStringLiteral("Can't instantiate enum!")); - qmlRegisterUncreatableMetaObject( - crypto::staticMetaObject, "im.nheko", 1, 0, "Crypto", QStringLiteral("Can't instantiate enum!")); + qmlRegisterUncreatableMetaObject(crypto::staticMetaObject, + "im.nheko", + 1, + 0, + "Crypto", + QStringLiteral("Can't instantiate enum!")); qmlRegisterUncreatableMetaObject(verification::staticMetaObject, "im.nheko", 1, @@ -181,11 +191,23 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par qmlRegisterType<MxcAnimatedImage>("im.nheko", 1, 0, "MxcAnimatedImage"); qmlRegisterType<MxcMediaProxy>("im.nheko", 1, 0, "MxcMedia"); qmlRegisterUncreatableType<DeviceVerificationFlow>( - "im.nheko", 1, 0, "DeviceVerificationFlow", QStringLiteral("Can't create verification flow from QML!")); + "im.nheko", + 1, + 0, + "DeviceVerificationFlow", + QStringLiteral("Can't create verification flow from QML!")); qmlRegisterUncreatableType<UserProfile>( - "im.nheko", 1, 0, "UserProfileModel", QStringLiteral("UserProfile needs to be instantiated on the C++ side")); + "im.nheko", + 1, + 0, + "UserProfileModel", + QStringLiteral("UserProfile needs to be instantiated on the C++ side")); qmlRegisterUncreatableType<MemberList>( - "im.nheko", 1, 0, "MemberList", QStringLiteral("MemberList needs to be instantiated on the C++ side")); + "im.nheko", + 1, + 0, + "MemberList", + QStringLiteral("MemberList needs to be instantiated on the C++ side")); qmlRegisterUncreatableType<RoomSettings>( "im.nheko", 1, @@ -207,7 +229,11 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par "SingleImagePackModel", QStringLiteral("SingleImagePackModel needs to be instantiated on the C++ side")); qmlRegisterUncreatableType<InviteesModel>( - "im.nheko", 1, 0, "InviteesModel", QStringLiteral("InviteesModel needs to be instantiated on the C++ side")); + "im.nheko", + 1, + 0, + "InviteesModel", + QStringLiteral("InviteesModel needs to be instantiated on the C++ side")); qmlRegisterUncreatableType<ReadReceiptsProxy>( "im.nheko", 1, @@ -270,8 +296,12 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par qmlRegisterType<emoji::EmojiModel>("im.nheko.EmojiModel", 1, 0, "EmojiModel"); qmlRegisterUncreatableType<emoji::Emoji>( "im.nheko.EmojiModel", 1, 0, "Emoji", QStringLiteral("Used by emoji models")); - qmlRegisterUncreatableMetaObject( - emoji::staticMetaObject, "im.nheko.EmojiModel", 1, 0, "EmojiCategory", QStringLiteral("Error: Only enums")); + qmlRegisterUncreatableMetaObject(emoji::staticMetaObject, + "im.nheko.EmojiModel", + 1, + 0, + "EmojiCategory", + QStringLiteral("Error: Only enums")); qmlRegisterType<RoomDirectoryModel>("im.nheko", 1, 0, "RoomDirectoryModel"); @@ -404,15 +434,17 @@ TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) return; } - MxcImageProvider::download( - mxcUrl.remove(QStringLiteral("mxc://")), QSize(), [this, eventId](QString, QSize, QImage img, QString) { - if (img.isNull()) { - nhlog::ui()->error("Error when retrieving image for overlay."); - return; - } + MxcImageProvider::download(mxcUrl.remove(QStringLiteral("mxc://")), + QSize(), + [this, eventId](QString, QSize, QImage img, QString) { + if (img.isNull()) { + nhlog::ui()->error( + "Error when retrieving image for overlay."); + return; + } - emit openImageOverlayInternalCb(eventId, std::move(img)); - }); + emit openImageOverlayInternalCb(eventId, std::move(img)); + }); } void