mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-30 04:50:08 +00:00
Centralises window title responsibility.
This commit is contained in:
parent
f6e5a2fb04
commit
b9e117cdcf
@ -201,8 +201,8 @@ void MainWindow::insertFile(const QString &fileName) {
|
|||||||
void MainWindow::launchFile(const QString &fileName) {
|
void MainWindow::launchFile(const QString &fileName) {
|
||||||
targets = Analyser::Static::GetTargets(fileName.toStdString());
|
targets = Analyser::Static::GetTargets(fileName.toStdString());
|
||||||
if(!targets.empty()) {
|
if(!targets.empty()) {
|
||||||
|
openFileName = QFileInfo(fileName).fileName();
|
||||||
launchMachine();
|
launchMachine();
|
||||||
setWindowTitle(QFileInfo(fileName).fileName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,6 @@ void MainWindow::launchMachine() {
|
|||||||
configurable->set_options(Machine::AllOptionsByMachineName()[longMachineName]);
|
configurable->set_options(Machine::AllOptionsByMachineName()[longMachineName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If this is a timed machine, start up the timer.
|
// If this is a timed machine, start up the timer.
|
||||||
const auto timedMachine = machine->timed_machine();
|
const auto timedMachine = machine->timed_machine();
|
||||||
if(timedMachine) {
|
if(timedMachine) {
|
||||||
@ -349,9 +348,6 @@ void MainWindow::launchMachine() {
|
|||||||
insertAction->setEnabled(true);
|
insertAction->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the window title. TODO: clearly I need a proper functional solution for the window title.
|
|
||||||
setWindowTitle(QString::fromStdString(longMachineName));
|
|
||||||
|
|
||||||
// Add machine-specific UI.
|
// Add machine-specific UI.
|
||||||
const std::string settingsPrefix = Machine::ShortNameForTargetMachine(machineType);
|
const std::string settingsPrefix = Machine::ShortNameForTargetMachine(machineType);
|
||||||
switch(machineType) {
|
switch(machineType) {
|
||||||
@ -731,7 +727,15 @@ void MainWindow::setUIPhase(UIPhase phase) {
|
|||||||
case UIPhase::RequestingROMs:
|
case UIPhase::RequestingROMs:
|
||||||
setWindowTitle(tr("Provide ROMs..."));
|
setWindowTitle(tr("Provide ROMs..."));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Update the window title. TODO: clearly I need a proper functional solution for the window title.
|
||||||
|
if(openFileName.isEmpty()) {
|
||||||
|
const auto machineType = targets[0]->machine;
|
||||||
|
setWindowTitle(QString::fromStdString(Machine::LongNameForTargetMachine(machineType)));
|
||||||
|
} else {
|
||||||
|
setWindowTitle(openFileName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
|||||||
enum class UIPhase {
|
enum class UIPhase {
|
||||||
SelectingMachine, RequestingROMs, RunningMachine
|
SelectingMachine, RequestingROMs, RunningMachine
|
||||||
} uiPhase = UIPhase::SelectingMachine;
|
} uiPhase = UIPhase::SelectingMachine;
|
||||||
|
QString openFileName;
|
||||||
void setUIPhase(UIPhase);
|
void setUIPhase(UIPhase);
|
||||||
|
|
||||||
void launchMachine();
|
void launchMachine();
|
||||||
|
Loading…
Reference in New Issue
Block a user