]> sigrok.org Git - pulseview.git/commitdiff
Add decoder after decoder dialog
authorJoel Holdsworth <redacted>
Mon, 31 Dec 2012 13:58:02 +0000 (13:58 +0000)
committerJoel Holdsworth <redacted>
Sun, 29 Sep 2013 01:34:42 +0000 (10:34 +0900)
pv/mainwindow.cpp
pv/sigsession.cpp
pv/sigsession.h
pv/view/decodesignal.cpp
pv/view/decodesignal.h

index aa06601c3824a6c74eab2ad74b33e3a3155040aa..0397c7f4a6076de6782f364be497ae8f462ad560 100644 (file)
@@ -392,7 +392,10 @@ void MainWindow::add_decoder(QObject *action)
                _session.get_signals();
 
        dialogs::Decoder dlg(this, dec, sigs);
-       dlg.exec();
+       if(dlg.exec() != QDialog::Accepted)
+               return;
+
+       _session.add_decoder(dec);
 }
 
 void MainWindow::run_stop()
index e9349bba0efb1eae40e3cfa4f93dd5ddd9fc5e92..c2c2dc983892dc65d1ff94b532b79b83e60a9cf6 100644 (file)
@@ -25,7 +25,9 @@
 #include "data/analogsnapshot.h"
 #include "data/logic.h"
 #include "data/logicsnapshot.h"
+
 #include "view/analogsignal.h"
+#include "view/decodesignal.h"
 #include "view/logicsignal.h"
 
 #include <assert.h>
@@ -194,6 +196,15 @@ boost::shared_ptr<data::Logic> SigSession::get_data()
        return _logic_data;
 }
 
+void SigSession::add_decoder(srd_decoder *const dec)
+{
+       {
+               shared_ptr<view::DecodeSignal> d(new view::DecodeSignal(*this, dec));
+               _decode_traces.push_back(d);
+       }
+       signals_changed();
+}
+
 void SigSession::set_capture_state(capture_state state)
 {
        lock_guard<mutex> lock(_sampling_mutex);
@@ -287,6 +298,9 @@ void SigSession::update_signals(const sr_dev_inst *const sdi)
        unsigned int logic_probe_count = 0;
        unsigned int analog_probe_count = 0;
 
+       // Clear the decode traces
+       _decode_traces.clear();
+
        // Detect what data types we will receive
        if(sdi) {
                for (const GSList *l = sdi->probes; l; l = l->next) {
index 88c603e20127baeb171d97b3ddbb154762c5d7cf..50768e6caf037152aafc62cf21ebae4799c4fb83 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <libsigrok/libsigrok.h>
 
+struct srd_decoder;
+
 namespace pv {
 
 class DeviceManager;
@@ -46,6 +48,7 @@ class LogicSnapshot;
 }
 
 namespace view {
+class DecodeSignal;
 class Signal;
 }
 
@@ -89,6 +92,8 @@ public:
 
        boost::shared_ptr<data::Logic> get_data();
 
+       void add_decoder(srd_decoder *const dec);
+
 private:
        void set_capture_state(capture_state state);
 
@@ -147,6 +152,8 @@ private:
         */
        struct sr_dev_inst *_sdi;
 
+       std::vector< boost::shared_ptr<view::DecodeSignal> > _decode_traces;
+
        mutable boost::mutex _sampling_mutex;
        capture_state _capture_state;
 
index 3e28d493d238a6b7a50a12fcc58f145fd39b66b7..1e53427526361660461fb460f027513916b7372b 100644 (file)
@@ -37,6 +37,11 @@ DecodeSignal::DecodeSignal(pv::SigSession &session, srd_decoder *const dec) :
        _colour = Qt::red;
 }
 
+void DecodeSignal::init_context_bar_actions(QWidget *parent)
+{
+       (void)parent;
+}
+
 bool DecodeSignal::enabled() const
 {
        return true;
index 7e1410e8e5fe335d3c403ca9fbb231d49bd28d59..e52c7947c1259571d3f997acb3c0812ba3953197 100644 (file)
@@ -33,6 +33,8 @@ class DecodeSignal : public Trace
 public:
        DecodeSignal(pv::SigSession &session, srd_decoder *const dec);
 
+       void init_context_bar_actions(QWidget *parent);
+
        bool enabled() const;
 
        /**