X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=9164c6e82ac0e330623ff8105db4a6c92a311d24;hp=d8247825d47c9c01ae818760b63b75679644112d;hb=87a97d8aa169936ec2dcd229df88b8c5b4a1411c;hpb=33a94f9bf233bbb3cfe9b407df303bbcd95d37df diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index d824782..9164c6e 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -86,6 +86,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, GlobalSettings::register_change_handler(GlobalSettings::Key_View_ColouredBG, bind(&MainWindow::on_settingViewColouredBg_changed, this, _1)); + GlobalSettings::register_change_handler(GlobalSettings::Key_View_StickyScrolling, + bind(&MainWindow::on_settingViewStickyScrolling_changed, this, _1)); setup_ui(); restore_ui_settings(); @@ -717,15 +719,6 @@ void MainWindow::on_tab_close_requested(int index) remove_session(session); } -void MainWindow::on_view_sticky_scrolling_shortcut() -{ - shared_ptr viewbase = get_active_view(); - views::TraceView::View* view = - qobject_cast(viewbase.get()); - if (view) - view->toggle_sticky_scrolling(); -} - void MainWindow::on_view_coloured_bg_shortcut() { GlobalSettings settings; @@ -734,6 +727,14 @@ void MainWindow::on_view_coloured_bg_shortcut() settings.setValue(GlobalSettings::Key_View_ColouredBG, !state); } +void MainWindow::on_view_sticky_scrolling_shortcut() +{ + GlobalSettings settings; + + bool state = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool(); + settings.setValue(GlobalSettings::Key_View_StickyScrolling, !state); +} + void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value) { bool state = new_value.toBool(); @@ -749,6 +750,21 @@ void MainWindow::on_settingViewColouredBg_changed(const QVariant new_value) } } +void MainWindow::on_settingViewStickyScrolling_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_sticky_scrolling(state); + } +} + void MainWindow::on_close_current_tab() { int tab = session_selector_.currentIndex();