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;
57 using std::placeholders::_1;
58 using std::shared_ptr;
67 using toolbars::MainBar;
69 const QString MainWindow::WindowTitle = tr("PulseView");
71 MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) :
73 device_manager_(device_manager),
74 session_selector_(this),
75 session_state_mapper_(this),
76 icon_red_(":/icons/status-red.svg"),
77 icon_green_(":/icons/status-green.svg"),
78 icon_grey_(":/icons/status-grey.svg")
80 qRegisterMetaType<util::Timestamp>("util::Timestamp");
81 qRegisterMetaType<uint64_t>("uint64_t");
83 GlobalSettings::register_change_handler(GlobalSettings::Key_View_ColouredBG,
84 bind(&MainWindow::on_settingViewColouredBg_changed, this, _1));
86 GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowSamplingPoints,
87 bind(&MainWindow::on_settingViewShowSamplingPoints_changed, this, _1));
89 GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowAnalogMinorGrid,
90 bind(&MainWindow::on_settingViewShowAnalogMinorGrid_changed, this, _1));
92 GlobalSettings settings;
93 settings.set_defaults_where_needed();
96 restore_ui_settings();
99 MainWindow::~MainWindow()
101 while (!sessions_.empty())
102 remove_session(sessions_.front());
105 shared_ptr<views::ViewBase> MainWindow::get_active_view() const
107 // If there's only one view, use it...
108 if (view_docks_.size() == 1)
109 return view_docks_.begin()->second;
111 // ...otherwise find the dock widget the widget with focus is contained in
112 QObject *w = QApplication::focusWidget();
113 QDockWidget *dock = nullptr;
116 dock = qobject_cast<QDockWidget*>(w);
122 // Get the view contained in the dock widget
123 for (auto entry : view_docks_)
124 if (entry.first == dock)
130 shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
131 views::ViewType type, Session &session)
133 GlobalSettings settings;
134 shared_ptr<views::ViewBase> v;
136 QMainWindow *main_window = nullptr;
137 for (auto entry : session_windows_)
138 if (entry.first.get() == &session)
139 main_window = entry.second;
143 shared_ptr<MainBar> main_bar = session.main_bar();
145 QDockWidget* dock = new QDockWidget(title, main_window);
146 dock->setObjectName(title);
147 main_window->addDockWidget(Qt::TopDockWidgetArea, dock);
149 // Insert a QMainWindow into the dock widget to allow for a tool bar
150 QMainWindow *dock_main = new QMainWindow(dock);
151 dock_main->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
153 if (type == views::ViewTypeTrace)
154 // This view will be the main view if there's no main bar yet
155 v = make_shared<views::trace::View>(session,
156 (main_bar ? false : true), dock_main);
161 view_docks_[dock] = v;
162 session.register_view(v);
164 dock_main->setCentralWidget(v.get());
165 dock->setWidget(dock_main);
167 dock->setContextMenuPolicy(Qt::PreventContextMenu);
168 dock->setFeatures(QDockWidget::DockWidgetMovable |
169 QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
171 QAbstractButton *close_btn =
172 dock->findChildren<QAbstractButton*>
173 ("qt_dockwidget_closebutton").front();
175 connect(close_btn, SIGNAL(clicked(bool)),
176 this, SLOT(on_view_close_clicked()));
178 connect(&session, SIGNAL(trigger_event(util::Timestamp)),
179 qobject_cast<views::ViewBase*>(v.get()),
180 SLOT(trigger_event(util::Timestamp)));
182 if (type == views::ViewTypeTrace) {
183 views::trace::View *tv =
184 qobject_cast<views::trace::View*>(v.get());
186 tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool());
187 tv->enable_show_sampling_points(settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool());
188 tv->enable_show_analog_minor_grid(settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool());
191 /* Initial view, create the main bar */
192 main_bar = make_shared<MainBar>(session, this, tv);
193 dock_main->addToolBar(main_bar.get());
194 session.set_main_bar(main_bar);
196 connect(main_bar.get(), SIGNAL(new_view(Session*)),
197 this, SLOT(on_new_view(Session*)));
199 main_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
201 /* For the main view we need to prevent the dock widget from
202 * closing itself when its close button is clicked. This is
203 * so we can confirm with the user first. Regular views don't
205 close_btn->disconnect(SIGNAL(clicked()), dock, SLOT(close()));
207 /* Additional view, create a standard bar */
208 pv::views::trace::StandardBar *standard_bar =
209 new pv::views::trace::StandardBar(session, this, tv);
210 dock_main->addToolBar(standard_bar);
212 standard_bar->action_view_show_cursors()->setChecked(tv->cursors_shown());
219 void MainWindow::remove_view(shared_ptr<views::ViewBase> view)
221 for (shared_ptr<Session> session : sessions_) {
222 if (!session->has_view(view))
225 // Find the dock the view is contained in and remove it
226 for (auto entry : view_docks_)
227 if (entry.second == view) {
228 // Remove the view from the session
229 session->deregister_view(view);
231 // Remove the view from its parent; otherwise, Qt will
232 // call deleteLater() on it, which causes a double free
233 // since the shared_ptr in view_docks_ doesn't know
234 // that Qt keeps a pointer to the view around
235 view->setParent(nullptr);
237 // Delete the view's dock widget and all widgets inside it
238 entry.first->deleteLater();
240 // Remove the dock widget from the list and stop iterating
241 view_docks_.erase(entry.first);
247 shared_ptr<Session> MainWindow::add_session()
249 static int last_session_id = 1;
250 QString name = tr("Session %1").arg(last_session_id++);
252 shared_ptr<Session> session = make_shared<Session>(device_manager_, name);
254 connect(session.get(), SIGNAL(add_view(const QString&, views::ViewType, Session*)),
255 this, SLOT(on_add_view(const QString&, views::ViewType, Session*)));
256 connect(session.get(), SIGNAL(name_changed()),
257 this, SLOT(on_session_name_changed()));
258 session_state_mapper_.setMapping(session.get(), session.get());
259 connect(session.get(), SIGNAL(capture_state_changed(int)),
260 &session_state_mapper_, SLOT(map()));
262 sessions_.push_back(session);
264 QMainWindow *window = new QMainWindow();
265 window->setWindowFlags(Qt::Widget); // Remove Qt::Window flag
266 session_windows_[session] = window;
268 int index = session_selector_.addTab(window, name);
269 session_selector_.setCurrentIndex(index);
270 last_focused_session_ = session;
272 window->setDockNestingEnabled(true);
274 shared_ptr<views::ViewBase> main_view =
275 add_view(name, views::ViewTypeTrace, *session);
280 void MainWindow::remove_session(shared_ptr<Session> session)
282 // Determine the height of the button before it collapses
283 int h = new_session_button_->height();
285 // Stop capture while the session still exists so that the UI can be
286 // updated in case we're currently running. If so, this will schedule a
287 // call to our on_capture_state_changed() slot for the next run of the
288 // event loop. We need to have this executed immediately or else it will
289 // be dismissed since the session object will be deleted by the time we
290 // leave this method and the event loop gets a chance to run again.
291 session->stop_capture();
292 QApplication::processEvents();
294 for (shared_ptr<views::ViewBase> view : session->views())
297 QMainWindow *window = session_windows_.at(session);
298 session_selector_.removeTab(session_selector_.indexOf(window));
300 session_windows_.erase(session);
302 if (last_focused_session_ == session)
303 last_focused_session_.reset();
305 // Remove the session from our list of sessions (which also destroys it)
306 sessions_.remove_if([&](shared_ptr<Session> s) {
307 return s == session; });
309 if (sessions_.empty()) {
310 // When there are no more tabs, the height of the QTabWidget
311 // drops to zero. We must prevent this to keep the static
313 for (QWidget *w : static_tab_widget_->findChildren<QWidget*>())
314 w->setMinimumHeight(h);
316 int margin = static_tab_widget_->layout()->contentsMargins().bottom();
317 static_tab_widget_->setMinimumHeight(h + 2 * margin);
318 session_selector_.setMinimumHeight(h + 2 * margin);
320 // Update the window title if there is no view left to
321 // generate focus change events
322 setWindowTitle(WindowTitle);
326 void MainWindow::add_session_with_file(string open_file_name,
327 string open_file_format)
329 shared_ptr<Session> session = add_session();
330 session->load_init_file(open_file_name, open_file_format);
333 void MainWindow::add_default_session()
335 // Only add the default session if there would be no session otherwise
336 if (sessions_.size() > 0)
339 shared_ptr<Session> session = add_session();
341 // Check the list of available devices. Prefer the one that was
342 // found with user supplied scan specs (if applicable). Then try
343 // one of the auto detected devices that are not the demo device.
344 // Pick demo in the absence of "genuine" hardware devices.
345 shared_ptr<devices::HardwareDevice> user_device, other_device, demo_device;
346 for (shared_ptr<devices::HardwareDevice> dev : device_manager_.devices()) {
347 if (dev == device_manager_.user_spec_device()) {
349 } else if (dev->hardware_device()->driver()->name() == "demo") {
356 session->select_device(user_device);
357 else if (other_device)
358 session->select_device(other_device);
360 session->select_device(demo_device);
363 void MainWindow::save_sessions()
368 for (shared_ptr<Session> session : sessions_) {
369 // Ignore sessions using the demo device or no device at all
370 if (session->device()) {
371 shared_ptr<devices::HardwareDevice> device =
372 dynamic_pointer_cast< devices::HardwareDevice >
376 device->hardware_device()->driver()->name() == "demo")
379 settings.beginGroup("Session" + QString::number(id++));
380 settings.remove(""); // Remove all keys in this group
381 session->save_settings(settings);
386 settings.setValue("sessions", id);
389 void MainWindow::restore_sessions()
392 int i, session_count;
394 session_count = settings.value("sessions", 0).toInt();
396 for (i = 0; i < session_count; i++) {
397 settings.beginGroup("Session" + QString::number(i));
398 shared_ptr<Session> session = add_session();
399 session->restore_settings(settings);
404 void MainWindow::setup_ui()
406 setObjectName(QString::fromUtf8("MainWindow"));
408 setCentralWidget(&session_selector_);
410 // Set the window icon
412 icon.addFile(QString(":/icons/pulseview.png"));
415 view_sticky_scrolling_shortcut_ = new QShortcut(QKeySequence(Qt::Key_S), this, SLOT(on_view_sticky_scrolling_shortcut()));
416 view_sticky_scrolling_shortcut_->setAutoRepeat(false);
418 view_show_sampling_points_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Period), this, SLOT(on_view_show_sampling_points_shortcut()));
419 view_show_sampling_points_shortcut_->setAutoRepeat(false);
421 view_show_analog_minor_grid_shortcut_ = new QShortcut(QKeySequence(Qt::Key_G), this, SLOT(on_view_show_analog_minor_grid_shortcut()));
422 view_show_analog_minor_grid_shortcut_->setAutoRepeat(false);
424 view_coloured_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_coloured_bg_shortcut()));
425 view_coloured_bg_shortcut_->setAutoRepeat(false);
427 // Set up the tab area
428 new_session_button_ = new QToolButton();
429 new_session_button_->setIcon(QIcon::fromTheme("document-new",
430 QIcon(":/icons/document-new.png")));
431 new_session_button_->setToolTip(tr("Create New Session"));
432 new_session_button_->setAutoRaise(true);
434 run_stop_button_ = new QToolButton();
435 run_stop_button_->setAutoRaise(true);
436 run_stop_button_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
437 run_stop_button_->setToolTip(tr("Start/Stop Acquisition"));
439 run_stop_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Space), run_stop_button_, SLOT(click()));
440 run_stop_shortcut_->setAutoRepeat(false);
442 settings_button_ = new QToolButton();
443 settings_button_->setIcon(QIcon::fromTheme("preferences-system",
444 QIcon(":/icons/preferences-system.png")));
445 settings_button_->setToolTip(tr("Settings"));
446 settings_button_->setAutoRaise(true);
448 QFrame *separator1 = new QFrame();
449 separator1->setFrameStyle(QFrame::VLine | QFrame::Raised);
450 QFrame *separator2 = new QFrame();
451 separator2->setFrameStyle(QFrame::VLine | QFrame::Raised);
453 QHBoxLayout* layout = new QHBoxLayout();
454 layout->setContentsMargins(2, 2, 2, 2);
455 layout->addWidget(new_session_button_);
456 layout->addWidget(separator1);
457 layout->addWidget(run_stop_button_);
458 layout->addWidget(separator2);
459 layout->addWidget(settings_button_);
461 static_tab_widget_ = new QWidget();
462 static_tab_widget_->setLayout(layout);
464 session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner);
465 session_selector_.setTabsClosable(true);
467 close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
468 close_application_shortcut_->setAutoRepeat(false);
470 close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab()));
472 connect(new_session_button_, SIGNAL(clicked(bool)),
473 this, SLOT(on_new_session_clicked()));
474 connect(run_stop_button_, SIGNAL(clicked(bool)),
475 this, SLOT(on_run_stop_clicked()));
476 connect(&session_state_mapper_, SIGNAL(mapped(QObject*)),
477 this, SLOT(on_capture_state_changed(QObject*)));
478 connect(settings_button_, SIGNAL(clicked(bool)),
479 this, SLOT(on_settings_clicked()));
481 connect(&session_selector_, SIGNAL(tabCloseRequested(int)),
482 this, SLOT(on_tab_close_requested(int)));
483 connect(&session_selector_, SIGNAL(currentChanged(int)),
484 this, SLOT(on_tab_changed(int)));
487 connect(static_cast<QApplication *>(QCoreApplication::instance()),
488 SIGNAL(focusChanged(QWidget*, QWidget*)),
489 this, SLOT(on_focus_changed()));
492 void MainWindow::save_ui_settings()
496 settings.beginGroup("MainWindow");
497 settings.setValue("state", saveState());
498 settings.setValue("geometry", saveGeometry());
502 void MainWindow::restore_ui_settings()
506 settings.beginGroup("MainWindow");
508 if (settings.contains("geometry")) {
509 restoreGeometry(settings.value("geometry").toByteArray());
510 restoreState(settings.value("state").toByteArray());
517 shared_ptr<Session> MainWindow::get_tab_session(int index) const
519 // Find the session that belongs to the tab's main window
520 for (auto entry : session_windows_)
521 if (entry.second == session_selector_.widget(index))
527 void MainWindow::closeEvent(QCloseEvent *event)
529 bool data_saved = true;
531 for (auto entry : session_windows_)
532 if (!entry.first->data_saved())
535 if (!data_saved && (QMessageBox::question(this, tr("Confirmation"),
536 tr("There is unsaved data. Close anyway?"),
537 QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)) {
546 QMenu* MainWindow::createPopupMenu()
551 bool MainWindow::restoreState(const QByteArray &state, int version)
556 // Do nothing. We don't want Qt to handle this, or else it
557 // will try to restore all the dock widgets and create havoc.
562 void MainWindow::session_error(const QString text, const QString info_text)
564 QMetaObject::invokeMethod(this, "show_session_error",
565 Qt::QueuedConnection, Q_ARG(QString, text),
566 Q_ARG(QString, info_text));
569 void MainWindow::show_session_error(const QString text, const QString info_text)
571 QMessageBox msg(this);
573 msg.setInformativeText(info_text);
574 msg.setStandardButtons(QMessageBox::Ok);
575 msg.setIcon(QMessageBox::Warning);
579 void MainWindow::on_add_view(const QString &title, views::ViewType type,
582 // We get a pointer and need a reference
583 for (shared_ptr<Session> s : sessions_)
584 if (s.get() == session)
585 add_view(title, type, *s);
588 void MainWindow::on_focus_changed()
590 shared_ptr<views::ViewBase> view = get_active_view();
593 for (shared_ptr<Session> session : sessions_) {
594 if (session->has_view(view)) {
595 if (session != last_focused_session_) {
596 // Activate correct tab if necessary
597 shared_ptr<Session> tab_session = get_tab_session(
598 session_selector_.currentIndex());
599 if (tab_session != session)
600 session_selector_.setCurrentWidget(
601 session_windows_.at(session));
603 on_focused_session_changed(session);
611 if (sessions_.empty())
612 setWindowTitle(WindowTitle);
615 void MainWindow::on_focused_session_changed(shared_ptr<Session> session)
617 last_focused_session_ = session;
619 setWindowTitle(session->name() + " - " + WindowTitle);
621 // Update the state of the run/stop button, too
622 on_capture_state_changed(session.get());
625 void MainWindow::on_new_session_clicked()
630 void MainWindow::on_run_stop_clicked()
632 shared_ptr<Session> session = last_focused_session_;
637 switch (session->get_capture_state()) {
638 case Session::Stopped:
639 session->start_capture([&](QString message) {
640 session_error("Capture failed", message); });
642 case Session::AwaitingTrigger:
643 case Session::Running:
644 session->stop_capture();
649 void MainWindow::on_settings_clicked()
651 dialogs::Settings dlg(device_manager_);
655 void MainWindow::on_session_name_changed()
657 // Update the corresponding dock widget's name(s)
658 Session *session = qobject_cast<Session*>(QObject::sender());
661 for (shared_ptr<views::ViewBase> view : session->views()) {
662 // Get the dock that contains the view
663 for (auto entry : view_docks_)
664 if (entry.second == view) {
665 entry.first->setObjectName(session->name());
666 entry.first->setWindowTitle(session->name());
670 // Update the tab widget by finding the main window and the tab from that
671 for (auto entry : session_windows_)
672 if (entry.first.get() == session) {
673 QMainWindow *window = entry.second;
674 const int index = session_selector_.indexOf(window);
675 session_selector_.setTabText(index, session->name());
678 // Refresh window title if the affected session has focus
679 if (session == last_focused_session_.get())
680 setWindowTitle(session->name() + " - " + WindowTitle);
683 void MainWindow::on_capture_state_changed(QObject *obj)
685 Session *caller = qobject_cast<Session*>(obj);
687 // Ignore if caller is not the currently focused session
688 // unless there is only one session
689 if ((sessions_.size() > 1) && (caller != last_focused_session_.get()))
692 int state = caller->get_capture_state();
694 const QIcon *icons[] = {&icon_grey_, &icon_red_, &icon_green_};
695 run_stop_button_->setIcon(*icons[state]);
696 run_stop_button_->setText((state == pv::Session::Stopped) ?
697 tr("Run") : tr("Stop"));
700 void MainWindow::on_new_view(Session *session)
702 // We get a pointer and need a reference
703 for (shared_ptr<Session> s : sessions_)
704 if (s.get() == session)
705 add_view(session->name(), views::ViewTypeTrace, *s);
708 void MainWindow::on_view_close_clicked()
710 // Find the dock widget that contains the close button that was clicked
711 QObject *w = QObject::sender();
712 QDockWidget *dock = nullptr;
715 dock = qobject_cast<QDockWidget*>(w);
721 // Get the view contained in the dock widget
722 shared_ptr<views::ViewBase> view;
724 for (auto entry : view_docks_)
725 if (entry.first == dock)
728 // Deregister the view
729 for (shared_ptr<Session> session : sessions_) {
730 if (!session->has_view(view))
733 // Also destroy the entire session if its main view is closing...
734 if (view == session->main_view()) {
735 // ...but only if data is saved or the user confirms closing
736 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
737 tr("This session contains unsaved data. Close it anyway?"),
738 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
739 remove_session(session);
742 // All other views can be closed at any time as no data will be lost
747 void MainWindow::on_tab_changed(int index)
749 shared_ptr<Session> session = get_tab_session(index);
752 on_focused_session_changed(session);
755 void MainWindow::on_tab_close_requested(int index)
757 shared_ptr<Session> session = get_tab_session(index);
762 if (session->data_saved() || (QMessageBox::question(this, tr("Confirmation"),
763 tr("This session contains unsaved data. Close it anyway?"),
764 QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes))
765 remove_session(session);
768 void MainWindow::on_view_coloured_bg_shortcut()
770 GlobalSettings settings;
772 bool state = settings.value(GlobalSettings::Key_View_ColouredBG).toBool();
773 settings.setValue(GlobalSettings::Key_View_ColouredBG, !state);
776 void MainWindow::on_view_sticky_scrolling_shortcut()
778 GlobalSettings settings;
780 bool state = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool();
781 settings.setValue(GlobalSettings::Key_View_StickyScrolling, !state);
784 void MainWindow::on_view_show_sampling_points_shortcut()
786 GlobalSettings settings;
788 bool state = settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool();
789 settings.setValue(GlobalSettings::Key_View_ShowSamplingPoints, !state);
792 void MainWindow::on_view_show_analog_minor_grid_shortcut()
794 GlobalSettings settings;
796 bool state = settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool();
797 settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, !state);
800 void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value)
802 bool state = new_value.toBool();
804 for (auto entry : view_docks_) {
805 shared_ptr<views::ViewBase> viewbase = entry.second;
807 // Only trace views have this setting
808 views::trace::View* view =
809 qobject_cast<views::trace::View*>(viewbase.get());
811 view->enable_coloured_bg(state);
815 void MainWindow::on_settingViewShowSamplingPoints_changed(const QVariant new_value)
817 bool state = new_value.toBool();
819 for (auto entry : view_docks_) {
820 shared_ptr<views::ViewBase> viewbase = entry.second;
822 // Only trace views have this setting
823 views::trace::View* view =
824 qobject_cast<views::trace::View*>(viewbase.get());
826 view->enable_show_sampling_points(state);
830 void MainWindow::on_settingViewShowAnalogMinorGrid_changed(const QVariant new_value)
832 bool state = new_value.toBool();
834 for (auto entry : view_docks_) {
835 shared_ptr<views::ViewBase> viewbase = entry.second;
837 // Only trace views have this setting
838 views::trace::View* view =
839 qobject_cast<views::trace::View*>(viewbase.get());
841 view->enable_show_analog_minor_grid(state);
845 void MainWindow::on_close_current_tab()
847 int tab = session_selector_.currentIndex();
849 on_tab_close_requested(tab);