mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 03:58:49 +03:00
Qt6.6 compatibility
This commit is contained in:
parent
4ec463bee2
commit
45ecb71444
16 changed files with 32 additions and 32 deletions
|
@ -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);
|
fetchAliasesStatus(alias.alias);
|
||||||
}
|
}
|
||||||
fetchPublishedAliases();
|
fetchPublishedAliases();
|
||||||
|
@ -148,7 +148,7 @@ void
|
||||||
AliasEditingModel::addAlias(QString newAlias)
|
AliasEditingModel::addAlias(QString newAlias)
|
||||||
{
|
{
|
||||||
const auto aliasStr = newAlias.toStdString();
|
const auto aliasStr = newAlias.toStdString();
|
||||||
for (const auto &e : qAsConst(aliases)) {
|
for (const auto &e : std::as_const(aliases)) {
|
||||||
if (e.alias == aliasStr) {
|
if (e.alias == aliasStr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ Cache::setup()
|
||||||
QDir stateDir(cacheDirectory_);
|
QDir stateDir(cacheDirectory_);
|
||||||
|
|
||||||
auto eList = stateDir.entryList(QDir::NoDotAndDotDot);
|
auto eList = stateDir.entryList(QDir::NoDotAndDotDot);
|
||||||
for (const auto &file : qAsConst(eList)) {
|
for (const auto &file : std::as_const(eList)) {
|
||||||
if (!stateDir.remove(file))
|
if (!stateDir.remove(file))
|
||||||
throw std::runtime_error(("Unable to delete file " + file).toStdString().c_str());
|
throw std::runtime_error(("Unable to delete file " + file).toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1573,7 +1573,7 @@ ChatPage::handleMatrixUri(QString uri)
|
||||||
|
|
||||||
auto items =
|
auto items =
|
||||||
uri_.query(QUrl::ComponentFormattingOption::FullyEncoded).split('&', Qt::SkipEmptyParts);
|
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());
|
nhlog::ui()->info("item: {}", item.toStdString());
|
||||||
|
|
||||||
if (item.startsWith(QLatin1String("action="))) {
|
if (item.startsWith(QLatin1String("action="))) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ InviteesModel::InviteesModel(TimelineModel *room, QObject *parent)
|
||||||
void
|
void
|
||||||
InviteesModel::addUser(QString mxid, QString displayName, QString avatarUrl)
|
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)
|
if (invitee->mxid_ == mxid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ InviteesModel::mxids()
|
||||||
{
|
{
|
||||||
QStringList mxidList;
|
QStringList mxidList;
|
||||||
mxidList.reserve(invitees_.size());
|
mxidList.reserve(invitees_.size());
|
||||||
for (auto &invitee : qAsConst(invitees_))
|
for (auto &invitee : std::as_const(invitees_))
|
||||||
mxidList.push_back(invitee->mxid_);
|
mxidList.push_back(invitee->mxid_);
|
||||||
return mxidList;
|
return mxidList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ MxcImageProvider::MxcImageProvider()
|
||||||
QDir::Filter::Writable | QDir::Filter::NoDotAndDotDot | QDir::Filter::Files);
|
QDir::Filter::Writable | QDir::Filter::NoDotAndDotDot | QDir::Filter::Files);
|
||||||
|
|
||||||
auto files = dir.entryInfoList();
|
auto files = dir.entryInfoList();
|
||||||
for (const auto &fileInfo : qAsConst(files)) {
|
for (const auto &fileInfo : std::as_const(files)) {
|
||||||
if (fileInfo.fileTime(QFile::FileTime::FileAccessTime)
|
if (fileInfo.fileTime(QFile::FileTime::FileAccessTime)
|
||||||
.daysTo(QDateTime::currentDateTime()) > 30) {
|
.daysTo(QDateTime::currentDateTime()) > 30) {
|
||||||
if (QFile::remove(fileInfo.absoluteFilePath()))
|
if (QFile::remove(fileInfo.absoluteFilePath()))
|
||||||
|
|
|
@ -83,7 +83,7 @@ std::map<std::string, mtx::events::state::power_level_t, std::less<>>
|
||||||
PowerlevelsTypeListModel::toEvents() const
|
PowerlevelsTypeListModel::toEvents() const
|
||||||
{
|
{
|
||||||
std::map<std::string, mtx::events::state::power_level_t, std::less<>> m;
|
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)
|
if (key.find('.') != std::string::npos)
|
||||||
m[key] = pl;
|
m[key] = pl;
|
||||||
return m;
|
return m;
|
||||||
|
@ -91,7 +91,7 @@ PowerlevelsTypeListModel::toEvents() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsTypeListModel::kick() const
|
PowerlevelsTypeListModel::kick() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(types))
|
for (const auto &[key, pl] : std::as_const(types))
|
||||||
if (key == "kick")
|
if (key == "kick")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -99,7 +99,7 @@ PowerlevelsTypeListModel::kick() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsTypeListModel::invite() const
|
PowerlevelsTypeListModel::invite() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(types))
|
for (const auto &[key, pl] : std::as_const(types))
|
||||||
if (key == "invite")
|
if (key == "invite")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -107,7 +107,7 @@ PowerlevelsTypeListModel::invite() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsTypeListModel::ban() const
|
PowerlevelsTypeListModel::ban() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(types))
|
for (const auto &[key, pl] : std::as_const(types))
|
||||||
if (key == "ban")
|
if (key == "ban")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -115,7 +115,7 @@ PowerlevelsTypeListModel::ban() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsTypeListModel::eventsDefault() const
|
PowerlevelsTypeListModel::eventsDefault() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(types))
|
for (const auto &[key, pl] : std::as_const(types))
|
||||||
if (key == "zdefault_events")
|
if (key == "zdefault_events")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -123,7 +123,7 @@ PowerlevelsTypeListModel::eventsDefault() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsTypeListModel::stateDefault() const
|
PowerlevelsTypeListModel::stateDefault() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(types))
|
for (const auto &[key, pl] : std::as_const(types))
|
||||||
if (key == "zdefault_states")
|
if (key == "zdefault_states")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -399,7 +399,7 @@ std::map<std::string, mtx::events::state::power_level_t, std::less<>>
|
||||||
PowerlevelsUserListModel::toUsers() const
|
PowerlevelsUserListModel::toUsers() const
|
||||||
{
|
{
|
||||||
std::map<std::string, mtx::events::state::power_level_t, std::less<>> m;
|
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) == '@')
|
if (key.size() > 0 && key.at(0) == '@')
|
||||||
m[key] = pl;
|
m[key] = pl;
|
||||||
return m;
|
return m;
|
||||||
|
@ -407,7 +407,7 @@ PowerlevelsUserListModel::toUsers() const
|
||||||
mtx::events::state::power_level_t
|
mtx::events::state::power_level_t
|
||||||
PowerlevelsUserListModel::usersDefault() const
|
PowerlevelsUserListModel::usersDefault() const
|
||||||
{
|
{
|
||||||
for (const auto &[key, pl] : qAsConst(users))
|
for (const auto &[key, pl] : std::as_const(users))
|
||||||
if (key == "default")
|
if (key == "default")
|
||||||
return pl;
|
return pl;
|
||||||
return powerLevels_.users_default;
|
return powerLevels_.users_default;
|
||||||
|
@ -635,7 +635,7 @@ PowerlevelEditingModels::updateSpacesModel()
|
||||||
void
|
void
|
||||||
PowerlevelEditingModels::addRole(int pl)
|
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))
|
if (pl == int(e.pl))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -752,7 +752,7 @@ PowerlevelsSpacesListModel::commit()
|
||||||
{
|
{
|
||||||
std::vector<std::string> spacesToApplyTo;
|
std::vector<std::string> spacesToApplyTo;
|
||||||
|
|
||||||
for (const auto &s : qAsConst(spaces))
|
for (const auto &s : std::as_const(spaces))
|
||||||
if (s.apply)
|
if (s.apply)
|
||||||
spacesToApplyTo.push_back(s.roomid);
|
spacesToApplyTo.push_back(s.roomid);
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
|
|
||||||
collapsedSpaces_.clear();
|
collapsedSpaces_.clear();
|
||||||
auto tempSpaces = settings.value(prefix + "user/collapsed_spaces", QList<QVariant>{}).toList();
|
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());
|
collapsedSpaces_.push_back(e.toStringList());
|
||||||
|
|
||||||
shareKeysWithTrustedUsers_ =
|
shareKeysWithTrustedUsers_ =
|
||||||
|
@ -962,7 +962,7 @@ UserSettings::save()
|
||||||
|
|
||||||
QVariantList v;
|
QVariantList v;
|
||||||
v.reserve(collapsedSpaces_.size());
|
v.reserve(collapsedSpaces_.size());
|
||||||
for (const auto &e : qAsConst(collapsedSpaces_))
|
for (const auto &e : std::as_const(collapsedSpaces_))
|
||||||
v.push_back(e);
|
v.push_back(e);
|
||||||
settings.setValue(prefix + "user/collapsed_spaces", v);
|
settings.setValue(prefix + "user/collapsed_spaces", v);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ NotificationsManager::removeNotifications(const QString &roomId_,
|
||||||
markerPos = std::max(markerPos, cache::getEventIndex(room_id, e.toStdString()).value_or(0));
|
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_)
|
if (roomId != roomId_)
|
||||||
continue;
|
continue;
|
||||||
auto idx = cache::getEventIndex(room_id, eventId.toStdString());
|
auto idx = cache::getEventIndex(room_id, eventId.toStdString());
|
||||||
|
|
|
@ -36,14 +36,14 @@ NotificationsManager::NotificationsManager(QObject *parent)
|
||||||
this)
|
this)
|
||||||
, hasMarkup_{std::invoke([this]() -> bool {
|
, hasMarkup_{std::invoke([this]() -> bool {
|
||||||
auto caps = dbus.call("GetCapabilities").arguments();
|
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"))
|
if (x.toStringList().contains("body-markup"))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
})}
|
})}
|
||||||
, hasImages_{std::invoke([this]() -> bool {
|
, hasImages_{std::invoke([this]() -> bool {
|
||||||
auto caps = dbus.call("GetCapabilities").arguments();
|
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"))
|
if (x.toStringList().contains("body-images"))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -581,7 +581,7 @@ CommunitiesModel::setCurrentTagId(const QString &tagId)
|
||||||
|
|
||||||
if (tagId.startsWith(QLatin1String("tag:"))) {
|
if (tagId.startsWith(QLatin1String("tag:"))) {
|
||||||
auto tag = tagId.mid(4);
|
auto tag = tagId.mid(4);
|
||||||
for (const auto &t : qAsConst(tags_)) {
|
for (const auto &t : std::as_const(tags_)) {
|
||||||
if (t == tag) {
|
if (t == tag) {
|
||||||
this->currentTagId_ = tagId;
|
this->currentTagId_ = tagId;
|
||||||
UserSettings::instance()->setCurrentTagId(tagId);
|
UserSettings::instance()->setCurrentTagId(tagId);
|
||||||
|
|
|
@ -96,7 +96,7 @@ DelegateChooser::clearChoices(QQmlListProperty<DelegateChoice> *p)
|
||||||
void
|
void
|
||||||
DelegateChooser::recalcChild()
|
DelegateChooser::recalcChild()
|
||||||
{
|
{
|
||||||
for (const auto choice : qAsConst(choices_)) {
|
for (const auto choice : std::as_const(choices_)) {
|
||||||
const auto &choiceValue = choice->roleValueRef();
|
const auto &choiceValue = choice->roleValueRef();
|
||||||
if (choiceValue == roleValue_ || (!choiceValue.isValid() && !roleValue_.isValid())) {
|
if (choiceValue == roleValue_ || (!choiceValue.isValid() && !roleValue_.isValid())) {
|
||||||
if (child_) {
|
if (child_) {
|
||||||
|
@ -134,7 +134,7 @@ DelegateChooser::DelegateIncubator::statusChanged(QQmlIncubator::Status status)
|
||||||
|
|
||||||
} else if (status == QQmlIncubator::Error) {
|
} else if (status == QQmlIncubator::Error) {
|
||||||
auto errors_ = errors();
|
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());
|
nhlog::ui()->error("Error instantiating delegate: {}", e.toString().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ EventDelegateChooser::DelegateIncubator::reset(QString id)
|
||||||
.toInt();
|
.toInt();
|
||||||
this->oldType = role;
|
this->oldType = role;
|
||||||
|
|
||||||
for (const auto choice : qAsConst(chooser.choices_)) {
|
for (const auto choice : std::as_const(chooser.choices_)) {
|
||||||
const auto &choiceValue = choice->roleValues();
|
const auto &choiceValue = choice->roleValues();
|
||||||
if (choiceValue.contains(role) || choiceValue.empty()) {
|
if (choiceValue.contains(role) || choiceValue.empty()) {
|
||||||
// nhlog::ui()->debug(
|
// nhlog::ui()->debug(
|
||||||
|
@ -288,7 +288,7 @@ EventDelegateChooser::DelegateIncubator::statusChanged(QQmlIncubator::Status sta
|
||||||
chooser.polish();
|
chooser.polish();
|
||||||
} else if (status == QQmlIncubator::Error) {
|
} else if (status == QQmlIncubator::Error) {
|
||||||
auto errors_ = errors();
|
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());
|
nhlog::ui()->error("Error instantiating delegate: {}", e.toString().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,7 +800,7 @@ EventStore::enableKeyRequests(bool suppressKeyRequests_)
|
||||||
{
|
{
|
||||||
if (!suppressKeyRequests_) {
|
if (!suppressKeyRequests_) {
|
||||||
auto keys = decryptedEvents_.keys();
|
auto keys = decryptedEvents_.keys();
|
||||||
for (const auto &key : qAsConst(keys))
|
for (const auto &key : std::as_const(keys))
|
||||||
if (key.room == this->room_id_)
|
if (key.room == this->room_id_)
|
||||||
decryptedEvents_.remove(key);
|
decryptedEvents_.remove(key);
|
||||||
suppressKeyRequests = false;
|
suppressKeyRequests = false;
|
||||||
|
|
|
@ -491,7 +491,7 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
|
||||||
QString body;
|
QString body;
|
||||||
bool firstLine = true;
|
bool firstLine = true;
|
||||||
auto lines = QStringView(related.quoted_body).split(u'\n');
|
auto lines = QStringView(related.quoted_body).split(u'\n');
|
||||||
for (auto line : qAsConst(lines)) {
|
for (auto line : std::as_const(lines)) {
|
||||||
if (firstLine) {
|
if (firstLine) {
|
||||||
firstLine = false;
|
firstLine = false;
|
||||||
body = QStringLiteral("> <%1> %2\n").arg(related.quoted_user, line);
|
body = QStringLiteral("> <%1> %2\n").arg(related.quoted_user, line);
|
||||||
|
|
|
@ -340,7 +340,7 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
|
||||||
|
|
||||||
int total_unread_msgs = 0;
|
int total_unread_msgs = 0;
|
||||||
|
|
||||||
for (const auto &room : qAsConst(models)) {
|
for (const auto &room : std::as_const(models)) {
|
||||||
if (!room.isNull() && !room->isSpace())
|
if (!room.isNull() && !room->isSpace())
|
||||||
total_unread_msgs += room->notificationCount();
|
total_unread_msgs += room->notificationCount();
|
||||||
}
|
}
|
||||||
|
@ -948,7 +948,7 @@ FilteredRoomlistModel::updateHiddenTagsAndSpaces()
|
||||||
hideDMs = false;
|
hideDMs = false;
|
||||||
|
|
||||||
auto hidden = UserSettings::instance()->hiddenTags();
|
auto hidden = UserSettings::instance()->hiddenTags();
|
||||||
for (const auto &t : qAsConst(hidden)) {
|
for (const auto &t : std::as_const(hidden)) {
|
||||||
if (t.startsWith(u"tag:"))
|
if (t.startsWith(u"tag:"))
|
||||||
hiddenTags.push_back(t.mid(4));
|
hiddenTags.push_back(t.mid(4));
|
||||||
else if (t.startsWith(u"space:"))
|
else if (t.startsWith(u"space:"))
|
||||||
|
|
|
@ -728,7 +728,7 @@ RoomSettingsAllowedRoomsModel::RoomSettingsAllowedRoomsModel(RoomSettings *paren
|
||||||
|
|
||||||
this->listedRoomIds = QStringList(parentSpaces.begin(), parentSpaces.end());
|
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))
|
if (!this->parentSpaces.count(e))
|
||||||
this->listedRoomIds.push_back(e);
|
this->listedRoomIds.push_back(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue