2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
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.
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.
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/>.
21 #include <libsigrokdecode/libsigrokdecode.h>
31 #include <QApplication>
32 #include <QCloseEvent>
33 #include <QDockWidget>
34 #include <QHBoxLayout>
35 #include <QMessageBox>
40 #include "mainwindow.hpp"
42 #include "devicemanager.hpp"
43 #include "devices/hardwaredevice.hpp"
44 #include "dialogs/settings.hpp"
45 #include "globalsettings.hpp"
46 #include "toolbars/mainbar.hpp"
48 #include "views/trace/view.hpp"
49 #include "views/trace/standardbar.hpp"
51 #include <libsigrokcxx/libsigrokcxx.hpp>
54 using std::dynamic_pointer_cast;
55 using std::make_shared;
56 using std::placeholders::_1;
57 using std::shared_ptr;
66 using toolbars::MainBar;
68 const QString MainWindow::WindowTitle = tr("PulseView");
70 MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) :
72 device_manager_(device_manager),
73 session_selector_(this),
74 session_state_mapper_(this),
75 icon_red_(":/icons/status-red.svg"),
76 icon_green_(":/icons/status-green.svg"),
77 icon_grey_(":/icons/status-grey.svg")
79 qRegisterMetaType<util::Timestamp>("util::Timestamp");
80 qRegisterMetaType<uint64_t>("uint64_t");
82 GlobalSettings::add_change_handler(this);
84 GlobalSettings settings;
85 settings.set_defaults_where_needed();
88 restore_ui_settings();
91 MainWindow::~MainWindow()
93 GlobalSettings::remove_change_handler(this);
95 while (!sessions_.empty())
96 remove_session(sessions_.front());
99 shared_ptr<views::ViewBase> MainWindow::get_active_view() const
101 // If there's only one view, use it...
102 if (view_docks_.size() == 1)
103 return view_docks_.begin()->second;
105 // ...otherwise find the dock widget the widget with focus is contained in
106 QObject *w = QApplication::focusWidget();
107 QDockWidget *dock = nullptr;
110 dock = qobject_cast<QDockWidget*>(w);
116 // Get the view contained in the dock widget
117 for (auto entry : view_docks_)
118 if (entry.first == dock)
124 shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
125 views::ViewType type, Session &session)
127 GlobalSettings settings;
128 shared_ptr<views::ViewBase> v;
130 QMainWindow *main_window = nullptr;
131 for (auto entry : session_windows_)
132 if (entry.first.get() == &session)
133 main_window = entry.second;
137 shared_ptr<MainBar> main_bar = session.main_bar();
139 QDockWidget* dock = new QDockWidget(title, main_window);
140 dock->setObjectName(title);
141 main_window->addDockWidget(Qt::TopDockWidgetArea, dock);
143 // Insert a QMainWindow into the dock widget to allow for a tool bar
144 QMainWindow *dock_main = new QMainWindow(dock);
145 dock_main->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
147 if (type == views::ViewTypeTrace)
148 // This view will be the main view if there's no main bar yet
149 v = make_shared<views::trace::View>(session,
150 (main_bar ? false : true), dock_main);
155 view_docks_[dock] = v;
156 session.register_view(v);
158 dock_main->setCentralWidget(v.get());
159 dock->setWidget(dock_main);
161 dock->setContextMenuPolicy(Qt::PreventContextMenu);
162 dock->setFeatures(QDockWidget::DockWidgetMovable |
163 QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
165 QAbstractButton *close_btn =
166 dock->findChildren<QAbstractButton*>
167 ("qt_dockwidget_closebutton").front();
169 connect(close_btn, SIGNAL(clicked(bool)),
170 this, SLOT(on_view_close_clicked()));
172 connect(&session, SIGNAL(trigger_event(int, util::Timestamp)),
173 qobject_cast<views::ViewBase*>(v.get()),
174 SLOT(trigger_event(int, util::Timestamp)));
176 if (type == views::ViewTypeTrace) {
177 views::trace::View *tv =
178 qobject_cast<views::trace::View*>(v.get());
180 tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool());
181 tv->enable_show_sampling_points(settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool());
182 tv->enable_show_analog_minor_grid(settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool());
185 /* Initial view, create the main bar */
186 main_bar = make_shared<MainBar>(session, this, tv);
187 dock_main->addToolBar(main_bar.get());
188 session.set_main_bar(main_bar);
190 connect(main_bar.get(), SIGNAL(new_view(Session*)),
191 this, SLOT(on_new_view(Session*)));
193 main_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
195 /* For the main view we need to prevent the dock widget from
196 * closing itself when its close button is clicked. This is
197 * so we can confirm with the user first. Regular views don't
199 close_btn->disconnect(SIGNAL(clicked()), dock, SLOT(close()));
201 /* Additional view, create a standard bar */
202 pv::views::trace::StandardBar *standard_bar =
203 new pv::views::trace::StandardBar(session, this, tv);
204 dock_main->addToolBar(standard_bar);
206 standard_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
213 void MainWindow::remove_view(shared_ptr<views::ViewBase> view)
215 for (shared_ptr<Session> session : sessions_) {
216 if (!session->has_view(view))
219 // Find the dock the view is contained in and remove it
220 for (auto entry : view_docks_)
221 if (entry.second == view) {
222 // Remove the view from the session
223 session->deregister_view(view);
225 // Remove the view from its parent; otherwise, Qt will
226 // call deleteLater() on it, which causes a double free
227 // since the shared_ptr in view_docks_ doesn't know
228 // that Qt keeps a pointer to the view around
229 view->setParent(nullptr);
231 // Delete the view's dock widget and all widgets inside it
232 entry.first->deleteLater();
234 // Remove the dock widget from the list and stop iterating
235 view_docks_.erase(entry.first);
241 shared_ptr<Session> MainWindow::add_session()
243 static int last_session_id = 1;
244 QString name = tr("Session %1").arg(last_session_id++);
246 shared_ptr<Session> session = make_shared<Session>(device_manager_, name);
248 connect(session.get(), SIGNAL(add_view(const QString&, views::ViewType, Session*)),
249 this, SLOT(on_add_view(const QString&, views::ViewType, Session*)));
250 connect(session.get(), SIGNAL(name_changed()),
251 this, SLOT(on_session_name_changed()));
252 session_state_mapper_.setMapping(session.get(), session.get());
253 connect(session.get(), SIGNAL(capture_state_changed(int)),
254 &session_state_mapper_, SLOT(map()));
256 sessions_.push_back(session);
258 QMainWindow *window = new QMainWindow();
259 window->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
260 session_windows_[session] = window;
262 int index = session_selector_.addTab(window, name);
263 session_selector_.setCurrentIndex(index);
264 last_focused_session_ = session;
266 window->setDockNestingEnabled(true);
268 shared_ptr<views::ViewBase> main_view =
269 add_view(name, views::ViewTypeTrace, *session);
274 void MainWindow::remove_session(shared_ptr<Session> session)
276 // Determine the height of the button before it collapses
277 int h = new_session_button_->height();
279 // Stop capture while the session still exists so that the UI can be
280 // updated in case we're currently running. If so, this will schedule a
281 // call to our on_capture_state_changed() slot for the next run of the
282 // event loop. We need to have this executed immediately or else it will
283 // be dismissed since the session object will be deleted by the time we
284 // leave this method and the event loop gets a chance to run again.
285 session->stop_capture();
286 QApplication::processEvents();
288 for (shared_ptr<views::ViewBase> view : session->views())
291 QMainWindow *window = session_windows_.at(session);
292 session_selector_.removeTab(session_selector_.indexOf(window));
294 session_windows_.erase(session);
296 if (last_focused_session_ == session)
297 last_focused_session_.reset();
299 // Remove the session from our list of sessions (which also destroys it)
300 sessions_.remove_if([&](shared_ptr<Session> s) {
301 return s == session; });
303 if (sessions_.empty()) {
304 // When there are no more tabs, the height of the QTabWidget
305 // drops to zero. We must prevent this to keep the static
307 for (QWidget *w : static_tab_widget_->findChildren<QWidget*>())
308 w->setMinimumHeight(h);
310 int margin = static_tab_widget_->layout()->contentsMargins().bottom();
311 static_tab_widget_->setMinimumHeight(h + 2 * margin);
312 session_selector_.setMinimumHeight(h + 2 * margin);
314 // Update the window title if there is no view left to
315 // generate focus change events
316 setWindowTitle(WindowTitle);
320 void MainWindow::add_session_with_file(string open_file_name,
321 string open_file_format)
323 shared_ptr<Session> session = add_session();
324 session->load_init_file(open_file_name, open_file_format);
327 void MainWindow::add_default_session()
329 // Only add the default session if there would be no session otherwise
330 if (sessions_.size() > 0)
333 shared_ptr<Session> session = add_session();
335 // Check the list of available devices. Prefer the one that was
336 // found with user supplied scan specs (if applicable). Then try
337 // one of the auto detected devices that are not the demo device.
338 // Pick demo in the absence of "genuine" hardware devices.
339 shared_ptr<devices::HardwareDevice> user_device, other_device, demo_device;
340 for (shared_ptr<devices::HardwareDevice> dev : device_manager_.devices()) {
341 if (dev == device_manager_.user_spec_device()) {
343 } else if (dev->hardware_device()->driver()->name() == "demo") {
350 session->select_device(user_device);
351 else if (other_device)
352 session->select_device(other_device);
354 session->select_device(demo_device);
357 void MainWindow::save_sessions()
362 for (shared_ptr<Session> session : sessions_) {
363 // Ignore sessions using the demo device or no device at all
364 if (session->device()) {
365 shared_ptr<devices::HardwareDevice> device =
366 dynamic_pointer_cast< devices::HardwareDevice >
370 device->hardware_device()->driver()->name() == "demo")
373 settings.beginGroup("Session" + QString::number(id++));
374 settings.remove(""); // Remove all keys in this group
375 session->save_settings(settings);
380 settings.setValue("sessions", id);
383 void MainWindow::restore_sessions()
386 int i, session_count;
388 session_count = settings.value("sessions", 0).toInt();
390 for (i = 0; i < session_count; i++) {
391 settings.beginGroup("Session" + QString::number(i));
392 shared_ptr<Session> session = add_session();
393 session->restore_settings(settings);
398 void MainWindow::on_setting_changed(const QString &key, const QVariant &value)
400 if (key == GlobalSettings::Key_View_ColouredBG)
401 on_settingViewColouredBg_changed(value);
403 if (key == GlobalSettings::Key_View_ShowSamplingPoints)
404 on_settingViewShowSamplingPoints_changed(value);
406 if (key == GlobalSettings::Key_View_ShowAnalogMinorGrid)
407 on_settingViewShowAnalogMinorGrid_changed(value);
410 void MainWindow::setup_ui()
412 setObjectName(QString::fromUtf8("MainWindow"));
414 setCentralWidget(&session_selector_);
416 // Set the window icon
418 icon.addFile(QString(":/icons/pulseview.png"));
421 view_sticky_scrolling_shortcut_ = new QShortcut(QKeySequence(Qt::Key_S), this, SLOT(on_view_sticky_scrolling_shortcut()));
422 view_sticky_scrolling_shortcut_->setAutoRepeat(false);
424 view_show_sampling_points_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Period), this, SLOT(on_view_show_sampling_points_shortcut()));
425 view_show_sampling_points_shortcut_->setAutoRepeat(false);
427 view_show_analog_minor_grid_shortcut_ = new QShortcut(QKeySequence(Qt::Key_G), this, SLOT(on_view_show_analog_minor_grid_shortcut()));
428 view_show_analog_minor_grid_shortcut_->setAutoRepeat(false);
430 view_coloured_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_coloured_bg_shortcut()));
431 view_coloured_bg_shortcut_->setAutoRepeat(false);
433 // Set up the tab area
434 new_session_button_ = new QToolButton();
435 new_session_button_->setIcon(QIcon::fromTheme("document-new",
436 QIcon(":/icons/document-new.png")));
437 new_session_button_->setToolTip(tr("Create New Session"));
438 new_session_button_->setAutoRaise(true);
440 run_stop_button_ = new QToolButton();
441 run_stop_button_->setAutoRaise(true);
442 run_stop_button_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
443 run_stop_button_->setToolTip(tr("Start/Stop Acquisition"));
445 run_stop_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Space), run_stop_button_, SLOT(click()));
446 run_stop_shortcut_->setAutoRepeat(false);
448 settings_button_ = new QToolButton();
449 settings_button_->setIcon(QIcon::fromTheme("preferences-system",
450 QIcon(":/icons/preferences-system.png")));
451 settings_button_->setToolTip(tr("Settings"));
452 settings_button_->setAutoRaise(true);
454 QFrame *separator1 = new QFrame();
455 separator1->setFrameStyle(QFrame::VLine | QFrame::Raised);
456 QFrame *separator2 = new QFrame();
457 separator2->setFrameStyle(QFrame::VLine | QFrame::Raised);
459 QHBoxLayout* layout = new QHBoxLayout();
460 layout->setContentsMargins(2, 2, 2, 2);
461 layout->addWidget(new_session_button_);
462 layout->addWidget(separator1);
463 layout->addWidget(run_stop_button_);
464 layout->addWidget(separator2);
465 layout->addWidget(settings_button_);
467 static_tab_widget_ = new QWidget();
468 static_tab_widget_->setLayout(layout);
470 session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner);
471 session_selector_.setTabsClosable(true);
473 close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
474 close_application_shortcut_->setAutoRepeat(false);
476 close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab()));
478 connect(new_session_button_, SIGNAL(clicked(bool)),
479 this, SLOT(on_new_session_clicked()));
480 connect(run_stop_button_, SIGNAL(clicked(bool)),
481 this, SLOT(on_run_stop_clicked()));
482 connect(&session_state_mapper_, SIGNAL(mapped(QObject*)),
483 this, SLOT(on_capture_state_changed(QObject*)));
484 connect(settings_button_, SIGNAL(clicked(bool)),
485 this, SLOT(on_settings_clicked()));
487 connect(&session_selector_, SIGNAL(tabCloseRequested(int)),
488 this, SLOT(on_tab_close_requested(int)));
489 connect(&session_selector_, SIGNAL(currentChanged(int)),
490 this, SLOT(on_tab_changed(int)));
493 connect(static_cast<QApplication *>(QCoreApplication::instance()),
494 SIGNAL(focusChanged(QWidget*, QWidget*)),
495 this, SLOT(on_focus_changed()));
498 void MainWindow::save_ui_settings()
502 settings.beginGroup("MainWindow");
503 settings.setValue("state", saveState());
504 settings.setValue("geometry", saveGeometry());
508 void MainWindow::restore_ui_settings()
512 settings.beginGroup("MainWindow");
514 if (settings.contains("geometry")) {
515 restoreGeometry(settings.value("geometry").toByteArray());
516 restoreState(settings.value("state").toByteArray());
523 shared_ptr<Session> MainWindow::get_tab_session(int index) const
525 // Find the session that belongs to the tab's main window
526 for (auto entry : session_windows_)
527 if (entry.second == session_selector_.widget(index))
533 void MainWindow::closeEvent(QCloseEvent *event)
535 bool data_saved = true;
537 for (auto entry : session_windows_)
538 if (!entry.first->data_saved())
541 if (!data_saved && (QMessageBox::question(this, tr("Confirmation"),
542 tr("There is unsaved data. Close anyway?"),
543 QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)) {
552 QMenu* MainWindow::createPopupMenu()
557 bool MainWindow::restoreState(const QByteArray &state, int version)
562 // Do nothing. We don't want Qt to handle this, or else it
563 // will try to restore all the dock widgets and create havoc.
568 void MainWindow::session_error(const QString text, const QString info_text)
570 QMetaObject::invokeMethod(this, "show_session_error",
571 Qt::QueuedConnection, Q_ARG(QString, text),
572 Q_ARG(QString, info_text));
575 void MainWindow::show_session_error(const QString text, const QString info_text)
577 QMessageBox msg(this);
579 msg.setInformativeText(info_text);
580 msg.setStandardButtons(QMessageBox::Ok);
581 msg.setIcon(QMessageBox::Warning);
585 void MainWindow::on_add_view(const QString &title, views::ViewType type,
588 // We get a pointer and need a reference
589 for (shared_ptr<Session> s : sessions_)
590 if (s.get() == session)
591 add_view(title, type, *s);
594 void MainWindow::on_focus_changed()
596 shared_ptr<views::ViewBase> view = get_active_view();
599 for (shared_ptr<Session> session : sessions_) {
600 if (session->has_view(view)) {
601 if (session != last_focused_session_) {
602 // Activate correct tab if necessary
603 shared_ptr<Session> tab_session = get_tab_session(
604 session_selector_.currentIndex());
605 if (tab_session != session)
606 session_selector_.setCurrentWidget(
607 session_windows_.at(session));
609 on_focused_session_changed(session);
617 if (sessions_.empty())
618 setWindowTitle(WindowTitle);
621 void MainWindow::on_focused_session_changed(shared_ptr<Session> session)
623 last_focused_session_ = session;
625 setWindowTitle(session->name() + " - " + WindowTitle);
627 // Update the state of the run/stop button, too
628 on_capture_state_changed(session.get());
631 void MainWindow::on_new_session_clicked()
636 void MainWindow::on_run_stop_clicked()
638 shared_ptr<Session> session = last_focused_session_;
643 switch (session->get_capture_state()) {
644 case Session::Stopped:
645 session->start_capture([&](QString message) {
646 session_error("Capture failed", message); });
648 case Session::AwaitingTrigger:
649 case Session::Running:
650 session->stop_capture();
655 void MainWindow::on_settings_clicked()
657 dialogs::Settings dlg(device_manager_);
661 void MainWindow::on_session_name_changed()
663 // Update the corresponding dock widget's name(s)
664 Session *session = qobject_cast<Session*>(QObject::sender());
667 for (shared_ptr<views::ViewBase> view : session->views()) {
668 // Get the dock that contains the view
669 for (auto entry : view_docks_)
670 if (entry.second == view) {
671 entry.first->setObjectName(session->name());
672 entry.first->setWindowTitle(session->name());
676 // Update the tab widget by finding the main window and the tab from that
677 for (auto entry : session_windows_)
678 if (entry.first.get() == session) {
679 QMainWindow *window = entry.second;
680 const int index = session_selector_.indexOf(window);
681 session_selector_.setTabText(index, session->name());
684 // Refresh window title if the affected session has focus
685 if (session == last_focused_session_.get())
686 setWindowTitle(session->name() + " - " + WindowTitle);
689 void MainWindow::on_capture_state_changed(QObject *obj)
691 Session *caller = qobject_cast<Session*>(obj);
693 // Ignore if caller is not the currently focused session
694 // unless there is only one session
695 if ((sessions_.size() > 1) && (caller != last_focused_session_.get()))
698 int state = caller->get_capture_state();
700 const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_};
701 run_stop_button_->setIcon(*icons[state]);
702 run_stop_button_->setText((state == pv::Session::Stopped) ?
703 tr("Run") : tr("Stop"));
706 void MainWindow::on_new_view(Session *session)
708 // We get a pointer and need a reference
709 for (shared_ptr<Session> s : sessions_)
710 if (s.get() == session)
711 add_view(session->name(), views::ViewTypeTrace, *s);
714 void MainWindow::on_view_close_clicked()
716 // Find the dock widget that contains the close button that was clicked
717 QObject *w = QObject::sender();
718 QDockWidget *dock = nullptr;
721 dock = qobject_cast<QDockWidget*>(w);
727 // Get the view contained in the dock widget
728 shared_ptr<views::ViewBase> view;
730 for (auto entry : view_docks_)
731 if (entry.first == dock)
734 // Deregister the view
735 for (shared_ptr<Session> session : sessions_) {
736 if (!session->has_view(view))
739 // Also destroy the entire session if its main view is closing...
740 if (view == session->main_view()) {
741 // ...but only if data is saved or the user confirms closing
742 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
743 tr("This session contains unsaved data. Close it anyway?"),
744 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
745 remove_session(session);
748 // All other views can be closed at any time as no data will be lost
753 void MainWindow::on_tab_changed(int index)
755 shared_ptr<Session> session = get_tab_session(index);
758 on_focused_session_changed(session);
761 void MainWindow::on_tab_close_requested(int index)
763 shared_ptr<Session> session = get_tab_session(index);
768 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
769 tr("This session contains unsaved data. Close it anyway?"),
770 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
771 remove_session(session);
774 void MainWindow::on_view_coloured_bg_shortcut()
776 GlobalSettings settings;
778 bool state = settings.value(GlobalSettings::Key_View_ColouredBG).toBool();
779 settings.setValue(GlobalSettings::Key_View_ColouredBG, !state);
782 void MainWindow::on_view_sticky_scrolling_shortcut()
784 GlobalSettings settings;
786 bool state = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool();
787 settings.setValue(GlobalSettings::Key_View_StickyScrolling, !state);
790 void MainWindow::on_view_show_sampling_points_shortcut()
792 GlobalSettings settings;
794 bool state = settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool();
795 settings.setValue(GlobalSettings::Key_View_ShowSamplingPoints, !state);
798 void MainWindow::on_view_show_analog_minor_grid_shortcut()
800 GlobalSettings settings;
802 bool state = settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool();
803 settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, !state);
806 void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value)
808 bool state = new_value.toBool();
810 for (auto entry : view_docks_) {
811 shared_ptr<views::ViewBase> viewbase = entry.second;
813 // Only trace views have this setting
814 views::trace::View* view =
815 qobject_cast<views::trace::View*>(viewbase.get());
817 view->enable_coloured_bg(state);
821 void MainWindow::on_settingViewShowSamplingPoints_changed(const QVariant new_value)
823 bool state = new_value.toBool();
825 for (auto entry : view_docks_) {
826 shared_ptr<views::ViewBase> viewbase = entry.second;
828 // Only trace views have this setting
829 views::trace::View* view =
830 qobject_cast<views::trace::View*>(viewbase.get());
832 view->enable_show_sampling_points(state);
836 void MainWindow::on_settingViewShowAnalogMinorGrid_changed(const QVariant new_value)
838 bool state = new_value.toBool();
840 for (auto entry : view_docks_) {
841 shared_ptr<views::ViewBase> viewbase = entry.second;
843 // Only trace views have this setting
844 views::trace::View* view =
845 qobject_cast<views::trace::View*>(viewbase.get());
847 view->enable_show_analog_minor_grid(state);
851 void MainWindow::on_close_current_tab()
853 int tab = session_selector_.currentIndex();
855 on_tab_close_requested(tab);