Skip to content

Commit

Permalink
Pass context object as third parameter to connect() call
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jan 8, 2020
1 parent 74e27d7 commit d38ef93
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/controllers/dlgprefcontrollers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DlgPrefControllers::DlgPrefControllers(DlgPreferences* pPreferences,
setupControllerWidgets();

connect(btnOpenUserPresets, &QPushButton::clicked,
[this] { slotOpenLocalFile(userPresetsPath(m_pConfig)); });
this, [this] { slotOpenLocalFile(userPresetsPath(m_pConfig)); });

// Connections
connect(m_pControllerManager, SIGNAL(devicesChanged()),
Expand Down
2 changes: 1 addition & 1 deletion src/effects/effectchainslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ void EffectChainSlot::registerInputChannel(const ChannelHandleAndGroup& handle_g
ChannelInfo* pInfo = new ChannelInfo(handle_group, pEnableControl);
m_channelInfoByName[handle_group.name()] = pInfo;
connect(pEnableControl, &ControlPushButton::valueChanged,
[this, handle_group] { slotChannelStatusChanged(handle_group.name()); });
this, [this, handle_group] { slotChannelStatusChanged(handle_group.name()); });

}

Expand Down
2 changes: 1 addition & 1 deletion src/errordialoghandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void ErrorDialogHandler::errorDialog(ErrorDialogProperties* pProps) {
// Signal mapper calls our slot with the key parameter so it knows which to
// remove from the list
connect(msgBox, &QMessageBox::finished,
[this, &props, &msgBox] { boxClosed(props->m_key, msgBox); });
this, [this, &props, &msgBox] { boxClosed(props->m_key, msgBox); });

locker.unlock();

Expand Down
2 changes: 1 addition & 1 deletion src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void AutoDJFeature::onRightClickChild(const QPoint& globalPos,
while (nonAutoDjCrates.populateNext(&crate)) {
auto pAction = std::make_unique<QAction>(crate.getName(), &crateMenu);
connect(pAction.get(), &QAction::triggered,
[this, crate] { slotAddCrateToAutoDj(crate.getId().value()); });
this, [this, crate] { slotAddCrateToAutoDj(crate.getId().value()); });
crateMenu.addAction(pAction.get());
pAction.release();
}
Expand Down
14 changes: 7 additions & 7 deletions src/widget/wmainmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void WMainMenuBar::initialize() {
// WMainMenuBar::onNumberOfDecksChanged.
pFileLoadSongToPlayer->setVisible(false);
connect(pFileLoadSongToPlayer, &QAction::triggered,
[this, deck] { loadTrackToDeck(deck + 1); });
this, [this, deck] { loadTrackToDeck(deck + 1); });

pFileMenu->addAction(pFileLoadSongToPlayer);
m_loadToDeckActions.push_back(pFileLoadSongToPlayer);
Expand Down Expand Up @@ -309,7 +309,7 @@ void WMainMenuBar::initialize() {
vc_checkbox->setWhatsThis(buildWhatsThis(vinylControlTitle,
vinylControlText));
connect(vc_checkbox, &QAction::triggered,
[this, i] { toggleVinylControl(i); });
this, [this, i] { toggleVinylControl(i); });
pVinylControlMenu->addAction(vc_checkbox);
}
pOptionsMenu->addMenu(pVinylControlMenu);
Expand Down Expand Up @@ -501,7 +501,7 @@ void WMainMenuBar::initialize() {
pHelpSupport->setStatusTip(supportText);
pHelpSupport->setWhatsThis(buildWhatsThis(supportTitle, supportText));
connect(pHelpSupport, &QAction::triggered,
[this] { slotVisitUrl(MIXXX_SUPPORT_URL); });
this, [this] { slotVisitUrl(MIXXX_SUPPORT_URL); });
pHelpMenu->addAction(pHelpSupport);

QDir resourceDir(m_pConfig->getResourcePath());
Expand Down Expand Up @@ -532,7 +532,7 @@ void WMainMenuBar::initialize() {
pHelpManual->setStatusTip(manualText);
pHelpManual->setWhatsThis(buildWhatsThis(manualTitle, manualText));
connect(pHelpManual, &QAction::triggered,
[this, qManualUrl] { slotVisitUrl(qManualUrl.toString()); });
this, [this, qManualUrl] { slotVisitUrl(qManualUrl.toString()); });
pHelpMenu->addAction(pHelpManual);

QString shortcutsTitle = tr("&Keyboard Shortcuts") + externalLinkSuffix;
Expand All @@ -541,7 +541,7 @@ void WMainMenuBar::initialize() {
pHelpShortcuts->setStatusTip(shortcutsText);
pHelpShortcuts->setWhatsThis(buildWhatsThis(shortcutsTitle, shortcutsText));
connect(pHelpShortcuts, &QAction::triggered,
[this] { slotVisitUrl(MIXXX_SHORTCUTS_URL); });
this, [this] { slotVisitUrl(MIXXX_SHORTCUTS_URL); });
pHelpMenu->addAction(pHelpShortcuts);

QString feedbackTitle = tr("Send Us &Feedback") + externalLinkSuffix;
Expand All @@ -550,7 +550,7 @@ void WMainMenuBar::initialize() {
pHelpFeedback->setStatusTip(feedbackText);
pHelpFeedback->setWhatsThis(buildWhatsThis(feedbackTitle, feedbackText));
connect(pHelpFeedback, &QAction::triggered,
[this] { slotVisitUrl(MIXXX_FEEDBACK_URL); });
this, [this] { slotVisitUrl(MIXXX_FEEDBACK_URL); });
pHelpMenu->addAction(pHelpFeedback);

QString translateTitle = tr("&Translate This Application") + externalLinkSuffix;
Expand All @@ -559,7 +559,7 @@ void WMainMenuBar::initialize() {
pHelpTranslation->setStatusTip(translateText);
pHelpTranslation->setWhatsThis(buildWhatsThis(translateTitle, translateText));
connect(pHelpTranslation, &QAction::triggered,
[this] { slotVisitUrl(MIXXX_TRANSLATION_URL); });
this, [this] { slotVisitUrl(MIXXX_TRANSLATION_URL); });
pHelpMenu->addAction(pHelpTranslation);

pHelpMenu->addSeparator();
Expand Down
28 changes: 14 additions & 14 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,15 @@ void WTrackTableView::createActions() {
m_updateInExternalTrackCollections += updateInExternalTrackCollection;
auto externalTrackCollectionPtr = updateInExternalTrackCollection.externalTrackCollection;
connect(updateInExternalTrackCollection.action, &QAction::triggered,
[=](){
this, [=](){
slotUpdateExternalTrackCollection(externalTrackCollectionPtr);});
}

m_pAddToPreviewDeck = new QAction(tr("Preview Deck"), this);
// currently there is only one preview deck so just map it here.
QString previewDeckGroup = PlayerManager::groupForPreviewDeck(0);
connect(m_pAddToPreviewDeck, &QAction::triggered,
[this, previewDeckGroup] { loadSelectionToGroup(previewDeckGroup); });
this, [this, previewDeckGroup] { loadSelectionToGroup(previewDeckGroup); });


// Clear metadata actions
Expand Down Expand Up @@ -555,17 +555,17 @@ void WTrackTableView::createActions() {
m_pBpmThreeHalvesAction = new QAction(tr("3/2 BPM"), this);

connect(m_pBpmDoubleAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::DOUBLE); });
this, [this] { slotScaleBpm(Beats::DOUBLE); });
connect(m_pBpmHalveAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::HALVE); });
this, [this] { slotScaleBpm(Beats::HALVE); });
connect(m_pBpmTwoThirdsAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::TWOTHIRDS); });
this, [this] { slotScaleBpm(Beats::TWOTHIRDS); });
connect(m_pBpmThreeFourthsAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::THREEFOURTHS); });
this, [this] { slotScaleBpm(Beats::THREEFOURTHS); });
connect(m_pBpmFourThirdsAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::FOURTHIRDS); });
this, [this] { slotScaleBpm(Beats::FOURTHIRDS); });
connect(m_pBpmThreeHalvesAction, &QAction::triggered,
[this] { slotScaleBpm(Beats::THREEHALVES); });
this, [this] { slotScaleBpm(Beats::THREEHALVES); });
}

// slot
Expand Down Expand Up @@ -848,7 +848,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) {
pAction->setEnabled(deckEnabled);
m_pDeckMenu->addAction(pAction);
connect(pAction, &QAction::triggered,
[this, deckGroup] { loadSelectionToGroup(deckGroup); });
this, [this, deckGroup] { loadSelectionToGroup(deckGroup); });
}
}
m_pLoadToMenu->addMenu(m_pDeckMenu);
Expand All @@ -868,7 +868,7 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) {
pAction->setEnabled(samplerEnabled);
m_pSamplerMenu->addAction(pAction);
connect(pAction, &QAction::triggered,
[this, samplerGroup] {loadSelectionToGroup(samplerGroup); } );
this, [this, samplerGroup] {loadSelectionToGroup(samplerGroup); } );

}
m_pLoadToMenu->addMenu(m_pSamplerMenu);
Expand Down Expand Up @@ -1628,15 +1628,15 @@ void WTrackTableView::slotPopulatePlaylistMenu() {
pAction->setEnabled(!locked);
m_pPlaylistMenu->addAction(pAction);
connect(pAction, &QAction::triggered,
[this, it] { addSelectionToPlaylist(it.value()); });
this, [this, it] { addSelectionToPlaylist(it.value()); });

}
}
m_pPlaylistMenu->addSeparator();
QAction* newPlaylistAction = new QAction(tr("Create New Playlist"), m_pPlaylistMenu);
m_pPlaylistMenu->addAction(newPlaylistAction);
connect(newPlaylistAction, &QAction::triggered,
[this] { addSelectionToPlaylist(-1); });
this, [this] { addSelectionToPlaylist(-1); });
m_bPlaylistMenuLoaded = true;
}

Expand Down Expand Up @@ -1740,9 +1740,9 @@ void WTrackTableView::slotPopulateCrateMenu() {

m_pCrateMenu->addAction(pAction.get());
connect(pAction.get(), &QAction::triggered,
[this, &pCheckBox] { updateSelectionCrates(pCheckBox.get()); });
this, [this, &pCheckBox] { updateSelectionCrates(pCheckBox.get()); });
connect(pCheckBox.get(), &QCheckBox::stateChanged,
[this, &pCheckBox] { updateSelectionCrates(pCheckBox.get()); });
this, [this, &pCheckBox] { updateSelectionCrates(pCheckBox.get()); });

}
m_pCrateMenu->addSeparator();
Expand Down
2 changes: 1 addition & 1 deletion src/widget/wtracktableviewheader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void WTrackTableViewHeader::setModel(QAbstractItemModel* model) {
// Map this action's signals
m_columnActions.insert(i, action);
connect(action, &QAction::triggered,
[this, i] { showOrHideColumn(i); });
this, [this, i] { showOrHideColumn(i); });
m_menu.addAction(action);

// force the section size to be a least WTTVH_MINIMUM_SECTION_SIZE
Expand Down
4 changes: 2 additions & 2 deletions src/widget/wwidgetstack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ void WWidgetStack::addWidgetWithControl(QWidget* pWidget, ControlObject* pContro
}
pListener->onCurrentWidgetChanged(currentIndex());
connect(pListener, &WidgetStackControlListener::switchToWidget,
[this, index] { showIndex(index); });
this, [this, index] { showIndex(index); });
connect(pListener, &WidgetStackControlListener::hideWidget,
[this, index] { hideIndex(index); });
this, [this, index] { hideIndex(index); });
connect(this, &WWidgetStack::currentChanged,
pListener, &WidgetStackControlListener::onCurrentWidgetChanged);
}
Expand Down

0 comments on commit d38ef93

Please sign in to comment.