X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=4ab78d1dc9972b1e2433fd34c830b240a3624c5e;hp=52b625086d4830df551f5a302e61cb1d3db30b5f;hb=9a0e130580f37277d94fd2637ee17bb9c181e110;hpb=20f59e957e70250cfb876ac7a1743134d6b83339 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 52b6250..4ab78d1 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -50,10 +50,8 @@ #include -using std::bind; using std::dynamic_pointer_cast; using std::make_shared; -using std::placeholders::_1; using std::shared_ptr; using std::string; @@ -79,14 +77,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 +88,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, QWidget *parent) : MainWindow::~MainWindow() { + GlobalSettings::remove_change_handler(this); + while (!sessions_.empty()) remove_session(sessions_.front()); } @@ -174,9 +167,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 +393,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"));