mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
use more literals
This commit is contained in:
parent
f3e1941612
commit
a3c4ebc460
7 changed files with 25 additions and 25 deletions
|
@ -63,10 +63,10 @@ const QRegularExpression url_regex(
|
||||||
QStringLiteral(
|
QStringLiteral(
|
||||||
R"((?<!["'])(?>((www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'"]+[^!,\.\s<>'"\]\)\:]))(?!["']))"));
|
R"((?<!["'])(?>((www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>'"]+[^!,\.\s<>'"\]\)\:]))(?!["']))"));
|
||||||
// match any markdown matrix.to link. Capture group 1 is the link name, group 2 is the target.
|
// match any markdown matrix.to link. Capture group 1 is the link name, group 2 is the target.
|
||||||
static const QRegularExpression matrixToMarkdownLink(
|
static const QRegularExpression
|
||||||
R"(\[(.*?)(?<!\\)\]\((https://matrix.to/#/.*?\)))"); // clazy:exclude=non-pod-global-static
|
matrixToMarkdownLink(QStringLiteral(R"(\[(.*?)(?<!\\)\]\((https://matrix.to/#/.*?\)))"));
|
||||||
static const QRegularExpression matrixToLink(
|
static const QRegularExpression
|
||||||
R"(<a href=\"(https://matrix.to/#/.*?)\">(.*?)</a>)"); // clazy:exclude=non-pod-global-static
|
matrixToLink(QStringLiteral(R"(<a href=\"(https://matrix.to/#/.*?)\">(.*?)</a>)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window geometry.
|
// Window geometry.
|
||||||
|
|
|
@ -94,8 +94,8 @@ event_body(const mtx::events::collections::TimelineEvents &event);
|
||||||
//! Match widgets/events with a description message.
|
//! Match widgets/events with a description message.
|
||||||
template<class T>
|
template<class T>
|
||||||
QString
|
QString
|
||||||
messageDescription(const QString &username = "",
|
messageDescription(const QString &username = QString(),
|
||||||
const QString &body = "",
|
const QString &body = QString(),
|
||||||
const bool isLocal = false)
|
const bool isLocal = false)
|
||||||
{
|
{
|
||||||
using Audio = mtx::events::RoomEvent<mtx::events::msg::Audio>;
|
using Audio = mtx::events::RoomEvent<mtx::events::msg::Audio>;
|
||||||
|
@ -157,7 +157,7 @@ messageDescription(const QString &username = "",
|
||||||
return QCoreApplication::translate("message-description sent:", "%1: %2")
|
return QCoreApplication::translate("message-description sent:", "%1: %2")
|
||||||
.arg(username, body);
|
.arg(username, body);
|
||||||
} else if (std::is_same<T, Emote>::value) {
|
} else if (std::is_same<T, Emote>::value) {
|
||||||
return QString("* %1 %2").arg(username, body);
|
return QStringLiteral("* %1 %2").arg(username, body);
|
||||||
} else if (std::is_same<T, Encrypted>::value) {
|
} else if (std::is_same<T, Encrypted>::value) {
|
||||||
if (isLocal)
|
if (isLocal)
|
||||||
return QCoreApplication::translate("message-description sent:",
|
return QCoreApplication::translate("message-description sent:",
|
||||||
|
|
|
@ -68,17 +68,17 @@ CreateRoom::CreateRoom(QWidget *parent)
|
||||||
|
|
||||||
auto visibilityLabel = new QLabel(tr("Room Visibility"), this);
|
auto visibilityLabel = new QLabel(tr("Room Visibility"), this);
|
||||||
visibilityCombo_ = new QComboBox(this);
|
visibilityCombo_ = new QComboBox(this);
|
||||||
visibilityCombo_->addItem("Private");
|
visibilityCombo_->addItem(tr("Private"));
|
||||||
visibilityCombo_->addItem("Public");
|
visibilityCombo_->addItem(tr("Public"));
|
||||||
|
|
||||||
visibilityLayout->addWidget(visibilityLabel);
|
visibilityLayout->addWidget(visibilityLabel);
|
||||||
visibilityLayout->addWidget(visibilityCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
visibilityLayout->addWidget(visibilityCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||||
|
|
||||||
auto presetLabel = new QLabel(tr("Room Preset"), this);
|
auto presetLabel = new QLabel(tr("Room Preset"), this);
|
||||||
presetCombo_ = new QComboBox(this);
|
presetCombo_ = new QComboBox(this);
|
||||||
presetCombo_->addItem("Private Chat");
|
presetCombo_->addItem(tr("Private Chat"));
|
||||||
presetCombo_->addItem("Public Chat");
|
presetCombo_->addItem(tr("Public Chat"));
|
||||||
presetCombo_->addItem("Trusted Private Chat");
|
presetCombo_->addItem(tr("Trusted Private Chat"));
|
||||||
|
|
||||||
presetLayout->addWidget(presetLabel);
|
presetLayout->addWidget(presetLabel);
|
||||||
presetLayout->addWidget(presetCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
presetLayout->addWidget(presetCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
|
||||||
|
@ -119,10 +119,10 @@ CreateRoom::CreateRoom(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(visibilityCombo_,
|
connect(visibilityCombo_,
|
||||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
[this](const QString &text) {
|
[this](int idx) {
|
||||||
if (text == "Private") {
|
if (idx == 0) {
|
||||||
request_.visibility = mtx::common::RoomVisibility::Private;
|
request_.visibility = mtx::common::RoomVisibility::Private;
|
||||||
} else {
|
} else {
|
||||||
request_.visibility = mtx::common::RoomVisibility::Public;
|
request_.visibility = mtx::common::RoomVisibility::Public;
|
||||||
|
@ -130,12 +130,12 @@ CreateRoom::CreateRoom(QWidget *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(presetCombo_,
|
connect(presetCombo_,
|
||||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
[this](const QString &text) {
|
[this](int idx) {
|
||||||
if (text == "Private Chat") {
|
if (idx == 0) {
|
||||||
request_.preset = mtx::requests::Preset::PrivateChat;
|
request_.preset = mtx::requests::Preset::PrivateChat;
|
||||||
} else if (text == "Public Chat") {
|
} else if (idx == 1) {
|
||||||
request_.preset = mtx::requests::Preset::PublicChat;
|
request_.preset = mtx::requests::Preset::PublicChat;
|
||||||
} else {
|
} else {
|
||||||
request_.preset = mtx::requests::Preset::TrustedPrivateChat;
|
request_.preset = mtx::requests::Preset::TrustedPrivateChat;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
|
ImageOverlay::ImageOverlay(const QPixmap &image, QWidget *parent)
|
||||||
: QWidget{parent}
|
: QWidget{parent}
|
||||||
, originalImage_{image}
|
, originalImage_{image}
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
|
||||||
setParent(nullptr);
|
setParent(nullptr);
|
||||||
|
|
||||||
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
setWindowRole("imageoverlay");
|
setWindowRole(QStringLiteral("imageoverlay"));
|
||||||
|
|
||||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ImageOverlay : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ImageOverlay(QPixmap image, QWidget *parent = nullptr);
|
ImageOverlay(const QPixmap &image, QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
|
@ -34,7 +34,7 @@ ReCaptcha::ReCaptcha(const QString &session, QWidget *parent)
|
||||||
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
buttonLayout->setSpacing(8);
|
buttonLayout->setSpacing(8);
|
||||||
|
|
||||||
openCaptchaBtn_ = new QPushButton("Open reCAPTCHA", this);
|
openCaptchaBtn_ = new QPushButton(tr("Open reCAPTCHA"), this);
|
||||||
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
cancelBtn_ = new QPushButton(tr("Cancel"), this);
|
||||||
confirmBtn_ = new QPushButton(tr("Confirm"), this);
|
confirmBtn_ = new QPushButton(tr("Confirm"), this);
|
||||||
confirmBtn_->setDefault(true);
|
confirmBtn_->setDefault(true);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
TextFieldLabel(TextField *parent);
|
TextFieldLabel(TextField *parent);
|
||||||
|
|
||||||
inline void setColor(const QColor &color);
|
inline void setColor(const QColor &color);
|
||||||
inline void setOffset(const QPointF &pos);
|
inline void setOffset(QPointF pos);
|
||||||
inline void setScale(qreal scale);
|
inline void setScale(qreal scale);
|
||||||
|
|
||||||
inline QColor color() const;
|
inline QColor color() const;
|
||||||
|
@ -120,7 +120,7 @@ TextFieldLabel::setColor(const QColor &color)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
TextFieldLabel::setOffset(const QPointF &pos)
|
TextFieldLabel::setOffset(QPointF pos)
|
||||||
{
|
{
|
||||||
x_ = pos.x();
|
x_ = pos.x();
|
||||||
y_ = pos.y();
|
y_ = pos.y();
|
||||||
|
|
Loading…
Reference in a new issue