X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=879c8a522d9121f8c27a907a9d1fc2bf78717dc4;hp=8b650e1ca00067b0d406b6387a3eab657a2dfae4;hb=24c29d4f917ffac5a280d572cc04d1edb66a81b9;hpb=bf9f12687c8d43422455cbdc27ec1cc5d4305149 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 8b650e1..879c8a5 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -87,6 +87,9 @@ MainWindow::MainWindow(DeviceManager &device_manager, qRegisterMetaType("util::Timestamp"); qRegisterMetaType("uint64_t"); + GlobalSettings::register_change_handler(GlobalSettings::Key_View_ColouredBG, + bind(&MainWindow::on_settingViewColouredBg_changed, this, _1)); + setup_ui(); restore_ui_settings(); @@ -155,6 +158,8 @@ shared_ptr MainWindow::get_active_view() const shared_ptr MainWindow::add_view(const QString &title, views::ViewType type, Session &session) { + GlobalSettings settings; + QMainWindow *main_window = nullptr; for (auto entry : session_windows_) if (entry.first.get() == &session) @@ -195,7 +200,7 @@ shared_ptr MainWindow::add_view(const QString &title, SLOT(trigger_event(util::Timestamp))); v->enable_sticky_scrolling(true); - v->enable_coloured_bg(true); + v->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool()); shared_ptr main_bar = session.main_bar(); if (!main_bar) { @@ -727,11 +732,25 @@ void MainWindow::on_view_sticky_scrolling_shortcut() void MainWindow::on_view_coloured_bg_shortcut() { - shared_ptr viewbase = get_active_view(); - views::TraceView::View* view = - qobject_cast(viewbase.get()); - if (view) - view->toggle_coloured_bg(); + GlobalSettings settings; + + bool state = settings.value(GlobalSettings::Key_View_ColouredBG).toBool(); + settings.setValue(GlobalSettings::Key_View_ColouredBG, !state); +} + +void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value) +{ + bool state = new_value.toBool(); + + for (auto entry : view_docks_) { + shared_ptr viewbase = entry.second; + + // Only trace views have this setting + views::TraceView::View* view = + qobject_cast(viewbase.get()); + if (view) + view->enable_coloured_bg(state); + } } void MainWindow::on_actionAbout_triggered()