]> sigrok.org Git - pulseview.git/commitdiff
MainWindow: Made menu_decoder_add into a member variable
authorJoel Holdsworth <redacted>
Sat, 10 Jan 2015 16:18:33 +0000 (16:18 +0000)
committerJoel Holdsworth <redacted>
Sat, 10 Jan 2015 16:32:05 +0000 (16:32 +0000)
pv/mainwindow.cpp
pv/mainwindow.hpp

index f9ae4d4e6eca7c07a2ab72e55215ab9d8d3c1bd8..a7dd773666fba9aec90f861dacc2f4935499859b 100644 (file)
@@ -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
index 8aab988b26c2fc2ce7f6bc87bdb7450d210efcb7..84245e0ec117c279814faeb7decffdbc03642963 100644 (file)
@@ -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<sigrok::Device> 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