1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-19 08:31:11 +00:00

Adds the ZX Spectrum to Qt's New... menu.

This commit is contained in:
Thomas Harte 2021-03-21 22:35:46 -04:00
parent dd7419282d
commit 21b1dab4a5
3 changed files with 78 additions and 7 deletions

View File

@ -1,12 +1,14 @@
#include "mainwindow.h"
#include "settings.h"
#include "timer.h"
#include <QObject>
#include <QStandardPaths>
#include <QtWidgets>
#include <QtGlobal>
#include "mainwindow.h"
#include "settings.h"
#include "timer.h"
#include <cstdio>
#include "../../Numeric/CRC.hpp"
@ -462,6 +464,11 @@ void MainWindow::launchMachine() {
addZX8081Menu(settingsPrefix);
break;
case Analyser::Machine::ZXSpectrum:
addDisplayMenu(settingsPrefix, "Composite", "", "S-Video", "SCART");
addEnhancementsMenu(settingsPrefix, true, false);
break;
default: break;
}
@ -599,7 +606,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
controlsMenu->addAction(startTapeAction);
connect(startTapeAction, &QAction::triggered, this, [=] {
std::lock_guard lock_guard(machineMutex);
static_cast<ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(true);
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(true);
updateTapeControls();
});
@ -607,7 +614,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
controlsMenu->addAction(stopTapeAction);
connect(stopTapeAction, &QAction::triggered, this, [=] {
std::lock_guard lock_guard(machineMutex);
static_cast<ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(false);
static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->set_tape_is_playing(false);
updateTapeControls();
});
@ -620,7 +627,7 @@ void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
void MainWindow::updateTapeControls() {
const bool startStopEnabled = !automaticTapeControlAction->isChecked();
const bool isPlaying = static_cast<ZX8081::Machine *>(machine->raw_pointer())->get_tape_is_playing();
const bool isPlaying = static_cast<Sinclair::ZX8081::Machine *>(machine->raw_pointer())->get_tape_is_playing();
startTapeAction->setEnabled(!isPlaying && startStopEnabled);
stopTapeAction->setEnabled(isPlaying && startStopEnabled);
@ -1097,6 +1104,7 @@ void MainWindow::setButtonPressed(int index, bool isPressed) {
#include "../../Analyser/Static/MSX/Target.hpp"
#include "../../Analyser/Static/Oric/Target.hpp"
#include "../../Analyser/Static/ZX8081/Target.hpp"
#include "../../Analyser/Static/ZXSpectrum/Target.hpp"
void MainWindow::startMachine() {
const auto selectedTab = ui->machineSelectionTabs->currentWidget();
@ -1115,6 +1123,7 @@ void MainWindow::startMachine() {
TEST(macintosh);
TEST(msx);
TEST(oric);
TEST(spectrum);
TEST(vic20);
TEST(zx80);
TEST(zx81);
@ -1245,6 +1254,18 @@ void MainWindow::start_oric() {
launchTarget(std::move(target));
}
void MainWindow::start_spectrum() {
using Target = Analyser::Static::ZXSpectrum::Target;
auto target = std::make_unique<Target>();
switch(ui->oricModelComboBox->currentIndex()) {
default: target->model = Target::Model::Plus2a; break;
case 1: target->model = Target::Model::Plus3; break;
}
launchTarget(std::move(target));
}
void MainWindow::start_vic20() {
using Target = Analyser::Static::Commodore::Target;
auto target = std::make_unique<Target>();

View File

@ -19,7 +19,7 @@
#include "../../Activity/Observer.hpp"
// There are machine-specific controls for the following:
#include "../../Machines/ZX8081/ZX8081.hpp"
#include "../../Machines/Sinclair/ZX8081/ZX8081.hpp"
#include "../../Machines/Atari/2600/Atari2600.hpp"
QT_BEGIN_NAMESPACE
@ -92,6 +92,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
void start_macintosh();
void start_msx();
void start_oric();
void start_spectrum();
void start_vic20();
void start_zx80();
void start_zx81();

View File

@ -533,6 +533,55 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="spectrumTab">
<attribute name="title">
<string>Spectrum</string>
</attribute>
<layout class="QVBoxLayout" name="spectrumLayout">
<item>
<layout class="QHBoxLayout" name="spectrumHorizontalLayout">
<item>
<layout class="QFormLayout" name="spectrumFormLayout">
<item row="0" column="0">
<widget class="QLabel" name="spectrumModelLabel">
<property name="text">
<string>Model:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="spectrumModelComboBox">
<item>
<property name="text">
<string>+2a</string>
</property>
</item>
<item>
<property name="text">
<string>+3</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spectrumHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="vic20Tab">
<attribute name="title">
<string>Vic-20</string>