]> git.sesse.net Git - pkanalytics/commitdiff
Add a menu.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Jul 2023 13:54:17 +0000 (15:54 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Jul 2023 13:54:17 +0000 (15:54 +0200)
main.cpp
mainwindow.cpp
mainwindow.ui

index 6ca5ecdce930bd484ecba1486fd582e3d398d3c8..bda85588e02cd167f9e7d73f7ecba257c00e5f35 100644 (file)
--- 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;
 }
index 0ff813b7ac7465c48192de94d08120d0daebd7a6..feaf3abc525ed4b0c88fe53e849004a7513b72c4 100644 (file)
@@ -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)
index 04a8f910f9d56c9222c866c849fc8aa98cd3c6a5..1a9ede58200af306676f19f66b3e811f154dd54d 100644 (file)
      <height>23</height>
     </rect>
    </property>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_export_json"/>
+    <addaction name="action_exit"/>
+   </widget>
+   <addaction name="menu_File"/>
   </widget>
+  <action name="action_export_json">
+   <property name="text">
+    <string>Export &amp;JSON</string>
+   </property>
+  </action>
+  <action name="action_exit">
+   <property name="text">
+    <string>E&amp;xit</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>