Skip to content

Commit

Permalink
[ISSUE #111][COMPONENTS] Introduce components architecture in the pro…
Browse files Browse the repository at this point in the history
…ject

1. [x] Have you followed the guidelines in our [Contributing document](../blob/master/CONTRIBUTING.md)?
2. [x] Have you checked to ensure there aren't other open [Pull Requests](../pulls) for the same update/change?
3. [x] Have you built the project, and performed manual testing of your functionality for all supported platforms - Linux and Windows?
4. [x] Is your change backward-compatible with the previous version of the plugin?

>>> Change description:

- Creation of the separate component from the filtersView folder of the project
- Adaptation of the project
- Update of the class diagrams
- Update of README
- Introduction of the cmake helper macro definitions which help to conveniently suppress clang_tidy analysis for a single library ( related to ISSUE #106 )

>>> Verification criteria:

- Manually checked on the Windows platform
- All sanity checks on Git Hub were passed
  • Loading branch information
svlad-90 committed Dec 24, 2020
1 parent 98e8522 commit 010e7ed
Show file tree
Hide file tree
Showing 43 changed files with 1,440 additions and 619 deletions.
33 changes: 10 additions & 23 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "components/analyzer/api/IDLTMessageAnalyzerController.hpp"
#include "common/CBGColorAnimation.hpp"
#include "components/patternsView/api/CPatternsView.hpp"
#include "filtersView/CFiltersView.hpp"
#include "filtersView/CFiltersModel.hpp"
#include "components/filtersView/api/CFiltersView.hpp"
#include "components/filtersView/api/IFiltersModel.hpp"
#include "components/log/api/CLog.hpp"
#include "common/CTableMemoryJumper.hpp"
#include "plant_uml/CUMLView.hpp"
Expand All @@ -60,7 +60,8 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
QLabel* pCacheStatusLabel, QTabWidget* pMainTabWidget,
QLineEdit* pPatternsSearchInput,
QComboBox* pRegexSelectionComboBox,
CFiltersView* pFiltersView, QLineEdit* pFiltersSearchInput,
CFiltersView* pFiltersView, const std::shared_ptr<IFiltersModel>& pFiltersModel,
QLineEdit* pFiltersSearchInput,
CUMLView* pUMLView, const std::shared_ptr<CTableMemoryJumper>& pSearchViewTableJumper,
CSearchResultView* pSearchResultView,
const std::shared_ptr<ISearchResultModel>& pSearchResultModel):
Expand All @@ -84,7 +85,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
mpPatternsTreeView(pPatternsTableView),
mpPatternsModel( pPatternsModel ),
mpFiltersView(pFiltersView),
mpFiltersModel( new CFiltersModel() ),
mpFiltersModel( pFiltersModel ),
mpUMLView(pUMLView),
// internal states
mSearchRange(),
Expand Down Expand Up @@ -133,11 +134,8 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
mpLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
}

if(nullptr != mpFiltersView &&
nullptr != mpFiltersModel)
if(nullptr != mpFiltersModel)
{
mpFiltersView->setSpecificModel(mpFiltersModel);

if(nullptr != mpRegexLineEdit)
{
connect( mpRegexLineEdit, &QLineEdit::textChanged, [this](const QString& regex)
Expand Down Expand Up @@ -180,7 +178,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
}
});

connect ( mpFiltersModel, &CFiltersModel::regexUpdatedByUser, [this](const QString& regex)
connect ( mpFiltersModel.get(), &IFiltersModel::regexUpdatedByUser, [this](const QString& regex)
{
mpRegexLineEdit->selectAll();
mpRegexLineEdit->insert( regex );
Expand Down Expand Up @@ -223,7 +221,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer

if(nullptr != mpFiltersModel && nullptr != mpFiltersView)
{
connect ( mpFiltersModel, &CFiltersModel::regexUpdatedByUserInvalid,
connect ( mpFiltersModel.get(), &IFiltersModel::regexUpdatedByUserInvalid,
[this](const QModelIndex& index, const QString& error)
{
mpFiltersView->highlightInvalidRegex(index);
Expand Down Expand Up @@ -582,17 +580,6 @@ void CDLTMessageAnalyzer::handleLoadedConfig()
}
}

CDLTMessageAnalyzer::~CDLTMessageAnalyzer()
{
//qDebug() << __FUNCTION__;

if(mpFiltersModel)
{
delete mpFiltersModel;
mpFiltersModel = nullptr;
}
}

std::shared_ptr<QRegularExpression> CDLTMessageAnalyzer::createRegex( const QString& regex,
const QString& onSuccessMessages,
const QString& onFailureMessages,
Expand Down Expand Up @@ -1738,9 +1725,9 @@ PUML_PACKAGE_BEGIN(DMA_Root)
PUML_INHERITANCE_CHECKED(IDLTMessageAnalyzerControllerConsumer, implements)
PUML_COMPOSITION_DEPENDENCY_CHECKED(IGroupedViewModel, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CPatternsView, 1, 1, uses)
PUML_COMPOSITION_DEPENDENCY_CHECKED(IPatternsModel, 1, 1, contains)
PUML_AGGREGATION_DEPENDENCY_CHECKED(IPatternsModel, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CFiltersView, 1, 1, uses)
PUML_COMPOSITION_DEPENDENCY_CHECKED(CFiltersModel, 1, 1, contains)
PUML_AGGREGATION_DEPENDENCY_CHECKED(IFiltersModel, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CUMLView, 1, 1, uses)
PUML_AGGREGATION_DEPENDENCY_CHECKED(CDLTFileWrapper, 1, 1, uses)
PUML_USE_DEPENDENCY_CHECKED(CBGColorAnimation, 1, 1, uses)
Expand Down
12 changes: 4 additions & 8 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CGroupedView;
class CPatternsView;
class CRegexDirectoryMonitor;
class CFiltersView;
class CFiltersModel;
class IFiltersModel;
class CUMLView;
class CSearchResultView;
class ISearchResultModel;
Expand All @@ -63,16 +63,12 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer
QLabel* pCacheStatusLabel, QTabWidget* pMainTabWidget,
QLineEdit* pPatternsSearchInput,
QComboBox* pRegexSelectionComboBox,
CFiltersView* pFiltersView, QLineEdit* pFiltersSearchInput,
CFiltersView* pFiltersView, const std::shared_ptr<IFiltersModel>& pFiltersModel,
QLineEdit* pFiltersSearchInput,
CUMLView* pUMLView, const std::shared_ptr<CTableMemoryJumper>& pSearchViewTableJumper,
CSearchResultView* pSearchResultView,
const std::shared_ptr<ISearchResultModel>& pSearchResultModel);

/**
* Destructor
*/
~CDLTMessageAnalyzer();

/**
* @brief setFile - set's the file to be used for analysis
* @param pFile - pointer to file to be used
Expand Down Expand Up @@ -282,7 +278,7 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer
tPatternsModelPtr mpPatternsModel;

CFiltersView* mpFiltersView;
CFiltersModel* mpFiltersModel;
std::shared_ptr<IFiltersModel> mpFiltersModel;

CUMLView* mpUMLView;

Expand Down
2 changes: 1 addition & 1 deletion dltmessageanalyzerplugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
################### PROJECT ###############################
enable_testing()
DMA_Prepare()
include(cmake/CMakeHelper.cmake)
################### PROJECT ( END ) #######################

set(TURN_OFF_RCC OFF)
Expand All @@ -105,7 +106,6 @@ DMA_add_subdirectory_with_clang_tidy(plant_uml)
DMA_add_subdirectory_with_clang_tidy(settings)
DMA_add_subdirectory_with_clang_tidy(logo)
DMA_add_subdirectory_with_clang_tidy(dltWrappers)
DMA_add_subdirectory_with_clang_tidy(filtersView)

add_library(DLT-Message-Analyzer MODULE
dltmessageanalyzerplugin.cpp
Expand Down
18 changes: 18 additions & 0 deletions dltmessageanalyzerplugin/src/cmake/CMakeHelper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
macro (DMA_SuppressClangTidy_START)
set(RESTORE_CLANG_TIDY OFF)
set(CLANG_TIDY_CACHED_VAL "")

if( DMA_CLANG_TIDY_BUILD )
set(RESTORE_CLANG_TIDY ON)
set(CLANG_TIDY_CACHED_VAL CMAKE_CXX_CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "")
endif()
endmacro(DMA_SuppressClangTidy_START)

macro (DMA_SuppressClangTidy_END)
if( RESTORE_CLANG_TIDY )
set(CMAKE_CXX_CLANG_TIDY CLANG_TIDY_CACHED_VAL)
set(CLANG_TIDY_CACHED_VAL "")
set(RESTORE_CLANG_TIDY OFF)
endif()
endmacro(DMA_SuppressClangTidy_END)
17 changes: 2 additions & 15 deletions dltmessageanalyzerplugin/src/common/PCRE/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
add_definitions(-DQT_NO_KEYWORDS)

set(RESTORE_CLANG_TIDY OFF)
set(CLANG_TIDY_CACHED_VAL "")

if( DMA_CLANG_TIDY_BUILD )
set(RESTORE_CLANG_TIDY ON)
set(CLANG_TIDY_CACHED_VAL CMAKE_CXX_CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "")
endif()

DMA_SuppressClangTidy_START()
add_library(DMA_PCRE STATIC
PCREHelper.cpp)

if( RESTORE_CLANG_TIDY )
set(CMAKE_CXX_CLANG_TIDY CLANG_TIDY_CACHED_VAL)
set(CLANG_TIDY_CACHED_VAL "")
set(RESTORE_CLANG_TIDY OFF)
endif()
DMA_SuppressClangTidy_END()

################### QT ####################################
target_link_libraries(DMA_PCRE Qt5::Widgets )
Expand Down
1 change: 1 addition & 0 deletions dltmessageanalyzerplugin/src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DMA_add_subdirectory_with_clang_tidy(analyzer)
DMA_add_subdirectory_with_clang_tidy(filtersView)
DMA_add_subdirectory_with_clang_tidy(groupedView)
DMA_add_subdirectory_with_clang_tidy(log)
DMA_add_subdirectory_with_clang_tidy(patternsView)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DMA_add_subdirectory_with_clang_tidy(src)
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#ifndef CFILTERSVIEW_HPP
#define CFILTERSVIEW_HPP
#pragma once

#include <QTreeView>

#include "../common/Definitions.hpp"
#include "common/Definitions.hpp"

class CFiltersModel;
class CFilterItemDelegate;
Expand Down Expand Up @@ -50,5 +49,3 @@ class CFiltersView : public QTreeView
QLineEdit* mpRegexInputField;
CFilterItemDelegate* mpFilerItemDelegate;
};

#endif // CFILTERSVIEW_HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "memory"

#include "common/Definitions.hpp"
#include "dma/component/IComponent.hpp"

class CFiltersView;
class IFiltersModel;

class CFiltersViewComponent : public DMA::IComponent
{
public:

CFiltersViewComponent( CFiltersView* pFiltersView );

CFiltersView* getFiltersView() const;

virtual const char* getName() const override;

std::shared_ptr<IFiltersModel> getFiltersModel();

protected:
virtual DMA::tSyncInitOperationResult init() override;
virtual DMA::tSyncInitOperationResult shutdown() override;

private:
std::shared_ptr<IFiltersModel> mpFiltersModel;
CFiltersView* mpFiltersView;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "QModelIndex"
#include "QAbstractItemModel"

#include "common/Definitions.hpp"

class IFiltersModel : public QAbstractItemModel
{
Q_OBJECT

public:

explicit IFiltersModel(QObject *parent = nullptr);
virtual ~IFiltersModel();

virtual void setUsedRegex(const QString& regexStr) = 0;
virtual void addCompletionData( const tFoundMatches& foundMatches ) = 0;
virtual void resetCompletionData() = 0;
virtual void resetData() = 0;
virtual void filterRegexTokens( const QString& filter ) = 0;

struct tFilteredEntry
{
QModelIndex parentIdx;
int row;
bool filtered;
};
typedef std::vector<tFilteredEntry> tFilteredEntryVec;

signals:

void filteredEntriesChanged(const tFilteredEntryVec& filteredEntryVec, bool expandVisible);
void regexUpdatedByUser( const QString& regex );
void regexUpdatedByUserInvalid( const QModelIndex& index, const QString& error );
};
25 changes: 25 additions & 0 deletions dltmessageanalyzerplugin/src/components/filtersView/doc/doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[**Go to the previous page**](../../../../../md/dev_docs/dev_docs.md)

----

# DMA_FiltersView

## Standalone package API diagram

![Class diagram with dependencies](../../../../../md/dev_docs/puml/DMA_FiltersView_API_standalone.svg)

## Package API diagram with the first-level dependencies

![Class diagram with dependencies](../../../../../md/dev_docs/puml/DMA_FiltersView_API.svg)

## Standalone package diagram

![Class diagram with dependencies](../../../../../md/dev_docs/puml/DMA_FiltersView_standalone.svg)

## Package diagram with the first-level dependencies

![Class diagram with dependencies](../../../../../md/dev_docs/puml/DMA_FiltersView.svg)

----

[**Go to the previous page**](../../../../../md/dev_docs/dev_docs.md)
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <QStringListModel>

#include "components/log/api/CLog.hpp"
#include "../settings/CSettingsManager.hpp"
#include "../common/Definitions.hpp"
#include "settings/CSettingsManager.hpp"
#include "common/Definitions.hpp"
#include "CFiltersModel.hpp"
#include "CFilterItemDelegate.hpp"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef CFILTERITEMDELEGATE_HPP
#define CFILTERITEMDELEGATE_HPP
#pragma once

#include <QMap>
#include <QElapsedTimer>
Expand Down Expand Up @@ -85,5 +84,3 @@ private slots:
QTreeView* mpParentTree;
CFiltersModel* mpModel;
};

#endif // CFILTERITEMDELEGATE_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#include "QElapsedTimer"
#endif

#include "../settings/CSettingsManager.hpp"
#include "settings/CSettingsManager.hpp"
#include "CFiltersModel.hpp"
#include "components/log/api/CLog.hpp"
#include "../common/PCRE/PCREHelper.hpp"
#include "common/PCRE/PCREHelper.hpp"

#include "DMA_Plantuml.hpp"

CFiltersModel::CFiltersModel(QObject *parent)
: QAbstractItemModel(parent),
: IFiltersModel(parent),
mRegex(),
mSortingColumn(eRegexFiltersColumn::Index),
mSortOrder(Qt::SortOrder::AscendingOrder),
Expand Down Expand Up @@ -804,7 +804,7 @@ QStringList CFiltersModel::getCompletionData( const int& groupIndex,

PUML_PACKAGE_BEGIN(DMA_FiltersView)
PUML_CLASS_BEGIN_CHECKED(CFiltersModel)
PUML_INHERITANCE_CHECKED(QAbstractItemModel, implements)
PUML_INHERITANCE_CHECKED(IFiltersModel, implements)
PUML_COMPOSITION_DEPENDENCY_CHECKED(CTreeItem, 1, *, contains)
PUML_CLASS_END()
PUML_PACKAGE_END()
Loading

0 comments on commit 010e7ed

Please sign in to comment.