Migrate to C++ 20 & switch to websocketpp develop branch (#4252)

* feat: c++ 20

* fix: c++ 20 deprecations

* fix(msvc): warnings

* chore: add changelog entry

* fix: formatting

* Update websocketpp to the `develop` branch

* Specify other template type in FlagsEnum != operator

* Remove the user of simple template ids in our websocketpp template class

Also standardizes the file a bit by using nested namespaces, using
pragma once

* fix: turn `MAGIC_MESSAGE_SUFFIX` into a `QString`

* hacky unhacky hacky const char hack

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-12-24 12:56:11 +01:00
committed by GitHub
parent 99e038ce5e
commit 86e71c8bd9
31 changed files with 219 additions and 212 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ BadgePickerDialog::BadgePickerDialog(QList<DisplayBadge> badges,
this->dropdown_->addItem(item.displayName(), item.badgeName());
}
const auto updateBadge = [=](int index) {
const auto updateBadge = [=, this](int index) {
BadgeOpt badge;
if (index >= 0 && index < badges.size())
{
+9 -8
View File
@@ -94,13 +94,14 @@ ColorPickerDialog::ColorPickerDialog(const QColor &initial, QWidget *parent)
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
{
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
QObject::connect(button_ok, &QPushButton::clicked, [this](bool) {
this->ok();
});
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
this->close();
});
QObject::connect(button_cancel, &QAbstractButton::clicked,
[this](bool) {
this->close();
});
}
this->themeChangedEvent();
@@ -226,7 +227,7 @@ void ColorPickerDialog::initRecentColors(LayoutCreator<QWidget> &creator)
grid->addWidget(button, rowInd, columnInd);
QObject::connect(button, &QPushButton::clicked, [=] {
QObject::connect(button, &QPushButton::clicked, [=, this] {
this->selectColor(button->color(), false);
});
@@ -260,7 +261,7 @@ void ColorPickerDialog::initDefaultColors(LayoutCreator<QWidget> &creator)
grid->addWidget(button, rowInd, columnInd);
QObject::connect(button, &QPushButton::clicked, [=] {
QObject::connect(button, &QPushButton::clicked, [=, this] {
this->selectColor(button->color(), false);
});
@@ -299,7 +300,7 @@ void ColorPickerDialog::initColorPicker(LayoutCreator<QWidget> &creator)
QObject::connect(
luminancePicker, &QColorLuminancePicker::newHsv,
[=](int h, int s, int v) {
[this](int h, int s, int v) {
int alpha = this->ui_.picker.spinBoxes[SpinBox::ALPHA]->value();
this->selectColor(QColor::fromHsv(h, s, v, alpha), true);
});
@@ -344,7 +345,7 @@ void ColorPickerDialog::initSpinBoxes(LayoutCreator<QWidget> &creator)
{
QObject::connect(
this->ui_.picker.spinBoxes[i],
QOverload<int>::of(&QSpinBox::valueChanged), [=](int value) {
QOverload<int>::of(&QSpinBox::valueChanged), [=, this](int value) {
this->selectColor(QColor(red->value(), green->value(),
blue->value(), alpha->value()),
false);
+14 -13
View File
@@ -177,16 +177,16 @@ AdvancedLoginWidget::AdvancedLoginWidget()
this->ui_.oauthTokenInput.setEchoMode(QLineEdit::Password);
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [=]() {
connect(&this->ui_.userIDInput, &QLineEdit::textChanged, [this]() {
this->refreshButtons();
});
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [=]() {
connect(&this->ui_.usernameInput, &QLineEdit::textChanged, [this]() {
this->refreshButtons();
});
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [=]() {
connect(&this->ui_.clientIDInput, &QLineEdit::textChanged, [this]() {
this->refreshButtons();
});
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [=]() {
connect(&this->ui_.oauthTokenInput, &QLineEdit::textChanged, [this]() {
this->refreshButtons();
});
@@ -201,22 +201,23 @@ AdvancedLoginWidget::AdvancedLoginWidget()
&this->ui_.buttonUpperRow.clearFieldsButton);
connect(&this->ui_.buttonUpperRow.clearFieldsButton, &QPushButton::clicked,
[=]() {
[this]() {
this->ui_.userIDInput.clear();
this->ui_.usernameInput.clear();
this->ui_.clientIDInput.clear();
this->ui_.oauthTokenInput.clear();
});
connect(
&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
QString userID = this->ui_.userIDInput.text();
QString username = this->ui_.usernameInput.text();
QString clientID = this->ui_.clientIDInput.text();
QString oauthToken = this->ui_.oauthTokenInput.text();
connect(&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked,
[this]() {
QString userID = this->ui_.userIDInput.text();
QString username = this->ui_.usernameInput.text();
QString clientID = this->ui_.clientIDInput.text();
QString oauthToken = this->ui_.oauthTokenInput.text();
logInWithCredentials(this, userID, username, clientID, oauthToken);
});
logInWithCredentials(this, userID, username, clientID,
oauthToken);
});
}
void AdvancedLoginWidget::refreshButtons()
+5 -4
View File
@@ -223,13 +223,14 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
layout.emplace<QHBoxLayout>().emplace<QDialogButtonBox>(this);
{
auto *button_ok = buttons->addButton(QDialogButtonBox::Ok);
QObject::connect(button_ok, &QPushButton::clicked, [=](bool) {
QObject::connect(button_ok, &QPushButton::clicked, [this](bool) {
this->ok();
});
auto *button_cancel = buttons->addButton(QDialogButtonBox::Cancel);
QObject::connect(button_cancel, &QAbstractButton::clicked, [=](bool) {
this->close();
});
QObject::connect(button_cancel, &QAbstractButton::clicked,
[this](bool) {
this->close();
});
}
this->setMinimumSize(300, 310);
+1 -1
View File
@@ -919,7 +919,7 @@ void UserInfoPopup::loadAvatar(const QUrl &url)
static auto manager = new QNetworkAccessManager();
auto *reply = manager->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
QObject::connect(reply, &QNetworkReply::finished, this, [=, this] {
if (reply->error() == QNetworkReply::NoError)
{
const auto data = reply->readAll();