Replaced deprecated QRegExp by QRegularExpression

This commit is contained in:
thunder2 2025-07-21 00:37:10 +02:00
parent f0286740f4
commit 13b294838b
8 changed files with 26 additions and 18 deletions

View file

@ -103,6 +103,7 @@
#include <QXmlStreamReader>
#include <QDomDocument>
#include <QTextStream>
#include <QRegularExpression>
#include "ChatStyle.h"
#include "gui/settings/rsharesettings.h"
@ -376,7 +377,7 @@ QString ChatStyle::formatMessage(enumFormatMessage type
QString strDate = DateTime::formatDate(timestamp.date()).prepend(QString("<a name=\"date\">")).append(QString("</a>"));
QString strTime = DateTime::formatTime(timestamp.time()).prepend(QString("<a name=\"time\">")).append(QString("</a>"));
int bi = name.lastIndexOf(QRegExp(" \\(.*\\)")); //trim location from the end
int bi = name.lastIndexOf(QRegularExpression(" \\(.*\\)")); //trim location from the end
QString strShortName = RsHtml::plainText(name.left(bi)).prepend(QString("<a name=\"name\">")).append(QString("</a>"));
//handle /me
@ -384,9 +385,9 @@ QString ChatStyle::formatMessage(enumFormatMessage type
//meName class for modifying the style of the name in the palce of /me
if(me){
messageBody = messageBody.replace(messageBody.indexOf("/me "), 3, strShortName.prepend(QString("<span class=\"meName\">")).append(QString("</span>"))); //replace only the first /me
style = style.remove(QRegExp("%nome%.*%/nome%")).remove("%me%").remove("%/me%");
style = style.remove(QRegularExpression("%nome%.*%/nome%")).remove("%me%").remove("%/me%");
} else {
style = style.remove(QRegExp("%me%.*%/me%")).remove("%nome%").remove("%/nome%");
style = style.remove(QRegularExpression("%me%.*%/me%")).remove("%nome%").remove("%/nome%");
}
QString formatMsg = style.replace("%name%", strName)