X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=9ca973a7ea9ca3b4227cde8973f2add6f284348a;hb=143d322d0c92ea5c2cc51facc37b68787362c244;hp=5959ff7b3f94f1288e2c02187a47b802da091704;hpb=6644424f1ea61ee7e1f048bfac09acd4a094feab;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 5959ff7..9ca973a 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -57,6 +57,7 @@ #include "viewport.hpp" #include "pv/session.hpp" +#include "pv/globalsettings.hpp" #include "pv/devices/device.hpp" #include "pv/data/logic.hpp" #include "pv/data/logicsegment.hpp" @@ -135,8 +136,8 @@ bool CustomAbstractScrollArea::viewportEvent(QEvent *event) } } -View::View(Session &session, QWidget *parent) : - ViewBase(session, parent), +View::View(Session &session, bool is_main_view, QWidget *parent) : + ViewBase(session, is_main_view, parent), viewport_(new Viewport(*this)), ruler_(new Ruler(*this)), header_(new Header(*this)), @@ -159,6 +160,9 @@ View::View(Session &session, QWidget *parent) : saved_v_offset_(0), size_finalized_(false) { + GlobalSettings settings; + coloured_bg_ = settings.value(GlobalSettings::Key_View_ColouredBG).toBool(); + connect(scrollarea_.horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(h_scroll_value_changed(int))); connect(scrollarea_.verticalScrollBar(), SIGNAL(valueChanged(int)), @@ -563,6 +567,11 @@ void View::enable_sticky_scrolling(bool state) sticky_scrolling_ = state; } +void View::toggle_sticky_scrolling(void) +{ + sticky_scrolling_ = !sticky_scrolling_; +} + void View::enable_coloured_bg(bool state) { const vector> items( @@ -1223,6 +1232,14 @@ void View::capture_state_updated(int state) set_time_unit(util::TimeUnit::Samples); trigger_markers_.clear(); + + // Activate "always zoom to fit" if the setting is enabled + GlobalSettings settings; + bool state = settings.value(GlobalSettings::Key_View_AlwaysZoomToFit).toBool(); + if (state) { + always_zoom_to_fit_ = true; + always_zoom_to_fit_changed(always_zoom_to_fit_); + } } if (state == Session::Stopped) { @@ -1233,7 +1250,7 @@ void View::capture_state_updated(int state) // Reset "always zoom to fit", the acquisition has stopped if (always_zoom_to_fit_) { always_zoom_to_fit_ = false; - always_zoom_to_fit_changed(false); + always_zoom_to_fit_changed(always_zoom_to_fit_); } } }