From 605df45786d9848550f3559cea85a24edb4dcb63 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 26 Jul 2023 15:54:17 +0200 Subject: [PATCH] Add a menu. --- main.cpp | 3 --- mainwindow.cpp | 4 ++++ mainwindow.ui | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 6ca5ecd..bda8558 100644 --- a/main.cpp +++ b/main.cpp @@ -165,8 +165,5 @@ int main(int argc, char *argv[]) int ret = app.exec(); - // TODO: do this on-demand instead, from a menu - export_to_json(db, "ultimate.json"); - return ret; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 0ff813b..feaf3ab 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -272,6 +272,10 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players, QShortcut *key_delete = new QShortcut(QKeySequence(Qt::Key_Delete), this); connect(key_delete, &QShortcut::activated, [this]() { ui->delete_->animateClick(); }); connect(ui->delete_, &QPushButton::clicked, [this]() { delete_current_event(); }); + + // Menus. + connect(ui->action_exit, &QAction::triggered, [this] { close(); }); + connect(ui->action_export_json, &QAction::triggered, [db] { export_to_json(db, "ultimate.json"); }); } void MainWindow::position_changed(uint64_t pos) diff --git a/mainwindow.ui b/mainwindow.ui index 04a8f91..1a9ede5 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -516,7 +516,25 @@ 23 + + + &File + + + + + + + + Export &JSON + + + + + E&xit + + -- 2.39.2