X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=874f66ce7c2cd8e0fb07d326affa837b7d976d9f;hb=3a21afa6a5dfc06c17f127960bb0038fd322f213;hp=bc20898249afd70ee4f90972304289a2db7ab0ba;hpb=d552c5c7f25ac892b7dc218264d6fe2823db44ef;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index bc20898..874f66c 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -218,6 +218,9 @@ shared_ptr MainWindow::add_session() shared_ptr session = make_shared(device_manager_, name); + connect(session.get(), SIGNAL(add_view(const QString&, view::ViewType, Session*)), + this, SLOT(on_add_view(const QString&, view::ViewType, Session*))); + sessions_.push_back(session); shared_ptr main_view = @@ -273,11 +276,13 @@ void MainWindow::save_ui_settings() dynamic_pointer_cast< devices::HardwareDevice > (session->device()); - if (device->hardware_device()->driver()->name() == "demo") + if (device && + device->hardware_device()->driver()->name() == "demo") continue; } settings.beginGroup("Session" + QString::number(id++)); + settings.remove(""); // Remove all keys in this group session->save_settings(settings); settings.endGroup(); } @@ -332,6 +337,15 @@ bool MainWindow::restoreState(const QByteArray &state, int version) return false; } +void MainWindow::on_add_view(const QString &title, view::ViewType type, + Session *session) +{ + // We get a pointer and need a reference + for (std::shared_ptr s : sessions_) + if (s.get() == session) + add_view(title, type, *s); +} + void MainWindow::on_actionViewStickyScrolling_triggered() { shared_ptr view = get_active_view();