all repos — mgba @ 0717e4ab76f068165a15b5862fc377e95c51a925

mGBA Game Boy Advance Emulator

Use lambda syntax for audio buffer size slots
Jeffrey Pfau jeffrey@endrift.com
Tue, 22 Jul 2014 02:33:01 -0700
commit

0717e4ab76f068165a15b5862fc377e95c51a925

parent

a7588f25bb48334364296bcd7d3a4b66a699eb1c

2 files changed, 9 insertions(+), 25 deletions(-)

jump to
M src/platform/qt/Window.cppsrc/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.hsrc/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;