]> sigrok.org Git - pulseview.git/commitdiff
Merge RowItem() into ViewItem()
authorSoeren Apel <redacted>
Mon, 25 Mar 2019 17:03:02 +0000 (18:03 +0100)
committerUwe Hermann <redacted>
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 b6c88f4f640c37ffea1b972b0c39f956ab8c4156..76e12935d1f788f1bd57fb4be05a3d113ace2dc2 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/rowitem.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/rowitem.hpp
        pv/views/trace/ruler.hpp
        pv/views/trace/signal.hpp
        pv/views/trace/timeitem.hpp
index d7da7e03706bdab45389f127c8bc874871a3c74a..1e97521afd7d7b41481eb1b259fc5e8df3e770bf 100644 (file)
@@ -99,16 +99,16 @@ void Header::paintEvent(QPaintEvent*)
 {
        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(),
-               [](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);
 
-       for (const shared_ptr<RowItem>& r : items) {
+       for (const shared_ptr<ViewItem>& r : items) {
                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 3605aa1a3b9c3fd031ca32211f92498f55ed355b..932e2b8c932285b0967993e2b5564569df6c5026 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <QPropertyAnimation>
 
-#include "rowitem.hpp"
+#include "viewitem.hpp"
 
 using std::enable_shared_from_this;
 using std::pair;
@@ -35,7 +35,7 @@ namespace trace {
 
 class TraceTreeItemOwner;
 
-class TraceTreeItem : public RowItem,
+class TraceTreeItem : public ViewItem,
        public enable_shared_from_this<TraceTreeItem>
 {
        Q_OBJECT
index 2dd8ade8c1fddb03c718c79179c4161c278dc461..2a3a6926190fb00c0c5aac1b35b0f564c554727e 100644 (file)
@@ -148,6 +148,11 @@ QColor ViewItem::select_text_color(QColor background)
        return (background.lightness() > 110) ? Qt::black : Qt::white;
 }
 
+void ViewItem::hover_point_changed(const QPoint &hp)
+{
+       (void)hp;
+}
+
 } // namespace trace
 } // namespace views
 } // namespace pv
index 5ce3bb608ec68156ba06c53b12409619e9772ec9..c445f609063df6386579d6fa6cebf74fd4a11c19 100644 (file)
@@ -167,6 +167,8 @@ public:
 
        virtual void delete_pressed();
 
+       virtual void hover_point_changed(const QPoint &hp);
+
 protected:
        static QPen highlight_pen();
 
index 2ca43a0b182da5fb6d9a3690faae7725055a55a7..6c51d0a1f4a4c44f4964421000edd7cc16aad9a7 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))
-               setCursor(dynamic_pointer_cast<RowItem>(item) ?
+               setCursor(dynamic_pointer_cast<ViewItem>(item) ?
                        Qt::SizeVerCursor : Qt::SizeHorCursor);
        else
                unsetCursor();
@@ -161,12 +161,12 @@ void Viewport::paintEvent(QPaintEvent*)
                &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(),
-               [](const shared_ptr<RowItem> &r) { return !r; }));
+               [](const shared_ptr<ViewItem> &r) { return !r; }));
 
        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());
@@ -187,7 +187,7 @@ void Viewport::paintEvent(QPaintEvent*)
                        (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);
        }
 
index 73c361f47d802dd469b8ad59f9a2f4e47f285060..46946a5cd5d36b5cff8d09d2f29471a8454867c2 100644 (file)
@@ -105,9 +105,9 @@ void ViewWidget::drag_items(const QPoint &delta)
        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);
 
index a237ad1222a8105e0f6192c735a58990347fc406..7e753153069323b75eb31ede1e0d4bd57c2fb6e1 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/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
@@ -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/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