mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2026-07-28 04:45:30 +00:00
Remove the base class SelectableItem
This commit is contained in:
@@ -277,7 +277,6 @@ set(DSView_SOURCES
|
||||
DSView/pv/view/dsldial.cpp
|
||||
DSView/pv/dock/dsotriggerdock.cpp
|
||||
DSView/pv/view/trace.cpp
|
||||
DSView/pv/view/selectableitem.cpp
|
||||
DSView/pv/data/decoderstack.cpp
|
||||
DSView/pv/data/decode/rowdata.cpp
|
||||
DSView/pv/data/decode/row.cpp
|
||||
@@ -379,7 +378,6 @@ set(DSView_HEADERS
|
||||
DSView/pv/dialogs/search.h
|
||||
DSView/pv/dock/dsotriggerdock.h
|
||||
DSView/pv/view/trace.h
|
||||
DSView/pv/view/selectableitem.h
|
||||
DSView/pv/data/decoderstack.h
|
||||
DSView/pv/view/decodetrace.h
|
||||
DSView/pv/widgets/fakelineedit.h
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/*
|
||||
* This file is part of the DSView project.
|
||||
* DSView is based on PulseView.
|
||||
*
|
||||
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
* Copyright (C) 2014 DreamSourceLab <support@dreamsourcelab.com>
|
||||
*
|
||||
* Copyright (C) 2023 DreamSourceLab <support@dreamsourcelab.com>
|
||||
*
|
||||
* 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
|
||||
@@ -20,38 +20,17 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "selectableitem.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPalette>
|
||||
#include <QApplication>
|
||||
#ifndef DSV_BASE_DEF_H
|
||||
#define DSV_BASE_DEF_H
|
||||
|
||||
namespace pv {
|
||||
namespace view {
|
||||
#ifdef _WIN32
|
||||
#define DSV_EXPORT __declspec(dllexport)
|
||||
#define DSV_IMPORT __declspec(dllimport)
|
||||
#define DSV_HIDDEN
|
||||
#else
|
||||
#define DSV_EXPORT __attribute__((visibility("default")))
|
||||
#define DSV_IMPORT __attribute__((visibility("default")))
|
||||
#define DSV_HIDDEN __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
const int SelectableItem::HighlightRadius = 6;
|
||||
|
||||
SelectableItem::SelectableItem() :
|
||||
_selected(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool SelectableItem::selected()
|
||||
{
|
||||
return _selected;
|
||||
}
|
||||
|
||||
void SelectableItem::select(bool select)
|
||||
{
|
||||
_selected = select;
|
||||
}
|
||||
|
||||
QPen SelectableItem::highlight_pen()
|
||||
{
|
||||
return QPen(QApplication::palette().brush(
|
||||
QPalette::Highlight), HighlightRadius,
|
||||
Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file is part of the DSView project.
|
||||
* DSView is based on PulseView.
|
||||
*
|
||||
* Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
* Copyright (C) 2014 DreamSourceLab <support@dreamsourcelab.com>
|
||||
*
|
||||
* 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 DSVIEW_PV_SELECTABLEITEM_H
|
||||
#define DSVIEW_PV_SELECTABLEITEM_H
|
||||
|
||||
#include <list>
|
||||
#include <QObject>
|
||||
#include <QPen>
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
class QWidget;
|
||||
|
||||
namespace pv {
|
||||
|
||||
namespace view {
|
||||
|
||||
//Trace's base class
|
||||
class SelectableItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static const int HighlightRadius;
|
||||
|
||||
protected:
|
||||
SelectableItem();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Returns true if the signal has been selected by the user.
|
||||
*/
|
||||
bool selected();
|
||||
|
||||
/**
|
||||
* Selects or deselects the signal.
|
||||
*/
|
||||
void select(bool select = true);
|
||||
|
||||
protected:
|
||||
static QPen highlight_pen();
|
||||
|
||||
private:
|
||||
bool _selected;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
||||
#endif // DSVIEW_PV_SELECTABLEITEM_H
|
||||
@@ -61,6 +61,7 @@ Trace::Trace(QString name, uint16_t index, int type) :
|
||||
{
|
||||
_index_list.push_back(index);
|
||||
_view_index = -1;
|
||||
_selected = false;
|
||||
}
|
||||
|
||||
Trace::Trace(QString name, std::list<int> index_list, int type, int sec_index) :
|
||||
@@ -74,6 +75,7 @@ Trace::Trace(QString name, std::list<int> index_list, int type, int sec_index) :
|
||||
_typeWidth(SquareNum)
|
||||
{
|
||||
_view_index = -1;
|
||||
_selected = false;
|
||||
}
|
||||
|
||||
Trace::Trace(const Trace &t) :
|
||||
@@ -90,6 +92,7 @@ Trace::Trace(const Trace &t) :
|
||||
_text_size(t._text_size)
|
||||
{
|
||||
_view_index = -1;
|
||||
_selected = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -347,18 +350,6 @@ QColor Trace::get_text_colour()
|
||||
return (_colour.lightness() > 64) ? Qt::black : Qt::white;
|
||||
}
|
||||
|
||||
void Trace::on_text_changed(const QString &text)
|
||||
{
|
||||
set_name(text);
|
||||
text_changed();
|
||||
}
|
||||
|
||||
void Trace::on_colour_changed(const QColor &colour)
|
||||
{
|
||||
set_colour(colour);
|
||||
colour_changed();
|
||||
}
|
||||
|
||||
int Trace::rows_size()
|
||||
{
|
||||
return 1;
|
||||
|
||||
+12
-7
@@ -28,10 +28,8 @@
|
||||
#include <QPen>
|
||||
#include <QRect>
|
||||
#include <QString>
|
||||
|
||||
#include <QObject>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "selectableitem.h"
|
||||
#include "dsldial.h"
|
||||
|
||||
class QFormLayout;
|
||||
@@ -43,7 +41,7 @@ class View;
|
||||
class Viewport;
|
||||
|
||||
//base class
|
||||
class Trace : public SelectableItem
|
||||
class Trace : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -295,6 +293,14 @@ public:
|
||||
return _view_index;
|
||||
}
|
||||
|
||||
inline bool selected(){
|
||||
return _selected;
|
||||
}
|
||||
|
||||
inline void select(bool flag){
|
||||
_selected = flag;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
@@ -322,9 +328,7 @@ private:
|
||||
void compute_text_size(QPainter &p);
|
||||
|
||||
private slots:
|
||||
void on_text_changed(const QString &text);
|
||||
void on_colour_changed(const QColor &colour);
|
||||
virtual void resize();
|
||||
void resize();
|
||||
|
||||
signals:
|
||||
void visibility_changed();
|
||||
@@ -347,6 +351,7 @@ protected:
|
||||
int _view_index;
|
||||
|
||||
QSizeF _text_size;
|
||||
bool _selected;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
|
||||
Reference in New Issue
Block a user