QCheckBox *always_zoom_to_fit_cb = new QCheckBox();
always_zoom_to_fit_cb->setChecked(settings.value(GlobalSettings::Key_View_AlwaysZoomToFit).toBool());
connect(always_zoom_to_fit_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_alwaysZoomToFit_changed(int)));
- trace_view_layout->addRow(tr("&Always zoom-to-fit during capture"), always_zoom_to_fit_cb);
+ trace_view_layout->addRow(tr("Constantly perform &zoom-to-fit during capture"), always_zoom_to_fit_cb);
+
+ QCheckBox *sticky_scrolling_cb = new QCheckBox();
+ sticky_scrolling_cb->setChecked(settings.value(GlobalSettings::Key_View_StickyScrolling).toBool());
+ connect(sticky_scrolling_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_stickyScrolling_changed(int)));
+ trace_view_layout->addRow(tr("Always keep &newest samples at the right edge during capture"), sticky_scrolling_cb);
return form;
}
settings.setValue(GlobalSettings::Key_View_ColouredBG, state ? true : false);
}
+void Settings::on_view_stickyScrolling_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_StickyScrolling, state ? true : false);
+}
+
+
} // namespace dialogs
} // namespace pv
void on_page_changed(QListWidgetItem *current, QListWidgetItem *previous);
void on_view_alwaysZoomToFit_changed(int state);
void on_view_colouredBG_changed(int state);
+ void on_view_stickyScrolling_changed(int state);
private:
DeviceManager &device_manager_;
const QString GlobalSettings::Key_View_AlwaysZoomToFit = "View_AlwaysZoomToFit";
const QString GlobalSettings::Key_View_ColouredBG = "View_ColouredBG";
+const QString GlobalSettings::Key_View_StickyScrolling = "View_StickyScrolling";
std::multimap< QString, std::function<void(QVariant)> > GlobalSettings::callbacks_;
bool GlobalSettings::tracking_ = false;
public:
static const QString Key_View_AlwaysZoomToFit;
static const QString Key_View_ColouredBG;
+ static const QString Key_View_StickyScrolling;
public:
GlobalSettings();
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();
remove_session(session);
}
-void MainWindow::on_view_sticky_scrolling_shortcut()
-{
- shared_ptr<views::ViewBase> viewbase = get_active_view();
- views::TraceView::View* view =
- qobject_cast<views::TraceView::View*>(viewbase.get());
- if (view)
- view->toggle_sticky_scrolling();
-}
-
void MainWindow::on_view_coloured_bg_shortcut()
{
GlobalSettings settings;
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();
}
}
+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();
void on_tab_changed(int index);
void on_tab_close_requested(int index);
- void on_view_sticky_scrolling_shortcut();
void on_view_coloured_bg_shortcut();
+ 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();
sticky_scrolling_ = state;
}
-void View::toggle_sticky_scrolling()
-{
- sticky_scrolling_ = !sticky_scrolling_;
-}
-
void View::enable_coloured_bg(bool state)
{
const vector<shared_ptr<TraceTreeItem>> items(
*/
void enable_sticky_scrolling(bool state);
- /**
- * Toggle sticky scrolling.
- */
- void toggle_sticky_scrolling(void);
-
/**
* Enables or disables coloured trace backgrounds. If they're not
* coloured then they will use alternating colors.