mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-30 01:37:19 +00:00
Avoid implicit capture of 'this' via '='.
This commit is contained in:
parent
592e339b70
commit
e62b41f615
@ -322,7 +322,7 @@ void MainWindow::launchMachine() {
|
|||||||
if(speaker) {
|
if(speaker) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
QAudioDevice device(QMediaDevices::defaultAudioOutput());
|
QAudioDevice device(QMediaDevices::defaultAudioOutput());
|
||||||
if(true) { // TODO: how to check that audio output is available in Qt6?
|
if(true) { // TODO: how to check that audio output is available in Qt6?
|
||||||
QAudioFormat idealFormat = device.preferredFormat();
|
QAudioFormat idealFormat = device.preferredFormat();
|
||||||
#else
|
#else
|
||||||
const QAudioDeviceInfo &defaultDeviceInfo = QAudioDeviceInfo::defaultOutputDevice();
|
const QAudioDeviceInfo &defaultDeviceInfo = QAudioDeviceInfo::defaultOutputDevice();
|
||||||
@ -412,13 +412,13 @@ void MainWindow::launchMachine() {
|
|||||||
#endif
|
#endif
|
||||||
inputMenu->addAction(asJoystickAction);
|
inputMenu->addAction(asJoystickAction);
|
||||||
|
|
||||||
connect(asKeyboardAction, &QAction::triggered, this, [=] {
|
connect(asKeyboardAction, &QAction::triggered, this, [=, this] {
|
||||||
keyboardInputMode = KeyboardInputMode::Keyboard;
|
keyboardInputMode = KeyboardInputMode::Keyboard;
|
||||||
asKeyboardAction->setChecked(true);
|
asKeyboardAction->setChecked(true);
|
||||||
asJoystickAction->setChecked(false);
|
asJoystickAction->setChecked(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(asJoystickAction, &QAction::triggered, this, [=] {
|
connect(asJoystickAction, &QAction::triggered, this, [=, this] {
|
||||||
keyboardInputMode = KeyboardInputMode::Joystick;
|
keyboardInputMode = KeyboardInputMode::Joystick;
|
||||||
asKeyboardAction->setChecked(false);
|
asKeyboardAction->setChecked(false);
|
||||||
asJoystickAction->setChecked(true);
|
asJoystickAction->setChecked(true);
|
||||||
@ -558,7 +558,7 @@ void MainWindow::addDisplayMenu(const std::string &machinePrefix, const std::str
|
|||||||
if(!action) continue;
|
if(!action) continue;
|
||||||
|
|
||||||
action->setChecked(displaySelection == defaultDisplay);
|
action->setChecked(displaySelection == defaultDisplay);
|
||||||
connect(action, &QAction::triggered, this, [=] {
|
connect(action, &QAction::triggered, this, [=, this] {
|
||||||
for(auto otherAction: {compositeColourAction, compositeMonochromeAction, sVideoAction, rgbAction}) {
|
for(auto otherAction: {compositeColourAction, compositeMonochromeAction, sVideoAction, rgbAction}) {
|
||||||
if(otherAction && otherAction != action) otherAction->setChecked(false);
|
if(otherAction && otherAction != action) otherAction->setChecked(false);
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ void MainWindow::addEnhancementsItems(const std::string &machinePrefix, QMenu *m
|
|||||||
} \
|
} \
|
||||||
action->setChecked(Reflection::get<bool>(*options, setting) ? Qt::Checked : Qt::Unchecked); \
|
action->setChecked(Reflection::get<bool>(*options, setting) ? Qt::Checked : Qt::Unchecked); \
|
||||||
\
|
\
|
||||||
connect(action, &QAction::triggered, this, [=] { \
|
connect(action, &QAction::triggered, this, [=, this] { \
|
||||||
std::lock_guard lock_guard(machineMutex); \
|
std::lock_guard lock_guard(machineMutex); \
|
||||||
auto options = machine->configurable_device()->get_options(); \
|
auto options = machine->configurable_device()->get_options(); \
|
||||||
Reflection::set(*options, setting, action->isChecked()); \
|
Reflection::set(*options, setting, action->isChecked()); \
|
||||||
@ -628,7 +628,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
|
|||||||
// Add the start/stop items.
|
// Add the start/stop items.
|
||||||
startTapeAction = new QAction(tr("Start Tape"), this);
|
startTapeAction = new QAction(tr("Start Tape"), this);
|
||||||
controlsMenu->addAction(startTapeAction);
|
controlsMenu->addAction(startTapeAction);
|
||||||
connect(startTapeAction, &QAction::triggered, this, [=] {
|
connect(startTapeAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(true);
|
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(true);
|
||||||
updateTapeControls();
|
updateTapeControls();
|
||||||
@ -636,7 +636,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
|
|||||||
|
|
||||||
stopTapeAction = new QAction(tr("Stop Tape"), this);
|
stopTapeAction = new QAction(tr("Stop Tape"), this);
|
||||||
controlsMenu->addAction(stopTapeAction);
|
controlsMenu->addAction(stopTapeAction);
|
||||||
connect(stopTapeAction, &QAction::triggered, this, [=] {
|
connect(stopTapeAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(false);
|
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(false);
|
||||||
updateTapeControls();
|
updateTapeControls();
|
||||||
@ -644,7 +644,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
|
|||||||
|
|
||||||
updateTapeControls();
|
updateTapeControls();
|
||||||
|
|
||||||
connect(automaticTapeControlAction, &QAction::triggered, this, [=] {
|
connect(automaticTapeControlAction, &QAction::triggered, this, [=, this] {
|
||||||
updateTapeControls();
|
updateTapeControls();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -662,7 +662,7 @@ void MainWindow::addAtari2600Menu() {
|
|||||||
|
|
||||||
QAction *const blackAndWhiteAction = new QAction(tr("Black and white"));
|
QAction *const blackAndWhiteAction = new QAction(tr("Black and white"));
|
||||||
blackAndWhiteAction->setCheckable(true);
|
blackAndWhiteAction->setCheckable(true);
|
||||||
connect(blackAndWhiteAction, &QAction::triggered, this, [=] {
|
connect(blackAndWhiteAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
// TODO: is this switch perhaps misnamed?
|
// TODO: is this switch perhaps misnamed?
|
||||||
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchColour, blackAndWhiteAction->isChecked());
|
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchColour, blackAndWhiteAction->isChecked());
|
||||||
@ -671,7 +671,7 @@ void MainWindow::addAtari2600Menu() {
|
|||||||
|
|
||||||
QAction *const leftDifficultyAction = new QAction(tr("Left Difficulty"));
|
QAction *const leftDifficultyAction = new QAction(tr("Left Difficulty"));
|
||||||
leftDifficultyAction->setCheckable(true);
|
leftDifficultyAction->setCheckable(true);
|
||||||
connect(leftDifficultyAction, &QAction::triggered, this, [=] {
|
connect(leftDifficultyAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftDifficultyAction->isChecked());
|
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchLeftPlayerDifficulty, leftDifficultyAction->isChecked());
|
||||||
});
|
});
|
||||||
@ -679,7 +679,7 @@ void MainWindow::addAtari2600Menu() {
|
|||||||
|
|
||||||
QAction *const rightDifficultyAction = new QAction(tr("Right Difficulty"));
|
QAction *const rightDifficultyAction = new QAction(tr("Right Difficulty"));
|
||||||
rightDifficultyAction->setCheckable(true);
|
rightDifficultyAction->setCheckable(true);
|
||||||
connect(rightDifficultyAction, &QAction::triggered, this, [=] {
|
connect(rightDifficultyAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightDifficultyAction->isChecked());
|
static_cast<Atari2600::Machine *>(machine->raw_pointer())->set_switch_is_enabled(Atari2600SwitchRightPlayerDifficulty, rightDifficultyAction->isChecked());
|
||||||
});
|
});
|
||||||
@ -689,13 +689,13 @@ void MainWindow::addAtari2600Menu() {
|
|||||||
|
|
||||||
QAction *const gameSelectAction = new QAction(tr("Game Select"));
|
QAction *const gameSelectAction = new QAction(tr("Game Select"));
|
||||||
controlsMenu->addAction(gameSelectAction);
|
controlsMenu->addAction(gameSelectAction);
|
||||||
connect(gameSelectAction, &QAction::triggered, this, [=] {
|
connect(gameSelectAction, &QAction::triggered, this, [=, this] {
|
||||||
toggleAtari2600Switch(Atari2600SwitchSelect);
|
toggleAtari2600Switch(Atari2600SwitchSelect);
|
||||||
});
|
});
|
||||||
|
|
||||||
QAction *const gameResetAction = new QAction(tr("Game Reset"));
|
QAction *const gameResetAction = new QAction(tr("Game Reset"));
|
||||||
controlsMenu->addAction(gameResetAction);
|
controlsMenu->addAction(gameResetAction);
|
||||||
connect(gameSelectAction, &QAction::triggered, this, [=] {
|
connect(gameSelectAction, &QAction::triggered, this, [=, this] {
|
||||||
toggleAtari2600Switch(Atari2600SwitchReset);
|
toggleAtari2600Switch(Atari2600SwitchReset);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -717,7 +717,7 @@ void MainWindow::addAppleIIMenu() {
|
|||||||
// Add an additional tick box, for square pixels.
|
// Add an additional tick box, for square pixels.
|
||||||
QAction *const squarePixelsAction = new QAction(tr("Square Pixels"));
|
QAction *const squarePixelsAction = new QAction(tr("Square Pixels"));
|
||||||
squarePixelsAction->setCheckable(true);
|
squarePixelsAction->setCheckable(true);
|
||||||
connect(squarePixelsAction, &QAction::triggered, this, [=] {
|
connect(squarePixelsAction, &QAction::triggered, this, [=, this] {
|
||||||
std::lock_guard lock_guard(machineMutex);
|
std::lock_guard lock_guard(machineMutex);
|
||||||
|
|
||||||
// Apply the new setting to the machine.
|
// Apply the new setting to the machine.
|
||||||
@ -806,7 +806,7 @@ void MainWindow::dropEvent(QDropEvent* event) {
|
|||||||
dir.mkpath(".");
|
dir.mkpath(".");
|
||||||
|
|
||||||
// Write into place.
|
// Write into place.
|
||||||
const std::string destination = QDir::toNativeSeparators(QString::fromStdString(path+ "/" + target_rom->file_names[0])).toStdString();
|
const std::string destination = QDir::toNativeSeparators(QString::fromStdString(path+ "/" + target_rom->file_names[0])).toStdString();
|
||||||
FILE *const target = fopen(destination.c_str(), "wb");
|
FILE *const target = fopen(destination.c_str(), "wb");
|
||||||
fwrite(contents->data(), 1, contents->size(), target);
|
fwrite(contents->data(), 1, contents->size(), target);
|
||||||
fclose(target);
|
fclose(target);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user