]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Moved all srd commands into decode thread, implemented error messages
[pulseview.git] / pv / mainwindow.cpp
index 97103ad514724278debbcb3588c585c8534331b5..183e841e804c3c6f48d37949268ec3227a0c70be 100644 (file)
@@ -41,6 +41,7 @@
 #include "dialogs/connect.h"
 #include "dialogs/decoder.h"
 #include "toolbars/samplingbar.h"
+#include "view/logicsignal.h"
 #include "view/view.h"
 
 /* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
@@ -214,13 +215,11 @@ void MainWindow::setup_ui()
        addToolBar(_toolbar);
 
        // Setup the sampling bar
-       _sampling_bar = new toolbars::SamplingBar(this);
+       _sampling_bar = new toolbars::SamplingBar(_session, this);
 
        // Populate the device list and select the initially selected device
        update_device_list();
 
-       connect(_sampling_bar, SIGNAL(device_selected()), this,
-               SLOT(device_selected()));
        connect(_sampling_bar, SIGNAL(run_stop()), this,
                SLOT(run_stop()));
        addToolBar(_sampling_bar);
@@ -370,11 +369,6 @@ void MainWindow::on_actionAbout_triggered()
        dlg.exec();
 }
 
-void MainWindow::device_selected()
-{
-       _session.set_device(_sampling_bar->get_selected_device());
-}
-
 void MainWindow::add_decoder(QObject *action)
 {
        assert(action);
@@ -382,13 +376,21 @@ void MainWindow::add_decoder(QObject *action)
                (srd_decoder*)((QAction*)action)->data().value<void*>();
        assert(dec);
 
-       const std::vector< boost::shared_ptr<view::Signal> > &sigs =
+       vector< shared_ptr<view::LogicSignal> > logic_sigs;
+       const vector< shared_ptr<view::Signal> > &sigs =
                _session.get_signals();
+       BOOST_FOREACH(shared_ptr<view::Signal> s, sigs) {
+               assert(s);
+               shared_ptr<view::LogicSignal> l =
+                       dynamic_pointer_cast<view::LogicSignal>(s);
+               if (l)
+                       logic_sigs.push_back(l);
+       }
 
        GHashTable *const options = g_hash_table_new_full(g_str_hash,
                g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
 
-       dialogs::Decoder dlg(this, dec, sigs, options);
+       dialogs::Decoder dlg(this, dec, logic_sigs, options);
        if(dlg.exec() != QDialog::Accepted) {
                g_hash_table_destroy(options);
                return;