summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-10-13 23:28:57 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-10-13 23:29:32 +0200
commit45ecb71444143a6f7ae8d2ae21a1b071fc708616 (patch)
treeb8c33354879575e84e4219b0eb7a4b11da740d60 /src
parentFix (hopefully) HiDPI scaling issues with edit and encryption icons (diff)
downloadnheko-45ecb71444143a6f7ae8d2ae21a1b071fc708616.tar.xz
Qt6.6 compatibility
Diffstat (limited to 'src')
-rw-r--r--src/AliasEditModel.cpp4
-rw-r--r--src/Cache.cpp2
-rw-r--r--src/ChatPage.cpp2
-rw-r--r--src/InviteesModel.cpp4
-rw-r--r--src/MxcImageProvider.cpp2
-rw-r--r--src/PowerlevelsEditModels.cpp20
-rw-r--r--src/UserSettingsPage.cpp4
-rw-r--r--src/notifications/Manager.cpp2
-rw-r--r--src/notifications/ManagerLinux.cpp4
-rw-r--r--src/timeline/CommunitiesModel.cpp2
-rw-r--r--src/timeline/DelegateChooser.cpp4
-rw-r--r--src/timeline/EventDelegateChooser.cpp4
-rw-r--r--src/timeline/EventStore.cpp2
-rw-r--r--src/timeline/InputBar.cpp2
-rw-r--r--src/timeline/RoomlistModel.cpp4
-rw-r--r--src/ui/RoomSettings.cpp2
16 files changed, 32 insertions, 32 deletions
diff --git a/src/AliasEditModel.cpp b/src/AliasEditModel.cpp
index 218c5b36..c6dc35c6 100644
--- a/src/AliasEditModel.cpp
+++ b/src/AliasEditModel.cpp
@@ -42,7 +42,7 @@ AliasEditingModel::AliasEditingModel(const std::string &rid, QObject *parent)
         }
     }
 
-    for (const auto &alias : qAsConst(aliases)) {
+    for (const auto &alias : std::as_const(aliases)) {
         fetchAliasesStatus(alias.alias);
     }
     fetchPublishedAliases();
@@ -148,7 +148,7 @@ void
 AliasEditingModel::addAlias(QString newAlias)
 {
     const auto aliasStr = newAlias.toStdString();
-    for (const auto &e : qAsConst(aliases)) {
+    for (const auto &e : std::as_const(aliases)) {
         if (e.alias == aliasStr) {
             return;
         }
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 0426f38a..cb5dc9c8 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -302,7 +302,7 @@ Cache::setup()
         QDir stateDir(cacheDirectory_);
 
         auto eList = stateDir.entryList(QDir::NoDotAndDotDot);
-        for (const auto &file : qAsConst(eList)) {
+        for (const auto &file : std::as_const(eList)) {
             if (!stateDir.remove(file))
                 throw std::runtime_error(("Unable to delete file " + file).toStdString().c_str());
         }
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index c3f63f7c..90d542dd 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -1573,7 +1573,7 @@ ChatPage::handleMatrixUri(QString uri)
 
     auto items =
       uri_.query(QUrl::ComponentFormattingOption::FullyEncoded).split('&', Qt::SkipEmptyParts);
-    for (QString item : qAsConst(items)) {
+    for (QString item : std::as_const(items)) {
         nhlog::ui()->info("item: {}", item.toStdString());
 
         if (item.startsWith(QLatin1String("action="))) {
diff --git a/src/InviteesModel.cpp b/src/InviteesModel.cpp
index 7b49c234..76f37fad 100644
--- a/src/InviteesModel.cpp
+++ b/src/InviteesModel.cpp
@@ -18,7 +18,7 @@ InviteesModel::InviteesModel(TimelineModel *room, QObject *parent)
 void
 InviteesModel::addUser(QString mxid, QString displayName, QString avatarUrl)
 {
-    for (const auto &invitee : qAsConst(invitees_))
+    for (const auto &invitee : std::as_const(invitees_))
         if (invitee->mxid_ == mxid)
             return;
 
@@ -79,7 +79,7 @@ InviteesModel::mxids()
 {
     QStringList mxidList;
     mxidList.reserve(invitees_.size());
-    for (auto &invitee : qAsConst(invitees_))
+    for (auto &invitee : std::as_const(invitees_))
         mxidList.push_back(invitee->mxid_);
     return mxidList;
 }
diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp
index 47e0344f..8f930c1a 100644
--- a/src/MxcImageProvider.cpp
+++ b/src/MxcImageProvider.cpp
@@ -38,7 +38,7 @@ MxcImageProvider::MxcImageProvider()
                      QDir::Filter::Writable | QDir::Filter::NoDotAndDotDot | QDir::Filter::Files);
 
             auto files = dir.entryInfoList();
-            for (const auto &fileInfo : qAsConst(files)) {
+            for (const auto &fileInfo : std::as_const(files)) {
                 if (fileInfo.fileTime(QFile::FileTime::FileAccessTime)
                       .daysTo(QDateTime::currentDateTime()) > 30) {
                     if (QFile::remove(fileInfo.absoluteFilePath()))
diff --git a/src/PowerlevelsEditModels.cpp b/src/PowerlevelsEditModels.cpp
index f0fd9194..01337f11 100644
--- a/src/PowerlevelsEditModels.cpp
+++ b/src/PowerlevelsEditModels.cpp
@@ -83,7 +83,7 @@ std::map<std::string, mtx::events::state::power_level_t, std::less<>>
 PowerlevelsTypeListModel::toEvents() const
 {
     std::map<std::string, mtx::events::state::power_level_t, std::less<>> m;
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key.find('.') != std::string::npos)
             m[key] = pl;
     return m;
@@ -91,7 +91,7 @@ PowerlevelsTypeListModel::toEvents() const
 mtx::events::state::power_level_t
 PowerlevelsTypeListModel::kick() const
 {
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key == "kick")
             return pl;
     return powerLevels_.users_default;
@@ -99,7 +99,7 @@ PowerlevelsTypeListModel::kick() const
 mtx::events::state::power_level_t
 PowerlevelsTypeListModel::invite() const
 {
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key == "invite")
             return pl;
     return powerLevels_.users_default;
@@ -107,7 +107,7 @@ PowerlevelsTypeListModel::invite() const
 mtx::events::state::power_level_t
 PowerlevelsTypeListModel::ban() const
 {
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key == "ban")
             return pl;
     return powerLevels_.users_default;
@@ -115,7 +115,7 @@ PowerlevelsTypeListModel::ban() const
 mtx::events::state::power_level_t
 PowerlevelsTypeListModel::eventsDefault() const
 {
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key == "zdefault_events")
             return pl;
     return powerLevels_.users_default;
@@ -123,7 +123,7 @@ PowerlevelsTypeListModel::eventsDefault() const
 mtx::events::state::power_level_t
 PowerlevelsTypeListModel::stateDefault() const
 {
-    for (const auto &[key, pl] : qAsConst(types))
+    for (const auto &[key, pl] : std::as_const(types))
         if (key == "zdefault_states")
             return pl;
     return powerLevels_.users_default;
@@ -399,7 +399,7 @@ std::map<std::string, mtx::events::state::power_level_t, std::less<>>
 PowerlevelsUserListModel::toUsers() const
 {
     std::map<std::string, mtx::events::state::power_level_t, std::less<>> m;
-    for (const auto &[key, pl] : qAsConst(users))
+    for (const auto &[key, pl] : std::as_const(users))
         if (key.size() > 0 && key.at(0) == '@')
             m[key] = pl;
     return m;
@@ -407,7 +407,7 @@ PowerlevelsUserListModel::toUsers() const
 mtx::events::state::power_level_t
 PowerlevelsUserListModel::usersDefault() const
 {
-    for (const auto &[key, pl] : qAsConst(users))
+    for (const auto &[key, pl] : std::as_const(users))
         if (key == "default")
             return pl;
     return powerLevels_.users_default;
@@ -635,7 +635,7 @@ PowerlevelEditingModels::updateSpacesModel()
 void
 PowerlevelEditingModels::addRole(int pl)
 {
-    for (const auto &e : qAsConst(types_.types))
+    for (const auto &e : std::as_const(types_.types))
         if (pl == int(e.pl))
             return;
 
@@ -752,7 +752,7 @@ PowerlevelsSpacesListModel::commit()
 {
     std::vector<std::string> spacesToApplyTo;
 
-    for (const auto &s : qAsConst(spaces))
+    for (const auto &s : std::as_const(spaces))
         if (s.apply)
             spacesToApplyTo.push_back(s.roomid);
 
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 75a6b443..4a25880c 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -152,7 +152,7 @@ UserSettings::load(std::optional<QString> profile)
 
     collapsedSpaces_.clear();
     auto tempSpaces = settings.value(prefix + "user/collapsed_spaces", QList<QVariant>{}).toList();
-    for (const auto &e : qAsConst(tempSpaces))
+    for (const auto &e : std::as_const(tempSpaces))
         collapsedSpaces_.push_back(e.toStringList());
 
     shareKeysWithTrustedUsers_ =
@@ -962,7 +962,7 @@ UserSettings::save()
 
     QVariantList v;
     v.reserve(collapsedSpaces_.size());
-    for (const auto &e : qAsConst(collapsedSpaces_))
+    for (const auto &e : std::as_const(collapsedSpaces_))
         v.push_back(e);
     settings.setValue(prefix + "user/collapsed_spaces", v);
 
diff --git a/src/notifications/Manager.cpp b/src/notifications/Manager.cpp
index a54256ae..ed5c0670 100644
--- a/src/notifications/Manager.cpp
+++ b/src/notifications/Manager.cpp
@@ -45,7 +45,7 @@ NotificationsManager::removeNotifications(const QString &roomId_,
         markerPos = std::max(markerPos, cache::getEventIndex(room_id, e.toStdString()).value_or(0));
     }
 
-    for (const auto &[roomId, eventId] : qAsConst(this->notificationIds)) {
+    for (const auto &[roomId, eventId] : std::as_const(this->notificationIds)) {
         if (roomId != roomId_)
             continue;
         auto idx = cache::getEventIndex(room_id, eventId.toStdString());
diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp
index fc92c9ae..e838bb85 100644
--- a/src/notifications/ManagerLinux.cpp
+++ b/src/notifications/ManagerLinux.cpp
@@ -36,14 +36,14 @@ NotificationsManager::NotificationsManager(QObject *parent)
          this)
   , hasMarkup_{std::invoke([this]() -> bool {
       auto caps = dbus.call("GetCapabilities").arguments();
-      for (const auto &x : qAsConst(caps))
+      for (const auto &x : std::as_const(caps))
           if (x.toStringList().contains("body-markup"))
               return true;
       return false;
   })}
   , hasImages_{std::invoke([this]() -> bool {
       auto caps = dbus.call("GetCapabilities").arguments();
-      for (const auto &x : qAsConst(caps))
+      for (const auto &x : std::as_const(caps))
           if (x.toStringList().contains("body-images"))
               return true;
       return false;
diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp
index 3c09d747..e1018f38 100644
--- a/src/timeline/CommunitiesModel.cpp
+++ b/src/timeline/CommunitiesModel.cpp
@@ -581,7 +581,7 @@ CommunitiesModel::setCurrentTagId(const QString &tagId)
 
     if (tagId.startsWith(QLatin1String("tag:"))) {
         auto tag = tagId.mid(4);
-        for (const auto &t : qAsConst(tags_)) {
+        for (const auto &t : std::as_const(tags_)) {
             if (t == tag) {
                 this->currentTagId_ = tagId;
                 UserSettings::instance()->setCurrentTagId(tagId);
diff --git a/src/timeline/DelegateChooser.cpp b/src/timeline/DelegateChooser.cpp
index 91b2194b..b95116ec 100644
--- a/src/timeline/DelegateChooser.cpp
+++ b/src/timeline/DelegateChooser.cpp
@@ -96,7 +96,7 @@ DelegateChooser::clearChoices(QQmlListProperty<DelegateChoice> *p)
 void
 DelegateChooser::recalcChild()
 {
-    for (const auto choice : qAsConst(choices_)) {
+    for (const auto choice : std::as_const(choices_)) {
         const auto &choiceValue = choice->roleValueRef();
         if (choiceValue == roleValue_ || (!choiceValue.isValid() && !roleValue_.isValid())) {
             if (child_) {
@@ -134,7 +134,7 @@ DelegateChooser::DelegateIncubator::statusChanged(QQmlIncubator::Status status)
 
     } else if (status == QQmlIncubator::Error) {
         auto errors_ = errors();
-        for (const auto &e : qAsConst(errors_))
+        for (const auto &e : std::as_const(errors_))
             nhlog::ui()->error("Error instantiating delegate: {}", e.toString().toStdString());
     }
 }
diff --git a/src/timeline/EventDelegateChooser.cpp b/src/timeline/EventDelegateChooser.cpp
index 4367bb9c..19a5357a 100644
--- a/src/timeline/EventDelegateChooser.cpp
+++ b/src/timeline/EventDelegateChooser.cpp
@@ -242,7 +242,7 @@ EventDelegateChooser::DelegateIncubator::reset(QString id)
         .toInt();
     this->oldType = role;
 
-    for (const auto choice : qAsConst(chooser.choices_)) {
+    for (const auto choice : std::as_const(chooser.choices_)) {
         const auto &choiceValue = choice->roleValues();
         if (choiceValue.contains(role) || choiceValue.empty()) {
             // nhlog::ui()->debug(
@@ -288,7 +288,7 @@ EventDelegateChooser::DelegateIncubator::statusChanged(QQmlIncubator::Status sta
         chooser.polish();
     } else if (status == QQmlIncubator::Error) {
         auto errors_ = errors();
-        for (const auto &e : qAsConst(errors_))
+        for (const auto &e : std::as_const(errors_))
             nhlog::ui()->error("Error instantiating delegate: {}", e.toString().toStdString());
     }
 }
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index e29dfb4c..3db70f77 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -800,7 +800,7 @@ EventStore::enableKeyRequests(bool suppressKeyRequests_)
 {
     if (!suppressKeyRequests_) {
         auto keys = decryptedEvents_.keys();
-        for (const auto &key : qAsConst(keys))
+        for (const auto &key : std::as_const(keys))
             if (key.room == this->room_id_)
                 decryptedEvents_.remove(key);
         suppressKeyRequests = false;
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index a371e2b4..fcec8e9c 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -491,7 +491,7 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
             QString body;
             bool firstLine = true;
             auto lines     = QStringView(related.quoted_body).split(u'\n');
-            for (auto line : qAsConst(lines)) {
+            for (auto line : std::as_const(lines)) {
                 if (firstLine) {
                     firstLine = false;
                     body      = QStringLiteral("> <%1> %2\n").arg(related.quoted_user, line);
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp
index 2bffc9be..5ea6f8c8 100644
--- a/src/timeline/RoomlistModel.cpp
+++ b/src/timeline/RoomlistModel.cpp
@@ -340,7 +340,7 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
 
             int total_unread_msgs = 0;
 
-            for (const auto &room : qAsConst(models)) {
+            for (const auto &room : std::as_const(models)) {
                 if (!room.isNull() && !room->isSpace())
                     total_unread_msgs += room->notificationCount();
             }
@@ -948,7 +948,7 @@ FilteredRoomlistModel::updateHiddenTagsAndSpaces()
     hideDMs = false;
 
     auto hidden = UserSettings::instance()->hiddenTags();
-    for (const auto &t : qAsConst(hidden)) {
+    for (const auto &t : std::as_const(hidden)) {
         if (t.startsWith(u"tag:"))
             hiddenTags.push_back(t.mid(4));
         else if (t.startsWith(u"space:"))
diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp
index 769f2c8d..5f4184b3 100644
--- a/src/ui/RoomSettings.cpp
+++ b/src/ui/RoomSettings.cpp
@@ -728,7 +728,7 @@ RoomSettingsAllowedRoomsModel::RoomSettingsAllowedRoomsModel(RoomSettings *paren
 
     this->listedRoomIds = QStringList(parentSpaces.begin(), parentSpaces.end());
 
-    for (const auto &e : qAsConst(this->allowedRoomIds)) {
+    for (const auto &e : std::as_const(this->allowedRoomIds)) {
         if (!this->parentSpaces.count(e))
             this->listedRoomIds.push_back(e);
     }