From 8151c24cf55160029a342fee66f3e81b69af5572 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 18 Jun 2020 20:05:46 -0400 Subject: [PATCH] Starts the machine-picker side of the interface. --- OSBindings/Qt/mainwindow.cpp | 22 +++++-- OSBindings/Qt/mainwindow.h | 7 ++ OSBindings/Qt/mainwindow.ui | 123 +++++++++++++++++++++++++++++++---- 3 files changed, 134 insertions(+), 18 deletions(-) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 11e7273b5..b52d1b7f3 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -25,9 +25,7 @@ MainWindow::MainWindow(QWidget *parent) timer = std::make_unique(this); - // Hide the missing ROMs box unless or until it's needed; grab the text it - // began with as a prefix for future mutation. - ui->missingROMsBox->setVisible(false); + setVisibleWidgetSet(WidgetSet::MachinePicker); romRequestBaseText = ui->missingROMsBox->toPlainText(); } @@ -154,7 +152,7 @@ void MainWindow::launchMachine() { default: { // TODO: correct assumptions herein that this is the first machine to be // assigned to this window. - ui->missingROMsBox->setVisible(false); + setVisibleWidgetSet(WidgetSet::RunningMachine); uiPhase = UIPhase::RunningMachine; // Supply the scan target. @@ -205,7 +203,7 @@ void MainWindow::launchMachine() { } break; case Machine::Error::MissingROM: { - ui->missingROMsBox->setVisible(true); + setVisibleWidgetSet(WidgetSet::ROMRequester); uiPhase = UIPhase::RequestingROMs; // Populate request text. @@ -316,6 +314,20 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { return QObject::eventFilter(obj, event); } +void MainWindow::setVisibleWidgetSet(WidgetSet set) { + // The volume slider is never visible by default; a running machine + // will show and hide it dynamically. + ui->volumeSlider->setVisible(false); + + // Show or hide the missing ROMs box. + ui->missingROMsBox->setVisible(set == WidgetSet::ROMRequester); + + // Show or hide the various machine-picking chrome. + ui->machineSelectionTabs->setVisible(set == WidgetSet::MachinePicker); + ui->startMachineButton->setVisible(set == WidgetSet::MachinePicker); + ui->topTipLabel->setVisible(set == WidgetSet::MachinePicker); +} + bool MainWindow::processEvent(QKeyEvent *event) { if(!machine) return true; diff --git a/OSBindings/Qt/mainwindow.h b/OSBindings/Qt/mainwindow.h index 36dfb4ec8..d36030b6f 100644 --- a/OSBindings/Qt/mainwindow.h +++ b/OSBindings/Qt/mainwindow.h @@ -59,6 +59,13 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat bool processEvent(QKeyEvent *); + enum class WidgetSet { + MachinePicker, + ROMRequester, + RunningMachine, + }; + void setVisibleWidgetSet(WidgetSet); + private slots: void open(); void newFile(); diff --git a/OSBindings/Qt/mainwindow.ui b/OSBindings/Qt/mainwindow.ui index dec26b91a..2f60acb7e 100644 --- a/OSBindings/Qt/mainwindow.ui +++ b/OSBindings/Qt/mainwindow.ui @@ -23,25 +23,122 @@ MainWindow - + - - - true - - - true - - - Clock Signal requires you to provide images of the system ROMs for this machine. They will be stored permanently; you need do this only once. + + + 2 + + + + Apple II + + + + + Amstrad CPC + + + + + Atari ST + + + + + + At present only a 512k Atari ST is supported. + + + + + + + + Electron + + + + + Macintosh + + + + + MSX + + + + + Oric + + + + + Vic-20 + + + + + ZX80 + + + + + ZX81 + + + + + + + + TIP: the easiest way to get started is just to open the disk, tape or cartridge you want to use. The emulator will automatically configure a suitable machine and attempt to launch the software you've selected. Use this method to load Atari 2600, ColecoVision or Master System games. + + + true + + + + + + + Start Machine + + + + + + + true + + + true + + + Clock Signal requires you to provide images of the system ROMs for this machine. They will be stored permanently; you need do this only once. Please drag and drop the following over this window: - - + + + + + + + + 250 + 0 + + + + Qt::Horizontal + + + + - Do this