Merge RowItem() into ViewItem()
authorSoeren Apel <soeren@apelpie.net>
Mon, 25 Mar 2019 17:03:02 +0000 (18:03 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 28 Mar 2019 18:41:16 +0000 (19:41 +0100)
CMakeLists.txt
pv/views/trace/header.cpp
pv/views/trace/rowitem.cpp [deleted file]
pv/views/trace/rowitem.hpp [deleted file]
pv/views/trace/tracetreeitem.hpp
pv/views/trace/viewitem.cpp
pv/views/trace/viewitem.hpp
pv/views/trace/viewport.cpp
pv/views/trace/viewwidget.cpp
test/CMakeLists.txt

index b6c88f4..76e1293 100644 (file)
@@ -275,7 +275,6 @@ set(pulseview_SOURCES
        pv/views/trace/header.cpp
        pv/views/trace/marginwidget.cpp
        pv/views/trace/logicsignal.cpp
        pv/views/trace/header.cpp
        pv/views/trace/marginwidget.cpp
        pv/views/trace/logicsignal.cpp
-       pv/views/trace/rowitem.cpp
        pv/views/trace/ruler.cpp
        pv/views/trace/signal.cpp
        pv/views/trace/timeitem.cpp
        pv/views/trace/ruler.cpp
        pv/views/trace/signal.cpp
        pv/views/trace/timeitem.cpp
@@ -339,7 +338,6 @@ set(pulseview_HEADERS
        pv/views/trace/header.hpp
        pv/views/trace/logicsignal.hpp
        pv/views/trace/marginwidget.hpp
        pv/views/trace/header.hpp
        pv/views/trace/logicsignal.hpp
        pv/views/trace/marginwidget.hpp
-       pv/views/trace/rowitem.hpp
        pv/views/trace/ruler.hpp
        pv/views/trace/signal.hpp
        pv/views/trace/timeitem.hpp
        pv/views/trace/ruler.hpp
        pv/views/trace/signal.hpp
        pv/views/trace/timeitem.hpp
index d7da7e0..1e97521 100644 (file)
@@ -99,16 +99,16 @@ void Header::paintEvent(QPaintEvent*)
 {
        const QRect rect(0, 0, width(), height());
 
 {
        const QRect rect(0, 0, width(), height());
 
-       vector< shared_ptr<RowItem> > items(view_.list_by_type<RowItem>());
+       vector< shared_ptr<ViewItem> > items(view_.list_by_type<ViewItem>());
 
        stable_sort(items.begin(), items.end(),
 
        stable_sort(items.begin(), items.end(),
-               [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
+               [](const shared_ptr<ViewItem> &a, const shared_ptr<ViewItem> &b) {
                        return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); });
 
        QPainter painter(this);
        painter.setRenderHint(QPainter::Antialiasing);
 
                        return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); });
 
        QPainter painter(this);
        painter.setRenderHint(QPainter::Antialiasing);
 
-       for (const shared_ptr<RowItem>& r : items) {
+       for (const shared_ptr<ViewItem>& r : items) {
                assert(r);
 
                const bool highlight = !item_dragging_ &&
                assert(r);
 
                const bool highlight = !item_dragging_ &&
diff --git a/pv/views/trace/rowitem.cpp b/pv/views/trace/rowitem.cpp
deleted file mode 100644 (file)
index c57043d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2015 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include "rowitem.hpp"
-
-namespace pv {
-namespace views {
-namespace trace {
-
-void RowItem::hover_point_changed(const QPoint &hp)
-{
-       (void)hp;
-}
-
-} // namespace trace
-} // namespace views
-} // namespace pv
diff --git a/pv/views/trace/rowitem.hpp b/pv/views/trace/rowitem.hpp
deleted file mode 100644 (file)
index d2a205f..0000000
+++ /dev/null
@@ -1,41 +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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
-#define PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
-
-#include "viewitem.hpp"
-
-namespace pv {
-namespace views {
-namespace trace {
-
-class RowItem : public ViewItem
-{
-       Q_OBJECT
-
-public:
-       virtual void hover_point_changed(const QPoint &hp);
-};
-
-} // namespace trace
-} // namespace views
-} // namespace pv
-
-#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_ROWITEM_HPP
index 3605aa1..932e2b8 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <QPropertyAnimation>
 
 
 #include <QPropertyAnimation>
 
-#include "rowitem.hpp"
+#include "viewitem.hpp"
 
 using std::enable_shared_from_this;
 using std::pair;
 
 using std::enable_shared_from_this;
 using std::pair;
@@ -35,7 +35,7 @@ namespace trace {
 
 class TraceTreeItemOwner;
 
 
 class TraceTreeItemOwner;
 
-class TraceTreeItem : public RowItem,
+class TraceTreeItem : public ViewItem,
        public enable_shared_from_this<TraceTreeItem>
 {
        Q_OBJECT
        public enable_shared_from_this<TraceTreeItem>
 {
        Q_OBJECT
index 2dd8ade..2a3a692 100644 (file)
@@ -148,6 +148,11 @@ QColor ViewItem::select_text_color(QColor background)
        return (background.lightness() > 110) ? Qt::black : Qt::white;
 }
 
        return (background.lightness() > 110) ? Qt::black : Qt::white;
 }
 
+void ViewItem::hover_point_changed(const QPoint &hp)
+{
+       (void)hp;
+}
+
 } // namespace trace
 } // namespace views
 } // namespace pv
 } // namespace trace
 } // namespace views
 } // namespace pv
index 5ce3bb6..c445f60 100644 (file)
@@ -167,6 +167,8 @@ public:
 
        virtual void delete_pressed();
 
 
        virtual void delete_pressed();
 
+       virtual void hover_point_changed(const QPoint &hp);
+
 protected:
        static QPen highlight_pen();
 
 protected:
        static QPen highlight_pen();
 
index 2ca43a0..6c51d0a 100644 (file)
@@ -69,7 +69,7 @@ shared_ptr<ViewItem> Viewport::get_mouse_over_item(const QPoint &pt)
 void Viewport::item_hover(const shared_ptr<ViewItem> &item, QPoint pos)
 {
        if (item && item->is_draggable(pos))
 void Viewport::item_hover(const shared_ptr<ViewItem> &item, QPoint pos)
 {
        if (item && item->is_draggable(pos))
-               setCursor(dynamic_pointer_cast<RowItem>(item) ?
+               setCursor(dynamic_pointer_cast<ViewItem>(item) ?
                        Qt::SizeVerCursor : Qt::SizeHorCursor);
        else
                unsetCursor();
                        Qt::SizeVerCursor : Qt::SizeHorCursor);
        else
                unsetCursor();
@@ -161,12 +161,12 @@ void Viewport::paintEvent(QPaintEvent*)
                &ViewItem::paint_back, &ViewItem::paint_mid,
                &ViewItem::paint_fore, nullptr};
 
                &ViewItem::paint_back, &ViewItem::paint_mid,
                &ViewItem::paint_fore, nullptr};
 
-       vector< shared_ptr<RowItem> > row_items(view_.list_by_type<RowItem>());
+       vector< shared_ptr<ViewItem> > row_items(view_.list_by_type<ViewItem>());
        assert(none_of(row_items.begin(), row_items.end(),
        assert(none_of(row_items.begin(), row_items.end(),
-               [](const shared_ptr<RowItem> &r) { return !r; }));
+               [](const shared_ptr<ViewItem> &r) { return !r; }));
 
        stable_sort(row_items.begin(), row_items.end(),
 
        stable_sort(row_items.begin(), row_items.end(),
-               [](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {
+               [](const shared_ptr<ViewItem> &a, const shared_ptr<ViewItem> &b) {
                        return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); });
 
        const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
                        return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); });
 
        const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
@@ -187,7 +187,7 @@ void Viewport::paintEvent(QPaintEvent*)
                        (t.get()->*(*paint_func))(p, time_pp);
 
                ViewItemPaintParams row_pp(rect(), view_.scale(), view_.offset());
                        (t.get()->*(*paint_func))(p, time_pp);
 
                ViewItemPaintParams row_pp(rect(), view_.scale(), view_.offset());
-               for (const shared_ptr<RowItem>& r : row_items)
+               for (const shared_ptr<ViewItem>& r : row_items)
                        (r.get()->*(*paint_func))(p, row_pp);
        }
 
                        (r.get()->*(*paint_func))(p, row_pp);
        }
 
index 73c361f..46946a5 100644 (file)
@@ -105,9 +105,9 @@ void ViewWidget::drag_items(const QPoint &delta)
        bool item_dragged = false;
 
        // Drag the row items
        bool item_dragged = false;
 
        // Drag the row items
-       const vector< shared_ptr<RowItem> > row_items(
-               view_.list_by_type<RowItem>());
-       for (const shared_ptr<RowItem>& r : row_items)
+       const vector< shared_ptr<ViewItem> > row_items(
+               view_.list_by_type<ViewItem>());
+       for (const shared_ptr<ViewItem>& r : row_items)
                if (r->dragging()) {
                        r->drag_by(delta);
 
                if (r->dragging()) {
                        r->drag_by(delta);
 
index a237ad1..7e75315 100644 (file)
@@ -63,7 +63,6 @@ set(pulseview_TEST_SOURCES
        ${PROJECT_SOURCE_DIR}/pv/views/trace/header.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/marginwidget.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/logicsignal.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/header.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/marginwidget.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/logicsignal.cpp
-       ${PROJECT_SOURCE_DIR}/pv/views/trace/rowitem.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/ruler.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/signal.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/timeitem.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/ruler.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/signal.cpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/timeitem.cpp
@@ -136,7 +135,6 @@ set(pulseview_TEST_HEADERS
        ${PROJECT_SOURCE_DIR}/pv/views/trace/header.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/logicsignal.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/marginwidget.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/header.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/logicsignal.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/marginwidget.hpp
-       ${PROJECT_SOURCE_DIR}/pv/views/trace/rowitem.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/ruler.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/signal.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/timeitem.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/ruler.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/signal.hpp
        ${PROJECT_SOURCE_DIR}/pv/views/trace/timeitem.hpp