From 4417f81014a39a67914cd0d5628b1d03abcb5b5d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 22 Jun 2020 22:58:58 -0400 Subject: [PATCH] Attempts to set a meaningful window title. --- OSBindings/Qt/mainwindow.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 3c84f0e91..298f7dc5c 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -184,6 +184,7 @@ void MainWindow::launchFile(const QString &fileName) { targets = Analyser::Static::GetTargets(fileName.toStdString()); if(!targets.empty()) { launchMachine(); + setWindowTitle(QFileInfo(fileName).fileName()); } } @@ -370,7 +371,7 @@ void MainWindow::dropEvent(QDropEvent* event) { // Ensure the destination folder exists. const std::string path = appDataLocation + "/ROMImages/" + rom.machine_name; - QDir dir(QString::fromStdString(path)); + const QDir dir(QString::fromStdString(path)); if (!dir.exists()) dir.mkpath("."); @@ -423,6 +424,18 @@ void MainWindow::setVisibleWidgetSet(WidgetSet set) { ui->startMachineButton->setVisible(set == WidgetSet::MachinePicker); ui->topTipLabel->setVisible(set == WidgetSet::MachinePicker); + // Consider setting a window title, if it's knowable. + switch(set) { + case WidgetSet::MachinePicker: + setWindowTitle(tr("Select a machine...")); + break; + case WidgetSet::ROMRequester: + setWindowTitle(tr("Provide ROMs...")); + break; + default: + break; + } + // Set appropriate focus if necessary; e.g. this ensures that machine-picker // widgets aren't still selectable after a machine starts. if(set != WidgetSet::MachinePicker) { @@ -535,6 +548,8 @@ void MainWindow::startMachine() { } void MainWindow::start_appleII() { + setWindowTitle(tr("Apple II")); + using Target = Analyser::Static::AppleII::Target; auto target = std::make_unique(); @@ -555,6 +570,8 @@ void MainWindow::start_appleII() { } void MainWindow::start_amstradCPC() { + setWindowTitle(tr("Amstrad CPC")); + using Target = Analyser::Static::AmstradCPC::Target; auto target = std::make_unique(); @@ -568,6 +585,8 @@ void MainWindow::start_amstradCPC() { } void MainWindow::start_atariST() { + setWindowTitle(tr("Atari ST")); + using Target = Analyser::Static::AtariST::Target; auto target = std::make_unique(); @@ -577,6 +596,8 @@ void MainWindow::start_atariST() { } void MainWindow::start_electron() { + setWindowTitle(tr("Acorn Electron")); + using Target = Analyser::Static::Acorn::Target; auto target = std::make_unique(); @@ -587,6 +608,8 @@ void MainWindow::start_electron() { } void MainWindow::start_macintosh() { + setWindowTitle(tr("Macintosh")); + using Target = Analyser::Static::Macintosh::Target; auto target = std::make_unique(); @@ -599,6 +622,8 @@ void MainWindow::start_macintosh() { } void MainWindow::start_msx() { + setWindowTitle(tr("MSX")); + using Target = Analyser::Static::MSX::Target; auto target = std::make_unique(); @@ -614,6 +639,8 @@ void MainWindow::start_msx() { } void MainWindow::start_oric() { + setWindowTitle(tr("Oric")); + using Target = Analyser::Static::Oric::Target; auto target = std::make_unique(); @@ -635,6 +662,8 @@ void MainWindow::start_oric() { } void MainWindow::start_vic20() { + setWindowTitle(tr("Vic-20")); + using Target = Analyser::Static::Commodore::Target; auto target = std::make_unique(); @@ -660,6 +689,8 @@ void MainWindow::start_vic20() { } void MainWindow::start_zx80() { + setWindowTitle(tr("ZX80")); + using Target = Analyser::Static::ZX8081::Target; auto target = std::make_unique(); @@ -675,6 +706,8 @@ void MainWindow::start_zx80() { } void MainWindow::start_zx81() { + setWindowTitle(tr("ZX81")); + using Target = Analyser::Static::ZX8081::Target; auto target = std::make_unique();