- if (type == views::ViewTypeTrace) {
- QDockWidget* dock = new QDockWidget(title, main_window);
- dock->setObjectName(title);
- main_window->addDockWidget(Qt::TopDockWidgetArea, dock);
-
- // Insert a QMainWindow into the dock widget to allow for a tool bar
- QMainWindow *dock_main = new QMainWindow(dock);
- dock_main->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
-
- shared_ptr<views::TraceView::View> v =
- make_shared<views::TraceView::View>(session, dock_main);
- 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()));
-
- if (type == views::ViewTypeTrace) {
- connect(&session, SIGNAL(trigger_event(util::Timestamp)),
- qobject_cast<views::ViewBase*>(v.get()),
- SLOT(trigger_event(util::Timestamp)));
-
- v->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
- v->enable_coloured_bg(action_view_coloured_bg_->isChecked());
-
- shared_ptr<MainBar> main_bar = session.main_bar();
- if (!main_bar) {
- main_bar = make_shared<MainBar>(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());