Skip to content

Commit

Permalink
Merge pull request #133 from svlad-90/feature/ISSUE_111
Browse files Browse the repository at this point in the history
[ISSUE #111][COMPONENTS] Introduce components architecture in the project
  • Loading branch information
svlad-90 authored Dec 9, 2020
2 parents 3509db2 + 867060c commit c0c74b1
Show file tree
Hide file tree
Showing 58 changed files with 919 additions and 462 deletions.
10 changes: 3 additions & 7 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
#include "patternsView/CPatternsView.hpp"
#include "filtersView/CFiltersView.hpp"
#include "filtersView/CFiltersModel.hpp"
#include "log/CLog.hpp"
#include "components/log/api/CLog.hpp"
#include "common/CTableMemoryJumper.hpp"
#include "log/CConsoleInputProcessor.hpp"
#include "plant_uml/CUMLView.hpp"

#include "DMA_Plantuml.hpp"
Expand All @@ -59,8 +58,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
QCheckBox* pContinuousSearchCheckBox,
QLabel* pCacheStatusLabel, QTabWidget* pMainTabWidget,
QLineEdit* pPatternsSearchInput, QComboBox* pRegexSelectionComboBox,
CFiltersView* pFiltersView, QLineEdit* pFiltersSearchInput,
QLineEdit* pConsoleViewInput, CUMLView* pUMLView
CFiltersView* pFiltersView, QLineEdit* pFiltersSearchInput, CUMLView* pUMLView
):
IDLTMessageAnalyzerControllerConsumer (pController),
// default widgets
Expand Down Expand Up @@ -102,8 +100,7 @@ CDLTMessageAnalyzer::CDLTMessageAnalyzer(const std::weak_ptr<IDLTMessageAnalyzer
, mMeasurementNotificationTimer()
#endif
, mMeasurementRequestTimer(),
mpSearchViewTableJumper(std::make_shared<CTableMemoryJumper>(mpSearchResultTableView)),
mpConsoleInputProcessor(std::make_shared<CConsoleInputProcessor>(pConsoleViewInput))
mpSearchViewTableJumper(std::make_shared<CTableMemoryJumper>(mpSearchResultTableView))
{
//////////////METATYPES_REGISTRATION/////////////////////
qRegisterMetaType<tIntRangePtrWrapper>("tIntRangePtrWrapper");
Expand Down Expand Up @@ -1799,7 +1796,6 @@ PUML_PACKAGE_BEGIN(DMA_Root)
#endif
PUML_COMPOSITION_DEPENDENCY_CHECKED(CRegexDirectoryMonitor, 1, 1, contains)
PUML_COMPOSITION_DEPENDENCY_CHECKED(CTableMemoryJumper, 1, 1, contains)
PUML_COMPOSITION_DEPENDENCY_CHECKED(CConsoleInputProcessor, 1, 1, contains)
PUML_USE_DEPENDENCY_CHECKED(IDLTMessageAnalyzerController, 1, 1, gets and feeds to IDLTMessageAnalyzerControllerConsumer)
PUML_CLASS_END()
PUML_PACKAGE_END()
4 changes: 1 addition & 3 deletions dltmessageanalyzerplugin/src/CDLTMessageAnalyzer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class CRegexDirectoryMonitor;
class CFiltersView;
class CFiltersModel;
class CTableMemoryJumper;
class CConsoleInputProcessor;
class CUMLView;

/**
Expand Down Expand Up @@ -82,7 +81,7 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer
QLineEdit* pPatternsSearchInput,
QComboBox* pRegexSelectionComboBox,
CFiltersView* pFiltersView, QLineEdit* pFiltersSearchInput,
QLineEdit* pConsoleViewInput, CUMLView* pUMLView);
CUMLView* pUMLView);

/**
* Destructor
Expand Down Expand Up @@ -325,7 +324,6 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer

QElapsedTimer mMeasurementRequestTimer;
std::shared_ptr<CTableMemoryJumper> mpSearchViewTableJumper;
std::shared_ptr<CConsoleInputProcessor> mpConsoleInputProcessor;
};

#endif // CDLTMESSAGEANALYZER_HPP
1 change: 0 additions & 1 deletion dltmessageanalyzerplugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ DMA_add_subdirectory_with_clang_tidy(common)
DMA_add_subdirectory_with_clang_tidy(components)
DMA_add_subdirectory_with_clang_tidy(searchView)
DMA_add_subdirectory_with_clang_tidy(plant_uml)
DMA_add_subdirectory_with_clang_tidy(log)
DMA_add_subdirectory_with_clang_tidy(settings)
DMA_add_subdirectory_with_clang_tidy(logo)
DMA_add_subdirectory_with_clang_tidy(dltWrappers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// project includes
#include "Definitions.hpp"
#include "../log/CLog.hpp"
#include "components/log/api/CLog.hpp"

// self-includes
#include "CRegexDirectoryMonitor.hpp"
Expand Down
2 changes: 1 addition & 1 deletion dltmessageanalyzerplugin/src/common/CTreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stack>

#include "CTreeItem.hpp"
#include "../log/CLog.hpp"
#include "components/log/api/CLog.hpp"

#include "DMA_Plantuml.hpp"

Expand Down
2 changes: 1 addition & 1 deletion dltmessageanalyzerplugin/src/common/Definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "QRegularExpression"
#include "QTextStream"

#include "../log/CLog.hpp"
#include "components/log/api/CLog.hpp"
#include "CTreeItem.hpp"

#include "DMA_Plantuml.hpp"
Expand Down
2 changes: 1 addition & 1 deletion dltmessageanalyzerplugin/src/common/PCRE/PCREHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "PCREBaseVisitor.h"

#include "../CTreeItem.hpp"
#include "../../log/CLog.hpp"
#include "components/log/api/CLog.hpp"
#include "PCREHelper.hpp"

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion dltmessageanalyzerplugin/src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DMA_add_subdirectory_with_clang_tidy(analyzer)
DMA_add_subdirectory_with_clang_tidy(analyzer)
DMA_add_subdirectory_with_clang_tidy(log)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ DMA::tSyncInitOperationResult CAnalyzerComponent::init()

DMA::tSyncInitOperationResult CAnalyzerComponent::shutdown()
{
if(nullptr != mpMessageAnalyzerController)
{
mpMessageAnalyzerController.reset();
}

DMA::tSyncInitOperationResult result;
result.bIsOperationSuccessful = true;
result.returnCode = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#endif

#include "settings/CSettingsManager.hpp"
#include "log/CLog.hpp"
#include "components/log/api/CLog.hpp"
#include "CDLTRegexAnalyzerWorker.hpp"

#include "DMA_Plantuml.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "dltWrappers/CDLTFileWrapper.hpp"
#include "../api/IDLTMessageAnalyzerControllerConsumer.hpp"
#include "dltWrappers/CDLTMsgWrapper.hpp"
#include "log/CLog.hpp"
#include "components/log/api/CLog.hpp"
#include "common/cpp_extensions.hpp"

#include "DMA_Plantuml.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "qdlt.h"

#include "settings/CSettingsManager.hpp"
#include "log/CLog.hpp"
#include "components/log/api/CLog.hpp"

#include "DMA_Plantuml.hpp"

Expand Down
1 change: 1 addition & 0 deletions dltmessageanalyzerplugin/src/components/log/CMakeLists.txt
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,5 +1,4 @@
#ifndef CCONSOLEVIEW_HPP
#define CCONSOLEVIEW_HPP
#pragma once

#include "QPlainTextEdit"

Expand All @@ -15,5 +14,3 @@ class CConsoleView : public QPlainTextEdit
protected:
virtual void keyPressEvent ( QKeyEvent* pEvent ) override;
};

#endif // CCONSOLEVIEW_HPP
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef CLOG_HPP
#define CLOG_HPP
#pragma once

#include <QString>
#include <QColor>
Expand Down Expand Up @@ -54,5 +53,3 @@ do\
{\
DMA_Log::clearConsole();\
}while(false)

#endif // CLOG_HPP
32 changes: 32 additions & 0 deletions dltmessageanalyzerplugin/src/components/log/api/CLogComponent.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "QLineEdit"
#include "QTabWidget"
#include "QPlainTextEdit"

#include "memory"
#include "dma/component/IComponent.hpp"

class CConsoleInputProcessor;

class CLogComponent : public DMA::IComponent
{
public:

CLogComponent(QLineEdit* pConsoleViewInput,
QTabWidget* pMainTabWidget,
QWidget* pConsoleViewTab,
QPlainTextEdit* pConsoleView
);
~CLogComponent();

virtual const char* getName() const override;

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

private:
QLineEdit* mpConsoleViewInput;
std::shared_ptr<CConsoleInputProcessor> mpConsoleInputProcessor;
};
25 changes: 25 additions & 0 deletions dltmessageanalyzerplugin/src/components/log/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_Log

## Standalone package API diagram

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

## Package API diagram with the first-level dependencies

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

## Standalone package diagram

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

## Package diagram with the first-level dependencies

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

----

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

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

#include "DMA_Plantuml.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef CCONSOLECTRL_HPP
#define CCONSOLECTRL_HPP
#pragma once

#include <QMap>

Expand Down Expand Up @@ -109,5 +108,3 @@ private slots:
};
}
}

#endif // CCONSOLECTRL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "QApplication"
#include "QTextStream"

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

#include "../dltmessageanalyzerplugin.hpp"
#include "dltmessageanalyzerplugin.hpp"
#include "CConsoleInputProcessor.hpp"
#include "CLog.hpp"
#include "../api/CLog.hpp"

#include "DMA_Plantuml.hpp"

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

#include "map"
#include "string"
Expand Down Expand Up @@ -56,5 +55,3 @@ class CConsoleInputProcessor : public QObject

eHistoryBorderStatus mbBorderReached;
};

#endif // CCONSOLEINPUTPROCESSOR_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QAction>
#include <QMenu>

#include "CConsoleView.hpp"
#include "../api/CConsoleView.hpp"

#include "DMA_Plantuml.hpp"

Expand Down Expand Up @@ -50,7 +50,7 @@ void CConsoleView::keyPressEvent ( QKeyEvent* pEvent )
}
}

PUML_PACKAGE_BEGIN(DMA_Log)
PUML_PACKAGE_BEGIN(DMA_Log_API)
PUML_CLASS_BEGIN_CHECKED(CConsoleView)
PUML_INHERITANCE_CHECKED(QPlainTextEdit, extends)
PUML_CLASS_END()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "CLog.hpp"
#include "../api/CLog.hpp"

#include "CConsoleCtrl.hpp"

Expand Down
67 changes: 67 additions & 0 deletions dltmessageanalyzerplugin/src/components/log/src/CLogComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include "../api/CLogComponent.hpp"
#include "CConsoleInputProcessor.hpp"
#include "CConsoleCtrl.hpp"

#include "DMA_Plantuml.hpp"

CLogComponent::CLogComponent(QLineEdit* pConsoleViewInput,
QTabWidget* pMainTabWidget,
QWidget* pConsoleViewTab,
QPlainTextEdit* pConsoleView):
mpConsoleViewInput(pConsoleViewInput),
mpConsoleInputProcessor(nullptr)
{
NDLTMessageAnalyzer::NConsole::tConsoleConfig consoleConfig;
consoleConfig.maxMsgSize = 10240;
consoleConfig.logSize = 1000;
consoleConfig.pTabWidget = pMainTabWidget;
consoleConfig.pConsoleTab = pConsoleViewTab;
consoleConfig.pConsoleTextEdit = pConsoleView;
NDLTMessageAnalyzer::NConsole::CConsoleCtrl::createInstance(consoleConfig);
}

CLogComponent::~CLogComponent()
{
NDLTMessageAnalyzer::NConsole::CConsoleCtrl::destroyInstance();
}

const char* CLogComponent::getName() const
{
return "CLogComponent";
}

DMA::tSyncInitOperationResult CLogComponent::init()
{
DMA::tSyncInitOperationResult result;

try
{
mpConsoleInputProcessor = std::make_shared<CConsoleInputProcessor>(mpConsoleViewInput);
result.bIsOperationSuccessful = true;
result.returnCode = 0;
}
catch (...)
{}

return result;
}

DMA::tSyncInitOperationResult CLogComponent::shutdown()
{
if(nullptr != mpConsoleInputProcessor)
{
mpConsoleInputProcessor.reset();
}

DMA::tSyncInitOperationResult result;
result.bIsOperationSuccessful = true;
result.returnCode = 0;
return result;
}

PUML_PACKAGE_BEGIN(DMA_Log_API)
PUML_CLASS_BEGIN(CLogComponent)
PUML_INHERITANCE_CHECKED(DMA::IComponent, implements)
PUML_COMPOSITION_DEPENDENCY_CHECKED(CConsoleInputProcessor, 1, 1, contains)
PUML_CLASS_END()
PUML_PACKAGE_END()
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
qt5_wrap_cpp(PROCESSED_MOCS
../api/CConsoleView.hpp)

add_library(DMA_log STATIC
CConsoleCtrl.cpp
CConsoleView.cpp
CConsoleInputProcessor.cpp
CLog.cpp)
CLog.cpp
CLogComponent.cpp
${PROCESSED_MOCS})

################### QT ####################################
target_link_libraries(DMA_log qdlt Qt5::Widgets )
Expand Down
Loading

0 comments on commit c0c74b1

Please sign in to comment.