Skip to content

Commit

Permalink
QML plugin (#216)
Browse files Browse the repository at this point in the history
* QML executor plugin

Signed-off-by: Remigiusz Kołłątaj <[email protected]>

Co-authored-by: Sebastian Wieczorek <[email protected]>
Co-authored-by: Remigiusz Kołłątaj <[email protected]>
Co-authored-by: Remigiusz Kołłątaj <[email protected]>
  • Loading branch information
4 people authored May 31, 2021
1 parent 7748b6a commit 4acee7b
Show file tree
Hide file tree
Showing 31 changed files with 2,538 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ environment:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
GENERATOR: '"MinGW Makefiles"'
BUILD_TYPE: Release
QT_PATH: C:\Qt\5.15.0\mingw81_32
QT_PATH: C:\Qt\5.15\mingw81_32
BOOST_PATH: C:\Libraries\boost_1_73_0
PACKAGE: 1
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
Expand Down
3 changes: 3 additions & 0 deletions CANdevResources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
<file>files/images/light/CANbus_icon_arrow_down.svg</file>
<file>files/images/light/CANbus_icon_arrow_up.svg</file>
<file>files/images/db_icon.svg</file>
<file>files/images/light/CANbus_icon_Log.svg</file>
<file>files/images/light/CANbus_icon_OpenProject_Grey.svg</file>
<file>files/images/light/CANbus_icon_edit.svg</file>
</qresource>
<qresource prefix="/">
<file>files/json/projectConfigSchema.json</file>
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ set(CMAKE_CXX_STANDARD 14)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

#windows build may need to point to boost, moidify with your boost install dir and uncomment
#set(BOOST_ROOT C:/local/boost_1_73_0/)
#set(BOOST_INCLUDE_DIR C:/local/boost_1_73_0/)
#set(BOOST_LIBRARY_DIR C:/local/boost_1_73_0/libs)


option(WITH_COVERAGE "Build with coverage" OFF)
option(WITH_TOOLS "Build tools directory" OFF)
option(DEV_BUILD "Development build will include GIT hash and branch to versioning" ON)
Expand Down Expand Up @@ -49,6 +55,9 @@ find_package(Qt5SerialBus ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Widgets ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Test ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Svg ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Qml ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5Quick ${QT_REQUIRED_VERSION} REQUIRED)
find_package(Qt5QuickWidgets ${QT_REQUIRED_VERSION} REQUIRED)
message(STATUS "Qt Version found: ${Qt5Core_VERSION}")

set_property(TARGET Qt5::SerialBus PROPERTY INTERFACE_COMPILE_FEATURES "")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CANdevStudio
[![Build Status](https://travis-ci.org/GENIVI/CANdevStudio.svg?branch=master)](https://travis-ci.org/GENIVI/CANdevStudio) [![Build status](https://ci.appveyor.com/api/projects/status/wak1kdfueyn68h0t/branch/master?svg=true)](https://ci.appveyor.com/project/rkollataj/candevstudio-j9v77/branch/master) [![codecov](https://codecov.io/gh/GENIVI/CANdevStudio/branch/master/graph/badge.svg)](https://codecov.io/gh/GENIVI/CANdevStudio) [![Download](https://api.bintray.com/packages/rkollataj/CANdevStudio/releases/images/download.svg) ](https://bintray.com/rkollataj/CANdevStudio/releases/_latestVersion) [![Download](https://api.bintray.com/packages/rkollataj/CANdevStudio/master/images/download.svg) ](https://bintray.com/rkollataj/CANdevStudio/master/_latestVersion) [![Doxygen](https://img.shields.io/badge/Doxygen-master-blue.svg)](https://genivi.github.io/CANdevStudio/master/)
[![Build Status](https://travis-ci.com/GENIVI/CANdevStudio.svg?branch=master)](https://travis-ci.org/GENIVI/CANdevStudio) [![Build status](https://ci.appveyor.com/api/projects/status/wak1kdfueyn68h0t/branch/master?svg=true)](https://ci.appveyor.com/project/rkollataj/candevstudio-j9v77/branch/master) [![codecov](https://codecov.io/gh/GENIVI/CANdevStudio/branch/master/graph/badge.svg)](https://codecov.io/gh/GENIVI/CANdevStudio) [![Download](https://api.bintray.com/packages/rkollataj/CANdevStudio/releases/images/download.svg) ](https://bintray.com/rkollataj/CANdevStudio/releases/_latestVersion) [![Download](https://api.bintray.com/packages/rkollataj/CANdevStudio/master/images/download.svg) ](https://bintray.com/rkollataj/CANdevStudio/master/_latestVersion) [![Doxygen](https://img.shields.io/badge/Doxygen-master-blue.svg)](https://genivi.github.io/CANdevStudio/master/)



Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ coverage:
- "src/components/cansignalsender/gui"
- "src/components/cansignalviewer/gui"
- "src/components/canload/canloadpainter.h"
- "src/components/qmlexecutor/gui"
- "src/common/guiinterface"
- "src/common/candbpainter.cpp"
- "src/common/candbpainter.h"
Expand Down
4 changes: 2 additions & 2 deletions files/css/darkStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ QPushButton#pbStartNew, #pbStartOpen, #close {
border: 0px;
}

QWidget#CanRawSenderPrivate, #CanRawViewPrivate, #CanRawFilterPrivate, #CanSignalDataPrivate, #CanSignalSenderPrivate {
QWidget#CanRawSenderPrivate, #CanRawViewPrivate, #CanRawFilterPrivate, #CanSignalDataPrivate, #CanSignalSenderPrivate, #QMLExecutorPrivate {
background-color: #616161;
}

QToolButton#toolSwitch {
image: url(:/images/files/images/light/CANbus_icon_Switch_dark.svg);
}

QLineEdit#searchLine {
QLineEdit#searchLine, #fileName {
background-color: #3a3a3a;
border : 1px solid #adadad;
padding: 2px;
Expand Down
2 changes: 1 addition & 1 deletion files/css/lightStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ QToolButton#toolSwitch {
image: url(:/images/files/images/light/CANbus_icon_Switch.svg);
}

QLineEdit#searchLine {
QLineEdit#searchLine, #fileName {
border : 1px solid #adadad;
padding: 2px;
}
Expand Down
68 changes: 68 additions & 0 deletions files/images/light/CANbus_icon_Log.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions files/images/light/CANbus_icon_OpenProject_Grey.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions files/images/light/CANbus_icon_edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/common/bcastmsgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static const QString ConfigChanged = "config_changed";
static const QString NodeDeleted = "node_deleted";
static const QString InitDone = "init_done";
static const QString CanDbUpdated = "can_db_updated";
static const QString GuiStyleSwitched = "gui_style_switched";

}

Expand Down
29 changes: 29 additions & 0 deletions src/components/qmlexecutor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set(COMPONENT_NAME qmlexecutor)

set(SRC
gui/qmlexecutor.ui
gui/qmlexecutorguiimpl.h
gui/qmlexecutorguiint.h
qmlexecutor.cpp
qmlexecutor_p.cpp
qmlexecutormodel.cpp
canbusmodel.hpp
)

set(QT_QML_LIBS Qt5::Quick Qt5::Widgets Qt5::Qml Qt5::QuickWidgets)

add_library(${COMPONENT_NAME} ${SRC})
target_link_libraries(${COMPONENT_NAME} cds-common ${QT_QML_LIBS})
target_include_directories(${COMPONENT_NAME} INTERFACE ${Qt5Widgets_INCLUDE_DIRS})
target_include_directories(${COMPONENT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

if(WITH_TESTS)

add_executable(${COMPONENT_NAME}_test tests/${COMPONENT_NAME}_test.cpp tests/guimock.h)
target_link_libraries(${COMPONENT_NAME}_test ${COMPONENT_NAME} Qt5::Test fakeit ${QT_QML_LIBS})
add_test(NAME ${COMPONENT_NAME}_test COMMAND ${COMPONENT_NAME}_test)

add_executable(${COMPONENT_NAME}model_test tests/${COMPONENT_NAME}model_test.cpp)
target_link_libraries(${COMPONENT_NAME}model_test ${COMPONENT_NAME} Qt5::Test fakeit ${QT_QML_LIBS})
add_test(NAME ${COMPONENT_NAME}model_test COMMAND ${COMPONENT_NAME}model_test)
endif()
57 changes: 57 additions & 0 deletions src/components/qmlexecutor/canbusmodel.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#ifndef CANBUSMODEL_HPP
#define CANBUSMODEL_HPP

#include <QObject>
#include <QCanBusFrame>

/**
* @brief The CANBusModel class is used to interface CAN operations with QML stack
*/
class CANBusModel : public QObject
{
Q_OBJECT

public:
CANBusModel() : QObject(nullptr) {}

signals:
/**
* @brief Sends a CAN frame
* @param frameId frame identifier
* @param frameData frame payload
*/
void sendFrame(const quint32& frameId, const QByteArray& frameData);

/**
* @brief Send a CAN named signal
* @param name signal name
* @param value signal value
*/
void sendSignal(const QString& name, const QVariant& value);

/**
* @brief A CAN frame was received
* @param frameId frame identifier
* @param frameData frame payload
*/
void frameReceived(const quint32& frameId, const QByteArray& frameData);

/**
* @brief A CAN signal was received
* @param signal name
* @param signal value
*/
void signalReceived(const QString& name, const QVariant& value);

/**
* @brief The simulation was started
*/
void simulationStarted();

/**
* @brief The simulation was stopped
*/
void simulationStopped();
};

#endif // CANBUSMODEL_HPP
Loading

0 comments on commit 4acee7b

Please sign in to comment.