Port to std::as_const
This commit is contained in:
@@ -88,7 +88,7 @@ void CustomEmojiModel::setConnection(Connection *it)
|
||||
QString CustomEmojiModel::preprocessText(const QString &it)
|
||||
{
|
||||
auto cp = it;
|
||||
for (const auto &emoji : qAsConst(d->emojies)) {
|
||||
for (const auto &emoji : std::as_const(d->emojies)) {
|
||||
cp.replace(
|
||||
emoji.regexp,
|
||||
QStringLiteral(R"(<img data-mx-emoticon="" src="%1" alt="%2" title="%2" height="32" vertical-align="middle" />)").arg(emoji.url, emoji.name));
|
||||
@@ -99,7 +99,7 @@ QString CustomEmojiModel::preprocessText(const QString &it)
|
||||
QVariantList CustomEmojiModel::filterModel(const QString &filter)
|
||||
{
|
||||
QVariantList results;
|
||||
for (const auto &emoji : qAsConst(d->emojies)) {
|
||||
for (const auto &emoji : std::as_const(d->emojies)) {
|
||||
if (results.length() >= 10)
|
||||
break;
|
||||
if (!emoji.name.contains(filter, Qt::CaseInsensitive))
|
||||
|
||||
@@ -92,7 +92,7 @@ void RoomListModel::setConnection(Connection *connection)
|
||||
|
||||
m_connection = connection;
|
||||
|
||||
for (NeoChatRoom *room : qAsConst(m_rooms)) {
|
||||
for (NeoChatRoom *room : std::as_const(m_rooms)) {
|
||||
room->disconnect(this);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void RoomListModel::setConnection(Connection *connection)
|
||||
connect(connection, &Connection::aboutToDeleteRoom, this, &RoomListModel::deleteRoom);
|
||||
connect(connection, &Connection::directChatsListChanged, this, [this, connection](Quotient::DirectChatsMap additions, Quotient::DirectChatsMap removals) {
|
||||
auto refreshRooms = [this, &connection](Quotient::DirectChatsMap rooms) {
|
||||
for (const QString &roomID : qAsConst(rooms)) {
|
||||
for (const QString &roomID : std::as_const(rooms)) {
|
||||
auto room = connection->room(roomID);
|
||||
if (room) {
|
||||
refresh(static_cast<NeoChatRoom *>(room));
|
||||
@@ -249,7 +249,7 @@ void RoomListModel::handleNotifications()
|
||||
void RoomListModel::refreshNotificationCount()
|
||||
{
|
||||
int count = 0;
|
||||
for (auto room : qAsConst(m_rooms)) {
|
||||
for (auto room : std::as_const(m_rooms)) {
|
||||
count += room->notificationCount();
|
||||
}
|
||||
if (m_notificationCount == count) {
|
||||
@@ -489,7 +489,7 @@ bool RoomListModel::categoryVisible(int category) const
|
||||
|
||||
NeoChatRoom *RoomListModel::roomByAliasOrId(const QString &aliasOrId)
|
||||
{
|
||||
for (const auto &room : qAsConst(m_rooms)) {
|
||||
for (const auto &room : std::as_const(m_rooms)) {
|
||||
if (room->aliases().contains(aliasOrId) || room->id() == aliasOrId) {
|
||||
return room;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void UserListModel::setRoom(Quotient::Room *room)
|
||||
if (m_currentRoom) {
|
||||
m_currentRoom->disconnect(this);
|
||||
// m_currentRoom->connection()->disconnect(this);
|
||||
for (User *user : qAsConst(m_users)) {
|
||||
for (User *user : std::as_const(m_users)) {
|
||||
user->disconnect(this);
|
||||
}
|
||||
m_users.clear();
|
||||
@@ -47,7 +47,7 @@ void UserListModel::setRoom(Quotient::Room *room)
|
||||
m_users = m_currentRoom->users();
|
||||
std::sort(m_users.begin(), m_users.end(), room->memberSorter());
|
||||
}
|
||||
for (User *user : qAsConst(m_users)) {
|
||||
for (User *user : std::as_const(m_users)) {
|
||||
#ifdef QUOTIENT_07
|
||||
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
||||
avatarChanged(user, m_currentRoom);
|
||||
|
||||
Reference in New Issue
Block a user