mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix a few clazy warnings
This commit is contained in:
parent
6a53944805
commit
23d9decbce
3 changed files with 11 additions and 21 deletions
|
@ -318,18 +318,6 @@ MainWindow::setWindowTitle(int notificationCount)
|
||||||
QQuickView::setTitle(name);
|
QQuickView::setTitle(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MainWindow::event(QEvent *event)
|
|
||||||
{
|
|
||||||
auto type = event->type();
|
|
||||||
|
|
||||||
if (type == QEvent::Close) {
|
|
||||||
closeEvent(static_cast<QCloseEvent *>(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
return QQuickView::event(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
void
|
void
|
||||||
MainWindow::mousePressEvent(QMouseEvent *event)
|
MainWindow::mousePressEvent(QMouseEvent *event)
|
||||||
|
@ -403,6 +391,7 @@ MainWindow::closeEvent(QCloseEvent *event)
|
||||||
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() && userSettings_->tray()) {
|
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() && userSettings_->tray()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
hide();
|
hide();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,7 @@ public:
|
||||||
QString focusedRoom() const;
|
QString focusedRoom() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event) override;
|
||||||
bool event(QEvent *event) override;
|
|
||||||
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
// HACK: https://bugreports.qt.io/browse/QTBUG-83972, qtwayland cannot auto hide menu
|
||||||
void mousePressEvent(QMouseEvent *) override;
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,9 @@ utils::stripReplyFromBody(const std::string &bodyi)
|
||||||
if (body.startsWith(QLatin1String("> <"))) {
|
if (body.startsWith(QLatin1String("> <"))) {
|
||||||
auto segments = body.split('\n');
|
auto segments = body.split('\n');
|
||||||
while (!segments.isEmpty() && segments.begin()->startsWith('>'))
|
while (!segments.isEmpty() && segments.begin()->startsWith('>'))
|
||||||
segments.erase(segments.begin());
|
segments.erase(segments.cbegin());
|
||||||
if (!segments.empty() && segments.first().isEmpty())
|
if (!segments.empty() && segments.first().isEmpty())
|
||||||
segments.erase(segments.begin());
|
segments.erase(segments.cbegin());
|
||||||
body = segments.join('\n');
|
body = segments.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,9 @@ std::string
|
||||||
utils::stripReplyFromFormattedBody(const std::string &formatted_bodyi)
|
utils::stripReplyFromFormattedBody(const std::string &formatted_bodyi)
|
||||||
{
|
{
|
||||||
QString formatted_body = QString::fromStdString(formatted_bodyi);
|
QString formatted_body = QString::fromStdString(formatted_bodyi);
|
||||||
formatted_body.remove(QRegularExpression(QStringLiteral("<mx-reply>.*</mx-reply>"),
|
static QRegularExpression replyRegex(QStringLiteral("<mx-reply>.*</mx-reply>"),
|
||||||
QRegularExpression::DotMatchesEverythingOption));
|
QRegularExpression::DotMatchesEverythingOption);
|
||||||
|
formatted_body.remove(replyRegex);
|
||||||
formatted_body.replace(QLatin1String("@room"), QString::fromUtf8("@\u2060room"));
|
formatted_body.replace(QLatin1String("@room"), QString::fromUtf8("@\u2060room"));
|
||||||
return formatted_body.toStdString();
|
return formatted_body.toStdString();
|
||||||
}
|
}
|
||||||
|
@ -409,9 +410,10 @@ utils::linkifyMessage(const QString &body)
|
||||||
// Convert to valid XML.
|
// Convert to valid XML.
|
||||||
auto doc = body;
|
auto doc = body;
|
||||||
doc.replace(conf::strings::url_regex, conf::strings::url_html);
|
doc.replace(conf::strings::url_regex, conf::strings::url_html);
|
||||||
doc.replace(
|
|
||||||
QRegularExpression(QStringLiteral("\\b(?<![\"'])(?>(matrix:[\\S]{5,}))(?![\"'])\\b")),
|
static QRegularExpression matrixURIRegex(
|
||||||
conf::strings::url_html);
|
QStringLiteral("\\b(?<![\"'])(?>(matrix:[\\S]{5,}))(?![\"'])\\b"));
|
||||||
|
doc.replace(matrixURIRegex, conf::strings::url_html);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue