1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Starts sketching out the ZX80/81 menu items.

This commit is contained in:
Thomas Harte 2020-06-28 01:04:32 -04:00
parent d87c840b76
commit 74da762ae1
2 changed files with 23 additions and 4 deletions

View File

@ -401,6 +401,7 @@ void MainWindow::launchMachine() {
break;
case Analyser::Machine::ZX8081:
addZX8081Menu(settingsPrefix);
break;
default: break;
@ -479,7 +480,10 @@ void MainWindow::addDisplayMenu(const std::string &machinePrefix, const std::str
void MainWindow::addEnhancementsMenu(const std::string &machinePrefix, bool offerQuickLoad, bool offerQuickBoot) {
enhancementsMenu = menuBar()->addMenu(tr("&Enhancements"));
addEnhancementsItems(machinePrefix, enhancementsMenu, offerQuickLoad, offerQuickBoot, false);
}
void MainWindow::addEnhancementsItems(const std::string &machinePrefix, QMenu *menu, bool offerQuickLoad, bool offerQuickBoot, bool offerAutomaticTapeControl) {
auto options = machine->configurable_device()->get_options();
Settings settings;
@ -487,7 +491,7 @@ void MainWindow::addEnhancementsMenu(const std::string &machinePrefix, bool offe
if(offered) { \
QAction *const action = new QAction(tr(text), this); \
action->setCheckable(true); \
enhancementsMenu->addAction(action); \
menu->addAction(action); \
\
const auto settingName = QString::fromStdString(machinePrefix + "." + setting); \
if(settings.contains(settingName)) { \
@ -509,11 +513,27 @@ void MainWindow::addEnhancementsMenu(const std::string &machinePrefix, bool offe
Add(offerQuickLoad, "Load Quickly", "quickload");
Add(offerQuickBoot, "Start Quickly", "quickboot");
if(offerAutomaticTapeControl) menu->addSeparator();
Add(offerAutomaticTapeControl, "Start and Stop Tape Automatically", "automatic_tape_motor_control");
#undef Add
machine->configurable_device()->set_options(options);
}
//QMenu *controlsMenu = nullptr;
void MainWindow::addZX8081Menu(const std::string &machinePrefix) {
controlsMenu = menuBar()->addMenu(tr("Tape &Control"));
// Add the quick-load option.
addEnhancementsItems(machinePrefix, controlsMenu, true, false, true);
// TODO: start and stop tape options, possibly both disabled as per the automatic control and,
// if not, with start enabled, stop disabled and appropriate wiring. Also add an additional
// connection from the automatic tape control action to update in the future.
}
void MainWindow::speaker_did_complete_samples(Outputs::Speaker::Speaker *, const std::vector<int16_t> &buffer) {
audioBuffer.write(buffer);
}
@ -598,9 +618,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
}
} break;
case QEvent::Close:
break;
default:
break;
}

View File

@ -105,8 +105,10 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
QMenu *enhancementsMenu = nullptr;
void addEnhancementsMenu(const std::string &machinePrefix, bool offerQuickLoad, bool offerQuickBoot);
void addEnhancementsItems(const std::string &machinePrefix, QMenu *menu, bool offerQuickLoad, bool offerQuickBoot, bool automatic_tape_motor_control);
QMenu *controlsMenu = nullptr;
void addZX8081Menu(const std::string &machinePrefix);
};
#endif // MAINWINDOW_H