X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=6eabdb6737e0a5b3a8e6641392480c8ea271bff4;hb=d0c0573b3ee694827a747727f862c5f91736ca05;hp=52b625086d4830df551f5a302e61cb1d3db30b5f;hpb=20f59e957e70250cfb876ac7a1743134d6b83339;p=pulseview.git diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 52b6250..6eabdb6 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -79,14 +79,7 @@ MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) : qRegisterMetaType("util::Timestamp"); qRegisterMetaType("uint64_t"); - GlobalSettings::register_change_handler(GlobalSettings::Key_View_ColouredBG, - bind(&MainWindow::on_settingViewColouredBg_changed, this, _1)); - - GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowSamplingPoints, - bind(&MainWindow::on_settingViewShowSamplingPoints_changed, this, _1)); - - GlobalSettings::register_change_handler(GlobalSettings::Key_View_ShowAnalogMinorGrid, - bind(&MainWindow::on_settingViewShowAnalogMinorGrid_changed, this, _1)); + GlobalSettings::add_change_handler(this); GlobalSettings settings; settings.set_defaults_where_needed(); @@ -97,6 +90,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) : MainWindow::~MainWindow() { + GlobalSettings::remove_change_handler(this); + while (!sessions_.empty()) remove_session(sessions_.front()); } @@ -174,9 +169,9 @@ shared_ptr MainWindow::add_view(const QString &title, connect(close_btn, SIGNAL(clicked(bool)), this, SLOT(on_view_close_clicked())); - connect(&session, SIGNAL(trigger_event(util::Timestamp)), + connect(&session, SIGNAL(trigger_event(int, util::Timestamp)), qobject_cast(v.get()), - SLOT(trigger_event(util::Timestamp))); + SLOT(trigger_event(int, util::Timestamp))); if (type == views::ViewTypeTrace) { views::trace::View *tv = @@ -400,6 +395,18 @@ void MainWindow::restore_sessions() } } +void MainWindow::on_setting_changed(const QString &key, const QVariant &value) +{ + if (key == GlobalSettings::Key_View_ColouredBG) + on_settingViewColouredBg_changed(value); + + if (key == GlobalSettings::Key_View_ShowSamplingPoints) + on_settingViewShowSamplingPoints_changed(value); + + if (key == GlobalSettings::Key_View_ShowAnalogMinorGrid) + on_settingViewShowAnalogMinorGrid_changed(value); +} + void MainWindow::setup_ui() { setObjectName(QString::fromUtf8("MainWindow"));