]> sigrok.org Git - pulseview.git/commitdiff
Change namespace for the trace view and implement ViewBase
authorSoeren Apel <redacted>
Mon, 26 Sep 2016 06:45:38 +0000 (08:45 +0200)
committerSoeren Apel <redacted>
Sun, 4 Dec 2016 13:37:36 +0000 (14:37 +0100)
61 files changed:
CMakeLists.txt
pv/mainwindow.cpp
pv/mainwindow.hpp
pv/session.cpp
pv/session.hpp
pv/toolbars/mainbar.cpp
pv/view/analogsignal.cpp
pv/view/analogsignal.hpp
pv/view/cursor.cpp
pv/view/cursor.hpp
pv/view/cursorpair.cpp
pv/view/cursorpair.hpp
pv/view/decodetrace.cpp
pv/view/decodetrace.hpp
pv/view/flag.cpp
pv/view/flag.hpp
pv/view/header.cpp
pv/view/header.hpp
pv/view/logicsignal.cpp
pv/view/logicsignal.hpp
pv/view/marginwidget.cpp
pv/view/marginwidget.hpp
pv/view/rowitem.cpp
pv/view/rowitem.hpp
pv/view/ruler.cpp
pv/view/ruler.hpp
pv/view/signal.cpp
pv/view/signal.hpp
pv/view/signalscalehandle.cpp
pv/view/signalscalehandle.hpp
pv/view/timeitem.cpp
pv/view/timeitem.hpp
pv/view/timemarker.cpp
pv/view/timemarker.hpp
pv/view/trace.cpp
pv/view/trace.hpp
pv/view/tracegroup.cpp
pv/view/tracegroup.hpp
pv/view/tracepalette.cpp
pv/view/tracepalette.hpp
pv/view/tracetreeitem.cpp
pv/view/tracetreeitem.hpp
pv/view/tracetreeitemowner.cpp
pv/view/tracetreeitemowner.hpp
pv/view/triggermarker.cpp
pv/view/triggermarker.hpp
pv/view/view.cpp
pv/view/view.hpp
pv/view/viewitem.cpp
pv/view/viewitem.hpp
pv/view/viewitemiterator.hpp
pv/view/viewitemowner.cpp
pv/view/viewitemowner.hpp
pv/view/viewitempaintparams.cpp
pv/view/viewitempaintparams.hpp
pv/view/viewport.cpp
pv/view/viewport.hpp
pv/view/viewwidget.cpp
pv/view/viewwidget.hpp
pv/views/viewbase.cpp [new file with mode: 0644]
pv/views/viewbase.hpp [new file with mode: 0644]

index a28f4f37f3a0bc107ac75b502ab71490d2112166..b70a905ecba381df743972b02e717abcac353ebd 100644 (file)
@@ -262,6 +262,7 @@ set(pulseview_SOURCES
        pv/view/viewitempaintparams.cpp
        pv/view/viewport.cpp
        pv/view/viewwidget.cpp
+       pv/views/viewbase.cpp
        pv/widgets/colourbutton.cpp
        pv/widgets/colourpopup.cpp
        pv/widgets/devicetoolbutton.cpp
@@ -314,6 +315,7 @@ set(pulseview_HEADERS
        pv/view/viewitem.hpp
        pv/view/viewport.hpp
        pv/view/viewwidget.hpp
+       pv/views/viewbase.hpp
        pv/widgets/colourbutton.hpp
        pv/widgets/colourpopup.hpp
        pv/widgets/devicetoolbutton.hpp
index 98ca7bada700ce1c7b6391ff6fb63a6dce6e0697..f64345cc532f9d33af4684ad1d7da43046aee7ce 100644 (file)
@@ -118,7 +118,7 @@ MainWindow::~MainWindow()
                // Remove the QMainWindow
                dock->setWidget(0);
 
-               const std::shared_ptr<pv::view::View> view = entry.second;
+               const std::shared_ptr<views::ViewBase> view = entry.second;
 
                for (shared_ptr<Session> session : sessions_)
                        if (session->has_view(view))
@@ -141,7 +141,7 @@ QAction* MainWindow::action_about() const
        return action_about_;
 }
 
-shared_ptr<pv::view::View> MainWindow::get_active_view() const
+shared_ptr<views::ViewBase> MainWindow::get_active_view() const
 {
        // If there's only one view, use it...
        if (view_docks_.size() == 1)
@@ -166,12 +166,10 @@ shared_ptr<pv::view::View> MainWindow::get_active_view() const
        return nullptr;
 }
 
-shared_ptr<pv::view::View> MainWindow::add_view(const QString &title,
-       view::ViewType type, Session &session)
+shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
+       views::ViewType type, Session &session)
 {
-       shared_ptr<pv::view::View> v;
-
-       if (type == pv::view::TraceView) {
+       if (type == views::ViewTypeTrace) {
                shared_ptr<QDockWidget> dock = make_shared<QDockWidget>(title, this);
                dock->setObjectName(title);
                addDockWidget(Qt::TopDockWidgetArea, dock.get());
@@ -180,7 +178,8 @@ shared_ptr<pv::view::View> MainWindow::add_view(const QString &title,
                QMainWindow *dock_main = new QMainWindow(dock.get());
                dock_main->setWindowFlags(Qt::Widget);  // Remove Qt::Window flag
 
-               v = make_shared<pv::view::View>(session, dock_main);
+               shared_ptr<views::TraceView::View> v =
+                       make_shared<views::TraceView::View>(session, dock_main);
                view_docks_[dock] = v;
                session.register_view(v);
 
@@ -197,8 +196,9 @@ shared_ptr<pv::view::View> MainWindow::add_view(const QString &title,
                connect(close_btn, SIGNAL(clicked(bool)),
                        this, SLOT(on_view_close_clicked()));
 
-               if (type == view::TraceView) {
-                       connect(&session, SIGNAL(trigger_event(util::Timestamp)), v.get(),
+               if (type == views::ViewTypeTrace) {
+                       connect(&session, SIGNAL(trigger_event(util::Timestamp)),
+                               qobject_cast<views::ViewBase*>(v.get()),
                                SLOT(trigger_event(util::Timestamp)));
 
                        v->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
@@ -220,9 +220,11 @@ shared_ptr<pv::view::View> MainWindow::add_view(const QString &title,
                        connect(v.get(), SIGNAL(always_zoom_to_fit_changed(bool)),
                                main_bar.get(), SLOT(on_always_zoom_to_fit_changed(bool)));
                }
+
+               return v;
        }
 
-       return v;
+       return nullptr;
 }
 
 shared_ptr<Session> MainWindow::add_session()
@@ -232,22 +234,22 @@ shared_ptr<Session> MainWindow::add_session()
 
        shared_ptr<Session> session = make_shared<Session>(device_manager_, name);
 
-       connect(session.get(), SIGNAL(add_view(const QString&, view::ViewType, Session*)),
-               this, SLOT(on_add_view(const QString&, view::ViewType, Session*)));
+       connect(session.get(), SIGNAL(add_view(const QString&, views::ViewType, Session*)),
+               this, SLOT(on_add_view(const QString&, views::ViewType, Session*)));
        connect(session.get(), SIGNAL(name_changed()),
                this, SLOT(on_session_name_changed()));
 
        sessions_.push_back(session);
 
-       shared_ptr<view::View> main_view =
-               add_view(name, pv::view::TraceView, *session);
+       shared_ptr<views::ViewBase> main_view =
+               add_view(name, views::ViewTypeTrace, *session);
 
        return session;
 }
 
 void MainWindow::remove_session(shared_ptr<Session> session)
 {
-       for (shared_ptr<view::View> view : session->views()) {
+       for (shared_ptr<views::ViewBase> view : session->views()) {
                // Find the dock the view is contained in and close it
                for (auto entry : view_docks_)
                        if (entry.second == view)
@@ -374,7 +376,7 @@ bool MainWindow::restoreState(const QByteArray &state, int version)
        return false;
 }
 
-void MainWindow::on_add_view(const QString &title, view::ViewType type,
+void MainWindow::on_add_view(const QString &title, views::ViewType type,
        Session *session)
 {
        // We get a pointer and need a reference
@@ -385,7 +387,7 @@ void MainWindow::on_add_view(const QString &title, view::ViewType type,
 
 void MainWindow::on_focus_changed()
 {
-       shared_ptr<view::View> view;
+       shared_ptr<views::ViewBase> view;
        bool title_set = false;
 
        view = get_active_view();
@@ -413,7 +415,7 @@ void MainWindow::on_session_name_changed()
        Session *session = qobject_cast<Session*>(QObject::sender());
        assert(session);
 
-       for (shared_ptr<view::View> view : session->views()) {
+       for (shared_ptr<views::ViewBase> view : session->views()) {
                // Get the dock that contains the view
                for (auto entry : view_docks_)
                        if (entry.second == view) {
@@ -431,7 +433,7 @@ void MainWindow::on_new_view(Session *session)
        // We get a pointer and need a reference
        for (std::shared_ptr<Session> s : sessions_)
                if (s.get() == session)
-                       add_view(session->name(), pv::view::TraceView, *s);
+                       add_view(session->name(), views::ViewTypeTrace, *s);
 }
 
 void MainWindow::on_view_close_clicked()
@@ -448,7 +450,7 @@ void MainWindow::on_view_close_clicked()
        }
 
        // Get the view contained in the dock widget
-       shared_ptr<view::View> view;
+       shared_ptr<views::ViewBase> view;
 
        for (auto entry : view_docks_)
                if (entry.first.get() == dock)
@@ -470,14 +472,18 @@ void MainWindow::on_view_close_clicked()
 
 void MainWindow::on_actionViewStickyScrolling_triggered()
 {
-       shared_ptr<pv::view::View> view = get_active_view();
+       shared_ptr<views::ViewBase> viewbase = get_active_view();
+       views::TraceView::View* view =
+               qobject_cast<views::TraceView::View*>(viewbase.get());
        if (view)
                view->enable_sticky_scrolling(action_view_sticky_scrolling_->isChecked());
 }
 
 void MainWindow::on_actionViewColouredBg_triggered()
 {
-       shared_ptr<pv::view::View> view = get_active_view();
+       shared_ptr<views::ViewBase> viewbase = get_active_view();
+       views::TraceView::View* view =
+                       qobject_cast<views::TraceView::View*>(viewbase.get());
        if (view)
                view->enable_coloured_bg(action_view_coloured_bg_->isChecked());
 }
index 3cd269f4ff50c162e6868cddd6741a1f9fb91115..ddad67050f03a5a78317ae00fd00d17750ad53c0 100644 (file)
@@ -28,7 +28,7 @@
 #include <QMainWindow>
 
 #include "session.hpp"
-#include "view/viewwidget.hpp"
+#include "views/viewbase.hpp"
 
 struct srd_decoder;
 
@@ -72,10 +72,10 @@ public:
        QAction* action_view_coloured_bg() const;
        QAction* action_about() const;
 
-       std::shared_ptr<pv::view::View> get_active_view() const;
+       std::shared_ptr<views::ViewBase> get_active_view() const;
 
-       std::shared_ptr<pv::view::View> add_view(const QString &title,
-               view::ViewType type, Session &session);
+       std::shared_ptr<views::ViewBase> add_view(const QString &title,
+               views::ViewType type, Session &session);
 
        std::shared_ptr<Session> add_session();
 
@@ -96,7 +96,7 @@ private:
        virtual bool restoreState(const QByteArray &state, int version = 0);
 
 private Q_SLOTS:
-       void on_add_view(const QString &title, view::ViewType type,
+       void on_add_view(const QString &title, views::ViewType type,
                Session *session);
 
        void on_focus_changed();
@@ -118,7 +118,7 @@ private:
        std::list< std::shared_ptr<Session> > sessions_;
 
        std::map< std::shared_ptr<QDockWidget>,
-               std::shared_ptr<pv::view::View> > view_docks_;
+               std::shared_ptr<views::ViewBase> > view_docks_;
 
        QAction *const action_view_sticky_scrolling_;
        QAction *const action_view_coloured_bg_;
index f6fb7085582a7ce19a1941c71e5effa3a040c91c..3c5bcc426cd750fcca98ab1a56c9b97c70a86009 100644 (file)
@@ -149,12 +149,12 @@ void Session::set_name(QString name)
        name_changed();
 }
 
-const std::list< std::shared_ptr<pv::view::View> > Session::views() const
+const std::list< std::shared_ptr<views::ViewBase> > Session::views() const
 {
        return views_;
 }
 
-std::shared_ptr<pv::view::View> Session::main_view() const
+std::shared_ptr<views::ViewBase> Session::main_view() const
 {
        return main_view_;
 }
@@ -243,7 +243,7 @@ void Session::save_settings(QSettings &settings) const
                main_view_->save_settings(settings);
                settings.endGroup();
 
-               for (shared_ptr<view::View> view : views_) {
+               for (shared_ptr<views::ViewBase> view : views_) {
                        if (view != main_view_) {
                                settings.beginGroup("view" + QString::number(views++));
                                view->save_settings(settings);
@@ -338,7 +338,7 @@ void Session::restore_settings(QSettings &settings)
                        settings.beginGroup("view" + QString::number(i));
 
                        if (i > 0) {
-                               view::ViewType type = (view::ViewType)settings.value("type").toInt();
+                               views::ViewType type = (views::ViewType)settings.value("type").toInt();
                                add_view(name_, type, this);
                                views_.back()->restore_settings(settings);
                        } else
@@ -366,10 +366,10 @@ void Session::set_device(shared_ptr<devices::Device> device)
        name_changed();
 
        // Remove all stored data
-       for (std::shared_ptr<pv::view::View> view : views_) {
+       for (std::shared_ptr<views::ViewBase> view : views_) {
                view->clear_signals();
 #ifdef ENABLE_DECODE
-               view->clear_decode_traces();
+               view->clear_decode_signals();
 #endif
        }
        for (const shared_ptr<data::SignalData> d : all_signal_data_)
@@ -472,7 +472,7 @@ void Session::stop_capture()
                sampling_thread_.join();
 }
 
-void Session::register_view(std::shared_ptr<pv::view::View> view)
+void Session::register_view(std::shared_ptr<views::ViewBase> view)
 {
        if (views_.empty()) {
                main_view_ = view;
@@ -483,9 +483,9 @@ void Session::register_view(std::shared_ptr<pv::view::View> view)
        update_signals();
 }
 
-void Session::deregister_view(std::shared_ptr<pv::view::View> view)
+void Session::deregister_view(std::shared_ptr<views::ViewBase> view)
 {
-       views_.remove_if([&](std::shared_ptr<pv::view::View> v) {
+       views_.remove_if([&](std::shared_ptr<views::ViewBase> v) {
                return v == view; });
 
        if (views_.empty()) {
@@ -496,9 +496,9 @@ void Session::deregister_view(std::shared_ptr<pv::view::View> view)
        }
 }
 
-bool Session::has_view(std::shared_ptr<pv::view::View> view)
+bool Session::has_view(std::shared_ptr<views::ViewBase> view)
 {
-       for (std::shared_ptr<pv::view::View> v : views_)
+       for (std::shared_ptr<views::ViewBase> v : views_)
                if (v == view)
                        return true;
 
@@ -569,8 +569,8 @@ bool Session::add_decoder(srd_decoder *const dec)
                signalbase->set_decoder_stack(decoder_stack);
                signalbases_.insert(signalbase);
 
-               for (std::shared_ptr<pv::view::View> view : views_)
-                       view->add_decode_trace(signalbase);
+               for (std::shared_ptr<views::ViewBase> view : views_)
+                       view->add_decode_signal(signalbase);
        } catch (std::runtime_error e) {
                return false;
        }
@@ -585,8 +585,8 @@ bool Session::add_decoder(srd_decoder *const dec)
 
 void Session::remove_decode_signal(shared_ptr<data::SignalBase> signalbase)
 {
-       for (std::shared_ptr<pv::view::View> view : views_)
-               view->remove_decode_trace(signalbase);
+       for (std::shared_ptr<views::ViewBase> view : views_)
+               view->remove_decode_signal(signalbase);
 }
 #endif
 
@@ -609,10 +609,10 @@ void Session::update_signals()
        if (!device_) {
                signalbases_.clear();
                logic_data_.reset();
-               for (std::shared_ptr<pv::view::View> view : views_) {
+               for (std::shared_ptr<views::ViewBase> view : views_) {
                        view->clear_signals();
 #ifdef ENABLE_DECODE
-                       view->clear_decode_traces();
+                       view->clear_decode_signals();
 #endif
                }
                return;
@@ -624,10 +624,10 @@ void Session::update_signals()
        if (!sr_dev) {
                signalbases_.clear();
                logic_data_.reset();
-               for (std::shared_ptr<pv::view::View> view : views_) {
+               for (std::shared_ptr<views::ViewBase> view : views_) {
                        view->clear_signals();
 #ifdef ENABLE_DECODE
-                       view->clear_decode_traces();
+                       view->clear_decode_signals();
 #endif
                }
                return;
@@ -655,70 +655,76 @@ void Session::update_signals()
        }
 
        // Make the signals list
-       for (std::shared_ptr<pv::view::View> view : views_) {
-               unordered_set< shared_ptr<view::Signal> > prev_sigs(view->signals());
-               view->clear_signals();
-
-               for (auto channel : sr_dev->channels()) {
-                       shared_ptr<data::SignalBase> signalbase;
-                       shared_ptr<view::Signal> signal;
-
-                       // Find the channel in the old signals
-                       const auto iter = std::find_if(
-                               prev_sigs.cbegin(), prev_sigs.cend(),
-                               [&](const shared_ptr<view::Signal> &s) {
-                                       return s->base()->channel() == channel;
-                               });
-                       if (iter != prev_sigs.end()) {
-                               // Copy the signal from the old set to the new
-                               signal = *iter;
-                               view->add_signal(signal);
-                       } else {
-                               // Find the signalbase for this channel if possible
-                               signalbase.reset();
-                               for (const shared_ptr<data::SignalBase> b : signalbases_)
-                                       if (b->channel() == channel)
-                                               signalbase = b;
-
-                               switch(channel->type()->id()) {
-                               case SR_CHANNEL_LOGIC:
-                                       if (!signalbase) {
-                                               signalbase = shared_ptr<data::SignalBase>(
-                                                       new data::SignalBase(channel));
-                                               signalbases_.insert(signalbase);
-
-                                               all_signal_data_.insert(logic_data_);
-                                               signalbase->set_data(logic_data_);
+       for (std::shared_ptr<views::ViewBase> viewbase : views_) {
+               views::TraceView::View *trace_view =
+                       qobject_cast<views::TraceView::View*>(viewbase.get());
+
+               if (trace_view) {
+                       unordered_set< shared_ptr<views::TraceView::Signal> >
+                               prev_sigs(trace_view->signals());
+                       trace_view->clear_signals();
+
+                       for (auto channel : sr_dev->channels()) {
+                               shared_ptr<data::SignalBase> signalbase;
+                               shared_ptr<views::TraceView::Signal> signal;
+
+                               // Find the channel in the old signals
+                               const auto iter = std::find_if(
+                                       prev_sigs.cbegin(), prev_sigs.cend(),
+                                       [&](const shared_ptr<views::TraceView::Signal> &s) {
+                                               return s->base()->channel() == channel;
+                                       });
+                               if (iter != prev_sigs.end()) {
+                                       // Copy the signal from the old set to the new
+                                       signal = *iter;
+                                       trace_view->add_signal(signal);
+                               } else {
+                                       // Find the signalbase for this channel if possible
+                                       signalbase.reset();
+                                       for (const shared_ptr<data::SignalBase> b : signalbases_)
+                                               if (b->channel() == channel)
+                                                       signalbase = b;
+
+                                       switch(channel->type()->id()) {
+                                       case SR_CHANNEL_LOGIC:
+                                               if (!signalbase) {
+                                                       signalbase = shared_ptr<data::SignalBase>(
+                                                               new data::SignalBase(channel));
+                                                       signalbases_.insert(signalbase);
+
+                                                       all_signal_data_.insert(logic_data_);
+                                                       signalbase->set_data(logic_data_);
+                                               }
+
+                                               signal = shared_ptr<views::TraceView::Signal>(
+                                                       new views::TraceView::LogicSignal(*this,
+                                                               device_, signalbase));
+                                               trace_view->add_signal(signal);
+                                               break;
+
+                                       case SR_CHANNEL_ANALOG:
+                                       {
+                                               if (!signalbase) {
+                                                       signalbase = shared_ptr<data::SignalBase>(
+                                                               new data::SignalBase(channel));
+                                                       signalbases_.insert(signalbase);
+
+                                                       shared_ptr<data::Analog> data(new data::Analog());
+                                                       all_signal_data_.insert(data);
+                                                       signalbase->set_data(data);
+                                               }
+
+                                               signal = shared_ptr<views::TraceView::Signal>(
+                                                       new views::TraceView::AnalogSignal(
+                                                               *this, signalbase));
+                                               trace_view->add_signal(signal);
+                                               break;
                                        }
 
-                                       signal = shared_ptr<view::Signal>(
-                                               new view::LogicSignal(*this,
-                                                       device_, signalbase));
-                                       view->add_signal(signal);
-                                       break;
-
-                               case SR_CHANNEL_ANALOG:
-                               {
-                                       if (!signalbase) {
-                                               signalbase = shared_ptr<data::SignalBase>(
-                                                       new data::SignalBase(channel));
-                                               signalbases_.insert(signalbase);
-
-                                               shared_ptr<data::Analog> data(new data::Analog());
-                                               all_signal_data_.insert(data);
-                                               signalbase->set_data(data);
+                                       default:
+                                               assert(0);
+                                               break;
                                        }
-
-                                       signal = shared_ptr<view::Signal>(
-                                               new view::AnalogSignal(
-                                                       *this, signalbase));
-                                       view->add_signal(signal);
-                                       break;
-                               }
-
-                               default:
-                                       assert(0);
-                                       break;
                                }
                        }
                }
index 19860b6b5ad3c26ce04a2a2a52935d3aed535f65..95a50c21c73a098e4ab89f1e3060843d90d1e071 100644 (file)
@@ -42,7 +42,7 @@
 #include <QString>
 
 #include "util.hpp"
-#include "view/viewwidget.hpp"
+#include "views/viewbase.hpp"
 
 struct srd_decoder;
 struct srd_channel;
@@ -78,8 +78,8 @@ namespace toolbars {
 class MainBar;
 }
 
-namespace view {
-class View;
+namespace views {
+class ViewBase;
 }
 
 class Session : public QObject
@@ -110,9 +110,9 @@ public:
 
        void set_name(QString name);
 
-       const std::list< std::shared_ptr<pv::view::View> > views() const;
+       const std::list< std::shared_ptr<views::ViewBase> > views() const;
 
-       std::shared_ptr<pv::view::View> main_view() const;
+       std::shared_ptr<views::ViewBase> main_view() const;
 
        void set_main_bar(std::shared_ptr<pv::toolbars::MainBar> main_bar);
 
@@ -137,11 +137,11 @@ public:
 
        double get_samplerate() const;
 
-       void register_view(std::shared_ptr<pv::view::View> view);
+       void register_view(std::shared_ptr<views::ViewBase> view);
 
-       void deregister_view(std::shared_ptr<pv::view::View> view);
+       void deregister_view(std::shared_ptr<views::ViewBase> view);
 
-       bool has_view(std::shared_ptr<pv::view::View> view);
+       bool has_view(std::shared_ptr<views::ViewBase> view);
 
        const std::unordered_set< std::shared_ptr<data::SignalBase> >
                signalbases() const;
@@ -183,8 +183,8 @@ private:
        std::shared_ptr<devices::Device> device_;
        QString default_name_, name_;
 
-       std::list< std::shared_ptr<pv::view::View> > views_;
-       std::shared_ptr<pv::view::View> main_view_;
+       std::list< std::shared_ptr<views::ViewBase> > views_;
+       std::shared_ptr<pv::views::ViewBase> main_view_;
 
        std::shared_ptr<pv::toolbars::MainBar> main_bar_;
 
@@ -221,7 +221,7 @@ Q_SIGNALS:
 
        void frame_ended();
 
-       void add_view(const QString &title, view::ViewType type,
+       void add_view(const QString &title, views::ViewType type,
                Session *session);
 };
 
index b21d5a9fe57a80874b31b1f56ebebe1eaa984822..ea36a77e90957609158017775c9a01bfae694247 100644 (file)
@@ -809,7 +809,10 @@ void MainBar::export_file(shared_ptr<OutputFormat> format,
 
        // Selection only? Verify that the cursors are active and fetch their values
        if (selection_only) {
-               if (!session_.main_view()->cursors()->enabled()) {
+               views::TraceView::View *trace_view =
+                       qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+               if (!trace_view->cursors()->enabled()) {
                        show_session_error(tr("Missing Cursors"), tr("You need to set the " \
                                        "cursors before you can save the data enclosed by them " \
                                        "to a session file (e.g. using ALT-V - Show Cursors)."));
@@ -818,8 +821,8 @@ void MainBar::export_file(shared_ptr<OutputFormat> format,
 
                const double samplerate = session_.get_samplerate();
 
-               const pv::util::Timestamp& start_time = session_.main_view()->cursors()->first()->time();
-               const pv::util::Timestamp& end_time = session_.main_view()->cursors()->second()->time();
+               const pv::util::Timestamp& start_time = trace_view->cursors()->first()->time();
+               const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time();
 
                const uint64_t start_sample =
                        std::max((double)0, start_time.convert_to<double>() * samplerate);
@@ -1010,31 +1013,46 @@ void MainBar::on_actionConnect_triggered()
 
 void MainBar::on_actionViewZoomIn_triggered()
 {
-       session_.main_view()->zoom(1);
+       views::TraceView::View *trace_view =
+               qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+       trace_view->zoom(1);
 }
 
 void MainBar::on_actionViewZoomOut_triggered()
 {
-       session_.main_view()->zoom(-1);
+       views::TraceView::View *trace_view =
+               qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+       trace_view->zoom(-1);
 }
 
 void MainBar::on_actionViewZoomFit_triggered()
 {
-       session_.main_view()->zoom_fit(action_view_zoom_fit_->isChecked());
+       views::TraceView::View *trace_view =
+               qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+       trace_view->zoom_fit(action_view_zoom_fit_->isChecked());
 }
 
 void MainBar::on_actionViewZoomOneToOne_triggered()
 {
-       session_.main_view()->zoom_one_to_one();
+       views::TraceView::View *trace_view =
+               qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+       trace_view->zoom_one_to_one();
 }
 
 void MainBar::on_actionViewShowCursors_triggered()
 {
-       const bool show = !session_.main_view()->cursors_shown();
+       views::TraceView::View *trace_view =
+               qobject_cast<views::TraceView::View*>(session_.main_view().get());
+
+       const bool show = !trace_view->cursors_shown();
        if (show)
-               session_.main_view()->centre_cursors();
+               trace_view->centre_cursors();
 
-       session_.main_view()->show_cursors(show);
+       trace_view->show_cursors(show);
 }
 
 void MainBar::on_always_zoom_to_fit_changed(bool state)
index 0d38314dfa270e95cdbcb906a01b4f0d025f5004..20004777cac2eda854cd4d97fcb3f1a327081f16 100644 (file)
@@ -48,7 +48,8 @@ using std::shared_ptr;
 using std::deque;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor AnalogSignal::SignalColours[4] = {
        QColor(0xC4, 0xA0, 0x00),       // Yellow
@@ -385,5 +386,6 @@ void AnalogSignal::on_resolution_changed(int index)
                owner_->row_item_appearance_changed(false, true);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 1369a76cf24f2c7852cb27d7683cef103b26287e..08edda36f0dcc818135747189dc76ff8ada121c2 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_ANALOGSIGNAL_HPP
-#define PULSEVIEW_PV_VIEW_ANALOGSIGNAL_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_ANALOGSIGNAL_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_ANALOGSIGNAL_HPP
 
 #include "signal.hpp"
 
@@ -35,7 +35,8 @@ class AnalogSegment;
 class SignalBase;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class AnalogSignal : public Signal
 {
@@ -146,7 +147,8 @@ private:
        float resolution_; // e.g. 10 for 10 V/div
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_ANALOGSIGNAL_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_ANALOGSIGNAL_HPP
index 7432e3048e217c20a3e72a4d06bc6f1fffa4b53b..4f2ef126a83fa357e88f5b6d69872fd0802cc29e 100644 (file)
@@ -40,7 +40,8 @@ using std::shared_ptr;
 using std::numeric_limits;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor Cursor::FillColour(52, 101, 164);
 
@@ -97,5 +98,6 @@ shared_ptr<Cursor> Cursor::get_other_cursor() const
                cursors->second() : cursors->first();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index e64beaa9f626d68e6de7ebcd090231a6f73892da..319d3a746aaae4f74c254cfb294891bd3025efae 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_CURSOR_HPP
-#define PULSEVIEW_PV_VIEW_CURSOR_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSOR_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSOR_HPP
 
 #include "timemarker.hpp"
 
@@ -30,7 +30,8 @@
 class QPainter;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class Cursor : public TimeMarker
 {
@@ -69,7 +70,8 @@ private:
        std::shared_ptr<Cursor> get_other_cursor() const;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_CURSOR_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSOR_HPP
index f9d3e53ddd3fec6bae38fc39dfdaa3d257ef87f8..e2c80833f2503631814a5ee1888f1088af13da69 100644 (file)
@@ -34,7 +34,8 @@ using std::shared_ptr;
 using std::pair;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const int CursorPair::DeltaPadding = 8;
 const QColor CursorPair::ViewportFillColour(220, 231, 243);
@@ -192,5 +193,6 @@ pair<float, float> CursorPair::get_cursor_offsets() const
                ((second_->time() - view_.offset()) / view_.scale()).convert_to<float>());
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 7cbd4f05f53aa440c1f35820ef4a2bc65bf17f9c..110f9ea087c046fc6afd4c859f715e979cdbbd2c 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_CURSORPAIR_HPP
-#define PULSEVIEW_PV_VIEW_CURSORPAIR_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSORPAIR_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSORPAIR_HPP
 
 #include "cursor.hpp"
 
@@ -30,7 +30,8 @@
 class QPainter;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class CursorPair : public TimeItem
 {
@@ -105,7 +106,8 @@ private:
        QSizeF text_size_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_CURSORPAIR_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_CURSORPAIR_HPP
index 832b249d4caf00f0366b2f0024aae77f05f9a85a..af8afc0f0462208467404a4146c80bfc36d65130 100644 (file)
@@ -72,7 +72,8 @@ using std::unordered_set;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor DecodeTrace::DecodeColours[4] = {
        QColor(0xEF, 0x29, 0x29),       // Red
@@ -1009,5 +1010,6 @@ void DecodeTrace::on_show_hide_decoder(int index)
                owner_->row_item_appearance_changed(false, true);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index f56953209293532716cad294997482b4348dfa65..7e9c081be542b7f08235d73ec88853342320d054 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_DECODETRACE_HPP
-#define PULSEVIEW_PV_VIEW_DECODETRACE_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_DECODETRACE_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_DECODETRACE_HPP
 
 #include "trace.hpp"
 
@@ -58,7 +58,8 @@ namespace widgets {
 class DecoderGroupBox;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class DecodeTrace : public Trace
 {
@@ -218,7 +219,8 @@ private:
        QSignalMapper delete_mapper_, show_hide_mapper_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_DECODETRACE_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_DECODETRACE_HPP
index 779ea2eec24cd8d5088b2675f9ede6978c682ba1..3afd255fc7ac05eba350c331d0731a129c4277e1 100644 (file)
@@ -33,7 +33,8 @@
 using std::shared_ptr;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor Flag::FillColour(0x73, 0xD2, 0x16);
 
@@ -45,7 +46,7 @@ Flag::Flag(View &view, const pv::util::Timestamp& time, const QString &text) :
 
 Flag::Flag(const Flag &flag) :
        TimeMarker(flag.view_, FillColour, flag.time_),
-       std::enable_shared_from_this<pv::view::Flag>(flag)
+       std::enable_shared_from_this<Flag>(flag)
 {
 }
 
@@ -108,5 +109,6 @@ void Flag::on_text_changed(const QString &text)
        view_.time_item_appearance_changed(true, false);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index bc82934e161e5829d5d025f515931c5817a60268..1311d4a9eec3dd831d36d3de28af39bed538d353 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_FLAG_HPP
-#define PULSEVIEW_PV_VIEW_FLAG_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP
 
 #include <memory>
 
 class QMenu;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class Flag : public TimeMarker,
-       public std::enable_shared_from_this<pv::view::Flag>
+       public std::enable_shared_from_this<Flag>
 {
        Q_OBJECT
 
@@ -77,7 +78,8 @@ private:
        QString text_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_FLAG_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_FLAG_HPP
index ba0f9e61affba6c9314dfd66437142f99b6ce296..4ad28cf1ca7529932c88e86d1f9041439cf88c9d 100644 (file)
@@ -49,7 +49,8 @@ using std::stable_sort;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const int Header::Padding = 12;
 const int Header::BaselineOffset = 5;
@@ -218,5 +219,6 @@ void Header::on_ungroup()
        } while (restart);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index deb984d0dee90585c8661d2118ce3e652ccdc29a..9ea1ff455d0e84d18d7ef2daf957698d03f163bc 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_HEADER_HPP
-#define PULSEVIEW_PV_VIEW_HEADER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_HEADER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_HEADER_HPP
 
 #include <list>
 #include <memory>
@@ -28,7 +28,8 @@
 #include "marginwidget.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TraceTreeItem;
 class View;
@@ -63,7 +64,7 @@ private:
        /**
         * Gets the row items.
         */
-       std::vector< std::shared_ptr<pv::view::ViewItem> > items();
+       std::vector< std::shared_ptr<ViewItem> > items();
 
        /**
         * Gets the first view item which has a label that contains @c pt .
@@ -71,8 +72,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<pv::view::ViewItem> get_mouse_over_item(
-               const QPoint &pt);
+       std::shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
 
 private:
        void paintEvent(QPaintEvent *event);
@@ -88,7 +88,8 @@ private Q_SLOTS:
        void on_ungroup();
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_HEADER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_HEADER_HPP
index b8be8bbad0eb4a7c2ab438291f131b436e559263..bc0961f6a685afa15ffd7b1bd95732682d9fa0b9 100644 (file)
@@ -59,7 +59,8 @@ using sigrok::TriggerMatch;
 using sigrok::TriggerMatchType;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const float LogicSignal::Oversampling = 2.0f;
 
@@ -485,5 +486,6 @@ void LogicSignal::on_trigger()
        modify_trigger();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 8274b618a541b565126aa4c67562292957e29cd8..ce843df9af37ad2d4df189435943733847a7546b 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_LOGICSIGNAL_HPP
-#define PULSEVIEW_PV_VIEW_LOGICSIGNAL_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_LOGICSIGNAL_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_LOGICSIGNAL_HPP
 
 #include <QCache>
 
@@ -44,7 +44,8 @@ namespace data {
 class Logic;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class LogicSignal : public Signal
 {
@@ -145,7 +146,8 @@ private:
        static QCache<QString, const QPixmap> pixmap_cache_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_LOGICSIGNAL_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_LOGICSIGNAL_HPP
index 7e4fcdfa76aed109e0e8bfb6cb2032f6690bbdb6..4c3728710551bfceef85fad0234bffc51f44a119 100644 (file)
@@ -30,7 +30,8 @@
 using std::shared_ptr;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 MarginWidget::MarginWidget(View &parent) :
        ViewWidget(parent)
@@ -74,5 +75,6 @@ void MarginWidget::keyPressEvent(QKeyEvent *event)
        }
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 455aaf970aed35c734269ebd08ba03f8d6edf74a..b785877299cd49ff508354cb04f6d337d6725a4b 100644 (file)
@@ -28,7 +28,8 @@
 #include "viewwidget.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class ViewItem;
 
@@ -37,7 +38,7 @@ class MarginWidget : public ViewWidget
        Q_OBJECT
 
 public:
-       MarginWidget(pv::view::View &parent);
+       MarginWidget(View &parent);
 
        /**
         * The extended area that the margin widget would like to be sized to.
@@ -52,7 +53,7 @@ protected:
         * @param item the view item that has been clicked.
         */
        virtual void item_clicked(
-               const std::shared_ptr<pv::view::ViewItem> &item);
+               const std::shared_ptr<ViewItem> &item);
 
        /**
         * Shows the popup of a the specified @c ViewItem .
@@ -66,7 +67,8 @@ protected:
        virtual void keyPressEvent(QKeyEvent *event);
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
 #endif // PULSEVIEW_PV_MARGINWIDGET_HPP
index 4ad8b5998adf477abf4ac2343c1967675ce2fb87..f41ea52e4ebe0b6086becb1c42d1ec49b8ce3c4b 100644 (file)
 #include "rowitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 void RowItem::hover_point_changed()
 {
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 1c4878666ffcdc1da371db58d1eaca3c37d375ab..d2e2dd99ee1b824b8ce07cd4d4013a9bbda381c0 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_ROWITEM_HPP
-#define PULSEVIEW_PV_VIEW_ROWITEM_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
 
-#include "viewitem.hpp"
+#include <pv/view/viewitem.hpp>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class RowItem : public ViewItem
 {
@@ -34,7 +35,8 @@ public:
        virtual void hover_point_changed();
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_ROWITEM_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
index f6ec4ac78d7d142a486d2347287bd4693816ca5c..a8d25fc9df6a2ee4dfa5c3cfcfe9b9035e5c9b3a 100644 (file)
@@ -33,7 +33,8 @@ using std::shared_ptr;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const float Ruler::RulerHeight = 2.5f; // x Text Height
 const int Ruler::MinorTickSubdivision = 4;
@@ -271,5 +272,6 @@ void Ruler::resizeEvent(QResizeEvent*)
        invalidate_tick_position_cache();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 923cceb5fc3d37abb998d239ae8e490ab9e5d027..f6ce99dc833985b2175a13a55078128e6d2f96ff 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_RULER_HPP
-#define PULSEVIEW_PV_VIEW_RULER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_RULER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_RULER_HPP
 
 #include <functional>
 #include <memory>
@@ -36,7 +36,8 @@ struct tick_position_test_2;
 }
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TimeItem;
 class ViewItem;
@@ -109,7 +110,7 @@ private:
        /**
         * Gets the time items.
         */
-       std::vector< std::shared_ptr<pv::view::ViewItem> > items() override;
+       std::vector< std::shared_ptr<ViewItem> > items() override;
 
        /**
         * Gets the first view item which has a label that contains @c pt .
@@ -117,7 +118,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<pv::view::ViewItem> get_mouse_over_item(
+       std::shared_ptr<ViewItem> get_mouse_over_item(
                const QPoint &pt) override;
 
        void paintEvent(QPaintEvent *event) override;
@@ -174,7 +175,8 @@ private Q_SLOTS:
        void invalidate_tick_position_cache();
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_RULER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_RULER_HPP
index ad139f7e4ad21cbbb79a03355aa1917fdfbd2d03..59817eba2c334fcad882d296f5f0a4ac158e7d17 100644 (file)
@@ -40,7 +40,8 @@ using std::shared_ptr;
 using std::make_shared;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const char *const ChannelNames[] = {
        "CLK",
@@ -183,5 +184,6 @@ void Signal::on_enabled_changed(bool enabled)
                owner_->extents_changed(true, true);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 5bac1f44d83c821a5dd107d3818bad53ceeef167..35081cdedd006fd561a31ccb1991ea69c5300d21 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_SIGNAL_HPP
-#define PULSEVIEW_PV_VIEW_SIGNAL_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
 
 #include <memory>
 
@@ -41,7 +41,8 @@ class SignalBase;
 class SignalData;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class Signal : public Trace, public ViewItemOwner
 {
@@ -115,7 +116,8 @@ protected:
        QComboBox *name_widget_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
index a4c2b4199c3d3e109a6f949750b69443c574e074..074bfb125fbadb1d6c67a37343c63e4e2596dd3f 100644 (file)
@@ -30,7 +30,8 @@ using std::max;
 using std::min;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 SignalScaleHandle::SignalScaleHandle(Signal &owner) :
        owner_(owner)
@@ -103,5 +104,6 @@ void SignalScaleHandle::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
        p.drawEllipse(r);
 }
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
index 9d1ae93d96b16790c17970e717e0f94cdd4cd036..67dcf14d0382a39596047b920d6ced6a2a236811 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_SIGNALSCALEHANDLE_HPP
-#define PULSEVIEW_PV_VIEW_SIGNALSCALEHANDLE_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP
 
 #include "rowitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class Signal;
 
@@ -87,7 +88,8 @@ private:
        Signal &owner_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_SIGNALSCALEHANDLE_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNALSCALEHANDLE_HPP
index ec8dd1a49f5c0abc81d68e5e4845f873e3fa4b5a..e2ad342453a09d76a3087eae3177ae1c12869996 100644 (file)
@@ -22,7 +22,8 @@
 #include "view.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 TimeItem::TimeItem(View &view) :
        view_(view) {
@@ -34,5 +35,6 @@ void TimeItem::drag_by(const QPoint &delta)
                view_.scale());
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index cd6f5f2499c428555189257482e118fd4ab57709..35cbab3f097e8af5d76359aa947d93ed17e0ebd2 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TIMEITEM_HPP
-#define PULSEVIEW_PV_VIEW_TIMEITEM_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TIMEITEM_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TIMEITEM_HPP
 
 #include "viewitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class View;
 
@@ -58,7 +59,8 @@ protected:
        View &view_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TIMEITEM_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TIMEITEM_HPP
index b5662e4b6ba32e3ec6b90945f11799cf68cc59ce..52fcf45612167fa50f2cbc4dffbcd975990a2ef6 100644 (file)
@@ -38,7 +38,8 @@ using std::max;
 using std::min;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const int TimeMarker::ArrowSize = 4;
 
@@ -191,5 +192,6 @@ void TimeMarker::on_value_changed(const pv::util::Timestamp& value)
                set_time(value);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index c65dab78a7006f89c98a26298d754c677c0f1ee9..2280363a4c127697b1e09759e82793e9856e4ba9 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_MARKER_HPP
-#define PULSEVIEW_PV_VIEW_MARKER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_MARKER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_MARKER_HPP
 
 #include <QColor>
 #include <QDoubleSpinBox>
@@ -37,7 +37,8 @@ namespace widgets {
        class TimestampSpinBox;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class View;
 
@@ -127,7 +128,8 @@ protected:
        bool updating_value_widget_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_MARKER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_MARKER_HPP
index d9cccdb649e94a0669be4d30084323341cc5077d..3bdf725df4f4bc52fb739586da259191c5b386e0 100644 (file)
@@ -36,7 +36,8 @@
 #include <pv/widgets/popup.hpp>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QPen Trace::AxisPen(QColor(0, 0, 0, 30*256/100));
 const int Trace::LabelHitPadding = 2;
@@ -140,8 +141,6 @@ pv::widgets::Popup* Trace::create_popup(QWidget *parent)
 
 QRectF Trace::label_rect(const QRectF &rect) const
 {
-       using pv::view::View;
-
        QFontMetrics m(QApplication::font());
        const QSize text_size(
                m.boundingRect(QRect(), 0, base_->name()).width(), m.height());
@@ -278,5 +277,6 @@ void Trace::on_colouredit_changed(const QColor &colour)
        set_colour(colour);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 0a6735f59d0787539fec1ef1cdac4e5eb91c645c..9f0ecd44c2a54ca82706775887db0e453792c6fa 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TRACE_HPP
-#define PULSEVIEW_PV_VIEW_TRACE_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACE_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACE_HPP
 
 #include <QColor>
 #include <QPainter>
@@ -41,7 +41,8 @@ namespace widgets {
 class Popup;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class Trace : public TraceTreeItem
 {
@@ -135,7 +136,8 @@ private:
        QFormLayout *popup_form_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TRACE_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACE_HPP
index 9c1d49ff2b6645b5ae186b900b2fccf058b6f813..5abcc86a5ec9d3253581a6da6d2c948f95bbb8c5 100644 (file)
@@ -33,7 +33,8 @@ using std::shared_ptr;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const int TraceGroup::Padding = 8;
 const int TraceGroup::Width = 12;
@@ -64,13 +65,13 @@ const pv::Session& TraceGroup::session() const
        return owner_->session();
 }
 
-pv::view::View* TraceGroup::view()
+View* TraceGroup::view()
 {
        assert(owner_);
        return owner_->view();
 }
 
-const pv::view::View* TraceGroup::view() const
+const View* TraceGroup::view() const
 {
        assert(owner_);
        return owner_->view();
@@ -222,5 +223,6 @@ void TraceGroup::extents_changed(bool horz, bool vert)
                owner_->extents_changed(horz, vert);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 6407f1b2fa72f77056f635b9864275ffeae9ec0c..badddf7d396ae6e3ff005e756ca03603b96f5034 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TRACEGROUP_HPP
-#define PULSEVIEW_PV_VIEW_TRACEGROUP_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
 
 #include "tracetreeitem.hpp"
 #include "tracetreeitemowner.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TraceGroup : public TraceTreeItem, public TraceTreeItemOwner
 {
@@ -61,12 +62,12 @@ public:
        /**
         * Returns the view of the owner.
         */
-       virtual pv::view::View* view();
+       virtual View* view();
 
        /**
         * Returns the view of the owner.
         */
-       virtual const pv::view::View* view() const;
+       virtual const View* view() const;
 
        /**
         * Computes the vertical extents of the contents of this row item.
@@ -127,7 +128,8 @@ private Q_SLOTS:
        void on_ungroup();
 };
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TRACEGROUP_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEGROUP_HPP
index 3dcb63d16c10e215e065cf3c87f2dade2c352eda..5a1eda24ae397a4e806c83cebff8b21a210e00f7 100644 (file)
@@ -21,7 +21,8 @@
 #include "tracepalette.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor TracePalette::Colours[Cols * Rows] = {
 
@@ -66,5 +67,6 @@ const QColor TracePalette::Colours[Cols * Rows] = {
        QColor(0xFF, 0xFF, 0xFF),       // White
 };
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
index e878a225ea5181a9261cd70e40b2abc6910505a1..bf5f92cce1b84c14e82aeddb4be9d60f2be0c650 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_TRACEPALETTE_HPP
-#define PULSEVIEW_PV_TRACEPALETTE_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEPALETTE_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEPALETTE_HPP
 
 #include <QColor>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TracePalette
 {
@@ -34,8 +35,8 @@ public:
        static const QColor Colours[Cols * Rows];
 };
 
+} // namespace TraceView
+} // namespace views
+} // namespace pv
 
-} // view
-} // pv
-
-#endif // PULSEVIEW_PV_VIEW_TRACEPALETTE_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACEPALETTE_HPP
index 44c5d4b9feedd7a7827ea3bee3303c5ebbf86e70..d859ebbb231471d8537a717046eebd5c7f996402 100644 (file)
@@ -25,7 +25,8 @@
 #include "tracetreeitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 TraceTreeItem::TraceTreeItem() :
        owner_(nullptr),
@@ -143,5 +144,6 @@ void TraceTreeItem::set_bgcolour_state(bool state)
        bgcolour_state_ = state;
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index 8317db7b7454b040384f1b4933a3e6deb0f21b9a..56e1d73cbf2831e6785e009361a8e6ad28b0e338 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TRACETREEITEM_HPP
-#define PULSEVIEW_PV_VIEW_TRACETREEITEM_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP
 
 #include <memory>
 
 #include "rowitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TraceTreeItemOwner;
 
 class TraceTreeItem : public RowItem,
-       public std::enable_shared_from_this<pv::view::TraceTreeItem>
+       public std::enable_shared_from_this<TraceTreeItem>
 {
        Q_OBJECT
        Q_PROPERTY(int visual_v_offset
@@ -91,7 +92,7 @@ public:
         * Sets the owner this trace in the view trace hierachy.
         * @param The new owner of the trace.
         */
-       void set_owner(pv::view::TraceTreeItemOwner *owner);
+       void set_owner(TraceTreeItemOwner *owner);
 
        /**
         * Gets the visual y-offset of the axis.
@@ -136,7 +137,8 @@ private:
        QPropertyAnimation v_offset_animation_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TRACETREEITEM_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEM_HPP
index 1449d813dac5e808bef25ac18253cf08500b760f..528e0a033fb3aaec8d6477f1785edea050897328 100644 (file)
@@ -35,7 +35,8 @@ using std::static_pointer_cast;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const ViewItemOwner::item_list& TraceTreeItemOwner::child_items() const
 {
@@ -132,5 +133,6 @@ void TraceTreeItemOwner::restack_items()
 {
 }
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
index 6d4b6d19ba733b2e3cf606b479941ad6309b254f..b5f1a3ad7124ac45cc994e752581ae959917eace 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
-#define PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP
 
 #include "viewitemowner.hpp"
 #include "tracetreeitem.hpp"
@@ -28,7 +28,8 @@ namespace pv {
 
 class Session;
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TraceTreeItem;
 class View;
@@ -39,24 +40,24 @@ public:
        /**
         * Returns the view of the owner.
         */
-       virtual pv::view::View* view() = 0;
+       virtual View* view() = 0;
 
        /**
         * Returns the view of the owner.
         */
-       virtual const pv::view::View* view() const = 0;
+       virtual const View* view() const = 0;
 
        virtual int owner_visual_v_offset() const = 0;
 
        /**
-        * Returns the session of the onwer.
+        * Returns the session of the owner.
         */
-       virtual pv::Session& session() = 0;
+       virtual Session& session() = 0;
 
        /**
         * Returns the session of the owner.
         */
-       virtual const pv::Session& session() const = 0;
+       virtual const Session& session() const = 0;
 
        /**
         * Returns the number of nested parents that this row item owner has.
@@ -111,7 +112,8 @@ public:
        virtual void extents_changed(bool horz, bool vert) = 0;
 };
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TRACETREEITEMOWNER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRACETREEITEMOWNER_HPP
index f15672b5d9ef1d057f271633d0bb0182a908fbc0..9be3285510d89c866b8717ae82e36115129266f2 100644 (file)
@@ -22,7 +22,8 @@
 #include "view.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QColor TriggerMarker::Colour(0x00, 0x00, 0xB0);
 
@@ -78,5 +79,6 @@ void TriggerMarker::paint_fore(QPainter &p, const ViewItemPaintParams &pp)
        p.drawLine(QPointF(x, pp.top()), QPointF(x, pp.bottom()));
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index cbbcb3671d518673702f81401dadcfd2f367338a..3be22faa99b96587198ea342b0b7b27ad489efa5 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_TRIGGER_MARKER_HPP
-#define PULSEVIEW_PV_VIEW_TRIGGER_MARKER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP
 
 #include "timeitem.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class TriggerMarker : public TimeItem
 {
@@ -80,7 +81,8 @@ private:
        pv::util::Timestamp time_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_TRIGGER_MARKER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_TRIGGER_MARKER_HPP
index c69e75caec10594ba3122aa31a8344a2e5dd5b3a..a086d23de523f07e2be1192cbfc3b4bd2a028b09 100644 (file)
@@ -39,6 +39,7 @@
 #include <boost/thread/locks.hpp>
 
 #include <QApplication>
+#include <QHBoxLayout>
 #include <QEvent>
 #include <QFontMetrics>
 #include <QMouseEvent>
@@ -95,7 +96,8 @@ using std::vector;
 using std::weak_ptr;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const Timestamp View::MaxScale("1e9");
 const Timestamp View::MinScale("1e-12");
@@ -105,12 +107,41 @@ const int View::MaxViewAutoUpdateRate = 25; // No more than 25 Hz with sticky sc
 
 const int View::ScaleUnits[3] = {1, 2, 5};
 
+
+CustomAbstractScrollArea::CustomAbstractScrollArea(QWidget *parent) :
+       QAbstractScrollArea(parent)
+{
+}
+
+void CustomAbstractScrollArea::setViewportMargins(int left, int top, int right, int bottom)
+{
+       QAbstractScrollArea::setViewportMargins(left, top, right, bottom);
+}
+
+bool CustomAbstractScrollArea::viewportEvent(QEvent *event)
+{
+       switch (event->type()) {
+       case QEvent::Paint:
+       case QEvent::MouseButtonPress:
+       case QEvent::MouseButtonRelease:
+       case QEvent::MouseButtonDblClick:
+       case QEvent::MouseMove:
+       case QEvent::Wheel:
+       case QEvent::TouchBegin:
+       case QEvent::TouchUpdate:
+       case QEvent::TouchEnd:
+               return false;
+       default:
+               return QAbstractScrollArea::viewportEvent(event);
+       }
+}
+
 View::View(Session &session, QWidget *parent) :
-       QAbstractScrollArea(parent),
-       session_(session),
+       ViewBase(session, parent),
        viewport_(new Viewport(*this)),
        ruler_(new Ruler(*this)),
        header_(new Header(*this)),
+       scrollarea_(this),
        scale_(1e-3),
        offset_(0),
        updating_scroll_(false),
@@ -126,20 +157,11 @@ View::View(Session &session, QWidget *parent) :
        trigger_markers_(),
        hover_point_(-1, -1)
 {
-       connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
+       connect(scrollarea_.horizontalScrollBar(), SIGNAL(valueChanged(int)),
                this, SLOT(h_scroll_value_changed(int)));
-       connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
+       connect(scrollarea_.verticalScrollBar(), SIGNAL(valueChanged(int)),
                this, SLOT(v_scroll_value_changed()));
 
-       connect(&session_, SIGNAL(signals_changed()),
-               this, SLOT(signals_changed()));
-       connect(&session_, SIGNAL(capture_state_changed(int)),
-               this, SLOT(capture_state_updated(int)));
-       connect(&session_, SIGNAL(data_received()),
-               this, SLOT(data_updated()));
-       connect(&session_, SIGNAL(frame_ended()),
-               this, SLOT(data_updated()));
-
        connect(header_, SIGNAL(selection_changed()),
                ruler_, SLOT(clear_selection()));
        connect(ruler_, SIGNAL(selection_changed()),
@@ -162,7 +184,13 @@ View::View(Session &session, QWidget *parent) :
        delayed_view_updater_.setSingleShot(true);
        delayed_view_updater_.setInterval(1000 / MaxViewAutoUpdateRate);
 
-       setViewport(viewport_);
+       /* To let the scroll area fill up the parent QWidget (this), we need a layout */
+       QHBoxLayout *layout = new QHBoxLayout(this);
+       setLayout(layout);
+       layout->setContentsMargins(0, 0, 0, 0);
+       layout->addWidget(&scrollarea_);
+
+       scrollarea_.setViewport(viewport_);
 
        viewport_->installEventFilter(this);
        ruler_->installEventFilter(this);
@@ -190,7 +218,7 @@ const Session& View::session() const
        return session_;
 }
 
-std::unordered_set< std::shared_ptr<view::Signal> > View::signals() const
+std::unordered_set< std::shared_ptr<Signal> > View::signals() const
 {
        return signals_;
 }
@@ -200,25 +228,25 @@ void View::clear_signals()
        signals_.clear();
 }
 
-void View::add_signal(const shared_ptr<view::Signal> signal)
+void View::add_signal(const shared_ptr<Signal> signal)
 {
        signals_.insert(signal);
 }
 
 #ifdef ENABLE_DECODE
-void View::clear_decode_traces()
+void View::clear_decode_signals()
 {
        decode_traces_.clear();
 }
 
-void View::add_decode_trace(shared_ptr<data::SignalBase> signalbase)
+void View::add_decode_signal(shared_ptr<data::SignalBase> signalbase)
 {
-       shared_ptr<view::DecodeTrace> d(
-               new view::DecodeTrace(session_, signalbase, decode_traces_.size()));
+       shared_ptr<DecodeTrace> d(
+               new DecodeTrace(session_, signalbase, decode_traces_.size()));
        decode_traces_.push_back(d);
 }
 
-void View::remove_decode_trace(shared_ptr<data::SignalBase> signalbase)
+void View::remove_decode_signal(shared_ptr<data::SignalBase> signalbase)
 {
        for (auto i = decode_traces_.begin(); i != decode_traces_.end(); i++)
                if ((*i)->base() == signalbase) {
@@ -258,7 +286,7 @@ void View::save_settings(QSettings &settings) const
        oa << boost::serialization::make_nvp("offset", offset_);
        settings.setValue("offset", QString::fromStdString(ss.str()));
 
-       for (shared_ptr<view::Signal> signal : signals_) {
+       for (shared_ptr<Signal> signal : signals_) {
                settings.beginGroup(signal->base()->internal_name());
                signal->save_settings(settings);
                settings.endGroup();
@@ -281,7 +309,7 @@ void View::restore_settings(QSettings &settings)
                set_offset(offset);
        }
 
-       for (shared_ptr<view::Signal> signal : signals_) {
+       for (shared_ptr<Signal> signal : signals_) {
                settings.beginGroup(signal->base()->internal_name());
                signal->restore_settings(settings);
                settings.endGroup();
@@ -330,12 +358,12 @@ void View::set_offset(const pv::util::Timestamp& offset)
 
 int View::owner_visual_v_offset() const
 {
-       return -verticalScrollBar()->sliderPosition();
+       return -scrollarea_.verticalScrollBar()->sliderPosition();
 }
 
 void View::set_v_offset(int offset)
 {
-       verticalScrollBar()->setSliderPosition(offset);
+       scrollarea_.verticalScrollBar()->setSliderPosition(offset);
        header_->update();
        viewport_->update();
 }
@@ -730,6 +758,8 @@ void View::calculate_tick_spacing()
 void View::update_scroll()
 {
        assert(viewport_);
+       QScrollBar *hscrollbar = scrollarea_.horizontalScrollBar();
+       QScrollBar *vscrollbar = scrollarea_.verticalScrollBar();
 
        const QSize areaSize = viewport_->size();
 
@@ -741,31 +771,31 @@ void View::update_scroll()
 
        int major_tick_distance = (tick_period_ / scale_).convert_to<int>();
 
-       horizontalScrollBar()->setPageStep(areaSize.width() / 2);
-       horizontalScrollBar()->setSingleStep(major_tick_distance);
+       hscrollbar->setPageStep(areaSize.width() / 2);
+       hscrollbar->setSingleStep(major_tick_distance);
 
        updating_scroll_ = true;
 
        if (length < MaxScrollValue) {
-               horizontalScrollBar()->setRange(0, length);
-               horizontalScrollBar()->setSliderPosition(offset.convert_to<double>());
+               hscrollbar->setRange(0, length);
+               hscrollbar->setSliderPosition(offset.convert_to<double>());
        } else {
-               horizontalScrollBar()->setRange(0, MaxScrollValue);
-               horizontalScrollBar()->setSliderPosition(
+               hscrollbar->setRange(0, MaxScrollValue);
+               hscrollbar->setSliderPosition(
                        (offset_ * MaxScrollValue / (scale_ * length)).convert_to<double>());
        }
 
        updating_scroll_ = false;
 
        // Set the vertical scrollbar
-       verticalScrollBar()->setPageStep(areaSize.height());
-       verticalScrollBar()->setSingleStep(areaSize.height() / 8);
+       vscrollbar->setPageStep(areaSize.height());
+       vscrollbar->setSingleStep(areaSize.height() / 8);
 
        const pair<int, int> extents = v_extents();
 
        // Don't change the scrollbar range if there are no traces
        if (extents.first != extents.second)
-               verticalScrollBar()->setRange(extents.first - areaSize.height(),
+               vscrollbar->setRange(extents.first - areaSize.height(),
                        extents.second);
 
        if (scroll_needs_defaults)
@@ -774,7 +804,7 @@ void View::update_scroll()
 
 void View::reset_scroll()
 {
-       verticalScrollBar()->setRange(0, 0);
+       scrollarea_.verticalScrollBar()->setRange(0, 0);
 }
 
 void View::set_scroll_default()
@@ -807,8 +837,8 @@ void View::set_scroll_default()
 
 void View::update_layout()
 {
-       setViewportMargins(
-               header_->sizeHint().width() - pv::view::Header::BaselineOffset,
+       scrollarea_.setViewportMargins(
+               header_->sizeHint().width() - Header::BaselineOffset,
                ruler_->sizeHint().height(), 0, 0);
        ruler_->setGeometry(viewport_->x(), 0,
                viewport_->width(), ruler_->extended_size_hint().height());
@@ -923,24 +953,6 @@ bool View::eventFilter(QObject *object, QEvent *event)
        return QObject::eventFilter(object, event);
 }
 
-bool View::viewportEvent(QEvent *event)
-{
-       switch (event->type()) {
-       case QEvent::Paint:
-       case QEvent::MouseButtonPress:
-       case QEvent::MouseButtonRelease:
-       case QEvent::MouseButtonDblClick:
-       case QEvent::MouseMove:
-       case QEvent::Wheel:
-       case QEvent::TouchBegin:
-       case QEvent::TouchUpdate:
-       case QEvent::TouchEnd:
-               return false;
-       default:
-               return QAbstractScrollArea::viewportEvent(event);
-       }
-}
-
 void View::resizeEvent(QResizeEvent*)
 {
        update_layout();
@@ -982,7 +994,7 @@ void View::h_scroll_value_changed(int value)
                sticky_scrolling_changed(false);
        }
 
-       const int range = horizontalScrollBar()->maximum();
+       const int range = scrollarea_.horizontalScrollBar()->maximum();
        if (range < MaxScrollValue)
                set_offset(scale_ * value);
        else {
@@ -1012,7 +1024,8 @@ void View::signals_changed()
        // Do we need to set the vertical scrollbar to its default position later?
        // We do if there are no traces, i.e. the scroll bar has no range set
        bool reset_scrollbar =
-               verticalScrollBar()->minimum() == verticalScrollBar()->maximum();
+               (scrollarea_.verticalScrollBar()->minimum() ==
+                       scrollarea_.verticalScrollBar()->maximum());
 
        if (!session_.device()) {
                reset_scroll();
@@ -1251,5 +1264,6 @@ void View::on_hover_point_changed()
                r->hover_point_changed();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index cb1035c4c93ea202c240e6e42128565f54df419b..0412c697ba1db0aea118760618fb1fd99c97c04d 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEW_HPP
-#define PULSEVIEW_PV_VIEW_VIEW_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP
 
 #include <stdint.h>
 
@@ -34,6 +34,7 @@
 #include <QTimer>
 
 #include <pv/data/signaldata.hpp>
+#include <pv/views/viewbase.hpp>
 #include <pv/util.hpp>
 
 #include "cursorpair.hpp"
@@ -48,7 +49,9 @@ namespace pv {
 
 class Session;
 
-namespace view {
+namespace views {
+
+namespace TraceView {
 
 class CursorHeader;
 class DecodeTrace;
@@ -59,7 +62,16 @@ class Trace;
 class Viewport;
 class TriggerMarker;
 
-class View : public QAbstractScrollArea, public TraceTreeItemOwner {
+class CustomAbstractScrollArea : public QAbstractScrollArea {
+       Q_OBJECT
+
+public:
+       CustomAbstractScrollArea(QWidget *parent = 0);
+       void setViewportMargins(int left, int top, int right, int bottom);
+       bool viewportEvent(QEvent *event);
+};
+
+class View : public ViewBase, public TraceTreeItemOwner {
        Q_OBJECT
 
 private:
@@ -86,37 +98,37 @@ public:
        /**
         * Returns the signals contained in this view.
         */
-       std::unordered_set< std::shared_ptr<view::Signal> > signals() const;
+       std::unordered_set< std::shared_ptr<Signal> > signals() const;
 
-       void clear_signals();
+       virtual void clear_signals();
 
-       void add_signal(const std::shared_ptr<view::Signal> signal);
+       virtual void add_signal(const std::shared_ptr<Signal> signal);
 
 #ifdef ENABLE_DECODE
-       void clear_decode_traces();
+       virtual void clear_decode_signals();
 
-       void add_decode_trace(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void add_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
 
-       void remove_decode_trace(std::shared_ptr<data::SignalBase> signalbase);
+       virtual void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
 #endif
 
        /**
         * Returns the view of the owner.
         */
-       virtual pv::view::View* view();
+       virtual View* view();
 
        /**
         * Returns the view of the owner.
         */
-       virtual const pv::view::View* view() const;
+       virtual const View* view() const;
 
        Viewport* viewport();
 
        const Viewport* viewport() const;
 
-       void save_settings(QSettings &settings) const;
+       virtual void save_settings(QSettings &settings) const;
 
-       void restore_settings(QSettings &settings);
+       virtual void restore_settings(QSettings &settings);
 
        /**
         * Gets a list of time markers.
@@ -310,8 +322,6 @@ private:
 
        bool eventFilter(QObject *object, QEvent *event);
 
-       bool viewportEvent(QEvent *event);
-
        void resizeEvent(QResizeEvent *event);
 
 public:
@@ -372,18 +382,18 @@ private Q_SLOTS:
        void set_time_unit(pv::util::TimeUnit time_unit);
 
 private:
-       Session &session_;
-
        Viewport *viewport_;
        Ruler *ruler_;
        Header *header_;
 
-       std::unordered_set< std::shared_ptr<view::Signal> > signals_;
+       std::unordered_set< std::shared_ptr<Signal> > signals_;
 
 #ifdef ENABLE_DECODE
-       std::vector< std::shared_ptr<view::DecodeTrace> > decode_traces_;
+       std::vector< std::shared_ptr<DecodeTrace> > decode_traces_;
 #endif
 
+       CustomAbstractScrollArea scrollarea_;
+
        /// The view time scale in seconds per pixel.
        double scale_;
 
@@ -417,7 +427,8 @@ private:
        bool scroll_needs_defaults;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEW_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEW_HPP
index e9602f8790ddcec61767509cd694524cbd3d8cd6..7e581d952bcd00d8cc3f2ec4dd491fd74e5d24fb 100644 (file)
@@ -27,7 +27,8 @@
 #include <QPalette>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 const QSizeF ViewItem::LabelPadding(4, 0);
 const int ViewItem::HighlightRadius = 3;
@@ -135,5 +136,6 @@ QColor ViewItem::select_text_colour(QColor background)
        return (background.lightness() > 110) ? Qt::black : Qt::white;
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index a4eb6aef30423a79beefa6fa616357cdb8f3a483..63fd101cdebab04ad6baa8140add624727b23a9c 100644 (file)
@@ -37,7 +37,8 @@ namespace widgets {
 class Popup;
 }
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class ViewItemOwner;
 
@@ -172,7 +173,8 @@ private:
        bool selected_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
 #endif // PULSEVIEW_PV_VIEWITEM_HPP
index eed67a939e1c63b683dec71c6d2b42eaeeef3302..403b196bfd4b8848eb9d65fd02d53320d8c71e72 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
-#define PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP
 
 #include <algorithm>
 #include <cassert>
@@ -32,7 +32,8 @@
 #include <pv/session.hpp>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 template<class Owner, class Item> class ViewItemIterator
 {
@@ -123,7 +124,8 @@ void swap(ViewItemIterator<Owner, Item>& a, ViewItemIterator<Owner, Item>& b)
        a.swap(b);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP
index 8a704787e1727f0ff1b613f31a25727f622313d8..292d04e352056ac1cce8b3b5b64e411622b57ae0 100644 (file)
@@ -34,7 +34,8 @@ using std::shared_ptr;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 ViewItemOwner::iterator ViewItemOwner::begin()
 {
@@ -56,5 +57,6 @@ ViewItemOwner::const_iterator ViewItemOwner::end() const
        return const_iterator(this);
 }
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
index 49c251e7828c99098c15b65cb978157c5e9ae06f..d31df80ec7263caafe4b388a979849091c3fc719 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEWITEMOWNER_HPP
-#define PULSEVIEW_PV_VIEW_VIEWITEMOWNER_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMOWNER_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMOWNER_HPP
 
 #include <memory>
 #include <vector>
@@ -30,7 +30,8 @@ namespace pv {
 
 class Session;
 
-namespace view {
+namespace views {
+namespace TraceView {
 
 class ViewItem;
 class View;
@@ -90,7 +91,8 @@ protected:
        item_list items_;
 };
 
-} // view
-} // pv
+} // namespace TraceView
+} // namespace views
+} // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEWITEMOWNER_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMOWNER_HPP
index 998045c8efdca9a2c189b89e64dde3edbef0e256..1727bd5ae761a11b35e567b61c77510674ac878b 100644 (file)
@@ -26,7 +26,8 @@
 #include "viewitempaintparams.hpp"
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 ViewItemPaintParams::ViewItemPaintParams(
        const QRect &rect, double scale, const pv::util::Timestamp& offset) :
@@ -47,5 +48,6 @@ int ViewItemPaintParams::text_height()
        return QFontMetrics(font()).height();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index bba0d70e6fe72759a7742ba2728db482a798aa97..354d8c5cfe3edc976df6e83645712453f4e8a683 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP
-#define PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP
 
 #include "pv/util.hpp"
 
@@ -27,7 +27,8 @@
 #include <QRect>
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class ViewItemPaintParams
 {
@@ -86,7 +87,8 @@ private:
        pv::util::Timestamp offset_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP
index 6e07a2a8baa48a7ba0f0286e867235aad701873c..564b331cf99e6157c92f857f8126a80700c5efc4 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <QMouseEvent>
 
+#include <QDebug>
+
 using std::abs;
 using std::back_inserter;
 using std::copy;
@@ -45,7 +47,8 @@ using std::stable_sort;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 Viewport::Viewport(View &parent) :
        ViewWidget(parent),
@@ -223,5 +226,6 @@ void Viewport::wheelEvent(QWheelEvent *event)
        }
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index e4c504215d7f266b21ad5c741bb4b90629afa248..a8062fb650c6e9f8fe11d93c29fd6f4dbb6e3bc7 100644 (file)
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEWPORT_HPP
-#define PULSEVIEW_PV_VIEW_VIEWPORT_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWPORT_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWPORT_HPP
 
 #include <boost/optional.hpp>
 
@@ -34,7 +34,8 @@ class QPaintEvent;
 class Session;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 class View;
 
@@ -51,7 +52,7 @@ private:
         * @param item The item that is being hovered over, or @c nullptr
         * if no view item is being hovered over.
         */
-       void item_hover(const std::shared_ptr<pv::view::ViewItem> &item);
+       void item_hover(const std::shared_ptr<ViewItem> &item);
 
        /**
         * Gets the first view item which has a hit-box that contains @c pt .
@@ -59,8 +60,7 @@ private:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       std::shared_ptr<pv::view::ViewItem> get_mouse_over_item(
-               const QPoint &pt);
+       std::shared_ptr<ViewItem> get_mouse_over_item(const QPoint &pt);
 
        /**
         * Sets this item into the dragged state.
@@ -81,7 +81,7 @@ private:
        /**
         * Gets the items in the view widget.
         */
-       std::vector< std::shared_ptr<pv::view::ViewItem> > items();
+       std::vector< std::shared_ptr<ViewItem> > items();
 
        /**
         * Handles touch begin update and end events.
@@ -104,7 +104,8 @@ private:
        bool pinch_zoom_active_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEWPORT_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWPORT_HPP
index 79326d2a10a06742a3a2639a6cbd88376d06a704..3bd8c6b9d919522909a3578fe69240767f2e7788 100644 (file)
@@ -31,7 +31,8 @@ using std::shared_ptr;
 using std::vector;
 
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 ViewWidget::ViewWidget(View &parent) :
        QWidget(&parent),
@@ -298,5 +299,6 @@ void ViewWidget::leaveEvent(QEvent*)
        update();
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
index e6d2aa60125db71cba6fcb07b79403d4af90d4a7..cfcbda43ff3b68db0679d6f4a44fd5e50017adf5 100644 (file)
 class QTouchEvent;
 
 namespace pv {
-namespace view {
-
-enum ViewType {
-       TraceView,
-       TabularDecodeView
-};
+namespace views {
+namespace TraceView {
 
 class View;
 class ViewItem;
@@ -52,7 +48,7 @@ protected:
         * @remarks the default implementation does nothing.
         */
        virtual void item_hover(
-               const std::shared_ptr<pv::view::ViewItem> &item);
+               const std::shared_ptr<ViewItem> &item);
 
        /**
         * Indicates the event an a view item has been clicked.
@@ -60,7 +56,7 @@ protected:
         * @remarks the default implementation does nothing.
         */
        virtual void item_clicked(
-               const std::shared_ptr<pv::view::ViewItem> &item);
+               const std::shared_ptr<ViewItem> &item);
 
        /**
         * Returns true if the selection of row items allows dragging.
@@ -99,7 +95,7 @@ protected:
        /**
         * Gets the items in the view widget.
         */
-       virtual std::vector< std::shared_ptr<pv::view::ViewItem> > items() = 0;
+       virtual std::vector< std::shared_ptr<ViewItem> > items() = 0;
 
        /**
         * Gets the first view item which has a hit-box that contains @c pt .
@@ -107,7 +103,7 @@ protected:
         * @return the view item that has been found, or and empty
         *   @c shared_ptr if no item was found.
         */
-       virtual std::shared_ptr<pv::view::ViewItem> get_mouse_over_item(
+       virtual std::shared_ptr<ViewItem> get_mouse_over_item(
                const QPoint &pt) = 0;
 
        /**
@@ -144,14 +140,15 @@ Q_SIGNALS:
        void selection_changed();
 
 protected:
-       pv::view::View &view_;
+       pv::views::TraceView::View &view_;
        QPoint mouse_point_;
        QPoint mouse_down_point_;
        std::shared_ptr<ViewItem> mouse_down_item_;
        bool item_dragging_;
 };
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
 #endif // PULSEVIEW_PV_VIEWWIDGET_HPP
diff --git a/pv/views/viewbase.cpp b/pv/views/viewbase.cpp
new file mode 100644 (file)
index 0000000..382e115
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net>
+ *
+ * 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
+ */
+
+#ifdef ENABLE_DECODE
+#include <libsigrokdecode/libsigrokdecode.h>
+#endif
+
+#include <libsigrokcxx/libsigrokcxx.hpp>
+
+#include "pv/session.hpp"
+#include "pv/util.hpp"
+
+using std::shared_ptr;
+
+namespace pv {
+namespace views {
+
+ViewBase::ViewBase(Session &session, QWidget *parent) :
+       session_(session)
+{
+       (void)parent;
+
+       connect(&session_, SIGNAL(signals_changed()),
+               this, SLOT(signals_changed()));
+       connect(&session_, SIGNAL(capture_state_changed(int)),
+               this, SLOT(capture_state_updated(int)));
+       connect(&session_, SIGNAL(data_received()),
+               this, SLOT(data_updated()));
+       connect(&session_, SIGNAL(frame_ended()),
+               this, SLOT(data_updated()));
+}
+
+Session& ViewBase::session()
+{
+       return session_;
+}
+
+const Session& ViewBase::session() const
+{
+       return session_;
+}
+
+void ViewBase::clear_signals()
+{
+}
+
+#ifdef ENABLE_DECODE
+void ViewBase::clear_decode_signals()
+{
+}
+
+void ViewBase::add_decode_signal(shared_ptr<data::SignalBase> signalbase)
+{
+       (void)signalbase;
+}
+
+void ViewBase::remove_decode_signal(shared_ptr<data::SignalBase> signalbase)
+{
+       (void)signalbase;
+}
+#endif
+
+void ViewBase::save_settings(QSettings &settings) const
+{
+       (void)settings;
+}
+
+void ViewBase::restore_settings(QSettings &settings)
+{
+       (void)settings;
+}
+
+void ViewBase::trigger_event(util::Timestamp location)
+{
+       (void)location;
+}
+
+void ViewBase::signals_changed()
+{
+}
+
+void ViewBase::capture_state_updated(int state)
+{
+       (void)state;
+}
+
+void ViewBase::data_updated()
+{
+}
+
+} // namespace view
+} // namespace pv
diff --git a/pv/views/viewbase.hpp b/pv/views/viewbase.hpp
new file mode 100644 (file)
index 0000000..1ac8475
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
+ * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net>
+ *
+ * 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_VIEWS_VIEWBASE_HPP
+#define PULSEVIEW_PV_VIEWS_VIEWBASE_HPP
+
+#include <stdint.h>
+
+#include <memory>
+#include <set>
+#include <vector>
+
+#include <QWidget>
+
+#include <pv/data/signalbase.hpp>
+#include <pv/util.hpp>
+
+namespace pv {
+
+class Session;
+
+namespace view {
+class DecodeTrace;
+class Signal;
+}
+
+namespace views {
+
+enum ViewType {
+       ViewTypeTrace,
+       ViewTypeTabularDecode
+};
+
+class ViewBase : public QWidget {
+       Q_OBJECT
+
+public:
+       explicit ViewBase(Session &session, QWidget *parent = 0);
+
+       Session& session();
+       const Session& session() const;
+
+       virtual void clear_signals();
+
+#ifdef ENABLE_DECODE
+       virtual void clear_decode_signals();
+
+       virtual void add_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+
+       virtual void remove_decode_signal(std::shared_ptr<data::SignalBase> signalbase);
+#endif
+
+       virtual void save_settings(QSettings &settings) const;
+
+       virtual void restore_settings(QSettings &settings);
+
+public Q_SLOTS:
+       virtual void trigger_event(util::Timestamp location);
+       virtual void signals_changed();
+       virtual void capture_state_updated(int state);
+       virtual void data_updated();
+
+protected:
+       Session &session_;
+
+       util::TimeUnit time_unit_;
+};
+
+} // namespace views
+} // namespace pv
+
+#endif // PULSEVIEW_PV_VIEWS_VIEWBASE_HPP