From: Joel Holdsworth Date: Sat, 10 Jan 2015 16:18:33 +0000 (+0000) Subject: MainWindow: Made menu_decoder_add into a member variable X-Git-Tag: pulseview-0.3.0~267 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=0f90452b8aff5c54096c23cadbbb549d25f1f88d;ds=sidebyside MainWindow: Made menu_decoder_add into a member variable --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index f9ae4d4e..a7dd7736 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -92,7 +92,8 @@ MainWindow::MainWindow(DeviceManager &device_manager, action_view_zoom_fit_(new QAction(this)), action_view_zoom_one_to_one_(new QAction(this)), action_view_show_cursors_(new QAction(this)), - action_about_(new QAction(this)) + action_about_(new QAction(this)), + menu_decoders_add_(new pv::widgets::DecoderMenu(this, true)) { setup_ui(); restore_ui_settings(); @@ -154,6 +155,11 @@ QAction* MainWindow::action_about() const return action_about_; } +QMenu* MainWindow::menu_decoder_add() const +{ + return menu_decoders_add_; +} + void MainWindow::run_stop() { switch(session_.get_capture_state()) { @@ -295,13 +301,11 @@ void MainWindow::setup_ui() QMenu *const menu_decoders = new QMenu; menu_decoders->setTitle(tr("&Decoders")); - pv::widgets::DecoderMenu *const menu_decoders_add = - new pv::widgets::DecoderMenu(menu_decoders, true); - menu_decoders_add->setTitle(tr("&Add")); - connect(menu_decoders_add, SIGNAL(decoder_selected(srd_decoder*)), + menu_decoders_add_->setTitle(tr("&Add")); + connect(menu_decoders_add_, SIGNAL(decoder_selected(srd_decoder*)), this, SLOT(add_decoder(srd_decoder*))); - menu_decoders->addMenu(menu_decoders_add); + menu_decoders->addMenu(menu_decoders_add_); #endif // Help Menu diff --git a/pv/mainwindow.hpp b/pv/mainwindow.hpp index 8aab988b..84245e0e 100644 --- a/pv/mainwindow.hpp +++ b/pv/mainwindow.hpp @@ -86,6 +86,8 @@ public: QAction* action_view_show_cursors() const; QAction* action_about() const; + QMenu* menu_decoder_add() const; + void run_stop(); void select_device(std::shared_ptr device); @@ -157,6 +159,8 @@ private: QAction *const action_view_zoom_one_to_one_; QAction *const action_view_show_cursors_; QAction *const action_about_; + + QMenu *const menu_decoders_add_; }; } // namespace pv