]> sigrok.org Git - pulseview.git/commitdiff
TraceView: Use sticky scrolling setting directly
authorSoeren Apel <redacted>
Mon, 13 Mar 2017 18:15:32 +0000 (19:15 +0100)
committerSoeren Apel <redacted>
Mon, 13 Mar 2017 18:23:22 +0000 (19:23 +0100)
pv/mainwindow.cpp
pv/mainwindow.hpp
pv/view/view.cpp
pv/view/view.hpp

index 9164c6e82ac0e330623ff8105db4a6c92a311d24..4e6ab75d9502b190e85e3823d839261fa36134f5 100644 (file)
@@ -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<views::ViewBase> MainWindow::add_view(const QString &title,
                views::TraceView::View *tv =
                        qobject_cast<views::TraceView::View*>(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<views::ViewBase> viewbase = entry.second;
-
-               // Only trace views have this setting
-               views::TraceView::View* view =
-                               qobject_cast<views::TraceView::View*>(viewbase.get());
-               if (view)
-                       view->enable_sticky_scrolling(state);
-       }
-}
-
 void MainWindow::on_close_current_tab()
 {
        int tab = session_selector_.currentIndex();
index 50708c2035a9f1069545292e03a50d3f6017e34d..a99e0adf9c7b4604c8b04c22869c45805531890a 100644 (file)
@@ -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();
 
index d47b4fd15315d61fe33d46ab9d11087954702114..8595594803b58f21b3c33f439e51b69358d149ae 100644 (file)
@@ -562,11 +562,6 @@ pair<Timestamp, Timestamp> 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<shared_ptr<TraceTreeItem>> 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) {
index 930f6cd2b560c26b32fd96ede652b5e32a39ca0e..1d63417cb89ab520dd7c43e07cfaf72f3b6240fd 100644 (file)
@@ -199,12 +199,6 @@ public:
 
        std::pair<pv::util::Timestamp, pv::util::Timestamp> 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.