Skip to content

Commit

Permalink
Release v5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Feb 13, 2024
2 parents cb3f83d + 391416e commit 736d6d0
Show file tree
Hide file tree
Showing 30 changed files with 170 additions and 270 deletions.
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ option (CC_TOOLS_QT_BUILD_PLUGIN_UDP_SOCKET "Build UDP socket plugin." ${CC_TOOL
option (CC_TOOLS_QT_BUILD_PLUGIN_RAW_DATA_PROTOCOL "Build raw data protocol plugin." ${CC_TOOLS_QT_BUILD_PLUGINS})
option (CC_TOOLS_QT_BUILD_PLUGIN_DEMO_PROTOCOL "Build demo protocol plugin." OFF)


# Extra configuration variables
set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use")
set (CC_TOOLS_QT_MAJOR_QT_VERSION 5 CACHE STRING "Major Qt version")
# CC_TOOLS_QT_MAJOR_QT_VERSION - Major Qt version, defaults to 5.

#######################################################################
# Used standard CMake variables
# CMAKE_CXX_STANDARD - Defaults to 17.

if (CMAKE_TOOLCHAIN_FILE AND EXISTS ${CMAKE_TOOLCHAIN_FILE})
message(STATUS "Loading toolchain from ${CMAKE_TOOLCHAIN_FILE}")
endif()
#######################################################################

set (CMAKE_SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/cmake")

if ("${CMAKE_CXX_STANDARD}" STREQUAL "")
set (CMAKE_CXX_STANDARD 17)
endif ()

if ("${CC_TOOLS_QT_MAJOR_QT_VERSION}" STREQUAL "")
set (CC_TOOLS_QT_MAJOR_QT_VERSION 5)
endif ()

include(GNUInstallDirs)
set (INSTALL_NAME "cc_tools_qt")
set (LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR})
Expand Down Expand Up @@ -136,6 +141,10 @@ include_directories (
include (${PROJECT_SOURCE_DIR}/cmake/CC_FindQt.cmake)
cc_find_qt_major ()

set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTOUIC ON)
set (CMAKE_AUTORCC ON)

add_subdirectory (lib)
add_subdirectory (plugin)
add_subdirectory (app)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Overview
# CommsChampion Tools
This project contains a set of tool applications , which can be used to
develop, monitor and debug custom binary communication protocols, that were
developed using the [COMMS Library](https://github.com/commschamp/comms).
Expand Down Expand Up @@ -76,6 +76,8 @@ cmake -DCC_TOOLS_QT_MAJOR_QT_VERSION=6 ...
It is highly recommended to open main [CMakeLists.txt](CMakeLists.txt) file and review the available
configuration options and variables.

Since **v5.0** this project uses and requires minimum **C++17** support from the compiler.

# Developing Custom Socket/Filter/Protocol Plugin
The full tutorial as well as API documentation can be downloaded as
**doc_cc_tools_qt_vX.zip** archive from
Expand Down
7 changes: 1 addition & 6 deletions app/cc_dump/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ function (bin_cc_dump)
RecordMessageHandler.cpp
)

cc_qt_wrap_cpp(
moc
AppMgr.h
)

add_executable(${name} ${src} ${moc})
add_executable(${name} ${src})
target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core)

install (
Expand Down
57 changes: 10 additions & 47 deletions app/cc_view/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ function (bin_cc_view)
widget/PluginConfigWrapWidget.cpp
widget/PluginConfigWrapsListWidget.cpp
widget/MsgCommentDialog.cpp
widget/field/FieldWidget.cpp
widget/MessagesFilterDialog.cpp
widget/MessageDisplayWidget.h
widget/field/FieldWidget.cpp
widget/field/ShortIntValueFieldWidget.cpp
widget/field/LongIntValueFieldWidget.cpp
widget/field/LongLongIntValueFieldWidget.cpp
Expand All @@ -54,49 +55,7 @@ function (bin_cc_view)
widget/field/SpecialValueWidget.cpp
)

cc_qt_wrap_cpp(
moc
GuiAppMgr.h
ShortcutMgr.h
widget/MessageDisplayWidget.h
widget/MessageWidget.h
widget/DefaultMessageWidget.h
widget/RecvAreaToolBar.h
widget/SendAreaToolBar.h
widget/MsgListWidget.h
widget/MsgDetailsWidget.h
widget/ProtocolsStackWidget.h
widget/MessageUpdateDialog.h
widget/RawHexDataDialog.h
widget/PluginsListWidget.h
widget/PluginConfigDialog.h
widget/MainWindowWidget.h
widget/MainToolbar.h
widget/DefaultMessageDisplayWidget.h
widget/MsgCommentDialog.h
widget/MessagesFilterDialog.h
widget/RightPaneWidget.h
widget/field/FieldWidget.h
widget/field/ShortIntValueFieldWidget.h
widget/field/LongIntValueFieldWidget.h
widget/field/LongLongIntValueFieldWidget.h
widget/field/UnsignedLongLongIntValueFieldWidget.h
widget/field/ScaledIntValueFieldWidget.h
widget/field/BitmaskValueFieldWidget.h
widget/field/EnumValueFieldWidget.h
widget/field/StringFieldWidget.h
widget/field/BitfieldFieldWidget.h
widget/field/OptionalFieldWidget.h
widget/field/BundleFieldWidget.h
widget/field/ArrayListRawDataFieldWidget.h
widget/field/ArrayListFieldWidget.h
widget/field/FloatValueFieldWidget.h
widget/field/VariantFieldWidget.h
widget/field/UnknownValueFieldWidget.h
widget/field/SpecialValueWidget.h
)

cc_qt_wrap_ui(
set (
ui
ui/MainWindowWidget.ui
ui/MsgListWidget.ui
Expand Down Expand Up @@ -126,15 +85,19 @@ function (bin_cc_view)
ui/MsgCommentDialog.ui
ui/MessagesFilterDialog.ui
)

cc_qt_add_resources(resources ${CMAKE_CURRENT_SOURCE_DIR}/ui.qrc)

set (resources
ui.qrc
)

set (gui_exe)
if (WIN32 AND ("${CMAKE_BUILD_TYPE}" STREQUAL "Release"))
set (gui_exe WIN32)
endif ()

add_executable(${name} ${gui_exe} ${src} ${moc} ${ui} ${resources})
set (CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui")

add_executable(${name} ${gui_exe} ${ui} ${resources} ${src})
target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Widgets Qt::Core)

install (
Expand Down
29 changes: 29 additions & 0 deletions app/cc_view/src/widget/DefaultMessageDisplayWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@

#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QSplitter>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonDocument>

#include "MsgDetailsWidget.h"
#include "ProtocolsStackWidget.h"

#include "cc_tools_qt/property/message.h"

namespace cc_tools_qt
{

Expand Down Expand Up @@ -57,6 +61,7 @@ void DefaultMessageDisplayWidget::displayMessageImpl(
bool force)
{
assert(msg);
m_displayedMsg = msg;
m_msgDetailsWidget->updateTitle(msg);
m_protocolsDetailsWidget->displayMessage(std::move(msg), force);
}
Expand Down Expand Up @@ -93,7 +98,31 @@ void DefaultMessageDisplayWidget::msgUpdated()
{
if (!m_protocolsDetailsWidget->isExtraInfoSelected()) {
emit sigMsgUpdated();
return;
}

assert(m_displayedMsg);
if (!m_displayedMsg) {
return;
}

auto extraInfoMsg = property::message::ExtraInfoMsg().getFrom(*m_displayedMsg);
if ((!extraInfoMsg) || (!extraInfoMsg->isValid())) {
return;
}

auto extraData = extraInfoMsg->encodeData();
if (extraData.empty()) {
property::message::ExtraInfo().setTo(QVariantMap(), *m_displayedMsg);
return;
}

auto doc =
QJsonDocument::fromJson(
QByteArray(
reinterpret_cast<const char*>(&extraData[0]),
static_cast<int>(extraData.size())));
property::message::ExtraInfo().setTo(doc.object().toVariantMap(), *m_displayedMsg);
}

} // namespace cc_tools_qt
Expand Down
1 change: 1 addition & 0 deletions app/cc_view/src/widget/DefaultMessageDisplayWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private slots:
private:
MsgDetailsWidget* m_msgDetailsWidget = nullptr;
ProtocolsStackWidget* m_protocolsDetailsWidget = nullptr;
MessagePtr m_displayedMsg;
bool m_globalEditEnabled = true;
};

Expand Down
25 changes: 0 additions & 25 deletions cmake/CC_FindQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,3 @@ macro (cc_find_qt_components)
endif ()
endforeach ()
endmacro ()

macro (cc_qt_wrap_cpp _name)
if ("${CC_TOOLS_QT_MAJOR_QT_VERSION}" STREQUAL "5")
qt5_wrap_cpp(${_name} ${ARGN})
else ()
qt_wrap_cpp(${_name} ${ARGN})
endif ()
endmacro ()

macro (cc_qt_wrap_ui _name)
if ("${CC_TOOLS_QT_MAJOR_QT_VERSION}" STREQUAL "5")
qt5_wrap_ui(${_name} ${ARGN})
else ()
qt_wrap_ui(${_name} ${ARGN})
endif ()
endmacro ()

macro (cc_qt_add_resources _name)
if ("${CC_TOOLS_QT_MAJOR_QT_VERSION}" STREQUAL "5")
qt5_add_resources(${_name} ${ARGN})
else ()
qt_add_resources(${_name} ${ARGN})
endif ()
endmacro ()

12 changes: 2 additions & 10 deletions demo/cc_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function (cc_plugin_demo)


set (src
Plugin.h
Plugin.cpp
Protocol.cpp
TransportMessage.cpp
Expand All @@ -29,16 +30,7 @@ function (cc_plugin_demo)
message/Variants.cpp
)

set (hdr
Plugin.h
)

cc_qt_wrap_cpp(
moc
${hdr}
)

add_library (${name} MODULE ${src} ${moc})
add_library (${name} MODULE ${src})
target_link_libraries(${name} PRIVATE cc::cc_tools_qt)

target_compile_options(${name} PRIVATE
Expand Down
14 changes: 14 additions & 0 deletions doxygen/page_filter_plugin.dox
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@
/// };
/// @endcode
///
/// @subsection page_filter_plugin_socket_connect Socket Connection Status
/// The communication link is driven by the @ref page_socket_plugin "socket" plugin.
/// Quite often it can be necessary for the filter plugin to be aware about socket
/// connection status. To do so override the virtual @ref cc_tools_qt::Filter::socketConnectionReportImpl()
/// function
/// @code
/// class MyFilter : public cc_tools_qt::Filter
/// {
/// ...
/// protected:
/// virtual void socketConnectionReportImpl(bool connected) override;
/// };
/// @endcode
///
/// @subsection page_filter_plugin_data_proc Processing Data
/// The new incoming data will be reported to the @b filter using virtual
/// cc_tools_qt::Filter::recvDataImpl(). The derived class must override and
Expand Down
3 changes: 1 addition & 2 deletions doxygen/page_protocol_plugin.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
/// @tableofcontents
/// Developing the @b protocol plugins is significantly more complex than
/// developing the @b socket or @b filter ones. Please follow this tutorial,
/// while observing the implementation of the
/// <a href="https://github.com/commschamp/cc_tools_qt#demo-protocol">Demo Protocol</a>
/// while observing the implementation of the <b>Demo Protocol</b>
/// (the sources are
/// <a href="https://github.com/commschamp/cc_tools_qt/tree/master/demo">here</a>)
/// provided as part of the
Expand Down
2 changes: 1 addition & 1 deletion doxygen/page_socket_plugin.dox
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
/// the data has arrived from in case of network socket. Such extra information
/// can be reported by the driving application when reporting received message details.
/// For example, take a look at
/// <a href="https://github.com/commschamp/cc_tools_qt/blob/master/plugin/tcp_socket/server/Socket.cpp">TCP/IP Server Socket</a> implementation.
/// <a href="https://github.com/commschamp/cc_tools_qt/blob/master/plugin/tcp_socket/server/TcpServerSocket.cpp">TCP/IP Server Socket</a> implementation.
///
/// @subsection page_socket_plugin_data_send Sending Data
/// The socket object receives requests to send outgoing data using call to
Expand Down
2 changes: 1 addition & 1 deletion lib/include/cc_tools_qt/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CC_TOOLS_QT_MINOR_VERSION 0U

/// @brief Patch level of the library
#define CC_TOOLS_QT_PATCH_VERSION 0U
#define CC_TOOLS_QT_PATCH_VERSION 1U

/// @brief Macro to create numeric version as single unsigned number
#define CC_TOOLS_QT_MAKE_VERSION(major_, minor_, patch_) \
Expand Down
7 changes: 1 addition & 6 deletions lib/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ function (lib_tools)
property/field.cpp
)

cc_qt_wrap_cpp(
moc
MsgSendMgrImpl.h
)

add_library(${name} SHARED ${src} ${moc})
add_library(${name} SHARED ${src})
add_library (cc::${PROJECT_NAME} ALIAS ${name})

target_link_libraries(${name} PUBLIC cc::comms Qt::Widgets Qt::Core ${CC_PLATFORM_SPECIFIC})
Expand Down
2 changes: 1 addition & 1 deletion lib/src/MsgMgrImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void MsgMgrImpl::addFilter(FilterPtr filter)
data.append(std::move(dataPtr));
for (auto iter = m_filters.rbegin() + static_cast<std::intmax_t>(revIdx); iter != m_filters.rend(); ++iter) {

if (!data.isEmpty()) {
if (data.isEmpty()) {
break;
}

Expand Down
11 changes: 1 addition & 10 deletions plugin/echo_socket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,10 @@ function (plugin_echo_socket)
set (src
EchoSocket.cpp
EchoSocketPlugin.cpp
)

set (hdr
EchoSocket.h
EchoSocketPlugin.h
)

cc_qt_wrap_cpp(
moc
${hdr}
)

add_library (${name} MODULE ${src} ${moc})
add_library (${name} MODULE ${src})
target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core)

install (
Expand Down
10 changes: 1 addition & 9 deletions plugin/null_socket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,10 @@ function (plugin_null_socket)
set (src
NullSocket.cpp
NullSocketPlugin.cpp
)

set (hdr
NullSocketPlugin.h
)

cc_qt_wrap_cpp(
moc
${hdr}
)

add_library (${name} MODULE ${src} ${moc})
add_library (${name} MODULE ${src})
target_link_libraries(${name} PRIVATE cc::${PROJECT_NAME} Qt::Core)

install (
Expand Down
Loading

0 comments on commit 736d6d0

Please sign in to comment.