Skip to content

Commit 21dffea

Browse files
authored
CanRawFilter (GENIVI#109)
Signed-off-by: Remigiusz Kołłątaj <[email protected]>
1 parent aa51ae7 commit 21dffea

27 files changed

+1770
-5
lines changed

3rdParty/nodeeditor

CANdevResources.qrc

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
<file>files/images/light/CANbus_icon_CheckBoxOn_disabled.svg</file>
8484
<file>files/images/dark/CANbus_icon_CheckBoxOff_disabled.svg</file>
8585
<file>files/images/dark/CANbus_icon_CheckBoxOn_disabled.svg</file>
86+
<file>files/images/light/CANbus_icon_arrow_down.svg</file>
87+
<file>files/images/light/CANbus_icon_arrow_up.svg</file>
8688
</qresource>
8789
<qresource prefix="/">
8890
<file>files/json/projectConfigSchema.json</file>

codecov.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ coverage:
22
ignore:
33
- "src/components/canrawsender/gui"
44
- "src/components/canrawview/gui"
5+
- "src/components/canrawfilter/gui"
56
- "src/gui"
67
- "src/common/guiinterface"
78
- "tests"

files/css/darkStyle.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ QPushButton#pbStartNew, #pbStartOpen, #close {
131131
border: 0px;
132132
}
133133

134-
QWidget#CanRawSenderPrivate, #CanRawViewPrivate {
134+
QWidget#CanRawSenderPrivate, #CanRawViewPrivate, #CanRawFilterPrivate {
135135
background-color: #616161;
136136
}
137137

files/css/lightStyle.css

+12-2
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ QTableView#tv QTableCornerButton::section {
7373
border: 1px solid #f7f7f7;
7474
}
7575

76-
QTableView#tv {
76+
QTableView#rxTv QTableCornerButton::section {
77+
background-color: #f7f7f7;
78+
border: 1px solid #f7f7f7;
79+
}
80+
81+
QTableView#txTv QTableCornerButton::section {
82+
background-color: #f7f7f7;
83+
border: 1px solid #f7f7f7;
84+
}
85+
86+
QTableView#tv, QTableView#txTv, QTableView#rxTv {
7787
background: #ffffff;
7888
gridline-color: #d3d3d3;
7989
color: #626262
8090
}
8191

82-
QTableView#tv::item {
92+
QTableView#tv::item, QTableView#txTv::item, QTableView#rxTv::item{
8393
background: #ffffff;
8494
border : 0px;
8595
border-color: #ff0000;
Loading
Loading

src/components/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ add_subdirectory(projectconfig)
55
add_subdirectory(canrawplayer)
66
add_subdirectory(canrawlogger)
77
add_subdirectory(canload)
8+
add_subdirectory(canrawfilter)
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(COMPONENT_NAME canrawfilter)
2+
3+
set(SRC
4+
gui/canrawfilter.ui
5+
gui/canrawfilterguiimpl.h
6+
canrawfilter.cpp
7+
canrawfilter_p.cpp
8+
)
9+
10+
add_library(${COMPONENT_NAME} ${SRC})
11+
target_link_libraries(${COMPONENT_NAME} Qt5::Widgets Qt5::Core Qt5::SerialBus nodes cds-common)
12+
target_include_directories(${COMPONENT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#include "canrawfilter.h"
2+
#include "canrawfilter_p.h"
3+
#include <confighelpers.h>
4+
#include <log.h>
5+
#include <QCanBusFrame>
6+
7+
CanRawFilter::CanRawFilter()
8+
: d_ptr(new CanRawFilterPrivate(this))
9+
{
10+
}
11+
12+
CanRawFilter::CanRawFilter(CanRawFilterCtx&& ctx)
13+
: d_ptr(new CanRawFilterPrivate(this, std::move(ctx)))
14+
{
15+
}
16+
17+
CanRawFilter::~CanRawFilter()
18+
{
19+
}
20+
21+
QWidget* CanRawFilter::mainWidget()
22+
{
23+
Q_D(CanRawFilter);
24+
25+
return d->_ui.mainWidget();
26+
}
27+
28+
void CanRawFilter::setConfig(const QJsonObject& json)
29+
{
30+
Q_D(CanRawFilter);
31+
32+
d_ptr->setSettings(json);
33+
}
34+
35+
void CanRawFilter::setConfig(const QObject& qobject)
36+
{
37+
Q_D(CanRawFilter);
38+
39+
configHelpers::setQConfig(qobject, getSupportedProperties(), d->_props);
40+
}
41+
42+
QJsonObject CanRawFilter::getConfig() const
43+
{
44+
return d_ptr->getSettings();
45+
}
46+
47+
std::shared_ptr<QObject> CanRawFilter::getQConfig() const
48+
{
49+
const Q_D(CanRawFilter);
50+
51+
return configHelpers::getQConfig(getSupportedProperties(), d->_props);
52+
}
53+
54+
void CanRawFilter::configChanged()
55+
{
56+
}
57+
58+
bool CanRawFilter::mainWidgetDocked() const
59+
{
60+
return d_ptr->_docked;
61+
}
62+
63+
ComponentInterface::ComponentProperties CanRawFilter::getSupportedProperties() const
64+
{
65+
return d_ptr->getSupportedProperties();
66+
}
67+
68+
void CanRawFilter::stopSimulation()
69+
{
70+
Q_D(CanRawFilter);
71+
72+
d->_simStarted = false;
73+
}
74+
75+
void CanRawFilter::startSimulation()
76+
{
77+
Q_D(CanRawFilter);
78+
79+
d->_simStarted = true;
80+
}
81+
82+
void CanRawFilter::txFrameIn(const QCanBusFrame& frame)
83+
{
84+
Q_D(CanRawFilter);
85+
86+
if(d->acceptTxFrame(frame) && d->_simStarted) {
87+
emit txFrameOut(frame);
88+
}
89+
}
90+
91+
void CanRawFilter::rxFrameIn(const QCanBusFrame& frame)
92+
{
93+
Q_D(CanRawFilter);
94+
95+
if(d->acceptRxFrame(frame) && d->_simStarted) {
96+
emit rxFrameOut(frame);
97+
}
98+
}
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#ifndef CANRAWFILTER_H
2+
#define CANRAWFILTER_H
3+
4+
#include <QtCore/QObject>
5+
#include <QtCore/QScopedPointer>
6+
#include <componentinterface.h>
7+
#include <context.h>
8+
#include <memory>
9+
10+
class CanRawFilterPrivate;
11+
class QWidget;
12+
class QCanBusFrame;
13+
struct CanRawFilterGuiInt;
14+
typedef Context<CanRawFilterGuiInt> CanRawFilterCtx;
15+
16+
class CanRawFilter : public QObject, public ComponentInterface {
17+
Q_OBJECT
18+
Q_DECLARE_PRIVATE(CanRawFilter)
19+
20+
public:
21+
CanRawFilter();
22+
explicit CanRawFilter(CanRawFilterCtx&& ctx);
23+
~CanRawFilter();
24+
25+
QWidget* mainWidget() override;
26+
void setConfig(const QJsonObject& json) override;
27+
void setConfig(const QObject& qobject) override;
28+
QJsonObject getConfig() const override;
29+
std::shared_ptr<QObject> getQConfig() const override;
30+
void configChanged() override;
31+
bool mainWidgetDocked() const override;
32+
ComponentInterface::ComponentProperties getSupportedProperties() const override;
33+
34+
signals:
35+
void mainWidgetDockToggled(QWidget* widget) override;
36+
void txFrameOut(const QCanBusFrame& frame);
37+
void rxFrameOut(const QCanBusFrame& frame);
38+
39+
public slots:
40+
void txFrameIn(const QCanBusFrame& frame);
41+
void rxFrameIn(const QCanBusFrame& frame);
42+
void stopSimulation() override;
43+
void startSimulation() override;
44+
45+
private:
46+
QScopedPointer<CanRawFilterPrivate> d_ptr;
47+
};
48+
49+
#endif //CANRAWFILTER_H

0 commit comments

Comments
 (0)