]> sigrok.org Git - pulseview.git/blobdiff - pv/session.hpp
Make the first view own the toolbar instead of the main window
[pulseview.git] / pv / session.hpp
index 0828edbbf912cb3d8e09e18db94102df872ca1e1..d6cfdd302c97815daec25bcf19b62e12008c96e2 100644 (file)
@@ -31,7 +31,7 @@
 #include <vector>
 
 #ifdef _WIN32
-// Windows: Avoid namespace pollution by thread.hpp (which includes windows.h).
+// Windows: Avoid boost/thread namespace pollution (which includes windows.h).
 #define NOGDI
 #define NORESOURCE
 #endif
@@ -40,6 +40,8 @@
 #include <QObject>
 #include <QString>
 
+#include "util.hpp"
+
 struct srd_decoder;
 struct srd_channel;
 
@@ -62,6 +64,7 @@ class Analog;
 class AnalogSegment;
 class Logic;
 class LogicSegment;
+class SignalBase;
 class SignalData;
 }
 
@@ -69,10 +72,12 @@ namespace devices {
 class Device;
 }
 
+namespace toolbars {
+class MainBar;
+}
+
 namespace view {
-class DecodeTrace;
-class LogicSignal;
-class Signal;
+class View;
 }
 
 class Session : public QObject
@@ -99,6 +104,12 @@ public:
 
        std::shared_ptr<devices::Device> device() const;
 
+       std::shared_ptr<pv::view::View> main_view() const;
+
+       void set_main_bar(std::shared_ptr<pv::toolbars::MainBar> main_bar);
+
+       std::shared_ptr<pv::toolbars::MainBar> main_bar() const;
+
        /**
         * Sets device instance that will be used in the next capture session.
         */
@@ -112,18 +123,19 @@ public:
 
        void stop_capture();
 
-       std::set< std::shared_ptr<data::SignalData> > get_data() const;
+       double get_samplerate() const;
+
+       void register_view(std::shared_ptr<pv::view::View> view);
 
-       const std::unordered_set< std::shared_ptr<view::Signal> >
-               signals() const;
+       void deregister_view(std::shared_ptr<pv::view::View> view);
+
+       const std::unordered_set< std::shared_ptr<data::SignalBase> >
+               signalbases() const;
 
 #ifdef ENABLE_DECODE
        bool add_decoder(srd_decoder *const dec);
 
-       std::vector< std::shared_ptr<view::DecodeTrace> >
-               get_decode_signals() const;
-
-       void remove_decode_signal(view::DecodeTrace *signal);
+       void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
 #endif
 
 private:
@@ -131,17 +143,18 @@ private:
 
        void update_signals();
 
-       std::shared_ptr<view::Signal> signal_from_channel(
+       std::shared_ptr<data::SignalBase> signalbase_from_channel(
                std::shared_ptr<sigrok::Channel> channel) const;
 
 private:
-       void sample_thread_proc(std::shared_ptr<devices::Device> device,
-               std::function<void (const QString)> error_handler);
+       void sample_thread_proc(std::function<void (const QString)> error_handler);
 
        void feed_in_header();
 
        void feed_in_meta(std::shared_ptr<sigrok::Meta> meta);
 
+       void feed_in_trigger();
+
        void feed_in_frame_begin();
 
        void feed_in_logic(std::shared_ptr<sigrok::Logic> logic);
@@ -155,13 +168,17 @@ private:
        DeviceManager &device_manager_;
        std::shared_ptr<devices::Device> device_;
 
-       std::vector< std::shared_ptr<view::DecodeTrace> > decode_traces_;
+       std::unordered_set< std::shared_ptr<pv::view::View> > views_;
+       std::shared_ptr<pv::view::View> main_view_;
 
-       mutable std::mutex sampling_mutex_;
+       std::shared_ptr<pv::toolbars::MainBar> main_bar_;
+
+       mutable std::mutex sampling_mutex_; //!< Protects access to capture_state_.
        capture_state capture_state_;
 
-       mutable boost::shared_mutex signals_mutex_;
-       std::unordered_set< std::shared_ptr<view::Signal> > signals_;
+
+       std::unordered_set< std::shared_ptr<data::SignalBase> > signalbases_;
+       std::unordered_set< std::shared_ptr<data::SignalData> > all_signal_data_;
 
        mutable std::recursive_mutex data_mutex_;
        std::shared_ptr<data::Logic> logic_data_;
@@ -180,6 +197,8 @@ Q_SIGNALS:
 
        void signals_changed();
 
+       void trigger_event(util::Timestamp location);
+
        void frame_began();
 
        void data_received();