]> sigrok.org Git - pulseview.git/commitdiff
Removed context bar
authorJoel Holdsworth <redacted>
Sun, 29 Sep 2013 14:50:53 +0000 (23:50 +0900)
committerJoel Holdsworth <redacted>
Sun, 13 Oct 2013 10:05:22 +0000 (11:05 +0100)
17 files changed:
CMakeLists.txt
pv/mainwindow.cpp
pv/mainwindow.h
pv/toolbars/contextbar.cpp [deleted file]
pv/toolbars/contextbar.h [deleted file]
pv/view/analogsignal.cpp
pv/view/analogsignal.h
pv/view/decodesignal.cpp
pv/view/decodesignal.h
pv/view/logicsignal.cpp
pv/view/logicsignal.h
pv/view/selectableitem.h
pv/view/signal.cpp
pv/view/signal.h
pv/view/timemarker.cpp
pv/view/timemarker.h
pv/view/view.cpp

index 6fa08273ef73ed8d865d971b4e1da42d8784c722..c2e9001bb7591f7ef40064d466314d1ddb58142a 100644 (file)
@@ -125,7 +125,6 @@ set(pulseview_SOURCES
        pv/prop/binding/binding.cpp
        pv/prop/binding/decoderoptions.cpp
        pv/prop/binding/deviceoptions.cpp
-       pv/toolbars/contextbar.cpp
        pv/toolbars/samplingbar.cpp
        pv/view/analogsignal.cpp
        pv/view/cursor.cpp
@@ -153,7 +152,6 @@ set(pulseview_HEADERS
        pv/dialogs/about.h
        pv/dialogs/connect.h
        pv/dialogs/deviceoptions.h
-       pv/toolbars/contextbar.h
        pv/toolbars/samplingbar.h
        pv/view/cursor.h
        pv/view/decodesignal.h
index ba232e25d0cb5afae12d5bb3f80a09f6b2fe3714..97103ad514724278debbcb3588c585c8534331b5 100644 (file)
@@ -40,7 +40,6 @@
 #include "dialogs/about.h"
 #include "dialogs/connect.h"
 #include "dialogs/decoder.h"
-#include "toolbars/contextbar.h"
 #include "toolbars/samplingbar.h"
 #include "view/view.h"
 
@@ -98,8 +97,6 @@ void MainWindow::setup_ui()
        setCentralWidget(_central_widget);
 
        _view = new pv::view::View(_session, this);
-       connect(_view, SIGNAL(selection_changed()), this,
-               SLOT(view_selection_changed()));
 
        _vertical_layout->addWidget(_view);
 
@@ -228,10 +225,6 @@ void MainWindow::setup_ui()
                SLOT(run_stop()));
        addToolBar(_sampling_bar);
 
-       // Setup the context bar
-       _context_bar = new toolbars::ContextBar(this);
-       addToolBar(_context_bar);
-
        // Set the title
        setWindowTitle(QApplication::translate("MainWindow", "PulseView", 0,
                QApplication::UnicodeUTF8));
@@ -425,13 +418,4 @@ void MainWindow::capture_state_changed(int state)
        _sampling_bar->set_capture_state((pv::SigSession::capture_state)state);
 }
 
-void MainWindow::view_selection_changed()
-{
-       assert(_context_bar);
-
-       const list<weak_ptr<pv::view::SelectableItem> > items(
-               _view->selected_items());
-       _context_bar->set_selected_items(items);
-}
-
 } // namespace pv
index b4b64f779de1419ac4686defedd67566c942aa5c..d34db1bffaa6d4a4a53acf88f9b1d39617b2afdf 100644 (file)
@@ -105,8 +105,6 @@ private slots:
 
        void capture_state_changed(int state);
 
-       void view_selection_changed();
-
 private:
        DeviceManager &_device_manager;
 
@@ -137,7 +135,6 @@ private:
 
        QToolBar *_toolbar;
        toolbars::SamplingBar *_sampling_bar;
-       toolbars::ContextBar *_context_bar;
 };
 
 } // namespace pv
diff --git a/pv/toolbars/contextbar.cpp b/pv/toolbars/contextbar.cpp
deleted file mode 100644 (file)
index a538d64..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#include <stdio.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/foreach.hpp>
-
-#include "contextbar.h"
-
-#include <pv/view/selectableitem.h>
-
-using namespace boost;
-using namespace std;
-
-namespace pv {
-namespace toolbars {
-
-ContextBar::ContextBar(QWidget *parent) :
-       QToolBar(tr("Context Bar"), parent)
-{
-}
-
-void ContextBar::set_selected_items(const list<
-       weak_ptr<pv::view::SelectableItem> > &items)
-{
-       clear();
-
-       if (items.empty())
-               return;
-
-       if (shared_ptr<pv::view::SelectableItem> item =
-               items.front().lock()) {
-
-               assert(item);
-
-               const list<QAction*> actions(
-                       item->get_context_bar_actions());
-               BOOST_FOREACH(QAction *action, actions) {
-                       assert(action);
-                       addAction(action);
-               }
-       }
-}
-
-} // namespace toolbars
-} // namespace pv
diff --git a/pv/toolbars/contextbar.h b/pv/toolbars/contextbar.h
deleted file mode 100644 (file)
index 6d8e7f3..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_TOOLBARS_CONTEXTBAR_H
-#define PULSEVIEW_PV_TOOLBARS_CONTEXTBAR_H
-
-#include <boost/weak_ptr.hpp>
-
-#include <QToolBar>
-
-#include <pv/view/selectableitem.h>
-
-namespace pv {
-namespace toolbars {
-
-class ContextBar : public QToolBar
-{
-       Q_OBJECT
-
-public:
-       ContextBar(QWidget *parent);
-
-public:
-       void set_selected_items(const std::list<
-               boost::weak_ptr<pv::view::SelectableItem> > &items);
-};
-
-} // namespace toolbars
-} // namespace pv
-
-#endif // PULSEVIEW_PV_TOOLBARS_CONTEXTBAR_H
index a4474dac8e06a0026b40da41e53b15b3cc7e8bc9..53af2643132ee895c65e5bd8df10e4bc655a3061 100644 (file)
@@ -55,13 +55,6 @@ AnalogSignal::~AnalogSignal()
 {
 }
 
-const list<QAction*> AnalogSignal::get_context_bar_actions()
-{
-       list<QAction*> actions;
-       actions.push_back(_name_action);
-       return actions;
-}
-
 void AnalogSignal::set_scale(float scale)
 {
        _scale = scale;
index 3b92455cb706a587815b2ada7d3728f5bb202977..0b6172f8144884d51b5ba2a918db6bf8106f7d86 100644 (file)
@@ -47,8 +47,6 @@ public:
 
        virtual ~AnalogSignal();
 
-       const std::list<QAction*> get_context_bar_actions();
-
        void set_scale(float scale);
 
        /**
index b151b3911d13ef6beb570cb092cefae115660ef1..bce58a1922751f145313bef0d53a39a992e92d61 100644 (file)
@@ -59,11 +59,6 @@ DecodeSignal::DecodeSignal(pv::SigSession &session,
                this, SLOT(on_new_decode_data()));
 }
 
-void DecodeSignal::init_context_bar_actions(QWidget *parent)
-{
-       (void)parent;
-}
-
 bool DecodeSignal::enabled() const
 {
        return true;
@@ -109,12 +104,6 @@ void DecodeSignal::paint_mid(QPainter &p, int left, int right)
        }
 }
 
-const list<QAction*> DecodeSignal::get_context_bar_actions()
-{
-       list<QAction*> actions;
-       return actions;
-}
-
 QMenu* DecodeSignal::create_context_menu(QWidget *parent)
 {
        QMenu *const menu = Trace::create_context_menu(parent);
index b9fbb24d15bc3ee3d18c0646799818f08159f884..22e0f3d07c02b31bd6b4bf75da4e212eb31b7a79 100644 (file)
@@ -44,8 +44,6 @@ public:
        DecodeSignal(pv::SigSession &session,
                boost::shared_ptr<pv::data::Decoder> decoder, int index);
 
-       void init_context_bar_actions(QWidget *parent);
-
        bool enabled() const;
 
        void set_view(pv::view::View *view);
@@ -66,8 +64,6 @@ public:
         **/
        void paint_mid(QPainter &p, int left, int right);
 
-       const std::list<QAction*> get_context_bar_actions();
-
        QMenu* create_context_menu(QWidget *parent);
 
 private:
index 19522fb27f0187d05fd3b27dfd5c705045445162..bf8b36598887036033d1dd6478bddda7e86eb45a 100644 (file)
@@ -59,7 +59,6 @@ LogicSignal::LogicSignal(pv::SigSession &session, const sr_probe *const probe,
        shared_ptr<data::Logic> data) :
        Signal(session, probe),
        _data(data),
-       _separator(NULL),
        _trigger_none(NULL),
        _trigger_rising(NULL),
        _trigger_high(NULL),
@@ -74,94 +73,11 @@ LogicSignal::~LogicSignal()
 {
 }
 
-void LogicSignal::init_context_bar_actions(QWidget *parent)
-{
-       Signal::init_context_bar_actions(parent);
-
-       _separator = new QAction(parent);
-       _separator->setSeparator(true);
-
-       _trigger_none = new QAction(QIcon(":/icons/trigger-none.svg"),
-               tr("No trigger"), this);
-       _trigger_none->setCheckable(true);
-       connect(_trigger_none, SIGNAL(triggered()),
-               this, SLOT(on_trigger_none()));
-
-       _trigger_rising = new QAction(QIcon(":/icons/trigger-rising.svg"),
-               tr("Trigger on rising edge"), this);
-       _trigger_rising->setCheckable(true);
-       connect(_trigger_rising, SIGNAL(triggered()),
-               this, SLOT(on_trigger_rising()));
-
-       _trigger_high = new QAction(QIcon(":/icons/trigger-low.svg"),
-               tr("Trigger on high level"), this);
-       _trigger_high->setCheckable(true);
-       connect(_trigger_high, SIGNAL(triggered()),
-               this, SLOT(on_trigger_high()));
-
-       _trigger_falling = new QAction(QIcon(":/icons/trigger-falling.svg"),
-               tr("Trigger on falling edge"), this);
-       _trigger_falling->setCheckable(true);
-       connect(_trigger_falling, SIGNAL(triggered()),
-               this, SLOT(on_trigger_falling()));
-
-       _trigger_low = new QAction(QIcon(":/icons/trigger-low.svg"),
-               tr("Trigger on low level"), this);
-       _trigger_low->setCheckable(true);
-       connect(_trigger_low, SIGNAL(triggered()),
-               this, SLOT(on_trigger_low()));
-
-       _trigger_change = new QAction(QIcon(":/icons/trigger-change.svg"),
-               tr("Trigger on rising or falling edge"), this);
-       _trigger_change->setCheckable(true);
-       connect(_trigger_change, SIGNAL(triggered()),
-               this, SLOT(on_trigger_change()));
-}
-
 boost::shared_ptr<pv::data::Logic> LogicSignal::data() const
 {
        return _data;
 }
 
-const list<QAction*> LogicSignal::get_context_bar_actions()
-{
-       GVariant *gvar;
-       list<QAction*> actions;
-
-       actions.push_back(_name_action);
-
-       // Add the trigger actions
-       const sr_dev_inst *const sdi = _session.get_device();
-       if (sr_config_list(sdi->driver, SR_CONF_TRIGGER_TYPE,
-               &gvar, sdi) == SR_OK) {
-               const char *const trig_types =
-                       g_variant_get_string(gvar, NULL);
-
-               if (trig_types && trig_types[0] != '\0') {
-                       actions.push_back(_separator);
-
-                       actions.push_back(_trigger_none);
-
-                       add_trigger_action(trig_types, 'r',
-                               _trigger_rising, actions);
-                       add_trigger_action(trig_types, '1',
-                               _trigger_high, actions);
-                       add_trigger_action(trig_types, 'f',
-                               _trigger_falling, actions);
-                       add_trigger_action(trig_types, '0',
-                               _trigger_low, actions);
-                       add_trigger_action(trig_types, 'c',
-                               _trigger_change, actions);
-               
-                       update_trigger_actions();
-               }
-
-               g_variant_unref(gvar);
-       }
-
-       return actions;
-}
-
 void LogicSignal::paint_back(QPainter &p, int left, int right)
 {
        if (_probe->enabled)
@@ -272,16 +188,6 @@ void LogicSignal::paint_caps(QPainter &p, QLineF *const lines,
        p.drawLines(lines, line - lines);
 }
 
-void LogicSignal::add_trigger_action(const char *trig_types, char type,
-       QAction *action, list<QAction*> &actions)
-{
-       while(*trig_types)
-               if(*trig_types++ == type) {
-                       actions.push_back(action);
-                       break;
-               }
-}
-
 void LogicSignal::update_trigger_actions()
 {
        const char cur_trigger = _probe->trigger ?
index 18b549811e604665fda5133bb3078c4e9c596954..8b977ae285b5dd3098637db533a6e78abd25b0e2 100644 (file)
@@ -52,12 +52,8 @@ public:
 
        virtual ~LogicSignal();
 
-       void init_context_bar_actions(QWidget *parent);
-
        boost::shared_ptr<pv::data::Logic> data() const;
 
-       const std::list<QAction*> get_context_bar_actions();
-
        /**
         * Paints the background layer of the signal with a QPainter
         * @param p the QPainter to paint into.
@@ -81,9 +77,6 @@ private:
                bool level, double samples_per_pixel, double pixels_offset,
                float x_offset, float y_offset);
 
-       static void add_trigger_action(const char *trig_types, char type,
-               QAction *action, std::list<QAction*> &actions);
-
        void update_trigger_actions();
 
        void set_trigger(char type);
@@ -99,8 +92,6 @@ private slots:
 private:
        boost::shared_ptr<pv::data::Logic> _data;
 
-       QAction *_separator;
-
        QAction *_trigger_none;
        QAction *_trigger_rising;
        QAction *_trigger_high;
index 323c87e18743ff894255137af83cbc86c6fce5c3..41f6811776bcc0fbc43f9df41fcf3db180c39b94 100644 (file)
@@ -54,10 +54,6 @@ public:
        void select(bool select = true);
 
 public:
-       virtual void init_context_bar_actions(QWidget *parent) = 0;
-
-       virtual const std::list<QAction*> get_context_bar_actions() = 0;
-
        virtual QMenu* create_context_menu(QWidget *parent);
 
 protected:
index 446814edc5fc4257b1cdf74f71d0ded15b5663ba..7c4a11e03eee9fc1082578d7ffa71a2d05563b5f 100644 (file)
@@ -51,29 +51,12 @@ const char *const ProbeNames[] = {
 Signal::Signal(pv::SigSession &session, const sr_probe *const probe) :
        Trace(session, probe->name),
        _probe(probe),
-       _name_action(NULL),
        _name_widget(NULL),
        _updating_name_widget(false)
 {
        assert(_probe);
 }
 
-void Signal::init_context_bar_actions(QWidget *parent)
-{
-       _name_widget = new QComboBox(parent);
-       _name_widget->setEditable(true);
-
-       _name_action = new QWidgetAction(parent);
-       _name_action->setDefaultWidget(_name_widget);
-
-       for(unsigned int i = 0; i < countof(ProbeNames); i++)
-               _name_widget->insertItem(i, ProbeNames[i]);
-       _name_widget->setEditText(_probe->name);
-
-       connect(_name_widget, SIGNAL(editTextChanged(const QString&)),
-               this, SLOT(on_text_changed(const QString&)));
-}
-
 void Signal::set_name(QString name)
 {
        Trace::set_name(name);
index aff8c4c427498e54c6eb00dc94dfc05e4c3e4169..540eb6eda38899b3027a9f3a4baac45ecb39b3ba 100644 (file)
@@ -46,8 +46,6 @@ protected:
        Signal(pv::SigSession &session, const sr_probe *const probe);
 
 public:
-       virtual void init_context_bar_actions(QWidget *parent);
-
        /**
         * Sets the name of the signal.
         */
@@ -60,7 +58,6 @@ public:
 
        const sr_probe* probe() const;
 
-private:
        virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
 
 private slots:
@@ -69,7 +66,6 @@ private slots:
 protected:
        const sr_probe *const _probe;
 
-       QWidgetAction *_name_action;
        QComboBox *_name_widget;
        bool _updating_name_widget;
 };
index 5907631a671f463efa3e479bf340c9b31b4c4633..5fd75dd8db91c4104a91b0a70b044f86374daedb 100644 (file)
@@ -39,21 +39,6 @@ TimeMarker::TimeMarker(View &view, const QColor &colour, double time) :
 {
 }
 
-void TimeMarker::init_context_bar_actions(QWidget *parent)
-{
-       _value_widget = new QDoubleSpinBox(parent);
-       _value_widget->setValue(_time);
-       _value_widget->setDecimals(6);
-       _value_widget->setSuffix("s");
-       _value_widget->setSingleStep(1e-6);
-
-       _value_action = new QWidgetAction(parent);
-       _value_action->setDefaultWidget(_value_widget);
-
-       connect(_value_widget, SIGNAL(valueChanged(double)),
-               this, SLOT(on_value_changed(double)));
-}
-
 double TimeMarker::time() const
 {
        return _time;
@@ -75,13 +60,6 @@ void TimeMarker::paint(QPainter &p, const QRect &rect)
        p.drawLine(QPointF(x, rect.top()), QPointF(x, rect.bottom()));
 }
 
-const list<QAction*> TimeMarker::get_context_bar_actions()
-{
-       list<QAction*> actions;
-       actions.push_back(_value_action);
-       return actions;
-}
-
 void TimeMarker::on_value_changed(double value)
 {
        if (!_updating_value_widget) {
index 328d428f0e52ca547c48840d5a4071e247c78e14..54b9c248529ff3e4a6c87d3fef5a1f274c626ca2 100644 (file)
@@ -51,8 +51,6 @@ protected:
        TimeMarker(View &view, const QColor &colour, double time);
 
 public:
-       virtual void init_context_bar_actions(QWidget *parent);
-       
        /**
         * Gets the time of the marker.
         */
@@ -86,12 +84,6 @@ public:
        virtual void paint_label(QPainter &p, const QRect &rect,
                unsigned int prefix) = 0;
 
-       /**
-        * Returns a list of context menu items to show in the context
-        * bar.
-        */
-       const std::list<QAction*> get_context_bar_actions();
-
 private slots:
        void on_value_changed(double value);
 
index 508b91c5c385ff7e34fae595105396ba94bc4d66..6af03c9c0f7a78fec96a341c57c7e38b1d951bae 100644 (file)
@@ -390,7 +390,6 @@ void View::signals_changed()
        const vector< shared_ptr<Trace> > traces(get_traces());
        BOOST_FOREACH(shared_ptr<Trace> t, traces) {
                t->set_view(this);
-               t->init_context_bar_actions(NULL);
                t->set_v_offset(offset);
                offset += SignalHeight + 2 * SignalMargin;
        }