+ view_docks_[dock] = v;
+ session.register_view(v);
+
+ dock_main->setCentralWidget(v.get());
+ dock->setWidget(dock_main);
+
+ dock->setFeatures(QDockWidget::DockWidgetMovable |
+ QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
+
+ QAbstractButton *close_btn =
+ dock->findChildren<QAbstractButton*>
+ ("qt_dockwidget_closebutton").front();
+
+ connect(close_btn, SIGNAL(clicked(bool)),
+ this, SLOT(on_view_close_clicked()));
+
+ connect(&session, SIGNAL(trigger_event(util::Timestamp)),
+ qobject_cast<views::ViewBase*>(v.get()),
+ SLOT(trigger_event(util::Timestamp)));
+
+ if (type == views::ViewTypeTrace) {
+ views::TraceView::View *tv =
+ qobject_cast<views::TraceView::View*>(v.get());
+
+ tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool());
+ tv->enable_show_sampling_points(settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool());
+
+ if (!main_bar) {
+ /* Initial view, create the main bar */
+ main_bar = make_shared<MainBar>(session, this, tv);
+ dock_main->addToolBar(main_bar.get());
+ session.set_main_bar(main_bar);
+
+ connect(main_bar.get(), SIGNAL(new_view(Session*)),
+ this, SLOT(on_new_view(Session*)));
+
+ main_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
+
+ /* For the main view we need to prevent the dock widget from
+ * closing itself when its close button is clicked. This is
+ * so we can confirm with the user first. Regular views don't
+ * need this */
+ close_btn->disconnect(SIGNAL(clicked()), dock, SLOT(close()));
+ } else {
+ /* Additional view, create a standard bar */
+ pv::views::trace::StandardBar *standard_bar =
+ new pv::views::trace::StandardBar(session, this, tv);
+ dock_main->addToolBar(standard_bar);
+
+ standard_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
+ }