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

Attempts to move the 'Help' menu to the correct place.

This commit is contained in:
Thomas Harte 2020-07-04 19:19:41 -04:00
parent 366793498a
commit 5a729f92c1
2 changed files with 19 additions and 9 deletions

View File

@ -114,7 +114,6 @@ void MainWindow::createActions() {
// Add file option: 'New' // Add file option: 'New'
QAction *const newAct = new QAction(tr("&New"), this); QAction *const newAct = new QAction(tr("&New"), this);
newAct->setShortcuts(QKeySequence::New); newAct->setShortcuts(QKeySequence::New);
newAct->setStatusTip(tr("Create a new file"));
connect(newAct, &QAction::triggered, this, [this] { connect(newAct, &QAction::triggered, this, [this] {
storeSelections(); storeSelections();
@ -128,7 +127,6 @@ void MainWindow::createActions() {
// Add file option: 'Open...' // Add file option: 'Open...'
QAction *const openAct = new QAction(tr("&Open..."), this); QAction *const openAct = new QAction(tr("&Open..."), this);
openAct->setShortcuts(QKeySequence::Open); openAct->setShortcuts(QKeySequence::Open);
openAct->setStatusTip(tr("Open an existing file"));
connect(openAct, &QAction::triggered, this, [this] { connect(openAct, &QAction::triggered, this, [this] {
const QString fileName = getFilename("Open..."); const QString fileName = getFilename("Open...");
if(!fileName.isEmpty()) { if(!fileName.isEmpty()) {
@ -149,7 +147,6 @@ void MainWindow::createActions() {
// Add a separator and then an 'Insert...'. // Add a separator and then an 'Insert...'.
fileMenu->addSeparator(); fileMenu->addSeparator();
insertAction = new QAction(tr("&Insert..."), this); insertAction = new QAction(tr("&Insert..."), this);
insertAction->setStatusTip(tr("Open an existing file"));
insertAction->setEnabled(false); insertAction->setEnabled(false);
connect(insertAction, &QAction::triggered, this, [this] { connect(insertAction, &QAction::triggered, this, [this] {
const QString fileName = getFilename("Insert..."); const QString fileName = getFilename("Insert...");
@ -159,9 +156,20 @@ void MainWindow::createActions() {
}); });
fileMenu->addAction(insertAction); fileMenu->addAction(insertAction);
addHelpMenu();
// Link up the start machine button.
connect(ui->startMachineButton, &QPushButton::clicked, this, &MainWindow::startMachine);
}
void MainWindow::addHelpMenu() {
if(helpMenu) {
menuBar()->removeAction(helpMenu->menuAction());
}
// Add Help menu, with an 'About...' option. // Add Help menu, with an 'About...' option.
QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu = menuBar()->addMenu(tr("&Help"));
QAction *aboutAct = helpMenu->addAction(tr("&About"), this, [this] { helpMenu->addAction(tr("&About"), this, [this] {
QMessageBox::about(this, tr("About Clock Signal"), QMessageBox::about(this, tr("About Clock Signal"),
tr( "<p>Clock Signal is an emulator of various platforms.</p>" tr( "<p>Clock Signal is an emulator of various platforms.</p>"
@ -174,10 +182,6 @@ void MainWindow::createActions() {
"<a href=\"https://github.com/tomharte/CLK/issues\">GitHub issue tracker</a>.</p>" "<a href=\"https://github.com/tomharte/CLK/issues\">GitHub issue tracker</a>.</p>"
)); ));
}); });
aboutAct->setStatusTip(tr("Show the application's About box"));
// Link up the start machine button.
connect(ui->startMachineButton, &QPushButton::clicked, this, &MainWindow::startMachine);
} }
QString MainWindow::getFilename(const char *title) { QString MainWindow::getFilename(const char *title) {
@ -412,6 +416,9 @@ void MainWindow::launchMachine() {
default: break; default: break;
} }
// Push the help menu after any that were just added.
addHelpMenu();
} }
void MainWindow::addDisplayMenu(const std::string &machinePrefix, const std::string &compositeColour, const std::string &compositeMono, const std::string &svideo, const std::string &rgb) { void MainWindow::addDisplayMenu(const std::string &machinePrefix, const std::string &compositeColour, const std::string &compositeMono, const std::string &svideo, const std::string &rgb) {

View File

@ -124,6 +124,9 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
void setWindowTitle(); void setWindowTitle();
bool mouseIsCaptured = false; bool mouseIsCaptured = false;
QMenu *helpMenu = nullptr;
void addHelpMenu();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H