use more literals

This commit is contained in:
Nicolas Werner 2021-12-29 00:36:43 +01:00
parent f3e1941612
commit a3c4ebc460
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
7 changed files with 25 additions and 25 deletions

View file

@ -68,17 +68,17 @@ CreateRoom::CreateRoom(QWidget *parent)
auto visibilityLabel = new QLabel(tr("Room Visibility"), this);
visibilityCombo_ = new QComboBox(this);
visibilityCombo_->addItem("Private");
visibilityCombo_->addItem("Public");
visibilityCombo_->addItem(tr("Private"));
visibilityCombo_->addItem(tr("Public"));
visibilityLayout->addWidget(visibilityLabel);
visibilityLayout->addWidget(visibilityCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
auto presetLabel = new QLabel(tr("Room Preset"), this);
presetCombo_ = new QComboBox(this);
presetCombo_->addItem("Private Chat");
presetCombo_->addItem("Public Chat");
presetCombo_->addItem("Trusted Private Chat");
presetCombo_->addItem(tr("Private Chat"));
presetCombo_->addItem(tr("Public Chat"));
presetCombo_->addItem(tr("Trusted Private Chat"));
presetLayout->addWidget(presetLabel);
presetLayout->addWidget(presetCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
@ -119,10 +119,10 @@ CreateRoom::CreateRoom(QWidget *parent)
});
connect(visibilityCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
[this](const QString &text) {
if (text == "Private") {
[this](int idx) {
if (idx == 0) {
request_.visibility = mtx::common::RoomVisibility::Private;
} else {
request_.visibility = mtx::common::RoomVisibility::Public;
@ -130,12 +130,12 @@ CreateRoom::CreateRoom(QWidget *parent)
});
connect(presetCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this,
[this](const QString &text) {
if (text == "Private Chat") {
[this](int idx) {
if (idx == 0) {
request_.preset = mtx::requests::Preset::PrivateChat;
} else if (text == "Public Chat") {
} else if (idx == 1) {
request_.preset = mtx::requests::Preset::PublicChat;
} else {
request_.preset = mtx::requests::Preset::TrustedPrivateChat;

View file

@ -14,7 +14,7 @@
using namespace dialogs;
ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
ImageOverlay::ImageOverlay(const QPixmap &image, QWidget *parent)
: QWidget{parent}
, originalImage_{image}
{
@ -22,7 +22,7 @@ ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
setParent(nullptr);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
setWindowRole("imageoverlay");
setWindowRole(QStringLiteral("imageoverlay"));
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);

View file

@ -16,7 +16,7 @@ class ImageOverlay : public QWidget
{
Q_OBJECT
public:
ImageOverlay(QPixmap image, QWidget *parent = nullptr);
ImageOverlay(const QPixmap &image, QWidget *parent = nullptr);
protected:
void mousePressEvent(QMouseEvent *event) override;

View file

@ -34,7 +34,7 @@ ReCaptcha::ReCaptcha(const QString &session, QWidget *parent)
buttonLayout->setContentsMargins(0, 0, 0, 0);
buttonLayout->setSpacing(8);
openCaptchaBtn_ = new QPushButton("Open reCAPTCHA", this);
openCaptchaBtn_ = new QPushButton(tr("Open reCAPTCHA"), this);
cancelBtn_ = new QPushButton(tr("Cancel"), this);
confirmBtn_ = new QPushButton(tr("Confirm"), this);
confirmBtn_->setDefault(true);