Mod some qWarning add QObject::tr

This commit is contained in:
Simon De Backer
2020-09-24 22:39:11 +02:00
parent 3b9ba6a261
commit 30b8205f82
6 changed files with 159 additions and 128 deletions

View File

@@ -245,7 +245,7 @@ void ElementsLocation::setPath(const QString &path)
("^project(?<project_id>[0-9])\\+(?<collection_path>embed://*.*)$");
if (!re.isValid())
{
qWarning() <<"this is an error in the code"
qWarning() <<QObject::tr("this is an error in the code")
<< re.errorString()
<< re.patternErrorOffset();
return;

View File

@@ -344,6 +344,12 @@ void SearchAndReplaceWorker::replaceAdvanced(
for (IndependentTextItem *text : texts)
{
QRegularExpression rx(m_advanced_struct.search);
if (!rx.isValid())
{
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
}
QString replace = m_advanced_struct.replace;
QString after = text->toPlainText();
after = after.replace(rx, replace);
@@ -461,6 +467,12 @@ TitleBlockProperties SearchAndReplaceWorker::replaceAdvanced(Diagram *diagram)
if (m_advanced_struct.who == 0)
{
QRegularExpression rx(m_advanced_struct.search);
if (!rx.isValid())
{
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
}
QString replace = m_advanced_struct.replace;
QString what = m_advanced_struct.what;
if (what == "title") {p.title = p.title.replace(rx, replace);}
@@ -490,6 +502,12 @@ DiagramContext SearchAndReplaceWorker::replaceAdvanced(Element *element)
if (context.contains(what))
{
QRegularExpression rx(m_advanced_struct.search);
if (!rx.isValid())
{
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
}
QString replace = m_advanced_struct.replace;
QString value = context[what].toString();
context.addValue(what, value.replace(rx, replace));
@@ -513,6 +531,12 @@ ConductorProperties SearchAndReplaceWorker::replaceAdvanced(
if (m_advanced_struct.who == 2)
{
QRegularExpression rx(m_advanced_struct.search);
if (!rx.isValid())
{
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
}
QString what = m_advanced_struct.what;
QString replace = m_advanced_struct.replace;

View File

@@ -407,6 +407,13 @@ void SearchAndReplaceWidget::search()
{
//entire word
QRegularExpression rx("\\b" + str + "\\b");
if (!rx.isValid())
{
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
return;
}
if (!ui->m_case_sensitive_cb->isChecked()) {
rx.setPatternOptions(
QRegularExpression::CaseInsensitiveOption);

View File

@@ -574,7 +574,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
QRegularExpression rx("^(?<name>[a-z-]+):(?<value>[a-z-]+)$");
if (!rx.isValid())
{
qWarning() <<"this is an error in the code"
qWarning() <<QObject::tr("this is an error in the code")
<< rx.errorString()
<< rx.patternErrorOffset();
return;

View File

@@ -2109,7 +2109,7 @@ int QETApp::projectIdFromString(const QString &url) {
QRegularExpression::CaseInsensitiveOption);
if (!embedded.isValid())
{
qWarning() <<"this is an error in the code"
qWarning() <<QObject::tr("this is an error in the code")
<< embedded.errorString()
<< embedded.patternErrorOffset();
return(-1);

View File

@@ -104,7 +104,7 @@ void TitleBlockTemplateLocation::fromString(const QString &loc_str)
QRegularExpression name_from_url("//*(?<name>.*)");
if (!name_from_url.isValid())
{
qWarning() <<"this is an error in the code"
qWarning() <<QObject::tr("this is an error in the code")
<< name_from_url.errorString()
<< name_from_url.patternErrorOffset();
return;