diff --git a/iris b/iris index f29160247..33906e74a 160000 --- a/iris +++ b/iris @@ -1 +1 @@ -Subproject commit f29160247b896e2d7272aff0b46f3202a43cd80c +Subproject commit 33906e74ae0715fea6a8ea01d5257bb157d5234b diff --git a/plugins/include/accountinfoaccessinghost.h b/plugins/include/accountinfoaccessinghost.h index fc22a7c35..a662d6f90 100644 --- a/plugins/include/accountinfoaccessinghost.h +++ b/plugins/include/accountinfoaccessinghost.h @@ -5,7 +5,6 @@ #include class QString; -class QStringList; class AccountInfoAccessingHost { public: diff --git a/plugins/include/contactinfoaccessinghost.h b/plugins/include/contactinfoaccessinghost.h index ce9b5a005..ae65e8b75 100644 --- a/plugins/include/contactinfoaccessinghost.h +++ b/plugins/include/contactinfoaccessinghost.h @@ -4,7 +4,6 @@ #include class QString; -class QStringList; class ContactInfoAccessingHost { public: diff --git a/src/Certificates/CertificateHelpers.cpp b/src/Certificates/CertificateHelpers.cpp index d9dbf856a..3b4766834 100644 --- a/src/Certificates/CertificateHelpers.cpp +++ b/src/Certificates/CertificateHelpers.cpp @@ -53,7 +53,7 @@ CertificateCollection CertificateHelpers::allCertificates(const QStringList &sto // Read in old XML format certificates (DEPRECATED) store.setNameFilters(QStringList("*.xml")); cert_files = store.entryList(); - for (const auto &cf : qAsConst(cert_files)) { + for (const auto &cf : std::as_const(cert_files)) { qWarning() << "Loading certificate in obsolete XML format: " << store.filePath(cf); QFile f(store.filePath(cf)); if (!f.open(QIODevice::ReadOnly)) diff --git a/src/accountregdlg.h b/src/accountregdlg.h index 1122cf7f9..49b92dcd1 100644 --- a/src/accountregdlg.h +++ b/src/accountregdlg.h @@ -33,7 +33,6 @@ class ProxyManager; class PsiCon; class QByteArray; class QScrollArea; -class QStringList; class QWidget; class ServerListQuerier; class XDataWidget; diff --git a/src/actionlist.cpp b/src/actionlist.cpp index 388d2bb26..7d8de579d 100644 --- a/src/actionlist.cpp +++ b/src/actionlist.cpp @@ -142,7 +142,7 @@ MetaActionList::~MetaActionList() ActionList *MetaActionList::actionList(const QString &name) const { - for (ActionList *a : qAsConst(d->lists)) { + for (ActionList *a : std::as_const(d->lists)) { if (a->name() == name) return a; } @@ -167,7 +167,7 @@ QList MetaActionList::actionLists(const unsigned int id) const if (!(id & (1u << i))) continue; - for (ActionList *a : qAsConst(d->lists)) { + for (ActionList *a : std::as_const(d->lists)) { if (uint(a->id()) & (1u << i)) list.append(a); } @@ -195,7 +195,7 @@ QStringList MetaActionList::actionLists() const { QStringList names; - for (ActionList *l : qAsConst(d->lists)) + for (ActionList *l : std::as_const(d->lists)) names << l->name(); return names; @@ -209,7 +209,7 @@ void MetaActionList::addList(ActionList *list) void MetaActionList::clear() { - for (ActionList *l : qAsConst(d->lists)) { + for (ActionList *l : std::as_const(d->lists)) { l->clear(); } } diff --git a/src/activeprofiles_dbus.cpp b/src/activeprofiles_dbus.cpp index 87b565212..81c175742 100644 --- a/src/activeprofiles_dbus.cpp +++ b/src/activeprofiles_dbus.cpp @@ -164,7 +164,7 @@ bool ActiveProfiles::setThisProfile(const QString &profile) void ActiveProfiles::unsetThisProfile() { QDBusConnectionInterface *dbusIface = QDBusConnection::sessionBus().interface(); - for (const QString &name : qAsConst(d->busNames)) { + for (const QString &name : std::as_const(d->busNames)) { dbusIface->unregisterService(name); } d->busNames.clear(); diff --git a/src/activitydlg.cpp b/src/activitydlg.cpp index f03a736d2..a181d6542 100644 --- a/src/activitydlg.cpp +++ b/src/activitydlg.cpp @@ -95,7 +95,7 @@ void ActivityDlg::setActivity() QString generalActivityStr = ui_.cb_general_type->currentText(); QString specificActivityStr = ui_.cb_specific_type->currentText(); - for (PsiAccount *pa : qAsConst(pa_)) { + for (PsiAccount *pa : std::as_const(pa_)) { if (generalActivityStr == tr("")) { pa->pepManager()->disable(PEP_ACTIVITY_TN, PEP_ACTIVITY_NS, "current"); } else { diff --git a/src/adduserdlg.h b/src/adduserdlg.h index feb3878eb..7c5720f5e 100644 --- a/src/adduserdlg.h +++ b/src/adduserdlg.h @@ -24,7 +24,6 @@ class PsiAccount; class QString; -class QStringList; namespace XMPP { class Jid; diff --git a/src/alertmanager.cpp b/src/alertmanager.cpp index b5535c2e3..5fe917454 100644 --- a/src/alertmanager.cpp +++ b/src/alertmanager.cpp @@ -68,7 +68,7 @@ void AlertManager::dialogUnregister(QWidget *w) return; } - for (Item *i : qAsConst(list_)) { + for (Item *i : std::as_const(list_)) { if (i->widget == w) { list_.removeAll(i); delete i; diff --git a/src/applicationinfo.h b/src/applicationinfo.h index 39e2a219c..3f5093279 100644 --- a/src/applicationinfo.h +++ b/src/applicationinfo.h @@ -3,7 +3,6 @@ class QLatin1String; class QString; -class QStringList; class ApplicationInfo { public: diff --git a/src/avcall/jinglertp.cpp b/src/avcall/jinglertp.cpp index 3a7ca7fb6..80067930a 100644 --- a/src/avcall/jinglertp.cpp +++ b/src/avcall/jinglertp.cpp @@ -198,7 +198,7 @@ class IceStopper : public QObject { } left = iceList; - for (XMPP::Ice176 *ice : qAsConst(left)) { + for (XMPP::Ice176 *ice : std::as_const(left)) { ice->setParent(this); if (ice->isStopped()) { ice_stopped(ice); @@ -713,7 +713,7 @@ class JingleRtpPrivate : public QObject { QList localAddrs; QStringList strList; - for (const auto &h : qAsConst(listenAddrs)) { + for (const auto &h : std::as_const(listenAddrs)) { localAddrs += XMPP::Ice176::LocalAddress { h }; strList += h.toString(); } @@ -726,7 +726,7 @@ class JingleRtpPrivate : public QObject { if (!strList.isEmpty()) { printf("Host addresses:\n"); - for (const QString &s : qAsConst(strList)) + for (const QString &s : std::as_const(strList)) printf(" %s\n", qPrintable(s)); } diff --git a/src/bookmarkmanagedlg.cpp b/src/bookmarkmanagedlg.cpp index c437bdc8a..705fc3913 100644 --- a/src/bookmarkmanagedlg.cpp +++ b/src/bookmarkmanagedlg.cpp @@ -145,7 +145,7 @@ void BookmarkManageDlg::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE if (hint == QAbstractItemDelegate::SubmitModelCache) { QList lineEdits; lineEdits << ui_.host << ui_.room << ui_.nickname; - for (QLineEdit *lineEdit : qAsConst(lineEdits)) { + for (QLineEdit *lineEdit : std::as_const(lineEdits)) { if (lineEdit->text().isEmpty()) { lineEdit->setFocus(); break; @@ -175,7 +175,7 @@ void BookmarkManageDlg::selectionChanged(const QItemSelection &selected, const Q ui_.autoJoin->setCurrentIndex(current.data(AutoJoinRole).toInt()); QList editors; editors << ui_.host << ui_.room << ui_.nickname << ui_.password << ui_.autoJoin; - for (QWidget *w : qAsConst(editors)) { + for (QWidget *w : std::as_const(editors)) { w->setEnabled(current.isValid()); } diff --git a/src/bookmarkmanager.cpp b/src/bookmarkmanager.cpp index 5b529e5af..46c06bd20 100644 --- a/src/bookmarkmanager.cpp +++ b/src/bookmarkmanager.cpp @@ -145,7 +145,7 @@ void BookmarkManager::removeConference(const XMPP::Jid &j) { if (isAvailable_) { QList confs; - for (const ConferenceBookmark &c : qAsConst(conferences_)) { + for (const ConferenceBookmark &c : std::as_const(conferences_)) { if (!c.jid().compare(j, false)) { confs.push_back(c); } @@ -264,7 +264,7 @@ void BookmarkManager::setBookmarks_finished() QStringList localMucs; QStringList ignoreMucs; - for (const ConferenceBookmark &cb : qAsConst(conferences_)) { + for (const ConferenceBookmark &cb : std::as_const(conferences_)) { if (cb.autoJoin() == ConferenceBookmark::OnlyThisComputer) { localMucs.append(cb.jid().withResource(cb.nick()).full()); } diff --git a/src/bosskey.cpp b/src/bosskey.cpp index d7bc4a4c6..4badda779 100644 --- a/src/bosskey.cpp +++ b/src/bosskey.cpp @@ -73,7 +73,7 @@ void BossKey::doHide() void BossKey::doShow() { - for (QPointer p : qAsConst(hiddenWidgets_)) { + for (QPointer p : std::as_const(hiddenWidgets_)) { if (p) { p->show(); } diff --git a/src/chatdlg.cpp b/src/chatdlg.cpp index 065b559bf..77d77fbe1 100644 --- a/src/chatdlg.cpp +++ b/src/chatdlg.cpp @@ -924,11 +924,11 @@ void ChatDlg::holdMessages(bool hold) if (!delayedMessages) delayedMessages = new QList(); } else if (delayedMessages) { - for (const MessageView &mv : qAsConst(*delayedMessages)) { + for (const MessageView &mv : std::as_const(*delayedMessages)) { if (mv.isSpooled()) displayMessage(mv); } - for (const MessageView &mv : qAsConst(*delayedMessages)) { + for (const MessageView &mv : std::as_const(*delayedMessages)) { if (!mv.isSpooled()) displayMessage(mv); } diff --git a/src/chatsplitter.cpp b/src/chatsplitter.cpp index 79416a3bb..eb8590917 100644 --- a/src/chatsplitter.cpp +++ b/src/chatsplitter.cpp @@ -120,7 +120,7 @@ void ChatSplitter::setSplitterEnabled(bool enable) */ void ChatSplitter::updateLayout() { - for (QWidget *child : qAsConst(children_)) + for (QWidget *child : std::as_const(children_)) child->setParent(this); delete splitter_; @@ -132,7 +132,7 @@ void ChatSplitter::updateLayout() splitter_->setOrientation(Qt::Vertical); splitter_->setVisible(splitterEnabled()); - for (QWidget *child : qAsConst(children_)) + for (QWidget *child : std::as_const(children_)) updateChildLayout(child); connect(splitter_, SIGNAL(splitterMoved(int, int)), SIGNAL(splitterMoved(int, int))); diff --git a/src/chatviewthemeprovider.cpp b/src/chatviewthemeprovider.cpp index 4daaeb1b5..85e789cd9 100644 --- a/src/chatviewthemeprovider.cpp +++ b/src/chatviewthemeprovider.cpp @@ -54,7 +54,7 @@ const QStringList ChatViewThemeProvider::themeIds() const dirs << ApplicationInfo::resourcesDir(); QSet ret; - for (const QString &dir : qAsConst(dirs)) { + for (const QString &dir : std::as_const(dirs)) { foreach (QFileInfo tDirInfo, QDir(dir + "/themes/chatview/").entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot)) { QString typeName = tDirInfo.fileName(); diff --git a/src/contactlistdragmodel.cpp b/src/contactlistdragmodel.cpp index 0da170603..abae24f80 100644 --- a/src/contactlistdragmodel.cpp +++ b/src/contactlistdragmodel.cpp @@ -103,7 +103,7 @@ void ContactListModelOperationList::removeAccidentalContactMoveOperations() QList contacts = operations_.keys(); for (PsiContact *psiContact : contacts) { bool remove = false; - for (const Operation &op : qAsConst(operations_[psiContact])) { + for (const Operation &op : std::as_const(operations_[psiContact])) { if (psiContact->groups().contains(op.groupTo)) { remove = true; break; diff --git a/src/contactlistdragview.cpp b/src/contactlistdragview.cpp index 63b02a162..6d069809f 100644 --- a/src/contactlistdragview.cpp +++ b/src/contactlistdragview.cpp @@ -642,7 +642,7 @@ void ContactListDragView::removeSelection() return; // Ask for deleting only some contacts. Exclude private contacts and not in list contacts - for (PsiContact *contact : qAsConst(contacts)) { + for (PsiContact *contact : std::as_const(contacts)) { QString name = contact->name(); if (name != contact->jid().full()) { name = QString("%1 (%2)").arg(name, TextUtil::escape(contact->jid().full())); @@ -668,7 +668,7 @@ void ContactListDragView::removeSelection() } if (doRemove) { - for (PsiContact *contact : qAsConst(contacts)) { + for (PsiContact *contact : std::as_const(contacts)) { contact->remove(); } } diff --git a/src/contactlistmodel.cpp b/src/contactlistmodel.cpp index ba0819835..7da3b1847 100644 --- a/src/contactlistmodel.cpp +++ b/src/contactlistmodel.cpp @@ -154,7 +154,7 @@ void ContactListModel::Private::updateContacts(const QList &contac QModelIndexList indexes2 = q->indexesFor(contact); indexes += indexes2; - for (const QModelIndex &index : qAsConst(indexes2)) { + for (const QModelIndex &index : std::as_const(indexes2)) { QModelIndex parent = index.parent(); int row = index.row(); if (ranges.contains(parent)) { @@ -372,7 +372,7 @@ void ContactListModel::Private::contactUpdated() ContactListItem::SpecialGroupType specialGroupType = specialGroupFor(contact); if (specialGroupType == ContactListItem::SpecialGroupType::NoneSpecialGroupType) { QStringList groups1; - for (ContactListItem *item : qAsConst(groupItems)) { + for (ContactListItem *item : std::as_const(groupItems)) { groups1 << item->name(); } groups1.sort(); @@ -617,7 +617,7 @@ bool ContactListModel::setData(const QModelIndex &index, const QVariant &data, i contacts << item->child(i)->contact(); } - for (PsiContact *contact : qAsConst(contacts)) { + for (PsiContact *contact : std::as_const(contacts)) { QStringList groups = contact->groups(); groups.removeOne(oldName); groups << name; diff --git a/src/contactmanager/contactmanagerdlg.cpp b/src/contactmanager/contactmanagerdlg.cpp index 54040b84c..f317b297d 100644 --- a/src/contactmanager/contactmanagerdlg.cpp +++ b/src/contactmanager/contactmanagerdlg.cpp @@ -150,7 +150,7 @@ void ContactManagerDlg::executeCurrent() changeDomain(users); break; case 6: // resolve nicks - for (UserListItem *u : qAsConst(users)) { + for (UserListItem *u : std::as_const(users)) { pa_->resolveContactName(u->jid()); } break; diff --git a/src/contactmanager/contactmanagermodel.cpp b/src/contactmanager/contactmanagermodel.cpp index 40e5abcfd..6e1757afe 100644 --- a/src/contactmanager/contactmanagermodel.cpp +++ b/src/contactmanager/contactmanagermodel.cpp @@ -231,7 +231,7 @@ bool ContactManagerModel::sortLessThan(UserListItem *u1, UserListItem *u2) QList ContactManagerModel::checkedUsers() { QList users; - for (UserListItem *u : qAsConst(_userList)) { + for (UserListItem *u : std::as_const(_userList)) { if (checks.contains(u->jid().full())) { users.append(u); } @@ -248,7 +248,7 @@ void ContactManagerModel::invertByMatch(int columnIndex, int matchType, const QS if (matchType == ContactManagerModel::RegexpMatch) { reg = QRegularExpression(str); } - for (UserListItem *u : qAsConst(_userList)) { + for (UserListItem *u : std::as_const(_userList)) { data = userFieldString(u, columnRole); if ((matchType == ContactManagerModel::SimpleMatch && str == data) || (matchType == ContactManagerModel::RegexpMatch && reg.indexIn(data) != -1)) { @@ -270,7 +270,7 @@ void ContactManagerModel::client_rosterItemUpdated(const RosterItem &item) { con void ContactManagerModel::contactUpdated(const Jid &jid) { int i = 0; - for (UserListItem *lu : qAsConst(_userList)) { + for (UserListItem *lu : std::as_const(_userList)) { if (lu->jid() == jid) { emit dataChanged(index(i, 1), index(i, columnNames.count() - 1)); } diff --git a/src/edbflatfile.cpp b/src/edbflatfile.cpp index bcecdd55d..f99d1c4a7 100644 --- a/src/edbflatfile.cpp +++ b/src/edbflatfile.cpp @@ -169,7 +169,7 @@ quint64 EDBFlatFile::eventsCount(const QString &accId, const XMPP::Jid &jid) EDBFlatFile::File *EDBFlatFile::findFile(const Jid &j) const { - for (File *i : qAsConst(d->flist)) { + for (File *i : std::as_const(d->flist)) { if (i->j.compare(j, false)) return i; } diff --git a/src/eventdb.cpp b/src/eventdb.cpp index 256f43413..d9267cfe9 100644 --- a/src/eventdb.cpp +++ b/src/eventdb.cpp @@ -191,7 +191,7 @@ int EDB::op_erase(const QString &accId, const Jid &j) { return erase(accId, j); void EDB::resultReady(int req, EDBResult r, int begin_row) { // deliver - for (EDBHandle *h : qAsConst(d->list)) { + for (EDBHandle *h : std::as_const(d->list)) { if (h->listeningFor() == req) { h->d->beginRow_ = begin_row; h->edb_resultReady(r); @@ -203,7 +203,7 @@ void EDB::resultReady(int req, EDBResult r, int begin_row) void EDB::writeFinished(int req, bool b) { // deliver - for (EDBHandle *h : qAsConst(d->list)) { + for (EDBHandle *h : std::as_const(d->list)) { if (h->listeningFor() == req) { h->edb_writeFinished(b); return; diff --git a/src/eventdlg.cpp b/src/eventdlg.cpp index ce7d8546a..dea318cea 100644 --- a/src/eventdlg.cpp +++ b/src/eventdlg.cpp @@ -707,7 +707,7 @@ void EventDlg::init() QList toolButtons; toolButtons << d->tb_url << d->tb_info << d->tb_history; toolButtons << d->tb_icon; - for (IconToolButton *toolButton : qAsConst(toolButtons)) + for (IconToolButton *toolButton : std::as_const(toolButtons)) if (toolButton) toolButton->setFocusPolicy(Qt::NoFocus); @@ -1107,7 +1107,7 @@ void EventDlg::to_tryComplete() if (s.length() < 1 || x != p2) return; - for (auto name : qAsConst(d->completionList)) { + for (auto name : std::as_const(d->completionList)) { if (s.length() > name.length()) continue; diff --git a/src/eventdlg.h b/src/eventdlg.h index c54ac96c8..15bc780f8 100644 --- a/src/eventdlg.h +++ b/src/eventdlg.h @@ -36,7 +36,6 @@ class PsiCon; class PsiHttpAuthRequest; class PsiIcon; class QDateTime; -class QStringList; namespace XMPP { class Jid; diff --git a/src/filesharedlg.cpp b/src/filesharedlg.cpp index 025390618..a28ed158c 100644 --- a/src/filesharedlg.cpp +++ b/src/filesharedlg.cpp @@ -146,7 +146,7 @@ void FileShareDlg::finish() QString desc = ui->lineEdit->text(); // append reference main links to description and setup their range - for (auto const &i : qAsConst(readyPublishers)) { + for (auto const &i : std::as_const(readyPublishers)) { auto r = i->toReference(myJid); if (r.isValid()) { auto uri = i->simpleSource(); diff --git a/src/filesharingitem.cpp b/src/filesharingitem.cpp index f1938f66d..4a093c1bf 100644 --- a/src/filesharingitem.cpp +++ b/src/filesharingitem.cpp @@ -191,7 +191,7 @@ bool FileSharingItem::initFromCache(FileCacheItem *cache) QString httpScheme(QString::fromLatin1("http")); QString xmppScheme(QString::fromLatin1("xmpp")); // jingle ? - for (const auto &u : qAsConst(_uris)) { + for (const auto &u : std::as_const(_uris)) { QUrl url(u); auto scheme = url.scheme(); if (scheme.startsWith(httpScheme)) { @@ -384,7 +384,7 @@ FileShareDownloader *FileSharingItem::download(bool isRanged, qint64 start, quin file.setName(_fileName); if (_flags & SizeKnown) file.setSize(_fileSize); - for (auto const &h : qAsConst(_sums)) { + for (auto const &h : std::as_const(_sums)) { file.addHash(h); } diff --git a/src/filetransdlg.cpp b/src/filetransdlg.cpp index a0a89602d..4c5d3aa08 100644 --- a/src/filetransdlg.cpp +++ b/src/filetransdlg.cpp @@ -1816,7 +1816,7 @@ void FileTransDlg::ft_error(int x, int, const QString &s) void FileTransDlg::updateItems() { - for (TransferMapping *i : qAsConst(d->transferList)) { + for (TransferMapping *i : std::as_const(d->transferList)) { if (i->h) { i->logSent(); d->updateProgress(i); diff --git a/src/geolocationdlg.cpp b/src/geolocationdlg.cpp index 65cf3fc90..91078baff 100644 --- a/src/geolocationdlg.cpp +++ b/src/geolocationdlg.cpp @@ -162,7 +162,7 @@ void GeoLocationDlg::setGeoLocation() if (!ui_.le_text->text().isEmpty()) geoloc.setText(ui_.le_text->text()); - for (PsiAccount *pa : qAsConst(pa_)) { + for (PsiAccount *pa : std::as_const(pa_)) { if (geoloc.isNull()) { pa->pepManager()->disable(PEP_GEOLOC_TN, PEP_GEOLOC_NS, "current"); } else { diff --git a/src/globalstatusmenu.cpp b/src/globalstatusmenu.cpp index 1774c81d8..57713355b 100644 --- a/src/globalstatusmenu.cpp +++ b/src/globalstatusmenu.cpp @@ -28,9 +28,9 @@ void GlobalStatusMenu::fill() { StatusMenu::fill(); // TODO: Find another way to prevent manual toggling - for (QAction *action : qAsConst(statusActs)) + for (QAction *action : std::as_const(statusActs)) connect(action, SIGNAL(triggered(bool)), SLOT(preventStateChange(bool))); - for (QAction *action : qAsConst(presetActs)) + for (QAction *action : std::as_const(presetActs)) connect(action, SIGNAL(triggered(bool)), SLOT(preventStateChange(bool))); statusChanged(makeStatus(psi->currentStatusType(), psi->currentStatusMessage())); } diff --git a/src/groupchatdlg.cpp b/src/groupchatdlg.cpp index 0700969df..1dd0590a9 100644 --- a/src/groupchatdlg.cpp +++ b/src/groupchatdlg.cpp @@ -500,7 +500,7 @@ join {,} [pass{,} } } QStringList res; - for (const QString &cmd : qAsConst(all)) { + for (const QString &cmd : std::as_const(all)) { if (cmd.startsWith(query, Qt::CaseInsensitive)) { res << cmd; } diff --git a/src/historycontactlistmodel.cpp b/src/historycontactlistmodel.cpp index 6413a642b..0b02469db 100644 --- a/src/historycontactlistmodel.cpp +++ b/src/historycontactlistmodel.cpp @@ -148,7 +148,7 @@ void HistoryContactListModel::loadContacts(PsiCon *psi, const QString &acc_id) QHash c_list; QHash groups; // Roster contacts - for (PsiContact *contact : qAsConst(contactList)) { + for (PsiContact *contact : std::as_const(contactList)) { if (contact->isConference() || contact->isPrivate()) continue; QString cId = contact->account()->id() + "|" + contact->jid().bare(); diff --git a/src/libpsi b/src/libpsi index 04ac56c00..c7fc891c0 160000 --- a/src/libpsi +++ b/src/libpsi @@ -1 +1 @@ -Subproject commit 04ac56c0081c8c750aef74a0353933aaca8e2511 +Subproject commit c7fc891c0864dde744fb5990ec02a524a9dda03a diff --git a/src/mainwin.cpp b/src/mainwin.cpp index a2121ef3b..897047c14 100644 --- a/src/mainwin.cpp +++ b/src/mainwin.cpp @@ -886,7 +886,7 @@ void MainWin::buildToolbars() // loadToolbarsState also restores correct toolbar visibility, // we might want to override that - for (PsiToolBar *tb : qAsConst(toolbars_)) { + for (PsiToolBar *tb : std::as_const(toolbars_)) { tb->updateVisibility(); } @@ -894,7 +894,7 @@ void MainWin::buildToolbars() // in case we have floating toolbars, they have inherited the 'no updates enabled' // state. now we need to explicitly re-enable updates. - for (PsiToolBar *tb : qAsConst(toolbars_)) { + for (PsiToolBar *tb : std::as_const(toolbars_)) { tb->setUpdatesEnabled(true); } diff --git a/src/mainwin_p.cpp b/src/mainwin_p.cpp index 959b9ad40..0f0c6b76c 100644 --- a/src/mainwin_p.cpp +++ b/src/mainwin_p.cpp @@ -284,7 +284,7 @@ void PopupAction::setIcon(const PsiIcon *icon, bool showText, bool alert) IconAction::setIcon(QIcon()); } - for (PopupActionButton *btn : qAsConst(d->buttons)) { + for (PopupActionButton *btn : std::as_const(d->buttons)) { btn->setIcon(d->icon, showText); } @@ -295,7 +295,7 @@ void PopupAction::setIcon(const PsiIcon *icon, bool showText, bool alert) void PopupAction::setText(const QString &text) { - for (PopupActionButton *btn : qAsConst(d->buttons)) { + for (PopupActionButton *btn : std::as_const(d->buttons)) { btn->setLabel(text); } } @@ -327,7 +327,7 @@ void PopupAction::objectDestroyed() { d->buttons.removeAll(static_castbuttons)) { + for (PopupActionButton *btn : std::as_const(d->buttons)) { btn->setEnabled(e); } } diff --git a/src/mcmdmanager.cpp b/src/mcmdmanager.cpp index 6416508ad..0665cf6ee 100644 --- a/src/mcmdmanager.cpp +++ b/src/mcmdmanager.cpp @@ -34,7 +34,7 @@ MCmdManager::MCmdManager(MCmdUiSiteIface *site_) : state_(nullptr), uiSite_(site MCmdManager::~MCmdManager() { - for (MCmdProviderIface *prov : qAsConst(providers_)) { + for (MCmdProviderIface *prov : std::as_const(providers_)) { prov->mCmdSiteDestroyed(); } } @@ -134,7 +134,7 @@ bool MCmdManager::processCommand(QString command) char tmp_3; items = parseCommand(command, -1, tmp_1, tmp_2, tmp_1, tmp_1, tmp_3); } - for (MCmdProviderIface *prov : qAsConst(providers_)) { + for (MCmdProviderIface *prov : std::as_const(providers_)) { if (prov->mCmdTryStateTransit(state_, items, tmpstate, preset)) { state_ = tmpstate; if (state_ != nullptr) { @@ -198,14 +198,14 @@ QStringList MCmdManager::completeCommand(QString &command, int pos, int &start, } QStringList res; - for (MCmdProviderIface *prov : qAsConst(providers_)) { + for (MCmdProviderIface *prov : std::as_const(providers_)) { res += prov->mCmdTryCompleteCommand(state_, query, all, part); } res.sort(); QStringList quoted; if ((state_->getFlags() & MCMDSTATE_UNPARSED) == 0) { - for (QString str : qAsConst(res)) { + for (QString str : std::as_const(res)) { QString trail; if (str.size() > 1 && str.at(str.size() - 1) == QChar(0)) { str.chop(1); diff --git a/src/minicmd.h b/src/minicmd.h index b009f399f..c97bd2387 100644 --- a/src/minicmd.h +++ b/src/minicmd.h @@ -31,7 +31,6 @@ class MCmdProviderIface; class QString; -class QStringList; /** This interface models the methods common to all mini command states. */ diff --git a/src/mooddlg.cpp b/src/mooddlg.cpp index f67a3bc55..189c1bf1a 100644 --- a/src/mooddlg.cpp +++ b/src/mooddlg.cpp @@ -56,7 +56,7 @@ MoodDlg::MoodDlg(QList list) : QDialog(nullptr), pa_(list) void MoodDlg::setMood() { QString moodstr = ui_.cb_type->currentText(); - for (PsiAccount *pa : qAsConst(pa_)) { + for (PsiAccount *pa : std::as_const(pa_)) { if (moodstr == tr("")) { pa->pepManager()->disable("mood", PEP_MOOD_NS, "current"); } else { diff --git a/src/mucaffiliationsmodel.cpp b/src/mucaffiliationsmodel.cpp index 539beb6bf..10db37100 100644 --- a/src/mucaffiliationsmodel.cpp +++ b/src/mucaffiliationsmodel.cpp @@ -104,7 +104,7 @@ bool MUCAffiliationsModel::dropMimeData(const QMimeData *data, Qt::DropAction ac // Insert the data insertRows(real_row, nb_rows, real_index); - for (const QString &text : qAsConst(newItems)) { + for (const QString &text : std::as_const(newItems)) { QModelIndex idx = index(real_row, 0, real_index); setData(idx, text); real_row++; @@ -251,7 +251,7 @@ QList MUCAffiliationsModel::changes() const // Remove all old items not present in the delta for (const MUCItem &item_old : items_old) { bool found = false; - for (const MUCItem &item_new : qAsConst(items_delta)) { + for (const MUCItem &item_new : std::as_const(items_delta)) { if (item_new.jid().compare(item_old.jid(), false)) { found = true; break; diff --git a/src/options/opt_iconset.cpp b/src/options/opt_iconset.cpp index d42ababfb..5da2fc81e 100644 --- a/src/options/opt_iconset.cpp +++ b/src/options/opt_iconset.cpp @@ -578,7 +578,7 @@ void OptionsTabIconsetEmoticons::restoreOptions() d->iss_emoticons->clear(); { - for (Iconset *is : qAsConst(PsiIconset::instance()->emoticons)) { + for (Iconset *is : std::as_const(PsiIconset::instance()->emoticons)) { d->iss_emoticons->insert(*is); d->iss_emoticons->lastItem()->setSelected(true); } @@ -587,7 +587,7 @@ void OptionsTabIconsetEmoticons::restoreOptions() { QStringList loaded; { - for (Iconset *tmp : qAsConst(PsiIconset::instance()->emoticons)) { + for (Iconset *tmp : std::as_const(PsiIconset::instance()->emoticons)) { loaded << tmp->id(); } } diff --git a/src/options/opt_input.cpp b/src/options/opt_input.cpp index 063d1eb86..c49deda2d 100644 --- a/src/options/opt_input.cpp +++ b/src/options/opt_input.cpp @@ -75,7 +75,7 @@ void OptionsTabInput::applyOptions() d->groupBoxDicts->setEnabled(isEnabled); s->setActiveLanguages(loadedDicts_); QStringList loaded; - for (auto const &id : qAsConst(loadedDicts_)) { + for (auto const &id : std::as_const(loadedDicts_)) { loaded.append(LanguageManager::toString(id)); } o->setOption(DICTS_OPTION, QVariant(loaded.join(" "))); @@ -154,7 +154,7 @@ void OptionsTabInput::fillList() if (!availableDicts_.isEmpty()) { d->availDicts->disconnect(); d->availDicts->clear(); - for (auto const &id : qAsConst(availableDicts_)) { + for (auto const &id : std::as_const(availableDicts_)) { QTreeWidgetItem *dic = new QTreeWidgetItem(d->availDicts, QTreeWidgetItem::Type); dic->setText(FullName, LanguageManager::languageName(id)); dic->setData(FullName, Qt::UserRole, QVariant::fromValue(id)); diff --git a/src/options/opt_shortcuts.cpp b/src/options/opt_shortcuts.cpp index 5fba39077..9224c9d9e 100644 --- a/src/options/opt_shortcuts.cpp +++ b/src/options/opt_shortcuts.cpp @@ -161,7 +161,7 @@ void OptionsTabShortcuts::readShortcuts(const PsiOptions *options) QList shortcutGroups = options->getChildOptionNames("options.shortcuts", true, true); /* step through the shortcut groups e.g. chatdlg */ - for (const QString &shortcutGroup : qAsConst(shortcutGroups)) { + for (const QString &shortcutGroup : std::as_const(shortcutGroups)) { topLevelItem = new QTreeWidgetItem(d->treeShortcuts); QString comment = options->getComment(shortcutGroup); @@ -196,7 +196,7 @@ void OptionsTabShortcuts::readShortcuts(const PsiOptions *options) shortcuts = options->getChildOptionNames(optionsPath, true, true); /* step through the shortcuts */ - for (const QString &shortcut : qAsConst(shortcuts)) { + for (const QString &shortcut : std::as_const(shortcuts)) { keys = ShortcutManager::readShortcutsFromOptions( shortcut.mid(QString("options.shortcuts").length() + 1), options); @@ -216,7 +216,7 @@ void OptionsTabShortcuts::readShortcuts(const PsiOptions *options) /* step through this shortcut's keys and create 'Key XXXX' entries for them */ keyItemsCount = 1; - for (const QKeySequence &key : qAsConst(keys)) { + for (const QKeySequence &key : std::as_const(keys)) { keyItem = new QTreeWidgetItem(shortcutItem); keyItem->setText(0, QString(tr("Key %1")).arg(keyItemsCount++)); keyItem->setData(0, ITEMKIND, QVariant(int(OptionsTabShortcuts::KeyItem))); diff --git a/src/options/opt_toolbars.cpp b/src/options/opt_toolbars.cpp index cc04a8328..52a8aae8e 100644 --- a/src/options/opt_toolbars.cpp +++ b/src/options/opt_toolbars.cpp @@ -226,7 +226,7 @@ void OptionsTabToolbars::applyOptions() PsiOptions *o = PsiOptions::instance(); o->removeOption("options.ui.contactlist.toolbars", true); - for (const ToolbarPrefs &toolbar : qAsConst(p->toolbars)) { + for (const ToolbarPrefs &toolbar : std::as_const(p->toolbars)) { PsiToolBar::structToOptions(o, toolbar); } } @@ -255,7 +255,7 @@ void OptionsTabToolbars::restoreOptions() QString chatToolbarName = tr("Chat"); QString groupchatToolbarName = tr("Groupchat"); - for (const QString &base : qAsConst(sortedToolbarBases)) { + for (const QString &base : std::as_const(sortedToolbarBases)) { ToolbarPrefs tb; tb.id = o->getOption(base + ".key").toString(); @@ -299,7 +299,7 @@ void OptionsTabToolbars::toolbarAdd() do { ok = true; tb.name = QObject::tr("").arg(j++); - for (const ToolbarPrefs &other : qAsConst(p->toolbars)) { + for (const ToolbarPrefs &other : std::as_const(p->toolbars)) { if (other.name == tb.name) { ok = false; break; @@ -459,7 +459,7 @@ void OptionsTabToolbars::toolbarSelectionChanged(int item) tw->resizeColumnToContents(0); } - for (auto const &name : qAsConst(tb.keys)) { + for (auto const &name : std::as_const(tb.keys)) { addToolbarAction(d->lw_selectedActions, name, p->currentType()); } updateArrows(); diff --git a/src/options/optionsdlgbase.cpp b/src/options/optionsdlgbase.cpp index d03960e22..0cd20c1fd 100644 --- a/src/options/optionsdlgbase.cpp +++ b/src/options/optionsdlgbase.cpp @@ -316,7 +316,7 @@ void OptionsDlgBase::Private::openTab(const QString &id) QWidget *tab = id2widget.value(id); if (!tab) { bool found = false; - for (OptionsTab *opttab : qAsConst(tabs)) { + for (OptionsTab *opttab : std::as_const(tabs)) { if (opttab->id() == id) { tab = opttab->widget(); // create the widget if (!tab) @@ -358,7 +358,7 @@ void OptionsDlgBase::Private::openTab(const QString &id) } } - for (OptionsTab *opttab : qAsConst(tabs)) { + for (OptionsTab *opttab : std::as_const(tabs)) { if (opttab->id() == id) { dlg->lb_pageTitle->setText(opttab->name()); dlg->lb_pageTitle->setHelp(opttab->desc()); @@ -459,7 +459,7 @@ void OptionsDlgBase::Private::doApply() if (!dirty) return; - for (OptionsTab *opttab : qAsConst(tabs)) { + for (OptionsTab *opttab : std::as_const(tabs)) { opttab->applyOptions(); } diff --git a/src/options/optionstab.cpp b/src/options/optionstab.cpp index b0d48f80f..700478256 100644 --- a/src/options/optionstab.cpp +++ b/src/options/optionstab.cpp @@ -232,7 +232,7 @@ QWidget *MetaOptionsTab::widget() connect(w, SIGNAL(connectDataChanged(QWidget *)), SIGNAL(connectDataChanged(QWidget *))); connect(w, SIGNAL(noDirty(bool)), SIGNAL(noDirty(bool))); - for (OptionsTab *tab : qAsConst(tabs)) { + for (OptionsTab *tab : std::as_const(tabs)) { t->addTab(tab); } @@ -244,7 +244,7 @@ QWidget *MetaOptionsTab::widget() void MetaOptionsTab::applyOptions() { - for (OptionsTab *tab : qAsConst(tabs)) { + for (OptionsTab *tab : std::as_const(tabs)) { tab->applyOptions(); } } @@ -256,14 +256,14 @@ void MetaOptionsTab::restoreOptions() d->restoreOptions(); } - for (OptionsTab *tab : qAsConst(tabs)) { + for (OptionsTab *tab : std::as_const(tabs)) { tab->restoreOptions(); } } void MetaOptionsTab::setData(PsiCon *psi, QWidget *w) { - for (OptionsTab *tab : qAsConst(tabs)) { + for (OptionsTab *tab : std::as_const(tabs)) { tab->setData(psi, w); } } diff --git a/src/pluginhost.cpp b/src/pluginhost.cpp index df89d6d6d..bd37d183f 100644 --- a/src/pluginhost.cpp +++ b/src/pluginhost.cpp @@ -1358,7 +1358,7 @@ bool PluginHost::encryptMessageElement(int account, QDomElement &message) QObject *PluginHost::getPlugin(const QString &shortName) { - for (PluginHost *plugin : qAsConst(manager_->pluginsByPriority_)) { + for (PluginHost *plugin : std::as_const(manager_->pluginsByPriority_)) { if (plugin->shortName() == shortName || plugin->name() == shortName) { return plugin->plugin_; } diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp index 3b2eb07bd..08ad98d3c 100644 --- a/src/pluginmanager.cpp +++ b/src/pluginmanager.cpp @@ -190,7 +190,7 @@ void PluginManager::loadEnabledPlugins() #ifndef PLUGINS_NO_DEBUG qDebug("Loading enabled plugins"); #endif - for (PluginHost *plugin : qAsConst(pluginsByPriority_)) { + for (PluginHost *plugin : std::as_const(pluginsByPriority_)) { loadPluginIfEnabled(plugin); } } @@ -216,7 +216,7 @@ void PluginManager::optionChanged(const QString &option) { bool pluginOpt = option.startsWith(loadOptionPrefix); const QString shortName = option.split(".").last(); - for (PluginHost *plugin : qAsConst(pluginByFile_)) { + for (PluginHost *plugin : std::as_const(pluginByFile_)) { plugin->optionChanged(option); if (pluginOpt && plugin->shortName() == shortName) { bool shouldUpdateFeatures; @@ -261,7 +261,7 @@ void PluginManager::loadAllPlugins() }*/ // Now look for external plugins - for (PluginHost *plugin : qAsConst(hosts_)) { + for (PluginHost *plugin : std::as_const(hosts_)) { plugin->load(); if (plugin->enable()) emit pluginEnabled(plugin->shortName()); @@ -279,7 +279,7 @@ bool PluginManager::unloadAllPlugins() qDebug("Unloading all plugins"); #endif bool ok = true; - for (PluginHost *plugin : qAsConst(hosts_)) { + for (PluginHost *plugin : std::as_const(hosts_)) { if (!plugin->unload()) { ok = false; } @@ -392,7 +392,7 @@ QWidget *PluginManager::optionsWidget(const QString &plugin) */ void PluginManager::setShortcuts() { - for (PluginHost *host : qAsConst(pluginByFile_)) { + for (PluginHost *host : std::as_const(pluginByFile_)) { host->setShortcuts(); } } @@ -411,7 +411,7 @@ bool PluginManager::processMessage(PsiAccount *account, const QString &jidFrom, const QString &subject) { bool handled = false; - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if (host->processMessage(accountIds_.id(account), jidFrom, body, subject)) { handled = true; break; @@ -434,7 +434,7 @@ bool PluginManager::processEvent(PsiAccount *account, QDomElement &event) { bool handled = false; const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if (host->processEvent(acc_id, event)) { handled = true; break; @@ -451,7 +451,7 @@ bool PluginManager::processOutgoingMessage(PsiAccount *account, const QString &j { bool handled = false; const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginByFile_)) { + for (PluginHost *host : std::as_const(pluginByFile_)) { if (host->processOutgoingMessage(acc_id, jidTo, body, type, subject)) { handled = true; break; @@ -463,7 +463,7 @@ bool PluginManager::processOutgoingMessage(PsiAccount *account, const QString &j void PluginManager::processOutgoingStanza(PsiAccount *account, QDomElement &stanza) { const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginByFile_)) { + for (PluginHost *host : std::as_const(pluginByFile_)) { if (host->outgoingXml(acc_id, stanza)) { break; } @@ -476,7 +476,7 @@ void PluginManager::processOutgoingStanza(PsiAccount *account, QDomElement &stan void PluginManager::startLogin(PsiAccount *account) { const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginByFile_)) { + for (PluginHost *host : std::as_const(pluginByFile_)) { host->logout(acc_id); emit accountBeforeLogin(acc_id); } @@ -488,7 +488,7 @@ void PluginManager::startLogin(PsiAccount *account) void PluginManager::logout(PsiAccount *account) { const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginByFile_)) { + for (PluginHost *host : std::as_const(pluginByFile_)) { host->logout(acc_id); emit accountLoggedOut(acc_id); } @@ -529,7 +529,7 @@ QList PluginManager::settingsPages() const { return sett bool PluginManager::incomingXml(int account, const QDomElement &xml) { bool handled = false; - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if (host->incomingXml(account, xml)) { handled = true; break; @@ -695,7 +695,7 @@ QMap PluginManager::getKnownPgpKeys(int account) const PsiAccount * pa = accountIds_.account(account); if (pa) { UserAccount acc = pa->userAccount(); - for (const auto &item : qAsConst(acc.pgpKnownKeys)) { + for (const auto &item : std::as_const(acc.pgpKnownKeys)) { out[item.key()] = item.data(); } } @@ -805,7 +805,7 @@ void PluginManager::setPopupDuration(const QString &name, int value) { psi_->pop void PluginManager::addAccountMenu(QMenu *menu, PsiAccount *account) { int i = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { host->addAccountMenu(menu, i); } } @@ -813,7 +813,7 @@ void PluginManager::addAccountMenu(QMenu *menu, PsiAccount *account) void PluginManager::addContactMenu(QMenu *menu, PsiAccount *account, QString jid) { int i = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { host->addContactMenu(menu, i, jid); } } @@ -821,7 +821,7 @@ void PluginManager::addContactMenu(QMenu *menu, PsiAccount *account, QString jid void PluginManager::setupChatTab(QWidget *tab, PsiAccount *account, const QString &contact) { int i = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { host->setupChatTab(tab, i, contact); } } @@ -829,7 +829,7 @@ void PluginManager::setupChatTab(QWidget *tab, PsiAccount *account, const QStrin void PluginManager::setupGCTab(QWidget *tab, PsiAccount *account, const QString &contact) { int i = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { host->setupGCTab(tab, i, contact); } } @@ -838,7 +838,7 @@ bool PluginManager::appendingChatMessage(PsiAccount *account, const QString &con bool local) { bool handled = false; - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if (host->appendingChatMessage(accountIds_.id(account), contact, body, html, local)) { handled = true; break; @@ -927,7 +927,7 @@ void PluginManager::addToolBarButton(QObject *parent, QWidget *toolbar, PsiAccou const QString &plugin) { const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if ((plugin.isEmpty() || (host->shortName() == plugin)) && host->isEnabled()) { host->addToolBarButton(parent, toolbar, acc_id, contact); } @@ -946,7 +946,7 @@ void PluginManager::addGCToolBarButton(QObject *parent, QWidget *toolbar, PsiAcc const QString &plugin) { const int acc_id = accountIds_.id(account); - for (PluginHost *host : qAsConst(pluginsByPriority_)) { + for (PluginHost *host : std::as_const(pluginsByPriority_)) { if ((plugin.isEmpty() || (host->shortName() == plugin)) && host->isEnabled()) { host->addGCToolBarButton(parent, toolbar, acc_id, contact); } diff --git a/src/popupmanager.cpp b/src/popupmanager.cpp index 7539b8f05..67e399f39 100644 --- a/src/popupmanager.cpp +++ b/src/popupmanager.cpp @@ -151,7 +151,7 @@ PopupManager::~PopupManager() { delete d; } int PopupManager::registerOption(const QString &name, int initValue, const QString &path) { - for (const OptionValue &v : qAsConst(d->options_)) { + for (const OptionValue &v : std::as_const(d->options_)) { if (v.optionName == name) return v.id; } @@ -180,7 +180,7 @@ void PopupManager::setValue(const QString &name, int value) int PopupManager::value(const QString &name) const { - for (const OptionValue &v : qAsConst(d->options_)) { + for (const OptionValue &v : std::as_const(d->options_)) { if (v.optionName == name) return v.optionValue; } @@ -190,7 +190,7 @@ int PopupManager::value(const QString &name) const const QString PopupManager::optionPath(const QString &name) const { - for (const OptionValue &v : qAsConst(d->options_)) { + for (const OptionValue &v : std::as_const(d->options_)) { if (v.optionName == name) return v.optionPath; } @@ -201,7 +201,7 @@ const QString PopupManager::optionPath(const QString &name) const const QStringList PopupManager::optionsNamesList() const { QStringList ret; - for (const OptionValue &v : qAsConst(d->options_)) + for (const OptionValue &v : std::as_const(d->options_)) ret.append(v.optionName); return ret; diff --git a/src/privacy/privacydlg.h b/src/privacy/privacydlg.h index e3cb2b35d..c14d33545 100644 --- a/src/privacy/privacydlg.h +++ b/src/privacy/privacydlg.h @@ -28,7 +28,6 @@ class PrivacyManager; class QString; -class QStringList; class QWidget; class PrivacyDlg : public QDialog { diff --git a/src/privacy/psiprivacymanager.cpp b/src/privacy/psiprivacymanager.cpp index 653598a2c..579b04e66 100644 --- a/src/privacy/psiprivacymanager.cpp +++ b/src/privacy/psiprivacymanager.cpp @@ -548,7 +548,7 @@ void PsiPrivacyManager::newListReceived(const PrivacyList &list) updatedContacts += findDifferences(previouslyBlockedContacts, currentlyBlockedContacts); updatedContacts += findDifferences(currentlyBlockedContacts, previouslyBlockedContacts); - for (const QString &contact : qAsConst(updatedContacts)) { + for (const QString &contact : std::as_const(updatedContacts)) { // emit simulateContactOffline(contact); if (!isContactBlocked(contact)) { diff --git a/src/profiledlg.cpp b/src/profiledlg.cpp index f19dfe1f1..ab7b52320 100644 --- a/src/profiledlg.cpp +++ b/src/profiledlg.cpp @@ -99,7 +99,7 @@ ProfileOpenDlg::ProfileOpenDlg(const QString &def, const VarList &_langs, const int x = 0; langSel = x; - for (const auto &lang : qAsConst(langs)) { + for (const auto &lang : std::as_const(langs)) { cb_lang->addItem(lang.data()); if ((curLang.isEmpty() && x == 0) || (curLang == lang.key())) { cb_lang->setCurrentIndex(x); diff --git a/src/proxy.cpp b/src/proxy.cpp index 1779d9bff..7ca776d78 100644 --- a/src/proxy.cpp +++ b/src/proxy.cpp @@ -143,7 +143,7 @@ public slots: QListWidgetItem *firstItem = nullptr; QListWidgetItem *currentItem = nullptr; - for (const ProxyItem &i : qAsConst(list)) { + for (const ProxyItem &i : std::as_const(list)) { QListWidgetItem *item = new QListWidgetItem(i.name); addItem(item); @@ -210,7 +210,7 @@ public slots: QList editors = QList() << q->ui_.cb_type << q->ui_.le_host << q->ui_.le_port << q->ui_.le_user << q->ui_.le_pass << q->ui_.le_url << q->ui_.gr_auth; - for (QWidget *w : qAsConst(editors)) { + for (QWidget *w : std::as_const(editors)) { w->blockSignals(true); w->setEnabled(bool(current)); if (!current) { @@ -231,7 +231,7 @@ public slots: q->ui_.gr_auth->setChecked(current->data(AuthRole).toBool()); } - for (QWidget *w : qAsConst(editors)) { + for (QWidget *w : std::as_const(editors)) { w->blockSignals(false); } diff --git a/src/psi_profiles.cpp b/src/psi_profiles.cpp index 789549486..836481156 100644 --- a/src/psi_profiles.cpp +++ b/src/psi_profiles.cpp @@ -385,7 +385,7 @@ void UserAccount::toOptions(OptionsTree *o, QString base) } int idx = 0; - for (const RosterItem &ri : qAsConst(roster)) { + for (const RosterItem &ri : std::as_const(roster)) { QString rbase = base + ".roster-cache.a" + QString::number(idx++); o->setOption(rbase + ".jid", ri.jid().full()); o->setOption(rbase + ".name", ri.name()); @@ -404,7 +404,7 @@ void UserAccount::toOptions(OptionsTree *o, QString base) groupList << qApp->translate("ContactProfile", "Agents/Transports"); // first, add all groups' names to groupList - for (const RosterItem &i : qAsConst(roster)) { + for (const RosterItem &i : std::as_const(roster)) { groupList += i.groups(); } @@ -417,7 +417,7 @@ void UserAccount::toOptions(OptionsTree *o, QString base) } // remove redundant groups - for (const QString &group : qAsConst(removeList)) { + for (const QString &group : std::as_const(removeList)) { groupState.remove(group); } @@ -563,7 +563,7 @@ void OptionsMigration::lateMigration() PsiOptions::instance()->removeOption("options.ui.contactlist.toolbars", true); - for (ToolbarPrefs tb : qAsConst(toolbars)) { + for (ToolbarPrefs tb : std::as_const(toolbars)) { tb.locked = true; PsiToolBar::structToOptions(PsiOptions::instance(), tb); } @@ -702,7 +702,7 @@ bool profileRename(const QString &oldname, const QString &name) return false; // and if all ok we may rename it. - for (const QString &path : qAsConst(paths)) { + for (const QString &path : std::as_const(paths)) { QDir d(path); if (!d.exists() || !d.exists(oldname)) continue; diff --git a/src/psiaccount.cpp b/src/psiaccount.cpp index aa7f3f798..5bad18399 100644 --- a/src/psiaccount.cpp +++ b/src/psiaccount.cpp @@ -586,7 +586,7 @@ private slots: void updateOnlineContactsCountTimeout() { int newOnlineContactsCount = 0; - for (const PsiContact *c : qAsConst(contacts)) { + for (const PsiContact *c : std::as_const(contacts)) { if ((c->isPrivate() || (c->inList() && c->status().type() != XMPP::Status::Offline)) && !c->isSelf()) { ++newOnlineContactsCount; } @@ -818,7 +818,7 @@ public slots: void dialogUnregister(QWidget *w) { - for (item_dialog2 *i : qAsConst(dialogList)) { + for (item_dialog2 *i : std::as_const(dialogList)) { if (i->widget == w) { dialogList.removeAll(i); delete i; @@ -903,14 +903,14 @@ public slots: void updateContacts() { QStringList jids; - for (PsiContact *pc : qAsConst(contacts)) { + for (PsiContact *pc : std::as_const(contacts)) { const Jid jid = pc->jid(); jids.append(jid.bare()); bool vis = isAlwaysVisibleContact(jid); if (vis != pc->isAlwaysVisible()) pc->setAlwaysVisible(vis); } - for (const QString &j : qAsConst(acc.alwaysVisibleContacts)) { + for (const QString &j : std::as_const(acc.alwaysVisibleContacts)) { if (!jids.contains(j)) acc.alwaysVisibleContacts.removeAll(j); } @@ -1172,7 +1172,7 @@ PsiAccount::PsiAccount(const UserAccount &acc, PsiContactList *parent, TabManage d->selfContact = new PsiContact(d->self, this, true); // restore cached roster - for (const auto &it : qAsConst(acc.roster)) + for (const auto &it : std::as_const(acc.roster)) client_rosterItemUpdated(it); // restore pgp key bindings @@ -1355,7 +1355,7 @@ const UserAccount &PsiAccount::userAccount() const // save the roster and pgp key bindings d->acc.roster.clear(); d->acc.pgpKnownKeys.clear(); - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (u->inList()) d->acc.roster += *u; @@ -1968,7 +1968,7 @@ void PsiAccount::sessionStarted() d->voiceCaller->initialize(); // flag roster for delete - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (u->inList()) u->setFlagForDelete(true); } @@ -2757,7 +2757,7 @@ void PsiAccount::client_messageReceived(const Message &m) } // if the sender is already in the queue, then queue this message also - for (const Message &mi : qAsConst(d->messageQueue)) { + for (const Message &mi : std::as_const(d->messageQueue)) { if (mi.from().compare(_m.from())) { d->messageQueue.append(_m); return; @@ -3091,7 +3091,7 @@ void PsiAccount::setStatus(const Status &_s, bool withPriority, bool isManualSta // Block all transports' contacts' status change popups from popping { - for (const auto &i : qAsConst(d->acc.roster)) { + for (const auto &i : std::as_const(d->acc.roster)) { if (i.jid() .node() .isEmpty() /*&& i.jid().resource() == "registered"*/) // it is very likely then, that it's transport @@ -3133,7 +3133,7 @@ void PsiAccount::setStatus(const Status &_s, bool withPriority, bool isManualSta if (s.isInvisible()) { //&&Pass invis to transports KEVIN // this is a nasty hack to let the transports know we're invisible, since they get an offline packet // when we go invisible - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (u->isTransport()) { JT_Presence *j = new JT_Presence(d->client->rootTask()); j->pres(u->jid(), s); @@ -3545,7 +3545,7 @@ void PsiAccount::openAddUserDlg(const Jid &jid, const QString &nick, const QStri { QStringList gl, services, names; UserListIt it(d->userList); - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (u->isTransport()) { services += u->jid().full(); names += JIDUtil::nickOrJid(u->name(), u->jid().full()); @@ -3718,7 +3718,7 @@ void PsiAccount::simulateRosterOffline() emit beginBulkContactUpdate(); notifyOnlineOk = false; - for (UserListItem *u : qAsConst(d->userList)) + for (UserListItem *u : std::as_const(d->userList)) simulateContactOffline(u); // self @@ -3865,7 +3865,7 @@ QList PsiAccount::findRelevant(const Jid &j) const if (j.compare(d->self.jid(), false)) list.append(&d->self); else { - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (!u->jid().compare(j, false)) continue; @@ -4272,7 +4272,7 @@ void PsiAccount::actionRename(const Jid &j, const QString &name) { dj_rename(j, void PsiAccount::actionGroupRename(const QString &oldname, const QString &newname) { QList nu; - for (UserListItem *u : qAsConst(d->userList)) { + for (UserListItem *u : std::as_const(d->userList)) { if (u->inGroup(oldname)) { u->removeGroup(oldname); u->addGroup(newname); @@ -5480,7 +5480,7 @@ int PsiAccount::forwardPendingEvents(const Jid &jid) { QList chatList; d->eventQueue->extractMessages(&chatList); - for (const PsiEvent::Ptr &e : qAsConst(chatList)) { + for (const PsiEvent::Ptr &e : std::as_const(chatList)) { MessageEvent::Ptr me = e.staticCast(); Message m = me->message(); @@ -5613,7 +5613,7 @@ void PsiAccount::processChatsHelper(const Jid &j, bool removeEvents) // 15:15 *mblsha is Offline // 15:10 hello! - for (const PsiEvent::Ptr &e : qAsConst(chatList)) { + for (const PsiEvent::Ptr &e : std::as_const(chatList)) { if (e->type() == PsiEvent::Message) { MessageEvent::Ptr me = e.staticCast(); const Message &m = me->message(); @@ -5778,7 +5778,7 @@ void PsiAccount::shareImage(const Jid &target, const QImage &image, const QStrin GCContact *PsiAccount::findGCContact(const Jid &j) const { - for (GCContact *c : qAsConst(d->gcbank)) { + for (GCContact *c : std::as_const(d->gcbank)) { if (c->jid.compare(j)) return c; } @@ -6435,7 +6435,7 @@ void PsiAccount::ed_addAuth(const Jid &j) if (static_cast(sender())->isForAll()) { QList events; d->eventQueue->extractByType(PsiEvent::Auth, &events); - for (const PsiEvent::Ptr &e : qAsConst(events)) { + for (const PsiEvent::Ptr &e : std::as_const(events)) { dj_addAuth(e->jid()); } } @@ -6447,7 +6447,7 @@ void PsiAccount::ed_deny(const Jid &j) if (static_cast(sender())->isForAll()) { QList events; d->eventQueue->extractByType(PsiEvent::Auth, &events); - for (const PsiEvent::Ptr &e : qAsConst(events)) { + for (const PsiEvent::Ptr &e : std::as_const(events)) { dj_deny(e->jid()); } } diff --git a/src/psichatdlg.cpp b/src/psichatdlg.cpp index 6ee57c735..de069b8ad 100644 --- a/src/psichatdlg.cpp +++ b/src/psichatdlg.cpp @@ -164,7 +164,7 @@ class PsiChatDlg::ChatDlgMCmdProvider : public QObject, public MCmdProviderIface } } QStringList res; - for (const QString &cmd : qAsConst(all)) { + for (const QString &cmd : std::as_const(all)) { if (cmd.startsWith(query)) { res << cmd; } diff --git a/src/psicon.cpp b/src/psicon.cpp index df51e3810..d2c8373aa 100644 --- a/src/psicon.cpp +++ b/src/psicon.cpp @@ -273,7 +273,7 @@ private slots: void updateIconSelect() { Iconset iss; - for (Iconset *iconset : qAsConst(PsiIconset::instance()->emoticons)) { + for (Iconset *iconset : std::as_const(PsiIconset::instance()->emoticons)) { iss += *iconset; } @@ -482,7 +482,7 @@ bool PsiCon::init() if (!accountsFile.exists()) { accountMigration = true; int idx = 0; - for (UserAccount a : qAsConst(d->optionsMigration.accMigration)) { + for (UserAccount a : std::as_const(d->optionsMigration.accMigration)) { QString base = "accounts.a" + QString::number(idx++); a.toOptions(&d->accountTree, base); } @@ -869,7 +869,7 @@ QStringList PsiCon::xmppFatures() const QStringList() << "http://jabber.org/protocol/chatstates") << OptFeatureMap("options.ui.notifications.send-receipts", QStringList() << "urn:xmpp:receipts"); - for (const OptFeatureMap &f : qAsConst(fmap)) { + for (const OptFeatureMap &f : std::as_const(fmap)) { if (PsiOptions::instance()->getOption(f.option).toBool()) { features << f.feature; } @@ -965,7 +965,7 @@ EventDlg *PsiCon::createEventDlg(const QString &to, PsiAccount *pa) // FIXME: WTF? Refactor! Refactor! void PsiCon::updateContactGlobal(PsiAccount *pa, const Jid &j) { - for (item_dialog *i : qAsConst(d->dialogList)) { + for (item_dialog *i : std::as_const(d->dialogList)) { if (i->className == "EventDlg") { EventDlg *e = qobject_cast(i->widget); if (e->psiAccount() == pa) @@ -977,7 +977,7 @@ void PsiCon::updateContactGlobal(PsiAccount *pa, const Jid &j) // FIXME: make it work like QObject::findChildren() QWidget *PsiCon::dialogFind(const char *className) { - for (item_dialog *i : qAsConst(d->dialogList)) { + for (item_dialog *i : std::as_const(d->dialogList)) { // does the classname and jid match? if (i->className == className) { return i->widget; @@ -1677,7 +1677,7 @@ const QStringList &PsiCon::recentNodeList() const { return d->recentNodeList; } void PsiCon::recentNodeAdd(const QString &str) { // remove it if we have it - for (const QString &s : qAsConst(d->recentNodeList)) { + for (const QString &s : std::as_const(d->recentNodeList)) { if (s == str) { d->recentNodeList.removeAll(s); break; diff --git a/src/psicontactlist.cpp b/src/psicontactlist.cpp index 0dba662f2..b2edfadee 100644 --- a/src/psicontactlist.cpp +++ b/src/psicontactlist.cpp @@ -61,7 +61,7 @@ void PsiContactList::gracefulDeinit() deinitAccCounter_ = 0; decltype(accounts_) loggedAccs; - for (auto account : qAsConst(enabledAccounts_)) { + for (auto account : std::as_const(enabledAccounts_)) { if (account->isAvailable()) { deinitAccCounter_++; loggedAccs.append(account); @@ -426,7 +426,7 @@ PsiAccount *PsiContactList::tryQueueLowestEventId(bool includeDND) int low_id = 0; int low_prior = EventPriorityDontCare; - for (PsiAccount *account : qAsConst(enabledAccounts_)) { + for (PsiAccount *account : std::as_const(enabledAccounts_)) { int n = account->eventQueue()->nextId(); if (n == -1) continue; diff --git a/src/psievent.cpp b/src/psievent.cpp index 9727f050e..4a8eede45 100644 --- a/src/psievent.cpp +++ b/src/psievent.cpp @@ -677,7 +677,7 @@ void EventQueue::enqueue(const PsiEvent::Ptr &e) bool found = false; // skip all with higher or equal priority - for (EventItem *ei : qAsConst(list_)) { + for (EventItem *ei : std::as_const(list_)) { if (ei && ei->event()->priority() < prior) { list_.insert(list_.indexOf(ei), i); found = true; @@ -697,7 +697,7 @@ void EventQueue::dequeue(const PsiEvent::Ptr &e) if (!e) return; - for (EventItem *i : qAsConst(list_)) { + for (EventItem *i : std::as_const(list_)) { if (e == i->event()) { list_.removeAll(i); emit queueChanged(); @@ -709,7 +709,7 @@ void EventQueue::dequeue(const PsiEvent::Ptr &e) PsiEvent::Ptr EventQueue::dequeue(const Jid &j, bool compareRes) { - for (EventItem *i : qAsConst(list_)) { + for (EventItem *i : std::as_const(list_)) { PsiEvent::Ptr e = i->event(); Jid j2(e->jid()); if (j.compare(j2, compareRes)) { @@ -950,7 +950,7 @@ QList EventQueue::eventsFor(const XMPP::Jid &jid, bool c { QList result; - for (EventItem *i : qAsConst(list_)) { + for (EventItem *i : std::as_const(list_)) { if (i->event()->from().compare(jid, compareRes)) result << QPair(i->id(), i->event()); } diff --git a/src/psiiconset.cpp b/src/psiiconset.cpp index 3b8968fec..81dd5fc26 100644 --- a/src/psiiconset.cpp +++ b/src/psiiconset.cpp @@ -184,7 +184,7 @@ class PsiIconset::Private { // second level -- transport icon if (jid.node().isEmpty() || status_icons.useServicesIcons) { - for (const StatusIconsets::IconsetItem &item : qAsConst(status_icons.list)) { + for (const StatusIconsets::IconsetItem &item : std::as_const(status_icons.list)) { if (item.regexp.isEmpty() ? jid.node().isEmpty() : (item.regexp.indexIn(jid.domain()) != -1)) { const Iconset *is = psi->roster.value(item.iconset); if (is) { @@ -199,7 +199,7 @@ class PsiIconset::Private { } // third level -- custom icons - for (const StatusIconsets::IconsetItem &item : qAsConst(status_icons.customList)) { + for (const StatusIconsets::IconsetItem &item : std::as_const(status_icons.customList)) { if (item.regexp.indexIn(jid.bare()) != -1) { const Iconset *is = psi->roster.value(item.iconset); if (is) { @@ -424,7 +424,7 @@ bool PsiIconset::loadRoster() d->cur_custom_status.insert(regexp, iconset); } - for (const QString &it2 : qAsConst(rosterIconsets)) { + for (const QString &it2 : std::as_const(rosterIconsets)) { if (it2 == PsiOptions::instance()->getOption("options.iconsets.status").toString()) { continue; } diff --git a/src/psioptions.cpp b/src/psioptions.cpp index 264d2c133..0ecd1b7ef 100644 --- a/src/psioptions.cpp +++ b/src/psioptions.cpp @@ -212,7 +212,7 @@ bool PsiOptions::newProfile() << "menu_xml_console"; QList toolbars = { chatToolbar, groupchatToolbar, buttons, showContacts }; - for (ToolbarPrefs tb : qAsConst(toolbars)) { + for (ToolbarPrefs tb : std::as_const(toolbars)) { tb.locked = true; PsiToolBar::structToOptions(this, tb); } diff --git a/src/psipopup.cpp b/src/psipopup.cpp index ec5d48ef6..5dc7975ff 100644 --- a/src/psipopup.cpp +++ b/src/psipopup.cpp @@ -303,7 +303,7 @@ void PsiPopup::setData(const Jid &j, const Resource &r, const UserListItem *u, c QString contactText = "" + name + "" + statusString; // hack for duplicate "Contact Online"/"Status Change" popups - for (PsiPopup *pp : qAsConst(*psiPopupList)) { + for (PsiPopup *pp : std::as_const(*psiPopupList)) { if (d->jid.full() == pp->d->jid.full() && d->status.show() == pp->d->status.show() && d->status.status() == d->status.status()) { if (d->popupType == PopupManager::AlertStatusChange && pp->d->popupType == PopupManager::AlertOnline) { @@ -385,7 +385,7 @@ void PsiPopup::show() } if (!d->id.isEmpty() /*&& LEGOPTS.ppNoDupes*/) { - for (PsiPopup *pp : qAsConst(*psiPopupList)) { + for (PsiPopup *pp : std::as_const(*psiPopupList)) { if (d->id == pp->id() && pp->popup()) { pp->popup()->restartHideTimer(); diff --git a/src/psirosterwidget.cpp b/src/psirosterwidget.cpp index f70aa9fe8..ceadaf9f4 100644 --- a/src/psirosterwidget.cpp +++ b/src/psirosterwidget.cpp @@ -78,7 +78,7 @@ class PsiRosterFilterProxyModel : public QSortFilterProxyModel { data << index.data(Qt::DisplayRole).toString() << index.data(ContactListModel::JidRole).toString(); } - for (const QString &str : qAsConst(data)) { + for (const QString &str : std::as_const(data)) { if (str.contains(filterRegExp())) return true; } diff --git a/src/psithememodel.cpp b/src/psithememodel.cpp index 3cd8ad709..884871da4 100644 --- a/src/psithememodel.cpp +++ b/src/psithememodel.cpp @@ -208,7 +208,7 @@ bool PsiThemeModel::setData(const QModelIndex &index, const QVariant &value, int int PsiThemeModel::themeRow(const QString &id) { int i = 0; - for (const ThemeItemInfo &tii : qAsConst(themesInfo)) { + for (const ThemeItemInfo &tii : std::as_const(themesInfo)) { if (tii.id == id) { return i; } diff --git a/src/registrationdlg.cpp b/src/registrationdlg.cpp index 0aef80857..c6a5a2c9d 100644 --- a/src/registrationdlg.cpp +++ b/src/registrationdlg.cpp @@ -291,7 +291,7 @@ void RegistrationDlg::processLegacyForm(const XMPP::Form &form) { setInstructions(d->jid.full(), form.instructions()); - for (const auto &f : qAsConst(d->form)) { + for (const auto &f : std::as_const(d->form)) { QLabel * lb = new QLabel(f.fieldName(), d->gr_form); QLineEdit *le = new QLineEdit(d->gr_form); d->gr_form_layout->addWidget(lb); // FIXME diff --git a/src/searchdlg.cpp b/src/searchdlg.cpp index 00cb2a848..aa351d23a 100644 --- a/src/searchdlg.cpp +++ b/src/searchdlg.cpp @@ -338,7 +338,7 @@ void SearchDlg::jt_finished() QString str = TextUtil::plain2rich(d->form.instructions()); lb_instructions->setText(str); - for (const auto &f : qAsConst(d->form)) { + for (const auto &f : std::as_const(d->form)) { QLabel * lb = new QLabel(f.fieldName(), d->gr_form); QLineEdit *le = new QLineEdit(d->gr_form); d->gr_form_layout->addWidget(lb); // FIXME diff --git a/src/searchdlg.h b/src/searchdlg.h index 7d3fd6b51..9a454a4f5 100644 --- a/src/searchdlg.h +++ b/src/searchdlg.h @@ -26,7 +26,6 @@ class PsiAccount; class QString; -class QStringList; namespace XMPP { class Jid; diff --git a/src/statusmenu.cpp b/src/statusmenu.cpp index 31727fb2a..4dec467d9 100644 --- a/src/statusmenu.cpp +++ b/src/statusmenu.cpp @@ -139,7 +139,7 @@ void StatusMenu::presetsChanged() void StatusMenu::statusChanged(const Status &status) { bool presetFound = false; - for (IconAction *action : qAsConst(presetActs)) { + for (IconAction *action : std::as_const(presetActs)) { // Maybe we should compare with priority too int st = static_cast(status.type()); QString message = action->property("message").toString(); @@ -150,7 +150,7 @@ void StatusMenu::statusChanged(const Status &status) action->setChecked(false); } bool statusFound = false; - for (IconAction *action : qAsConst(statusActs)) { + for (IconAction *action : std::as_const(statusActs)) { if (!statusFound && !presetFound && action->property("type").toInt() == static_cast(status.type())) { action->setChecked(true); statusFound = true; diff --git a/src/sxe/sxemanager.cpp b/src/sxe/sxemanager.cpp index 3baaf0d38..68dc1f7ef 100644 --- a/src/sxe/sxemanager.cpp +++ b/src/sxe/sxemanager.cpp @@ -89,7 +89,7 @@ void SxeManager::messageReceived(const Message &message) void SxeManager::recordDetectedSession(const Message &message) { // check if a record of the session exists - for (const DetectedSession &d : qAsConst(DetectedSessions_)) { + for (const DetectedSession &d : std::as_const(DetectedSessions_)) { if (d.session == message.sxe().attribute("session") && d.jid.compare(message.from(), message.type() != "groupchat")) return; @@ -540,7 +540,7 @@ SxeManager::SxeNegotiation *SxeManager::createNegotiation(const Message &message // ownJid is determined based on the bare part of ownJids_ negotiation->groupChat = true; - for (const QString &j : qAsConst(ownJids_)) { + for (const QString &j : std::as_const(ownJids_)) { if (message.from().bare() == j.left(j.indexOf("/"))) { negotiation->ownJid = j; break; @@ -620,7 +620,7 @@ void SxeManager::startNewSession(const Jid &target, const Jid &ownJid, bool grou QDomElement negotiationElement = doc.createElementNS(SXENS, "negotiation"); QDomElement request = doc.createElementNS(SXENS, "invitation"); QDomElement feature = doc.createElementNS(SXENS, "feature"); - for (const QString &f : qAsConst(features)) { + for (const QString &f : std::as_const(features)) { feature = feature.cloneNode(false).toElement(); feature.appendChild(doc.createTextNode(f)); request.appendChild(feature); @@ -696,7 +696,7 @@ QList> SxeManager::findSession(const Jid &jid) { // find if a session for the jid already exists QList> matching; - for (const QPointer &w : qAsConst(sessions_)) { + for (const QPointer &w : std::as_const(sessions_)) { // does the jid match? if (w->target().compare(jid)) { matching.append(w); @@ -708,7 +708,7 @@ QList> SxeManager::findSession(const Jid &jid) QPointer SxeManager::findSession(const QString &session) { // find if a session for the session already exists - for (SxeSession *w : qAsConst(sessions_)) { + for (SxeSession *w : std::as_const(sessions_)) { // does the session match? if (w->session() == session) return w; diff --git a/src/sxe/sxesession.cpp b/src/sxe/sxesession.cpp index 5a851cd25..3ee1a69f5 100644 --- a/src/sxe/sxesession.cpp +++ b/src/sxe/sxesession.cpp @@ -111,7 +111,7 @@ bool SxeSession::processSxe(const QDomElement &sxe, const QString &id) // store incoming edits when queueing if (queueing_) { // Make sure the element is not already in the queue. - for (const IncomingEdit &i : qAsConst(queuedIncomingEdits_)) + for (const IncomingEdit &i : std::as_const(queuedIncomingEdits_)) if (i.xml == sxe) return false; diff --git a/src/systeminfo.cpp b/src/systeminfo.cpp index 37b46593c..5b78d7fdf 100644 --- a/src/systeminfo.cpp +++ b/src/systeminfo.cpp @@ -50,7 +50,7 @@ static QString lsbRelease(const QStringList &args) QStringList path = QString(qgetenv("PATH")).split(':'); QString found; - for (const QString &dirname : qAsConst(path)) { + for (const QString &dirname : std::as_const(path)) { QDir dir(dirname); QFileInfo cand(dir.filePath("lsb_release")); if (cand.isExecutable()) { diff --git a/src/tabs/tabdlg.cpp b/src/tabs/tabdlg.cpp index 63925cd90..1229efae5 100644 --- a/src/tabs/tabdlg.cpp +++ b/src/tabs/tabdlg.cpp @@ -502,7 +502,7 @@ void TabDlg::updateCaption() void TabDlg::closeEvent(QCloseEvent *closeEvent) { - for (TabbableWidget *tab : qAsConst(tabs_)) { + for (TabbableWidget *tab : std::as_const(tabs_)) { if (!tab->readyToHide()) { closeEvent->ignore(); return; @@ -521,7 +521,7 @@ TabbableWidget *TabDlg::getTab(int i) const { return static_castjid().full() == fullJid && tab->account() == account) { return tab; } @@ -635,7 +635,7 @@ void TabDlg::dropEvent(QDropEvent *event) void TabDlg::extinguishFlashingTabs() { - for (TabbableWidget *tab : qAsConst(tabs_)) { + for (TabbableWidget *tab : std::as_const(tabs_)) { if (tab->flashing()) { tab->blockSignals(true); tab->doFlash(false); @@ -804,7 +804,7 @@ bool TabDlg::isTabPinned(QWidget *page) { return tabWidget_->isPagePinned(page); void TabDlg::updateVSplitters(int log, int chat) { - for (TabbableWidget *w : qAsConst(tabs_)) { + for (TabbableWidget *w : std::as_const(tabs_)) { w->setVSplitterPosition(log, chat); } } diff --git a/src/tabs/tabmanager.cpp b/src/tabs/tabmanager.cpp index aa9c74082..e671b4552 100644 --- a/src/tabs/tabmanager.cpp +++ b/src/tabs/tabmanager.cpp @@ -95,7 +95,7 @@ void TabManager::tabDestroyed(QObject *obj) if (preferedTabsetForKind_[it.key()] != obj) continue; bool ok = false; - for (TabDlg *tabDlg : qAsConst(tabs_)) { + for (TabDlg *tabDlg : std::as_const(tabs_)) { // currently destroyed tab is removed from the list a few lines above if (tabsetToKinds_[tabDlg].contains(it.key())) { preferedTabsetForKind_[it.key()] = tabDlg; @@ -155,7 +155,7 @@ void TabManager::setUserManagementEnabled(bool enabled) } userManagement_ = enabled; - for (TabDlg *tab : qAsConst(tabs_)) { + for (TabDlg *tab : std::as_const(tabs_)) { tab->setUserManagementEnabled(enabled); } } @@ -167,7 +167,7 @@ void TabManager::setTabBarShownForSingles(bool enabled) } tabSingles_ = enabled; - for (TabDlg *tab : qAsConst(tabs_)) { + for (TabDlg *tab : std::as_const(tabs_)) { tab->setTabBarShownForSingles(enabled); } } @@ -179,7 +179,7 @@ void TabManager::setSimplifiedCaptionEnabled(bool enabled) } simplifiedCaption_ = enabled; - for (TabDlg *tab : qAsConst(tabs_)) { + for (TabDlg *tab : std::as_const(tabs_)) { tab->setSimplifiedCaptionEnabled(enabled); } } diff --git a/src/textutil.cpp b/src/textutil.cpp index a23e7c7b7..f37db9cbf 100644 --- a/src/textutil.cpp +++ b/src/textutil.cpp @@ -513,7 +513,7 @@ QString TextUtil::emoticonify(const QString &in) int foundPos = -1, foundLen = -1; - for (const Iconset *iconset : qAsConst(PsiIconset::instance()->emoticons)) { + for (const Iconset *iconset : std::as_const(PsiIconset::instance()->emoticons)) { QListIterator it = iconset->iterator(); while (it.hasNext()) { PsiIcon *icon = it.next(); diff --git a/src/tools/advwidget/advwidget.cpp b/src/tools/advwidget/advwidget.cpp index 35aa13058..85c834ba5 100644 --- a/src/tools/advwidget/advwidget.cpp +++ b/src/tools/advwidget/advwidget.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -110,7 +110,7 @@ GAdvancedWidget::Private::Private(QWidget *parent) : QObject(parent), parentWidg void GAdvancedWidget::Private::posChanging(int *x, int *y, int *width, int *height) { - if (stickAt <= 0 || !stickEnabled || !parentWidget_->isTopLevel() || parentWidget_->isMaximized() + if (stickAt <= 0 || !stickEnabled || !parentWidget_->isWindow() || parentWidget_->isMaximized() || !parentWidget_->updatesEnabled()) { return; } @@ -121,20 +121,20 @@ void GAdvancedWidget::Private::posChanging(int *x, int *y, int *width, int *heig bool resizing = p->frameSize() != QSize(*width, *height); - QDesktopWidget *desktop = qApp->desktop(); + auto parentScreen = p->screen(); QWidgetList list; if (stickToWindows) list = QApplication::topLevelWidgets(); - for (QWidget *w : qAsConst(list)) { + for (QWidget *w : std::as_const(list)) { QRect rect; bool dockWidget = false; if (w->windowType() == Qt::Desktop) - rect = (static_cast(w))->availableGeometry(static_cast(parent())); + rect = w->frameGeometry(); else { - if (w == p || desktop->screenNumber(p) != desktop->screenNumber(w)) + if (w == p || parentScreen != w->screen()) continue; if (!w->isVisible()) @@ -262,7 +262,7 @@ void GAdvancedWidget::Private::saveGeometry() isMaximized ? normalGeometry_ : parentWidget_->normalGeometry()); PsiOptions::instance()->setOption(geometryOptionPath_ + "-frame", parentWidget_->frameGeometry()); PsiOptions::instance()->setOption(geometryOptionPath_ + "-screen", - QApplication::desktop()->screenNumber(parentWidget_)); + QGuiApplication::screens().indexOf(parentWidget_->screen())); PsiOptions::instance()->setOption(geometryOptionPath_ + "-maximized", isMaximized); PsiOptions::instance()->setOption(geometryOptionPath_ + "-fullscreen", bool(parentWidget_->windowState() & Qt::WindowFullScreen)); @@ -273,7 +273,7 @@ void GAdvancedWidget::Private::restoreGeometry() PsiOptions *o = PsiOptions::instance(); QVariant v(o->getOption(geometryOptionPath_)); - if (v.type() == QVariant::ByteArray) { + if (v.typeId() == QVariant::ByteArray) { // migrate options back from format used for a short time before // 0.12-RC2. This can be removed later. parentWidget_->restoreGeometry(v.toByteArray()); @@ -288,6 +288,9 @@ void GAdvancedWidget::Private::restoreGeometry() QByteArray array; QDataStream stream(&array, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_0); + // see https://github.com/qt/qtbase/blob/6.7/src/widgets/kernel/qwidget.cpp + // TODO 2024. update to version 3 or get rid of text form at all since the format + // looks pretty much forward and backward compatible const quint32 magicNumber = 0x1D9D0CB; quint16 majorVersion = 1; quint16 minorVersion = 0; diff --git a/src/tools/iconset/iconset.cpp b/src/tools/iconset/iconset.cpp index 6ea195084..121458a76 100644 --- a/src/tools/iconset/iconset.cpp +++ b/src/tools/iconset/iconset.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #ifdef ICONSET_SOUND @@ -861,7 +860,7 @@ class IconsetFactoryPrivate : public QObject { { QStringList list; - for (const Iconset *iconset : qAsConst(*iconsets_)) { + for (const Iconset *iconset : std::as_const(*iconsets_)) { QListIterator it = iconset->iterator(); while (it.hasNext()) { list << it.next()->name(); @@ -920,7 +919,7 @@ const PsiIcon *IconsetFactoryPrivate::icon(const QString &name) const } const PsiIcon *out = nullptr; - for (const Iconset *const iconset : qAsConst(*iconsets_)) { + for (const Iconset *const iconset : std::as_const(*iconsets_)) { if (iconset) { out = iconset->icon(name); } @@ -1228,7 +1227,7 @@ class Iconset::Private : public QSharedData { // construct RegExp if (text.count()) { QStringList regexp; - for (const PsiIcon::IconText &t : qAsConst(text)) { + for (const PsiIcon::IconText &t : std::as_const(text)) { regexp += QRegularExpression::escape(t.text); } @@ -1402,7 +1401,7 @@ class Iconset::Private : public QSharedData { // construct RegExp if (text.count()) { QStringList regexp; - for (const PsiIcon::IconText &t : qAsConst(text)) { + for (const PsiIcon::IconText &t : std::as_const(text)) { regexp += QRegularExpression::escape(t.text); } diff --git a/src/tools/optionstree/optionstreereader.h b/src/tools/optionstree/optionstreereader.h index e3bc3823a..17953eb3f 100644 --- a/src/tools/optionstree/optionstreereader.h +++ b/src/tools/optionstree/optionstreereader.h @@ -8,7 +8,6 @@ class OptionsTree; class QRect; class QSize; -class QStringList; class VariantTree; class OptionsTreeReader : public AtomicXmlFileReader { diff --git a/src/tools/optionstree/varianttree.cpp b/src/tools/optionstree/varianttree.cpp index 495251ca3..830ad85aa 100644 --- a/src/tools/optionstree/varianttree.cpp +++ b/src/tools/optionstree/varianttree.cpp @@ -277,7 +277,7 @@ QStringList VariantTree::nodeChildren(const QString &node, bool direct, bool int return children; } else { QStringList long_children; - for (const QString &child : qAsConst(children)) { + for (const QString &child : std::as_const(children)) { QString long_child = QString("%1.%2").arg(key, child); long_children << long_child; } diff --git a/src/tools/tunecontroller/mpristunecontroller.cpp b/src/tools/tunecontroller/mpristunecontroller.cpp index d55116cc2..f7419cd56 100644 --- a/src/tools/tunecontroller/mpristunecontroller.cpp +++ b/src/tools/tunecontroller/mpristunecontroller.cpp @@ -58,7 +58,7 @@ MPRISTuneController::MPRISTuneController() : tuneSent_(false) qDBusRegisterMetaType(); QDBusConnection bus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, busName); players_ = bus.interface()->registeredServiceNames().value().filter(MPRIS_PREFIX); - for (const QString &player : qAsConst(players_)) { + for (const QString &player : std::as_const(players_)) { connectToBus(player); } bus.connect(QLatin1String("org.freedesktop.DBus"), QLatin1String("/org/freedesktop/DBus"), @@ -68,7 +68,7 @@ MPRISTuneController::MPRISTuneController() : tuneSent_(false) MPRISTuneController::~MPRISTuneController() { - for (const QString &player : qAsConst(players_)) { + for (const QString &player : std::as_const(players_)) { disconnectFromBus(player); } QDBusConnection(busName).disconnect(QLatin1String("org.freedesktop.DBus"), QLatin1String("/org/freedesktop/DBus"), diff --git a/src/userlist.cpp b/src/userlist.cpp index bc01dd04d..3a2868ebf 100644 --- a/src/userlist.cpp +++ b/src/userlist.cpp @@ -642,7 +642,7 @@ QString UserListItem::makeBareTip(bool trim, bool doLinkify) const str += QString("
") + QObject::tr("Presence Error") + QString(": %1").arg(TextUtil::escape(err[0])) + "
"; err.pop_front(); - for (const QString &line : qAsConst(err)) + for (const QString &line : std::as_const(err)) str += "
" + TextUtil::escape(line) + "
"; } @@ -681,7 +681,7 @@ bool UserListItem::isSecure(const QString &rname) const { return secList.contain void UserListItem::setSecure(const QString &rname, bool b) { - for (const QString &s : qAsConst(secList)) { + for (const QString &s : std::as_const(secList)) { if (s == rname) { if (!b) secList.removeAll(s); @@ -701,7 +701,7 @@ void UserListItem::setPublicKeyID(const QString &k) { v_keyID = k; } //---------------------------------------------------------------------------- UserListItem *UserList::find(const XMPP::Jid &j) { - for (UserListItem *i : qAsConst(*this)) { + for (UserListItem *i : std::as_const(*this)) { if (i->jid().compare(j)) return i; } diff --git a/src/varlist.cpp b/src/varlist.cpp index 717721004..d67534f1a 100644 --- a/src/varlist.cpp +++ b/src/varlist.cpp @@ -49,7 +49,7 @@ void VarList::fromOptions(OptionsTree *o, QString base) void VarList::toOptions(OptionsTree *o, QString base) { o->removeOption(base, true); - for (const VarListItem &item : qAsConst(*this)) { + for (const VarListItem &item : std::as_const(*this)) { QString ibase = o->mapPut(base, item.key()); o->setOption(ibase + ".data", item.data()); } diff --git a/src/varlist.h b/src/varlist.h index aedd61f56..a68a9cc86 100644 --- a/src/varlist.h +++ b/src/varlist.h @@ -26,7 +26,6 @@ class OptionsTree; class QDomDocument; class QDomElement; -class QStringList; class VarListItem { public: diff --git a/src/webview.cpp b/src/webview.cpp index cd937f0a5..d49d1cabd 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -129,7 +129,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) if (!page()->selectedText().isEmpty()) { #ifdef WEBENGINE menu->addAction(pageAction(QWebEnginePage::Copy)); - for (auto act : qAsConst(contextMenuActions_)) { + for (auto act : std::as_const(contextMenuActions_)) { menu->addAction(act); } } else { diff --git a/src/whiteboarding/wbitem.cpp b/src/whiteboarding/wbitem.cpp index 662e47520..9560a0257 100644 --- a/src/whiteboarding/wbitem.cpp +++ b/src/whiteboarding/wbitem.cpp @@ -37,7 +37,7 @@ WbItemMenu::WbItemMenu(QWidget *parent) : QMenu(parent) { connect(this, SIGNAL(a WbItemMenu::~WbItemMenu() { - for (QActionGroup *g : qAsConst(groups_)) { + for (QActionGroup *g : std::as_const(groups_)) { const auto &acts = g->actions(); for (QAction *a : acts) { a->deleteLater(); diff --git a/src/whiteboarding/wbmanager.cpp b/src/whiteboarding/wbmanager.cpp index 64df3ab3c..d5c9f326c 100644 --- a/src/whiteboarding/wbmanager.cpp +++ b/src/whiteboarding/wbmanager.cpp @@ -142,7 +142,7 @@ void WbManager::removeDialog(WbDlg *dialog) WbDlg *WbManager::findWbDlg(const Jid &jid) { // find if a dialog for the jid already exists - for (WbDlg *w : qAsConst(dialogs_)) { + for (WbDlg *w : std::as_const(dialogs_)) { // does the jid match? if (w->session()->target().compare(jid)) { return w; @@ -199,7 +199,7 @@ void WbManager::checkInvitation(const Jid &peer, const QList &features, void WbManager::requestActivated(int id) { - for (WbRequest *wr : qAsConst(requests_)) { + for (WbRequest *wr : std::as_const(requests_)) { if (wr->id() == id) { wr->stopLoop(); return; diff --git a/src/whiteboarding/wbscene.cpp b/src/whiteboarding/wbscene.cpp index 4aba4c85d..33c6f67ec 100644 --- a/src/whiteboarding/wbscene.cpp +++ b/src/whiteboarding/wbscene.cpp @@ -29,7 +29,7 @@ void WbScene::queueTransformationRegeneration(WbItem *item) void WbScene::regenerateTransformations() { - for (QPointer item : qAsConst(pendingTranformations_)) { + for (QPointer item : std::as_const(pendingTranformations_)) { if (item) { // qDebug() << QString("Regenerating %1 transform.").arg((unsigned int) &(*item)).toLatin1(); item->regenerateTransform(); diff --git a/src/whiteboarding/wbwidget.cpp b/src/whiteboarding/wbwidget.cpp index 62df6da17..8f99057bf 100644 --- a/src/whiteboarding/wbwidget.cpp +++ b/src/whiteboarding/wbwidget.cpp @@ -332,7 +332,7 @@ void WbWidget::mouseReleaseEvent(QMouseEvent *event) WbItem *WbWidget::wbItem(const QDomNode &node) { - for (WbItem *wbitem : qAsConst(items_)) { + for (WbItem *wbitem : std::as_const(items_)) { if (wbitem->node() == node) return wbitem; } @@ -446,7 +446,7 @@ void WbWidget::rerender() renderer_.load(xmldump.toLatin1()); // Update all positions if changed - for (WbItem *wbitem : qAsConst(items_)) { + for (WbItem *wbitem : std::as_const(items_)) { // resetting elementId is necessary for rendering some updates to the element (e.g. adding child elements to // ) wbitem->setElementId(wbitem->id()); diff --git a/src/widgets/fancypopup.cpp b/src/widgets/fancypopup.cpp index cb307465e..9cd0b90c0 100644 --- a/src/widgets/fancypopup.cpp +++ b/src/widgets/fancypopup.cpp @@ -162,7 +162,7 @@ QPoint FancyPopup::Private::position() if (destination.y() < 0) destination.setY(0); - for (FancyPopup *p : qAsConst(prevPopups)) + for (FancyPopup *p : std::as_const(prevPopups)) destination.setY(destination.y() + popupLayout * p->height()); return destination; diff --git a/src/widgets/iconaction.cpp b/src/widgets/iconaction.cpp index f6c88aece..79838a16d 100644 --- a/src/widgets/iconaction.cpp +++ b/src/widgets/iconaction.cpp @@ -172,7 +172,7 @@ void IconAction::setPsiIcon(const PsiIcon *i) QAction::setIcon(is); - for (IconToolButton *btn : qAsConst(d->buttons)) + for (IconToolButton *btn : std::as_const(d->buttons)) btn->setPsiIcon(d->icon); #endif } @@ -255,7 +255,7 @@ void IconAction::objectDestroyed() void IconAction::setChecked(bool b) { QAction::setChecked(b); - for (IconToolButton *btn : qAsConst(d->buttons)) + for (IconToolButton *btn : std::as_const(d->buttons)) btn->setChecked(b); } @@ -264,14 +264,14 @@ void IconAction::toolButtonToggled(bool b) { setChecked(b); } void IconAction::setEnabled(bool e) { QAction::setEnabled(e); - for (IconToolButton *btn : qAsConst(d->buttons)) + for (IconToolButton *btn : std::as_const(d->buttons)) btn->setEnabled(e); } void IconAction::setText(const QString &t) { QAction::setText(t); - for (IconToolButton *btn : qAsConst(d->buttons)) + for (IconToolButton *btn : std::as_const(d->buttons)) btn->setText(t); } @@ -295,7 +295,7 @@ void IconAction::doSetMenu(QMenu *p) { QAction::setMenu(p); - for (IconToolButton *btn : qAsConst(d->buttons)) { + for (IconToolButton *btn : std::as_const(d->buttons)) { btn->setMenu(nullptr); if (menu()) @@ -307,7 +307,7 @@ void IconAction::setIcon(const QIcon &ic) { QAction::setIcon(ic); - for (IconToolButton *btn : qAsConst(d->buttons)) + for (IconToolButton *btn : std::as_const(d->buttons)) btn->setIcon(ic); } @@ -315,7 +315,7 @@ void IconAction::setVisible(bool b) { QAction::setVisible(b); - for (IconToolButton *btn : qAsConst(d->buttons)) { + for (IconToolButton *btn : std::as_const(d->buttons)) { if (b) btn->show(); else diff --git a/src/widgets/psirichtext.cpp b/src/widgets/psirichtext.cpp index 5f900a9f5..75f9d7c02 100644 --- a/src/widgets/psirichtext.cpp +++ b/src/widgets/psirichtext.cpp @@ -439,7 +439,7 @@ static void appendTextHelper(QTextDocument *doc, QString text, QTextCursor &curs QString path = QFileInfo(imgSrcUrl.scheme() == "file" ? imgSrcUrl.toLocalFile() : imgSrc).absoluteFilePath(); bool baseDirFound = false; - for (const QString &baseDir : qAsConst(allowedImageDirs)) { + for (const QString &baseDir : std::as_const(allowedImageDirs)) { if (path.startsWith(baseDir)) { baseDirFound = true; break;