]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Name session tabs "Session 1" per default.
[pulseview.git] / pv / mainwindow.cpp
index ddc2c8f0435c798039ab369830a3368c148a23dc..500d2a435625cd20cde87f66f87c906c73cfa50a 100644 (file)
@@ -268,7 +268,7 @@ void MainWindow::remove_view(shared_ptr<views::ViewBase> view)
 shared_ptr<Session> MainWindow::add_session()
 {
        static int last_session_id = 1;
-       QString name = tr("Untitled-%1").arg(last_session_id++);
+       QString name = tr("Session %1").arg(last_session_id++);
 
        shared_ptr<Session> session = make_shared<Session>(device_manager_, name);
 
@@ -401,6 +401,11 @@ void MainWindow::setup_ui()
        session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner);
        session_selector_.setTabsClosable(true);
 
+       close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
+       close_application_shortcut_->setAutoRepeat(false);
+
+       close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab()));
+
        connect(new_session_button_, SIGNAL(clicked(bool)),
                this, SLOT(on_new_session_clicked()));
        connect(run_stop_button_, SIGNAL(clicked(bool)),
@@ -742,4 +747,11 @@ void MainWindow::on_actionAbout_triggered()
        dlg.exec();
 }
 
+void MainWindow::on_close_current_tab()
+{
+       int tab = session_selector_.currentIndex();
+
+       on_tab_close_requested(tab);
+}
+
 } // namespace pv