Moved decoder config into the popup
[pulseview.git] / pv / view / decodesignal.h
index e52c7947c1259571d3f997acb3c0812ba3953197..7977c1c3ab40cd25497a548888d8958bc1b80de5 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_DECODESIGNAL_H
-#define PULSEVIEW_PV_DECODESIGNAL_H
+#ifndef PULSEVIEW_PV_VIEW_DECODESIGNAL_H
+#define PULSEVIEW_PV_VIEW_DECODESIGNAL_H
 
 #include "trace.h"
 
+#include <map>
+
 #include <boost/shared_ptr.hpp>
 
+#include <pv/prop/binding/decoderoptions.h>
+
+struct srd_probe;
+
+class QComboBox;
+
 namespace pv {
+
+namespace data {
+class Decoder;
+}
+
 namespace view {
 
 class DecodeSignal : public Trace
 {
-public:
-       DecodeSignal(pv::SigSession &session, srd_decoder *const dec);
+       Q_OBJECT
 
-       void init_context_bar_actions(QWidget *parent);
+private:
+       static const QColor DecodeColours[4];
+       static const QColor ErrorBgColour;
+
+public:
+       DecodeSignal(pv::SigSession &session,
+               boost::shared_ptr<pv::data::Decoder> decoder, int index);
 
        bool enabled() const;
 
+       const boost::shared_ptr<pv::data::Decoder>& decoder() const;
+
+       void set_view(pv::view::View *view);
+
        /**
-        * Paints the trace with a QPainter
+        * Paints the background layer of the trace with a QPainter
+        * @param p the QPainter to paint into.
+        * @param left the x-coordinate of the left edge of the signal.
+        * @param right the x-coordinate of the right edge of the signal.
+        **/
+       void paint_back(QPainter &p, int left, int right);
+
+       /**
+        * Paints the mid-layer of the trace with a QPainter
         * @param p the QPainter to paint into.
-        * @param y the y-coordinate to draw the signal at
         * @param left the x-coordinate of the left edge of the signal
         * @param right the x-coordinate of the right edge of the signal
-        * @param scale the scale in seconds per pixel.
-        * @param offset the time to show at the left hand edge of
-        *   the view in seconds.
         **/
-       void paint(QPainter &p, int y, int left, int right,
-               double scale, double offset);
+       void paint_mid(QPainter &p, int left, int right);
+
+       void populate_popup_form(QWidget *parent, QFormLayout *form);
+
+       QMenu* create_context_menu(QWidget *parent);
 
-       const std::list<QAction*> get_context_bar_actions();
+       void delete_pressed();
 
 private:
+       void draw_error(QPainter &p, const QString &message,
+               int left, int right);
 
-       /**
-        * When painting into the rectangle, calculate the y
-        * offset of the zero point.
-        **/
-       int get_nominal_offset(const QRect &rect) const;
+       QComboBox* create_probe_selector(
+               QWidget *parent, const srd_probe *const probe);
+
+       void commit_probes();
+
+private slots:
+       void on_new_decode_data();
+
+       void on_delete();
+
+       void on_probe_selected(int);
 
 private:
-       srd_decoder *const _decoder;
+       boost::shared_ptr<pv::data::Decoder> _decoder;
+
+       uint64_t _decode_start, _decode_end;
+
+       pv::prop::binding::DecoderOptions _binding;
+
+       std::map<const srd_probe*, QComboBox*> _probe_selector_map;
 };
 
 } // namespace view
 } // namespace pv
 
-#endif // PULSEVIEW_PV_DECODESIGNAL_H
+#endif // PULSEVIEW_PV_VIEW_DECODESIGNAL_H