mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Takes a swing at adding a square pixels toggle for Qt.
This commit is contained in:
parent
de3b37799c
commit
85fab2abc4
@ -403,7 +403,7 @@ void MainWindow::launchMachine() {
|
||||
break;
|
||||
|
||||
case Analyser::Machine::AppleII:
|
||||
addDisplayMenu(settingsPrefix, "Colour", "Monochrome", "", "");
|
||||
addAppleIIMenu();
|
||||
break;
|
||||
|
||||
case Analyser::Machine::Atari2600:
|
||||
@ -671,6 +671,41 @@ void MainWindow::toggleAtari2600Switch(Atari2600Switch toggleSwitch) {
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::addAppleIIMenu() {
|
||||
// Add the standard display settings.
|
||||
addDisplayMenu(settingsPrefix, "Colour", "Monochrome", "", "");
|
||||
|
||||
// Add an additional tick box, for square pixels.
|
||||
QAction *const squarePixelsAction = new QAction(tr("Square Pixels"));
|
||||
squarePixelsAction->setCheckable(true);
|
||||
connect(squarePixelsAction, &QAction::triggered, this, [=] {
|
||||
std::lock_guard lock_guard(machineMutex);
|
||||
|
||||
// Apply the new setting to the machine.
|
||||
setAppleIISquarePixels(squarePixelsAction->isChecked());
|
||||
|
||||
// Also store it.
|
||||
Settings settings;
|
||||
settings.setValue("appleII.squarePixels", squarePixelsAction->isChecked());
|
||||
});
|
||||
displayMenu->addAction(squarePixelsAction);
|
||||
|
||||
// Establish initial selection.
|
||||
Settings settings;
|
||||
const bool useSquarePixels = settings.value("appleII.squarePixels").toBool();
|
||||
squarePixelsAction->setIsChecked(useSquarePixels);
|
||||
setAppleIISquarePixels(useSquarePixels);
|
||||
}
|
||||
|
||||
void MainWindow::setAppleIISquarePixels(bool squarePixels) {
|
||||
const auto configurable = dynamic_cast<Configurable::Device *>(machine->raw_pointer());
|
||||
auto options = configurable->get_options();
|
||||
auto appleii_configurable = static_cast<Apple::II::Machine::Options *>(options.get());
|
||||
|
||||
appleii_configurable->use_square_pixels = squarePixelsAction->isChecked();
|
||||
configurable->set_options(options);
|
||||
}
|
||||
|
||||
void MainWindow::speaker_did_complete_samples(Outputs::Speaker::Speaker *, const std::vector<int16_t> &buffer) {
|
||||
audioBuffer.write(buffer);
|
||||
}
|
||||
|
@ -137,6 +137,9 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
||||
void addAtari2600Menu();
|
||||
void toggleAtari2600Switch(Atari2600Switch toggleSwitch);
|
||||
|
||||
void addAppleIIMenu();
|
||||
void setAppleIISquarePixels(bool);
|
||||
|
||||
void setWindowTitle();
|
||||
bool mouseIsCaptured = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user