]> sigrok.org Git - pulseview.git/blame_incremental - pv/mainwindow.cpp
Show sampling points in logic traces.
[pulseview.git] / pv / mainwindow.cpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifdef ENABLE_DECODE
21#include <libsigrokdecode/libsigrokdecode.h>
22#endif
23
24#include <cassert>
25#include <algorithm>
26#include <iterator>
27#include <cstdint>
28#include <cstdarg>
29
30#include <QAction>
31#include <QApplication>
32#include <QCloseEvent>
33#include <QDockWidget>
34#include <QHBoxLayout>
35#include <QMessageBox>
36#include <QSettings>
37#include <QWidget>
38#include <QShortcut>
39
40#include "mainwindow.hpp"
41
42#include "devicemanager.hpp"
43#include "globalsettings.hpp"
44#include "util.hpp"
45#include "devices/hardwaredevice.hpp"
46#include "dialogs/settings.hpp"
47#include "toolbars/mainbar.hpp"
48#include "view/view.hpp"
49#include "views/trace/standardbar.hpp"
50
51#include <libsigrokcxx/libsigrokcxx.hpp>
52
53using std::dynamic_pointer_cast;
54using std::list;
55using std::make_shared;
56using std::map;
57using std::shared_ptr;
58using std::string;
59
60namespace pv {
61
62namespace view {
63class ViewItem;
64}
65
66using toolbars::MainBar;
67
68using std::bind;
69using std::placeholders::_1;
70
71const QString MainWindow::WindowTitle = tr("PulseView");
72
73MainWindow::MainWindow(DeviceManager &device_manager,
74 string open_file_name, string open_file_format,
75 QWidget *parent) :
76 QMainWindow(parent),
77 device_manager_(device_manager),
78 session_selector_(this),
79 session_state_mapper_(this),
80 icon_red_(":/icons/status-red.svg"),
81 icon_green_(":/icons/status-green.svg"),
82 icon_grey_(":/icons/status-grey.svg")
83{
84 qRegisterMetaType<util::Timestamp>("util::Timestamp");
85 qRegisterMetaType<uint64_t>("uint64_t");
86
87 GlobalSettings::register_change_handler(GlobalSettings::Key_View_ColouredBG,
88 bind(&MainWindow::on_settingViewColouredBg_changed, this, _1));
89
90 setup_ui();
91 restore_ui_settings();
92
93 if (!open_file_name.empty()) {
94 shared_ptr<Session> session = add_session();
95 session->load_init_file(open_file_name, open_file_format);
96 }
97
98 // Add empty default session if there aren't any sessions
99 if (sessions_.size() == 0) {
100 shared_ptr<Session> session = add_session();
101
102 map<string, string> dev_info;
103 shared_ptr<devices::HardwareDevice> other_device, demo_device;
104
105 // Use any available device that's not demo
106 for (shared_ptr<devices::HardwareDevice> dev : device_manager_.devices()) {
107 if (dev->hardware_device()->driver()->name() == "demo") {
108 demo_device = dev;
109 } else {
110 other_device = dev;
111 }
112 }
113
114 // ...and if there isn't any, just use demo then
115 session->select_device(other_device ? other_device : demo_device);
116 }
117}
118
119MainWindow::~MainWindow()
120{
121 while (!sessions_.empty())
122 remove_session(sessions_.front());
123}
124
125shared_ptr<views::ViewBase> MainWindow::get_active_view() const
126{
127 // If there's only one view, use it...
128 if (view_docks_.size() == 1)
129 return view_docks_.begin()->second;
130
131 // ...otherwise find the dock widget the widget with focus is contained in
132 QObject *w = QApplication::focusWidget();
133 QDockWidget *dock = nullptr;
134
135 while (w) {
136 dock = qobject_cast<QDockWidget*>(w);
137 if (dock)
138 break;
139 w = w->parent();
140 }
141
142 // Get the view contained in the dock widget
143 for (auto entry : view_docks_)
144 if (entry.first == dock)
145 return entry.second;
146
147 return nullptr;
148}
149
150shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
151 views::ViewType type, Session &session)
152{
153 GlobalSettings settings;
154 shared_ptr<views::ViewBase> v;
155
156 QMainWindow *main_window = nullptr;
157 for (auto entry : session_windows_)
158 if (entry.first.get() == &session)
159 main_window = entry.second;
160
161 assert(main_window);
162
163 shared_ptr<MainBar> main_bar = session.main_bar();
164
165 QDockWidget* dock = new QDockWidget(title, main_window);
166 dock->setObjectName(title);
167 main_window->addDockWidget(Qt::TopDockWidgetArea, dock);
168
169 // Insert a QMainWindow into the dock widget to allow for a tool bar
170 QMainWindow *dock_main = new QMainWindow(dock);
171 dock_main->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
172
173 if (type == views::ViewTypeTrace)
174 // This view will be the main view if there's no main bar yet
175 v = make_shared<views::TraceView::View>(session,
176 (main_bar ? false : true), dock_main);
177
178 if (!v)
179 return nullptr;
180
181 view_docks_[dock] = v;
182 session.register_view(v);
183
184 dock_main->setCentralWidget(v.get());
185 dock->setWidget(dock_main);
186
187 dock->setFeatures(QDockWidget::DockWidgetMovable |
188 QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
189
190 QAbstractButton *close_btn =
191 dock->findChildren<QAbstractButton*>
192 ("qt_dockwidget_closebutton").front();
193
194 connect(close_btn, SIGNAL(clicked(bool)),
195 this, SLOT(on_view_close_clicked()));
196
197 connect(&session, SIGNAL(trigger_event(util::Timestamp)),
198 qobject_cast<views::ViewBase*>(v.get()),
199 SLOT(trigger_event(util::Timestamp)));
200
201 if (type == views::ViewTypeTrace) {
202 views::TraceView::View *tv =
203 qobject_cast<views::TraceView::View*>(v.get());
204
205 tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool());
206
207 if (!main_bar) {
208 /* Initial view, create the main bar */
209 main_bar = make_shared<MainBar>(session, this, tv);
210 dock_main->addToolBar(main_bar.get());
211 session.set_main_bar(main_bar);
212
213 connect(main_bar.get(), SIGNAL(new_view(Session*)),
214 this, SLOT(on_new_view(Session*)));
215
216 main_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
217
218 /* For the main view we need to prevent the dock widget from
219 * closing itself when its close button is clicked. This is
220 * so we can confirm with the user first. Regular views don't
221 * need this */
222 close_btn->disconnect(SIGNAL(clicked()), dock, SLOT(close()));
223 } else {
224 /* Additional view, create a standard bar */
225 pv::views::trace::StandardBar *standard_bar =
226 new pv::views::trace::StandardBar(session, this, tv);
227 dock_main->addToolBar(standard_bar);
228
229 standard_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
230 }
231 }
232
233 return v;
234}
235
236void MainWindow::remove_view(shared_ptr<views::ViewBase> view)
237{
238 for (shared_ptr<Session> session : sessions_) {
239 if (!session->has_view(view))
240 continue;
241
242 // Find the dock the view is contained in and remove it
243 for (auto entry : view_docks_)
244 if (entry.second == view) {
245 // Remove the view from the session
246 session->deregister_view(view);
247
248 // Remove the view from its parent; otherwise, Qt will
249 // call deleteLater() on it, which causes a double free
250 // since the shared_ptr in view_docks_ doesn't know
251 // that Qt keeps a pointer to the view around
252 view->setParent(nullptr);
253
254 // Delete the view's dock widget and all widgets inside it
255 entry.first->deleteLater();
256
257 // Remove the dock widget from the list and stop iterating
258 view_docks_.erase(entry.first);
259 break;
260 }
261 }
262}
263
264shared_ptr<Session> MainWindow::add_session()
265{
266 static int last_session_id = 1;
267 QString name = tr("Session %1").arg(last_session_id++);
268
269 shared_ptr<Session> session = make_shared<Session>(device_manager_, name);
270
271 connect(session.get(), SIGNAL(add_view(const QString&, views::ViewType, Session*)),
272 this, SLOT(on_add_view(const QString&, views::ViewType, Session*)));
273 connect(session.get(), SIGNAL(name_changed()),
274 this, SLOT(on_session_name_changed()));
275 session_state_mapper_.setMapping(session.get(), session.get());
276 connect(session.get(), SIGNAL(capture_state_changed(int)),
277 &session_state_mapper_, SLOT(map()));
278
279 sessions_.push_back(session);
280
281 QMainWindow *window = new QMainWindow();
282 window->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
283 session_windows_[session] = window;
284
285 int index = session_selector_.addTab(window, name);
286 session_selector_.setCurrentIndex(index);
287 last_focused_session_ = session;
288
289 window->setDockNestingEnabled(true);
290
291 shared_ptr<views::ViewBase> main_view =
292 add_view(name, views::ViewTypeTrace, *session);
293
294 return session;
295}
296
297void MainWindow::remove_session(shared_ptr<Session> session)
298{
299 int h = new_session_button_->height();
300
301 for (shared_ptr<views::ViewBase> view : session->views())
302 remove_view(view);
303
304 QMainWindow *window = session_windows_.at(session);
305 session_selector_.removeTab(session_selector_.indexOf(window));
306
307 session_windows_.erase(session);
308
309 if (last_focused_session_ == session)
310 last_focused_session_.reset();
311
312 sessions_.remove_if([&](shared_ptr<Session> s) {
313 return s == session; });
314
315 if (sessions_.empty()) {
316 // When there are no more tabs, the height of the QTabWidget
317 // drops to zero. We must prevent this to keep the static
318 // widgets visible
319 for (QWidget *w : static_tab_widget_->findChildren<QWidget*>())
320 w->setMinimumHeight(h);
321
322 int margin = static_tab_widget_->layout()->contentsMargins().bottom();
323 static_tab_widget_->setMinimumHeight(h + 2 * margin);
324 session_selector_.setMinimumHeight(h + 2 * margin);
325
326 // Update the window title if there is no view left to
327 // generate focus change events
328 setWindowTitle(WindowTitle);
329 }
330}
331
332void MainWindow::setup_ui()
333{
334 setObjectName(QString::fromUtf8("MainWindow"));
335
336 setCentralWidget(&session_selector_);
337
338 // Set the window icon
339 QIcon icon;
340 icon.addFile(QString(":/icons/sigrok-logo-notext.png"));
341 setWindowIcon(icon);
342
343 view_sticky_scrolling_shortcut_ = new QShortcut(QKeySequence(Qt::Key_S), this, SLOT(on_view_sticky_scrolling_shortcut()));
344 view_sticky_scrolling_shortcut_->setAutoRepeat(false);
345
346 view_coloured_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_coloured_bg_shortcut()));
347 view_coloured_bg_shortcut_->setAutoRepeat(false);
348
349 // Set up the tab area
350 new_session_button_ = new QToolButton();
351 new_session_button_->setIcon(QIcon::fromTheme("document-new",
352 QIcon(":/icons/document-new.png")));
353 new_session_button_->setToolTip(tr("Create New Session"));
354 new_session_button_->setAutoRaise(true);
355
356 run_stop_button_ = new QToolButton();
357 run_stop_button_->setAutoRaise(true);
358 run_stop_button_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
359 run_stop_button_->setToolTip(tr("Start/Stop Acquisition"));
360
361 run_stop_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Space), run_stop_button_, SLOT(click()));
362 run_stop_shortcut_->setAutoRepeat(false);
363
364 settings_button_ = new QToolButton();
365 settings_button_->setIcon(QIcon::fromTheme("configure",
366 QIcon(":/icons/configure.png")));
367 settings_button_->setToolTip(tr("Settings"));
368 settings_button_->setAutoRaise(true);
369
370 QFrame *separator1 = new QFrame();
371 separator1->setFrameStyle(QFrame::VLine | QFrame::Raised);
372 QFrame *separator2 = new QFrame();
373 separator2->setFrameStyle(QFrame::VLine | QFrame::Raised);
374
375 QHBoxLayout* layout = new QHBoxLayout();
376 layout->setContentsMargins(2, 2, 2, 2);
377 layout->addWidget(new_session_button_);
378 layout->addWidget(separator1);
379 layout->addWidget(run_stop_button_);
380 layout->addWidget(separator2);
381 layout->addWidget(settings_button_);
382
383 static_tab_widget_ = new QWidget();
384 static_tab_widget_->setLayout(layout);
385
386 session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner);
387 session_selector_.setTabsClosable(true);
388
389 close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
390 close_application_shortcut_->setAutoRepeat(false);
391
392 close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab()));
393
394 connect(new_session_button_, SIGNAL(clicked(bool)),
395 this, SLOT(on_new_session_clicked()));
396 connect(run_stop_button_, SIGNAL(clicked(bool)),
397 this, SLOT(on_run_stop_clicked()));
398 connect(&session_state_mapper_, SIGNAL(mapped(QObject*)),
399 this, SLOT(on_capture_state_changed(QObject*)));
400 connect(settings_button_, SIGNAL(clicked(bool)),
401 this, SLOT(on_settings_clicked()));
402
403 connect(&session_selector_, SIGNAL(tabCloseRequested(int)),
404 this, SLOT(on_tab_close_requested(int)));
405 connect(&session_selector_, SIGNAL(currentChanged(int)),
406 this, SLOT(on_tab_changed(int)));
407
408
409 connect(static_cast<QApplication *>(QCoreApplication::instance()),
410 SIGNAL(focusChanged(QWidget*, QWidget*)),
411 this, SLOT(on_focus_changed()));
412}
413
414void MainWindow::save_ui_settings()
415{
416 QSettings settings;
417 int id = 0;
418
419 settings.beginGroup("MainWindow");
420 settings.setValue("state", saveState());
421 settings.setValue("geometry", saveGeometry());
422 settings.endGroup();
423
424 for (shared_ptr<Session> session : sessions_) {
425 // Ignore sessions using the demo device or no device at all
426 if (session->device()) {
427 shared_ptr<devices::HardwareDevice> device =
428 dynamic_pointer_cast< devices::HardwareDevice >
429 (session->device());
430
431 if (device &&
432 device->hardware_device()->driver()->name() == "demo")
433 continue;
434
435 settings.beginGroup("Session" + QString::number(id++));
436 settings.remove(""); // Remove all keys in this group
437 session->save_settings(settings);
438 settings.endGroup();
439 }
440 }
441
442 settings.setValue("sessions", id);
443}
444
445void MainWindow::restore_ui_settings()
446{
447 QSettings settings;
448 int i, session_count;
449
450 settings.beginGroup("MainWindow");
451
452 if (settings.contains("geometry")) {
453 restoreGeometry(settings.value("geometry").toByteArray());
454 restoreState(settings.value("state").toByteArray());
455 } else
456 resize(1000, 720);
457
458 settings.endGroup();
459
460 session_count = settings.value("sessions", 0).toInt();
461
462 for (i = 0; i < session_count; i++) {
463 settings.beginGroup("Session" + QString::number(i));
464 shared_ptr<Session> session = add_session();
465 session->restore_settings(settings);
466 settings.endGroup();
467 }
468}
469
470std::shared_ptr<Session> MainWindow::get_tab_session(int index) const
471{
472 // Find the session that belongs to the tab's main window
473 for (auto entry : session_windows_)
474 if (entry.second == session_selector_.widget(index))
475 return entry.first;
476
477 return nullptr;
478}
479
480void MainWindow::closeEvent(QCloseEvent *event)
481{
482 bool data_saved = true;
483
484 for (auto entry : session_windows_)
485 if (!entry.first->data_saved())
486 data_saved = false;
487
488 if (!data_saved && (QMessageBox::question(this, tr("Confirmation"),
489 tr("There is unsaved data. Close anyway?"),
490 QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)) {
491 event->ignore();
492 } else {
493 save_ui_settings();
494 event->accept();
495 }
496}
497
498QMenu* MainWindow::createPopupMenu()
499{
500 return nullptr;
501}
502
503bool MainWindow::restoreState(const QByteArray &state, int version)
504{
505 (void)state;
506 (void)version;
507
508 // Do nothing. We don't want Qt to handle this, or else it
509 // will try to restore all the dock widgets and create havoc.
510
511 return false;
512}
513
514void MainWindow::session_error(const QString text, const QString info_text)
515{
516 QMetaObject::invokeMethod(this, "show_session_error",
517 Qt::QueuedConnection, Q_ARG(QString, text),
518 Q_ARG(QString, info_text));
519}
520
521void MainWindow::show_session_error(const QString text, const QString info_text)
522{
523 QMessageBox msg(this);
524 msg.setText(text);
525 msg.setInformativeText(info_text);
526 msg.setStandardButtons(QMessageBox::Ok);
527 msg.setIcon(QMessageBox::Warning);
528 msg.exec();
529}
530
531void MainWindow::on_add_view(const QString &title, views::ViewType type,
532 Session *session)
533{
534 // We get a pointer and need a reference
535 for (std::shared_ptr<Session> s : sessions_)
536 if (s.get() == session)
537 add_view(title, type, *s);
538}
539
540void MainWindow::on_focus_changed()
541{
542 shared_ptr<views::ViewBase> view = get_active_view();
543
544 if (view) {
545 for (shared_ptr<Session> session : sessions_) {
546 if (session->has_view(view)) {
547 if (session != last_focused_session_) {
548 // Activate correct tab if necessary
549 shared_ptr<Session> tab_session = get_tab_session(
550 session_selector_.currentIndex());
551 if (tab_session != session)
552 session_selector_.setCurrentWidget(
553 session_windows_.at(session));
554
555 on_focused_session_changed(session);
556 }
557
558 break;
559 }
560 }
561 }
562
563 if (sessions_.empty())
564 setWindowTitle(WindowTitle);
565}
566
567void MainWindow::on_focused_session_changed(shared_ptr<Session> session)
568{
569 last_focused_session_ = session;
570
571 setWindowTitle(session->name() + " - " + WindowTitle);
572
573 // Update the state of the run/stop button, too
574 on_capture_state_changed(session.get());
575}
576
577void MainWindow::on_new_session_clicked()
578{
579 add_session();
580}
581
582void MainWindow::on_run_stop_clicked()
583{
584 shared_ptr<Session> session = last_focused_session_;
585
586 if (!session)
587 return;
588
589 switch (session->get_capture_state()) {
590 case Session::Stopped:
591 session->start_capture([&](QString message) {
592 session_error("Capture failed", message); });
593 break;
594 case Session::AwaitingTrigger:
595 case Session::Running:
596 session->stop_capture();
597 break;
598 }
599}
600
601void MainWindow::on_settings_clicked()
602{
603 dialogs::Settings dlg(device_manager_);
604 dlg.exec();
605}
606
607void MainWindow::on_session_name_changed()
608{
609 // Update the corresponding dock widget's name(s)
610 Session *session = qobject_cast<Session*>(QObject::sender());
611 assert(session);
612
613 for (shared_ptr<views::ViewBase> view : session->views()) {
614 // Get the dock that contains the view
615 for (auto entry : view_docks_)
616 if (entry.second == view) {
617 entry.first->setObjectName(session->name());
618 entry.first->setWindowTitle(session->name());
619 }
620 }
621
622 // Update the tab widget by finding the main window and the tab from that
623 for (auto entry : session_windows_)
624 if (entry.first.get() == session) {
625 QMainWindow *window = entry.second;
626 const int index = session_selector_.indexOf(window);
627 session_selector_.setTabText(index, session->name());
628 }
629
630 // Refresh window title if the affected session has focus
631 if (session == last_focused_session_.get())
632 setWindowTitle(session->name() + " - " + WindowTitle);
633}
634
635void MainWindow::on_capture_state_changed(QObject *obj)
636{
637 Session *caller = qobject_cast<Session*>(obj);
638
639 // Ignore if caller is not the currently focused session
640 // unless there is only one session
641 if ((sessions_.size() > 1) && (caller != last_focused_session_.get()))
642 return;
643
644 int state = caller->get_capture_state();
645
646 const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_};
647 run_stop_button_->setIcon(*icons[state]);
648 run_stop_button_->setText((state == pv::Session::Stopped) ?
649 tr("Run") : tr("Stop"));
650}
651
652void MainWindow::on_new_view(Session *session)
653{
654 // We get a pointer and need a reference
655 for (std::shared_ptr<Session> s : sessions_)
656 if (s.get() == session)
657 add_view(session->name(), views::ViewTypeTrace, *s);
658}
659
660void MainWindow::on_view_close_clicked()
661{
662 // Find the dock widget that contains the close button that was clicked
663 QObject *w = QObject::sender();
664 QDockWidget *dock = nullptr;
665
666 while (w) {
667 dock = qobject_cast<QDockWidget*>(w);
668 if (dock)
669 break;
670 w = w->parent();
671 }
672
673 // Get the view contained in the dock widget
674 shared_ptr<views::ViewBase> view;
675
676 for (auto entry : view_docks_)
677 if (entry.first == dock)
678 view = entry.second;
679
680 // Deregister the view
681 for (shared_ptr<Session> session : sessions_) {
682 if (!session->has_view(view))
683 continue;
684
685 // Also destroy the entire session if its main view is closing...
686 if (view == session->main_view()) {
687 // ...but only if data is saved or the user confirms closing
688 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
689 tr("This session contains unsaved data. Close it anyway?"),
690 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
691 remove_session(session);
692 break;
693 } else
694 // All other views can be closed at any time as no data will be lost
695 remove_view(view);
696 }
697}
698
699void MainWindow::on_tab_changed(int index)
700{
701 shared_ptr<Session> session = get_tab_session(index);
702
703 if (session)
704 on_focused_session_changed(session);
705}
706
707void MainWindow::on_tab_close_requested(int index)
708{
709 shared_ptr<Session> session = get_tab_session(index);
710
711 assert(session);
712
713 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
714 tr("This session contains unsaved data. Close it anyway?"),
715 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
716 remove_session(session);
717}
718
719void MainWindow::on_view_coloured_bg_shortcut()
720{
721 GlobalSettings settings;
722
723 bool state = settings.value(GlobalSettings::Key_View_ColouredBG).toBool();
724 settings.setValue(GlobalSettings::Key_View_ColouredBG, !state);
725}
726
727void MainWindow::on_view_sticky_scrolling_shortcut()
728{
729 GlobalSettings settings;
730
731 bool state = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool();
732 settings.setValue(GlobalSettings::Key_View_StickyScrolling, !state);
733}
734
735void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value)
736{
737 bool state = new_value.toBool();
738
739 for (auto entry : view_docks_) {
740 shared_ptr<views::ViewBase> viewbase = entry.second;
741
742 // Only trace views have this setting
743 views::TraceView::View* view =
744 qobject_cast<views::TraceView::View*>(viewbase.get());
745 if (view)
746 view->enable_coloured_bg(state);
747 }
748}
749
750void MainWindow::on_close_current_tab()
751{
752 int tab = session_selector_.currentIndex();
753
754 on_tab_close_requested(tab);
755}
756
757} // namespace pv