From: Soeren Apel Date: Mon, 13 Mar 2017 18:15:32 +0000 (+0100) Subject: TraceView: Use sticky scrolling setting directly X-Git-Tag: pulseview-0.4.0~150 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9b64f2dfe9179f665ef97c0d0ac992274864f4a4;p=pulseview.git TraceView: Use sticky scrolling setting directly --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 9164c6e8..4e6ab75d 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -86,8 +86,6 @@ 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(); @@ -204,7 +202,6 @@ shared_ptr MainWindow::add_view(const QString &title, views::TraceView::View *tv = qobject_cast(v.get()); - tv->enable_sticky_scrolling(true); tv->enable_coloured_bg(settings.value(GlobalSettings::Key_View_ColouredBG).toBool()); if (!main_bar) { @@ -750,21 +747,6 @@ 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(); diff --git a/pv/mainwindow.hpp b/pv/mainwindow.hpp index 50708c20..a99e0adf 100644 --- a/pv/mainwindow.hpp +++ b/pv/mainwindow.hpp @@ -125,7 +125,6 @@ private Q_SLOTS: void on_view_sticky_scrolling_shortcut(); void on_settingViewColouredBg_changed(const QVariant new_value); - void on_settingViewStickyScrolling_changed(const QVariant new_value); void on_close_current_tab(); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index d47b4fd1..85955948 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -562,11 +562,6 @@ pair View::get_time_extents() const return make_pair(*left_time, *right_time); } -void View::enable_sticky_scrolling(bool state) -{ - sticky_scrolling_ = state; -} - void View::enable_coloured_bg(bool state) { const vector> items( @@ -1236,6 +1231,9 @@ void View::capture_state_updated(int state) always_zoom_to_fit_ = true; always_zoom_to_fit_changed(always_zoom_to_fit_); } + + // Enable sticky scrolling if the setting is enabled + sticky_scrolling_ = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool(); } if (state == Session::Stopped) { diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 930f6cd2..1d63417c 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -199,12 +199,6 @@ public: std::pair get_time_extents() const; - /** - * Enables or disables sticky scrolling, i.e. the view always shows - * the most recent samples when capturing data. - */ - void enable_sticky_scrolling(bool state); - /** * Enables or disables coloured trace backgrounds. If they're not * coloured then they will use alternating colors.