mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
lint and avoid copy
This commit is contained in:
parent
a320fc6f7a
commit
0ab566dc4b
3 changed files with 44 additions and 43 deletions
24
src/Config.h
24
src/Config.h
|
@ -25,8 +25,7 @@ constexpr auto LABEL_MEDIUM_SIZE_RATIO = 1.3;
|
||||||
|
|
||||||
namespace strings {
|
namespace strings {
|
||||||
const QString url_html = QStringLiteral("<a href=\"\\1\">\\1</a>");
|
const QString url_html = QStringLiteral("<a href=\"\\1\">\\1</a>");
|
||||||
const QRegularExpression
|
const QRegularExpression url_regex(
|
||||||
url_regex(
|
|
||||||
// match an unquoted URL
|
// match an unquoted URL
|
||||||
[]() {
|
[]() {
|
||||||
const auto general_unicode = QStringLiteral(
|
const auto general_unicode = QStringLiteral(
|
||||||
|
@ -34,8 +33,8 @@ const QRegularExpression
|
||||||
const auto protocol = QStringLiteral(R"((?:[Hh][Tt][Tt][Pp][Ss]?))");
|
const auto protocol = QStringLiteral(R"((?:[Hh][Tt][Tt][Pp][Ss]?))");
|
||||||
const auto unreserved_subdelims_colon = QStringLiteral(R"([a-zA-Z0-9\-._~!$&'()*+,;=:])");
|
const auto unreserved_subdelims_colon = QStringLiteral(R"([a-zA-Z0-9\-._~!$&'()*+,;=:])");
|
||||||
const auto pct_enc = QStringLiteral(R"((?:%[[:xdigit:]]{2}))");
|
const auto pct_enc = QStringLiteral(R"((?:%[[:xdigit:]]{2}))");
|
||||||
const auto userinfo = "(?:" + unreserved_subdelims_colon + "*(?:" + pct_enc +
|
const auto userinfo =
|
||||||
unreserved_subdelims_colon + "*)*)";
|
"(?:" + unreserved_subdelims_colon + "*(?:" + pct_enc + unreserved_subdelims_colon + "*)*)";
|
||||||
const auto dec_octet =
|
const auto dec_octet =
|
||||||
QStringLiteral(R"((?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]))");
|
QStringLiteral(R"((?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]))");
|
||||||
const auto ipv4_addr = "(?:" + dec_octet + R"((?:\.)" + dec_octet + "){3})";
|
const auto ipv4_addr = "(?:" + dec_octet + R"((?:\.)" + dec_octet + "){3})";
|
||||||
|
@ -65,14 +64,15 @@ const QRegularExpression
|
||||||
const auto query = R"(((?:[a-zA-Z0-9\-._~!$&'*+,;=:@/?\\{}]|)" + pct_enc +
|
const auto query = R"(((?:[a-zA-Z0-9\-._~!$&'*+,;=:@/?\\{}]|)" + pct_enc +
|
||||||
R"(|\((?-1)\)|\[(?-1)\]|)" + general_unicode + ")*)";
|
R"(|\((?-1)\)|\[(?-1)\]|)" + general_unicode + ")*)";
|
||||||
const auto &fragment = query;
|
const auto &fragment = query;
|
||||||
return
|
return R"((?<!["'\w])(?>()" + protocol + "://" + "(?:" + userinfo + "@)?" + host +
|
||||||
R"((?<!["'\w])(?>()"
|
"(?::[0-9]+)?" + path +
|
||||||
+ protocol + "://"
|
"?"
|
||||||
+ "(?:" + userinfo + "@)?"
|
R"((?:\?)" +
|
||||||
+ host + "(?::[0-9]+)?"
|
query +
|
||||||
+ path + "?"
|
")?"
|
||||||
R"((?:\?)" + query + ")?"
|
R"((?:#)" +
|
||||||
R"((?:#)" + fragment + ")?"
|
fragment +
|
||||||
|
")?"
|
||||||
"(?<![.!?,;:'])"
|
"(?<![.!?,;:'])"
|
||||||
R"())(?!["']))";
|
R"())(?!["']))";
|
||||||
}(),
|
}(),
|
||||||
|
|
|
@ -275,7 +275,8 @@ NotificationsManager::notificationClosed(uint id, uint reason)
|
||||||
void
|
void
|
||||||
NotificationsManager::closeAllNotifications()
|
NotificationsManager::closeAllNotifications()
|
||||||
{
|
{
|
||||||
for (auto id : notificationIds.keys()) {
|
const auto ids = notificationIds.keys();
|
||||||
|
for (const auto &id : ids) {
|
||||||
closeNotification(id);
|
closeNotification(id);
|
||||||
notificationIds.remove(id);
|
notificationIds.remove(id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue