X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=dab9c7866fab2b61ac85438dfe336bb05a96a9cd;hb=c9da51187f8db0c9822d544a0253e0e7a58945d7;hp=77dc946213ef20850247fc0b5acf15f51b820df3;hpb=f2040dcb783986fd478e910a13b6c9bcf8a0a4be;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 77dc946..dab9c78 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -200,6 +200,11 @@ shared_ptr MainWindow::add_view(const QString &title, main_bar = make_shared(session, *this); dock_main->addToolBar(main_bar.get()); session.set_main_bar(main_bar); + + connect(main_bar.get(), SIGNAL(new_session()), + this, SLOT(on_new_session())); + connect(main_bar.get(), SIGNAL(new_view(Session*)), + this, SLOT(on_new_view(Session*))); } main_bar->action_view_show_cursors()->setChecked(v->cursors_shown()); @@ -218,6 +223,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 = @@ -252,6 +260,8 @@ void MainWindow::setup_ui() action_about_->setObjectName(QString::fromUtf8("actionAbout")); action_about_->setText(tr("&About...")); + setDockNestingEnabled(true); + // Set the title setWindowTitle(tr("PulseView")); } @@ -334,6 +344,28 @@ 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_new_session() +{ + add_session(); +} + +void MainWindow::on_new_view(Session *session) +{ + // We get a pointer and need a reference + for (std::shared_ptr s : sessions_) + if (s.get() == session) + add_view(session->name(), pv::view::TraceView, *s); +} + void MainWindow::on_actionViewStickyScrolling_triggered() { shared_ptr view = get_active_view();