From c4b2be45d29a247422e60bb8fdf1664c10384eee Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 6 Dec 2021 03:51:08 -0600 Subject: First pass for Qt6 compatibility --- src/organizercore.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/organizercore.cpp') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 7cf3212a..0807957b 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1428,17 +1428,20 @@ void OrganizerCore::requestDownload(const QUrl &url, QNetworkReply *reply) QString gameName = ""; int modID = 0; int fileID = 0; - QRegExp nameExp("www\\.nexusmods\\.com/(\\a+)/"); - if (nameExp.indexIn(url.toString()) != -1) { - gameName = nameExp.cap(1); + QRegularExpression nameExp("www\\.nexusmods\\.com/(\\a+)/"); + auto match = nameExp.match(url.toString()); + if (match.hasMatch()) { + gameName = match.captured(1); } - QRegExp modExp("mods/(\\d+)"); - if (modExp.indexIn(url.toString()) != -1) { - modID = modExp.cap(1).toInt(); + QRegularExpression modExp("mods/(\\d+)"); + match = modExp.match(url.toString()); + if (match.hasMatch()) { + modID = match.captured(1).toInt(); } - QRegExp fileExp("fid=(\\d+)"); - if (fileExp.indexIn(reply->url().toString()) != -1) { - fileID = fileExp.cap(1).toInt(); + QRegularExpression fileExp("fid=(\\d+)"); + match = fileExp.match(url.toString()); + if (match.hasMatch()) { + fileID = match.captured(1).toInt(); } m_DownloadManager.addDownload(reply, new ModRepositoryFileInfo(gameName, modID, fileID)); -- cgit v1.3.1