Use lambda syntax for audio buffer size slots
Jeffrey Pfau jeffrey@endrift.com
Tue, 22 Jul 2014 02:33:01 -0700
2 files changed,
9 insertions(+),
25 deletions(-)
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -133,22 +133,6 @@ action->setDisabled(true);
} } -void Window::setBuffers512() { - emit audioBufferSamplesChanged(512); -} - -void Window::setBuffers1024() { - emit audioBufferSamplesChanged(1024); -} - -void Window::setBuffers2048() { - emit audioBufferSamplesChanged(2048); -} - -void Window::setBuffers4096() { - emit audioBufferSamplesChanged(4096); -} - void Window::setupMenu(QMenuBar* menubar) { menubar->clear(); QMenu* fileMenu = menubar->addMenu(tr("&File"));@@ -185,10 +169,15 @@ emulationMenu->addAction(frameAdvance);
QMenu* soundMenu = menubar->addMenu(tr("&Sound")); QMenu* buffersMenu = soundMenu->addMenu(tr("Buffer &size")); - buffersMenu->addAction(tr("512"), this, SLOT(setBuffers512())); - buffersMenu->addAction(tr("1024"), this, SLOT(setBuffers1024())); - buffersMenu->addAction(tr("2048"), this, SLOT(setBuffers2048())); - buffersMenu->addAction(tr("4096"), this, SLOT(setBuffers4096())); + QAction* setBuffer = new QAction(tr("512"), nullptr); + connect(setBuffer, &QAction::triggered, [this]() { emit audioBufferSamplesChanged(512); }); + buffersMenu->addAction(setBuffer); + setBuffer = new QAction(tr("1024"), nullptr); + connect(setBuffer, &QAction::triggered, [this]() { emit audioBufferSamplesChanged(1024); }); + buffersMenu->addAction(setBuffer); + setBuffer = new QAction(tr("2048"), nullptr); + connect(setBuffer, &QAction::triggered, [this]() { emit audioBufferSamplesChanged(2048); }); + buffersMenu->addAction(setBuffer); QMenu* debuggingMenu = menubar->addMenu(tr("&Debugging")); #ifdef USE_GDB_STUB
M
src/platform/qt/Window.h
→
src/platform/qt/Window.h
@@ -45,11 +45,6 @@ private slots:
void gameStarted(GBAThread*); void gameStopped(); - void setBuffers512(); - void setBuffers1024(); - void setBuffers2048(); - void setBuffers4096(); - private: void setupMenu(QMenuBar*); GameController* m_controller;