Skip to content

Commit

Permalink
[c++] Fix some C++20 warnings due to lambda capture ; also llvm 17 an…
Browse files Browse the repository at this point in the history
…d leapmotion fixes
  • Loading branch information
jcelerier committed Jul 13, 2023
1 parent cb39194 commit 7b589ef
Show file tree
Hide file tree
Showing 139 changed files with 621 additions and 534 deletions.
4 changes: 2 additions & 2 deletions src/lib/core/messages/MessagesPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ MessagesPanelDelegate::MessagesPanelDelegate(const score::GUIApplicationContext&
"is not behaving as it should"));
m_widget->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
connect(
m_widget, &QListView::customContextMenuRequested, this, [=](const QPoint& pos) {
m_widget, &QListView::customContextMenuRequested, this, [this](const QPoint& pos) {
QMenu m{};
auto act = m.addAction(QObject::tr("Clear"));
auto res = m.exec(QCursor::pos());
Expand Down Expand Up @@ -191,7 +191,7 @@ const score::PanelStatus& MessagesPanelDelegate::defaultPanelStatus() const

void MessagesPanelDelegate::qtLog(const std::string& str)
{
ossia::qt::run_async(this, [=] {
ossia::qt::run_async(this, [this, str] {
if(m_itemModel && m_widget)
{
push(QString::fromStdString(str), score::log::dark4);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/presenter/DocumentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ DocumentManager::setupDocument(const score::GUIApplicationContext& ctx, Document
m_view->addDocumentView(doc->view());
connect(
&doc->metadata(), &DocumentMetadata::fileNameChanged, this,
[=](const QString& s) { m_view->on_fileNameChanged(doc->view(), s); });
[this, doc](const QString& s) { m_view->on_fileNameChanged(doc->view(), s); });
}
setCurrentDocument(ctx, doc);

Expand Down
8 changes: 5 additions & 3 deletions src/lib/score/actions/ActionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ void ActionManager::reset(score::Document* doc)
{
mdoc = &doc->context();

focusConnection = con(
doc->focusManager(), &FocusManager::changed, this, [=] { focusChanged(mdoc); });
focusConnection
= con(doc->focusManager(), &FocusManager::changed, this, [this, mdoc] {
focusChanged(mdoc);
});
selectionConnection = con(
doc->selectionStack(), &SelectionStack::currentSelectionChanged, this,
[=] { this->selectionChanged(mdoc); }, Qt::QueuedConnection);
[this, mdoc] { this->selectionChanged(mdoc); }, Qt::QueuedConnection);
}

// Reset all the actions
Expand Down
2 changes: 1 addition & 1 deletion src/lib/score/widgets/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void DoubleSlider::createPopup(QPoint pos)
w->setValue(map(m_value));
w->setDecimals(3);
QObject::connect(
w, SignalUtils::QDoubleSpinBox_valueChanged_double(), this, [=](double v) {
w, SignalUtils::QDoubleSpinBox_valueChanged_double(), this, [this](double v) {
this->setValue(this->unmap(v));
sliderMoved(this->value());
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/score/widgets/IntSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void IntSlider::createPopup(QPoint pos)
w->setValue(m_value);
w->setRange(m_min, m_max);

QObject::connect(w, SignalUtils::QSpinBox_valueChanged_int(), this, [=](int v) {
QObject::connect(w, SignalUtils::QSpinBox_valueChanged_int(), this, [this](int v) {
this->setValue(v);
sliderMoved(this->value());
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/score/widgets/QuantificationWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ QuantificationWidget::QuantificationWidget(QWidget* parent)
addItems(
{tr("Parent"), tr("Free"), tr("8 bars"), tr("4 bars"), tr("2 bars"), tr("1 bar "),
tr("1/2 "), tr("1/4 "), tr("1/8 "), tr("1/16 "), tr("1/32 ")});
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, [=](int idx) {
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int idx) {
quantificationChanged(quantificationForIndex(idx));
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/score/widgets/SpinBoxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ void SpeedSlider::createPopup(QPoint pos)

QObject::connect(
w, SignalUtils::QDoubleSpinBox_valueChanged_double(), this,
[=](double v) { this->setValue(valueFromSpeed(v / ossia::root_tempo)); });
[this](double v) { this->setValue(valueFromSpeed(v / ossia::root_tempo)); });
}
else
{
Expand All @@ -702,7 +702,7 @@ void SpeedSlider::createPopup(QPoint pos)

QObject::connect(
w, SignalUtils::QDoubleSpinBox_valueChanged_double(), this,
[=](double v) { this->setValue(valueFromSpeed(v)); });
[this](double v) { this->setValue(valueFromSpeed(v)); });
}

w->show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,10 @@ void DeviceInterface::setListening(const State::Address& addr, bool b)
if(cb_it == m_callbacks.end())
{
m_callbacks.insert(
{addr, {ossia_addr, ossia_addr->add_callback([=](const ossia::value& val) {
valueUpdated(addr, val);
})}});
{addr,
{ossia_addr,
ossia_addr->add_callback(
[this, addr](const ossia::value& val) { valueUpdated(addr, val); })}});
}

valueUpdated(addr, ossia_addr->value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ AddressAccessorEditWidget::AddressAccessorEditWidget(
m_qualifiers = new State::DestinationQualifierWidget{this};
connect(
m_qualifiers, &State::DestinationQualifierWidget::qualifiersChanged, this,
[=](const auto& qual) {
[this](const auto& qual) {
if(m_address.address.qualifiers != qual)
{
m_address.address.qualifiers = qual;
Expand All @@ -65,7 +65,7 @@ AddressAccessorEditWidget::AddressAccessorEditWidget(

m_lineEdit->addAction(act, QLineEdit::TrailingPosition);

connect(act, &QAction::triggered, [=]() { m_qualifiers->chooseQualifier(); });
connect(act, &QAction::triggered, [this]() { m_qualifiers->chooseQualifier(); });

{
auto& plist = ctx.app.interfaces<DeviceModelProviderList>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ InspectorSectionWidget::InspectorSectionWidget(bool editable, QWidget* parent)

m_sectionTitle.setObjectName("SectionTitle");
con(m_sectionTitle, &QLineEdit::editingFinished, this,
[=]() { nameChanged(m_sectionTitle.text()); });
[this]() { nameChanged(m_sectionTitle.text()); });
if(editable)
m_buttonTitle.hide();
else
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/score-lib-localtree/LocalTree/NameProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MetadataNamePropertyWrapper
});
*/

auto setNameFun = [=](const QString& newName_qstring) {
auto setNameFun = [this](const QString& newName_qstring) {
const auto newName = newName_qstring.toStdString();
const auto curName = node.get_name();

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/score-lib-localtree/LocalTree/Property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct PropertyWrapper final : public BaseCallbackWrapper
{
QObject::connect(
&m_model, Property::notify, context,
[=] {
[this] {
auto newVal = converter_t::convert((m_model.*Property::get)());
try
{
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/score-lib-localtree/LocalTree/SetProperty.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ struct SetPropertyWrapper final : public BaseCallbackWrapper
: BaseCallbackWrapper{param_addr}
, setFun{prop}
{
callbackIt = addr.add_callback(
[=](const ossia::value& v) { ossia::qt::run_async(qApp, [=] { setFun(v); }); });
callbackIt = addr.add_callback([this](const ossia::value& v) {
ossia::qt::run_async(qApp, [this, v] { setFun(v); });
});

// addr.set_value(typename ossia::qt_property_converter<T>::type{});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void MagnetismAdjuster::registerHandler(QObject* context, MagnetismHandler h) no

if(context)
{
QObject::connect(context, &QObject::destroyed, this, [=] {
QObject::connect(context, &QObject::destroyed, this, [this, context] {
qDebug() << "Warning: MagnetismAdjuster::registerHandler: unregistering "
"happened in unnatural ways: "
<< context->objectName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AudioPortComboBox::AudioPortComboBox(
m_address.address.path.push_back(first_child);
}

connect(this, &QComboBox::currentTextChanged, [=](const QString& str) {
connect(this, &QComboBox::currentTextChanged, [this](const QString& str) {
if(str == "None")
{
if(m_address.address != m_root)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ CableItem::CableItem(

SCORE_ASSERT(canCreateCable(c, plug));

con(c.selection, &Selectable::changed, this, [=](bool b) {
con(c.selection, &Selectable::changed, this, [this](bool b) {
if(m_p1 && m_p2)
{
if(b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void NodeItem::createWithDecorations()
connect(
&process, &Process::ProcessModel::outletsChanged, this, &NodeItem::resetOutlets);

connect(m_fold, &score::QGraphicsPixmapToggle::toggled, this, [=](bool b) {
connect(m_fold, &score::QGraphicsPixmapToggle::toggled, this, [this](bool b) {
if(b)
{
createContentItem();
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/score-lib-process/Process/HeaderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ DefaultHeaderDelegate::DefaultHeaderDelegate(
m_portStartX += 18;
}

con(m_model, &Process::ProcessModel::prettyNameChanged, this, [=] {
con(m_model, &Process::ProcessModel::prettyNameChanged, this, [this] {
updateText();
update();
});

con(m_model, &Process::ProcessModel::inletsChanged, this, [=] { updatePorts(); });
con(m_model, &Process::ProcessModel::inletsChanged, this, [this] { updatePorts(); });
updatePorts();

con(m_model, &Process::ProcessModel::benchmark, this,
[=](double d) { updateBench(d); });
[this](double d) { updateBench(d); });
con(
m_model.selection, &Selectable::changed, this,
[=](bool b) {
[this](bool b) {
m_sel = b;
updateText();
update();
Expand Down Expand Up @@ -260,7 +260,7 @@ DefaultFooterDelegate::DefaultFooterDelegate(
auto& skin = score::Skin::instance();
setCursor(skin.CursorScaleV);
setFlag(ItemHasNoContents, true);
con(model, &Process::ProcessModel::outletsChanged, this, [=] { updatePorts(); });
con(model, &Process::ProcessModel::outletsChanged, this, [this] { updatePorts(); });
updatePorts();
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/score-lib-process/Process/Script/ScriptEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ScriptDialog::ScriptDialog(
QDialogButtonBox::Ok | QDialogButtonBox::Reset | QDialogButtonBox::Close, this};
bbox->button(QDialogButtonBox::Ok)->setText(tr("Compile"));
bbox->button(QDialogButtonBox::Reset)->setText(tr("Clear log"));
connect(bbox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [=] {
connect(bbox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [this] {
m_error->clear();
});
lay->addWidget(bbox);
Expand Down Expand Up @@ -96,7 +96,7 @@ MultiScriptDialog::MultiScriptDialog(const score::DocumentContext& ctx, QWidget*

bbox->button(QDialogButtonBox::Ok)->setText(tr("Compile"));
bbox->button(QDialogButtonBox::Reset)->setText(tr("Clear log"));
connect(bbox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [=] {
connect(bbox->button(QDialogButtonBox::Reset), &QPushButton::clicked, this, [this] {
m_error->clear();
});

Expand Down
15 changes: 8 additions & 7 deletions src/plugins/score-lib-state/State/Widgets/UnitWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ UnitWidget::UnitWidget(Qt::Orientation orient, QWidget* parent)

// Fill dataspace. Unit is filled each time the dataspace changes
m_dataspace->addItem(tr("None"), QVariant::fromValue(State::Unit{}));
ossia::for_each_tagged(ossia::dataspace_u_list{}, [=](auto d) {
ossia::for_each_tagged(ossia::dataspace_u_list{}, [this](auto d) {
// For each dataspace, add its text to the combo box
using dataspace_type =
typename ossia::matching_unit_u_list<typename decltype(d)::type>::type;
Expand All @@ -48,11 +48,12 @@ UnitWidget::UnitWidget(Qt::Orientation orient, QWidget* parent)

// Signals
connect(
m_dataspace, SignalUtils::QComboBox_currentIndexChanged_int(), this, [=](int i) {
on_dataspaceChanged(m_dataspace->itemData(i).value<State::Unit>());
m_dataspace, SignalUtils::QComboBox_currentIndexChanged_int(), this,
[this](int i) {
on_dataspaceChanged(m_dataspace->itemData(i).value<State::Unit>());
});

connect(m_unit, SignalUtils::QComboBox_currentIndexChanged_int(), this, [=](int i) {
connect(m_unit, SignalUtils::QComboBox_currentIndexChanged_int(), this, [this](int i) {
unitChanged(m_unit->itemData(i).value<State::Unit>());
});
}
Expand All @@ -79,7 +80,7 @@ void UnitWidget::setUnit(const State::Unit& unit)

// Then set the correct unit
ossia::apply_nonnull(
[=](auto dataspace) { m_unit->setCurrentIndex(dataspace.which()); }, u.v);
[this](auto dataspace) { m_unit->setCurrentIndex(dataspace.which()); }, u.v);
}
else
{
Expand All @@ -105,12 +106,12 @@ void UnitWidget::on_dataspaceChanged(const State::Unit& unit)

// First lift ourselves in the dataspace realm
ossia::apply_nonnull(
[=](auto dataspace) -> void {
[this](auto dataspace) -> void {
// Then For each unit in the dataspace, add it to the unit
// combobox.
using typelist =
typename ossia ::matching_unit_u_list<decltype(dataspace)>::type;
ossia::for_each_tagged(typelist{}, [=](auto u) {
ossia::for_each_tagged(typelist{}, [this](auto u) {
using unit_type = typename decltype(u)::type;
ossia::string_view text = ossia::unit_traits<unit_type>::text()[0];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NumericValueSetDialog final : public QDialog
lay->addLayout(m_lay = new score::MarginLess<QVBoxLayout>);

auto addbutton = new QPushButton{tr("+"), this};
connect(addbutton, &QPushButton::pressed, this, [=] { addRow({}); });
connect(addbutton, &QPushButton::pressed, this, [this] { addRow({}); });
lay->addWidget(addbutton);

auto buttonBox
Expand Down Expand Up @@ -149,16 +149,16 @@ class NumericDomainWidget final : public QWidget
m_min->setEnabled(false);
m_max->setEnabled(false);

connect(m_minCB, &QCheckBox::stateChanged, this, [=](int st) {
connect(m_minCB, &QCheckBox::stateChanged, this, [this](int st) {
m_min->setEnabled(bool(st));
});
connect(m_maxCB, &QCheckBox::stateChanged, this, [=](int st) {
connect(m_maxCB, &QCheckBox::stateChanged, this, [this](int st) {
m_max->setEnabled(bool(st));
});
auto pb = new QPushButton{tr("Values"), this};
lay->addWidget(pb);

connect(pb, &QPushButton::clicked, this, [=] {
connect(pb, &QPushButton::clicked, this, [this] {
NumericValueSetDialog<T> dial{this};
dial.setValues(m_values);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ StringValueSetDialog::StringValueSetDialog(QWidget* parent)
lay->addLayout(m_lay = new score::MarginLess<QVBoxLayout>);

auto addbutton = new QPushButton{tr("+"), this};
connect(addbutton, &QPushButton::pressed, this, [=] { addRow(""); });
connect(addbutton, &QPushButton::pressed, this, [this] { addRow(""); });
lay->addWidget(addbutton);

auto buttonBox = new QDialogButtonBox{QDialogButtonBox::Ok | QDialogButtonBox::Cancel};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TypeComboBox::TypeComboBox(QWidget* parent)
}
addItem(arr[n - 1], QVariant::fromValue(ossia::val_type::NONE));

connect(this, SignalUtils::QComboBox_currentIndexChanged_int(), this, [=](int i) {
connect(this, SignalUtils::QComboBox_currentIndexChanged_int(), this, [this](int i) {
changed(this->itemData(i).value<ossia::val_type>());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class VecWidget final : public VecEditBase
box->setMaximum(9999);
box->setValue(0);

connect(box, &QDoubleSpinBox::editingFinished, this, [=] { changed(); });
connect(box, &QDoubleSpinBox::editingFinished, this, [this] { changed(); });

lay->addWidget(box);
m_boxes[i] = box;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-audio/Audio/ALSAInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ALSAWidget : public QWidget
}
});

con(m, &Model::changed, this, [=, &m] { setCard(card_list, m.getCardOut()); });
con(m, &Model::changed, this, [this, &m] { setCard(card_list, m.getCardOut()); });
}

void updateCombos(const AlsaCard& card)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ALSAPortAudioWidget : public QWidget
setInfos(devices[dev_idx]);
}
}
con(m, &Model::changed, this, [=, &m] { setCard(card_list, m.getCardOut()); });
con(m, &Model::changed, this, [this, &m] { setCard(card_list, m.getCardOut()); });
}
void setCard(QComboBox* combo, QString val)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ score::GUIElements ApplicationPlugin::makeGUIElements()
sl->setStatusTip("Change the master volume");
bar->addWidget(sl);
bar->addAction(m_audioEngineAct);
connect(sl, &score::VolumeSlider::valueChanged, this, [=](double v) {
connect(sl, &score::VolumeSlider::valueChanged, this, [this](double v) {
if(!this->audio)
return;

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/score-plugin-audio/Audio/AudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ class AudioAddressDialog final : public Device::AddressDialog

con(
m_type, SignalUtils::QComboBox_currentIndexChanged_int(), this,
[=] { updateType(m_type.currentIndex()); }, Qt::QueuedConnection);
[this] { updateType(m_type.currentIndex()); }, Qt::QueuedConnection);
con(
m_channels, &QSpinBox::editingFinished, this,
[=] { updateType(m_type.currentIndex()); }, Qt::QueuedConnection);
[this] { updateType(m_type.currentIndex()); }, Qt::QueuedConnection);

m_mapping.setAlternatingRowColors(true);
m_mapping.setCornerButtonEnabled(false);
Expand Down
Loading

0 comments on commit 7b589ef

Please sign in to comment.