Skip to content

Commit

Permalink
Merge pull request #200 from svlad-90/dev/vladyslav-goncharuk/ISSUE-191
Browse files Browse the repository at this point in the history
[ISSUE #191][GROUPED_VIEW] Seeting to turn off the "Grouped view"
  • Loading branch information
svlad-90 authored Jun 5, 2024
2 parents 5a20e68 + e7aa167 commit d3e3c91
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 13 deletions.
2 changes: 0 additions & 2 deletions dltmessageanalyzerplugin/src/common/Definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ typedef std::shared_ptr<IPatternsModel> tPatternsModelPtr;
extern const QString sDefaultStatusText;
extern const QString sDefaultRegexFileName;



typedef int tMsgId;
extern const tMsgId INVALID_MSG_ID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ public slots:
IDLTMessageAnalyzerControllerConsumer( const std::weak_ptr<IDLTMessageAnalyzerController>& pController );
tRequestId requestAnalyze( const tRequestParameters& requestParameters,
bool bUMLFeatureActive,
bool bPlotViewFeatureActive );
bool bPlotViewFeatureActive,
bool bGroupedViewFeatureActive );
void cancelRequest( const tRequestId& requestId );
bool isGroupedViewFeatureActiveForCurrentAnalysis() const;

protected: // fields
std::weak_ptr<IDLTMessageAnalyzerController> mpController;

private: // fields
bool mbGroupedViewFeatureActiveForCurrentAnalysis;
};

typedef std::shared_ptr<IDLTMessageAnalyzerControllerConsumer> tDLTMessageAnalyzerControllerConsumerPtr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ IDLTMessageAnalyzerControllerConsumer::~IDLTMessageAnalyzerControllerConsumer()

IDLTMessageAnalyzerControllerConsumer::IDLTMessageAnalyzerControllerConsumer( const std::weak_ptr<IDLTMessageAnalyzerController>& pController ):
std::enable_shared_from_this<IDLTMessageAnalyzerControllerConsumer>(),
mpController(pController)
mpController(pController),
mbGroupedViewFeatureActiveForCurrentAnalysis(false)
{

}

tRequestId IDLTMessageAnalyzerControllerConsumer::requestAnalyze( const tRequestParameters& requestParameters,
bool bUMLFeatureActive,
bool bPlotViewFeatureActive )
bool bPlotViewFeatureActive,
bool bGroupedViewFeatureActive )
{
tRequestId requestId = INVALID_REQUEST_ID;

if(false == mpController.expired())
{
tRegexScriptingMetadata regexMetadata;

bool bParseResult = regexMetadata.parse(requestParameters.regex, bUMLFeatureActive, bPlotViewFeatureActive);
bool bParseResult = regexMetadata.parse(requestParameters.regex,
bUMLFeatureActive,
bPlotViewFeatureActive);

if(false == bParseResult)
{
Expand Down Expand Up @@ -71,11 +75,17 @@ tRequestId IDLTMessageAnalyzerControllerConsumer::requestAnalyze( const tRequest
}

requestId = mpController.lock()->requestAnalyze(shared_from_this(), requestParameters, regexMetadata);
mbGroupedViewFeatureActiveForCurrentAnalysis = bGroupedViewFeatureActive;
}

return requestId;
}

bool IDLTMessageAnalyzerControllerConsumer::isGroupedViewFeatureActiveForCurrentAnalysis() const
{
return mbGroupedViewFeatureActiveForCurrentAnalysis;
}

void IDLTMessageAnalyzerControllerConsumer::cancelRequest( const tRequestId& requestId )
{
if(false == mpController.expired())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,11 @@ void CSearchResultView::handleSettingsManagerChange()
forceUpdateWidthAndResetContentMap();
});

connect( getSettingsManager().get(), &ISettingsManager::groupedViewFeatureActiveChanged, this, [this]()
{
restartSearch();
});

connect( getSettingsManager().get(), &ISettingsManager::UML_FeatureActiveChanged, this, [this]()
{
restartSearch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class ISettingsManager : public QObject
virtual void setJavaPathMode(const int& val) = 0;
virtual void setJavaPathEnvVar(const QString& val) = 0;
virtual void setJavaCustomPath(const QString& val) = 0;
virtual void setGroupedViewFeatureActive(bool val) = 0;

/**
* @brief setSelectedRegexFile - updates selected regex file
Expand Down Expand Up @@ -195,6 +196,7 @@ class ISettingsManager : public QObject
virtual const int& getJavaPathMode() const = 0;
virtual const QString& getJavaPathEnvVar() const = 0;
virtual const QString& getJavaCustomPath() const = 0;
virtual const bool& getGroupedViewFeatureActive() const = 0;

// allowed ranges
virtual const TOptional<tRange<int>>& getSetting_NumberOfThreads_AllowedRange() const = 0;
Expand Down Expand Up @@ -259,4 +261,5 @@ class ISettingsManager : public QObject
void javaPathModeChanged(const int& plantumlPathMode);
void javaPathEnvVarChanged(const QString& plantumlPathEnvVar);
void javaCustomPathChanged(const QString& plantumlPathEnvVar);
void groupedViewFeatureActiveChanged(const bool& groupedViewFeatureActive);
};
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ static const QString sJavaPathMode = "JavaPathMode";
static const QString sJavaPathEnvVar = "JavaPathEnvVar";
static const QString sJavaCustomPath = "JavaCustomPath";

static const QString sGroupedViewFeatureActive = "GroupedViewFeatureActive";

static const tSettingsManagerVersion sDefaultSettingsManagerVersion = static_cast<tSettingsManagerVersion>(-1);
static const tSettingsManagerVersion sCurrentSettingsManagerVersion = 1u; // current version of settings manager used by SW.

Expand Down Expand Up @@ -460,6 +462,10 @@ CSettingsManager::CSettingsManager():
[this](const QString& data){javaCustomPathChanged(data);},
[this](){tryStoreSettingsConfig();},
"")),
mSetting_GroupedViewFeatureActive(createBooleanSettingsItem(sGroupedViewFeatureActive,
[this](const bool& data){groupedViewFeatureActiveChanged(data);},
[this](){tryStoreSettingsConfig();},
true)),
mRootSettingItemPtrVec(),
mUserSettingItemPtrVec(),
mPatternsSettingItemPtrVec(),
Expand All @@ -484,7 +490,7 @@ CSettingsManager::CSettingsManager():
mUserSettingItemPtrVec.push_back(&mSetting_SearchResultHighlightingGradient);
mUserSettingItemPtrVec.push_back(&mSetting_SearchResultColumnsVisibilityMap);
mUserSettingItemPtrVec.push_back(&mSetting_SearchResultColumnsCopyPasteMap);
mUserSettingItemPtrVec.push_back(&mSetting_SearchResultColumnsSearchMap);
mUserSettingItemPtrVec.push_back(&mSetting_SearchResultColumnsSearchMap);
mUserSettingItemPtrVec.push_back(&mSetting_MarkTimeStampWithBold);
mUserSettingItemPtrVec.push_back(&mSetting_PatternsColumnsVisibilityMap);
mUserSettingItemPtrVec.push_back(&mSetting_PatternsColumnsCopyPasteMap);
Expand Down Expand Up @@ -514,6 +520,7 @@ CSettingsManager::CSettingsManager():
mUserSettingItemPtrVec.push_back(&mSetting_JavaPathMode);
mUserSettingItemPtrVec.push_back(&mSetting_JavaPathEnvVar);
mUserSettingItemPtrVec.push_back(&mSetting_JavaCustomPath);
mUserSettingItemPtrVec.push_back(&mSetting_GroupedViewFeatureActive);

/////////////// PATTERNS SETTINGS ///////////////
mPatternsSettingItemPtrVec.push_back(&mSetting_Aliases);
Expand Down Expand Up @@ -1674,6 +1681,11 @@ void CSettingsManager::setJavaCustomPath(const QString& val)
mSetting_JavaCustomPath.setData(val);
}

void CSettingsManager::setGroupedViewFeatureActive(bool val)
{
mSetting_GroupedViewFeatureActive.setData(val);
}

void CSettingsManager::setSelectedRegexFile(const QString& val)
{
mSetting_SelectedRegexFile.setData(val);
Expand Down Expand Up @@ -1917,6 +1929,11 @@ const QString& CSettingsManager::getJavaCustomPath() const
return mSetting_JavaCustomPath.getData();
}

const bool& CSettingsManager::getGroupedViewFeatureActive() const
{
return mSetting_GroupedViewFeatureActive.getData();
}

QString CSettingsManager::getRegexDirectory() const
{
return sSettingsManager_Directory + QDir::separator() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class CSettingsManager : public ISettingsManager
void setJavaPathMode(const int& val) override;
void setJavaPathEnvVar(const QString& val) override;
void setJavaCustomPath(const QString& val) override;
void setGroupedViewFeatureActive(bool val) override;

void setSelectedRegexFile(const QString& val) override;

Expand Down Expand Up @@ -160,6 +161,7 @@ class CSettingsManager : public ISettingsManager
const int& getJavaPathMode() const override;
const QString& getJavaPathEnvVar() const override;
const QString& getJavaCustomPath() const override;
const bool& getGroupedViewFeatureActive() const override;

// allowed ranges
const TRangedSettingItem<int>::tOptionalAllowedRange& getSetting_NumberOfThreads_AllowedRange() const override;
Expand Down Expand Up @@ -454,6 +456,9 @@ class CSettingsManager : public ISettingsManager
TSettingItem<QString> mSetting_JavaPathEnvVar;
TSettingItem<QString> mSetting_JavaCustomPath;

// Grouped view settings
TSettingItem<bool> mSetting_GroupedViewFeatureActive;

typedef ISettingItem* tSettingItemPtr;
typedef std::vector<tSettingItemPtr> tSettingItemsPtrVec;

Expand Down
16 changes: 13 additions & 3 deletions dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,8 @@ bool CDLTMessageAnalyzer::analyze()

auto requestId = requestAnalyze( requestParameters,
getSettingsManager()->getUML_FeatureActive(),
getSettingsManager()->getPlotViewFeatureActive() );
getSettingsManager()->getPlotViewFeatureActive(),
getSettingsManager()->getGroupedViewFeatureActive());

setReuqestId(requestId);

Expand Down Expand Up @@ -1137,7 +1138,11 @@ void CDLTMessageAnalyzer::progressNotification(const tProgressNotificationData&
progressNotificationData.processedMatches.matchedItemVec.end(); ++foundMatchesIt)
{
auto endIt = progressNotificationData.processedMatches.matchedItemVec.end();
mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt));
if(true == isGroupedViewFeatureActiveForCurrentAnalysis())
{
mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt));
}

mpFiltersModel->addCompletionData(foundMatchesIt->getFoundMatches());
}

Expand Down Expand Up @@ -1179,7 +1184,12 @@ void CDLTMessageAnalyzer::progressNotification(const tProgressNotificationData&
++foundMatchesIt)
{
auto endIt = progressNotificationData.processedMatches.matchedItemVec.end();
mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt));

if(true == isGroupedViewFeatureActiveForCurrentAnalysis())
{
mpGroupedViewModel->addMatches(foundMatchesIt->getFoundMatches(), foundMatchesIt == --(endIt));
}

mpFiltersModel->addCompletionData(foundMatchesIt->getFoundMatches());
}

Expand Down
71 changes: 68 additions & 3 deletions dltmessageanalyzerplugin/src/plugin/src/form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,

contextMenu.addSeparator();

{
QAction* pAction = new QAction("Grouped view", this);
connect(pAction, &QAction::triggered, this, [this](bool checked)
{
getSettingsManager()->setGroupedViewFeatureActive(checked);
});
pAction->setCheckable(true);
pAction->setChecked(getSettingsManager()->getGroupedViewFeatureActive());
contextMenu.addAction(pAction);
}

contextMenu.addSeparator();

{
QAction* pAction = new QAction("PlantUML", this);
connect(pAction, &QAction::triggered, this, [this](bool checked)
Expand All @@ -224,7 +237,6 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,

contextMenu.addSeparator();


{
QAction* pAction = new QAction("Plot view", this);
connect(pAction, &QAction::triggered, this, [this](bool checked)
Expand Down Expand Up @@ -295,6 +307,38 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,
mpUI->createSequenceDiagram->setText("Create sequence diagram");
});

{
auto pGroupedViewWidget = mpUI->tabWidget->findChild<QWidget*>(QString("groupedViewTab"));

if(nullptr != pGroupedViewWidget)
{
auto enableGroupedViewWidget = [this, pGroupedViewWidget](bool val)
{
if(nullptr != mpUI && nullptr != mpUI->tabWidget)
{
if(mpUI->tabWidget->count() > 0)
{
if(true != val)
{
mpUI->tabWidget->removeTab(mpUI->tabWidget->indexOf(pGroupedViewWidget));
}
else
{
mpUI->tabWidget->insertTab(2, pGroupedViewWidget, "Grouped view");
}
}
}
};

enableGroupedViewWidget(getSettingsManager()->getGroupedViewFeatureActive());

connect(getSettingsManager().get(), &ISettingsManager::groupedViewFeatureActiveChanged, [enableGroupedViewWidget](bool val)
{
enableGroupedViewWidget(val);
});
}
}

{
auto pUMLWidget = mpUI->tabWidget->findChild<QWidget*>(QString("UMLView"));

Expand All @@ -312,7 +356,7 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,
}
else
{
mpUI->tabWidget->insertTab(3, pUMLWidget, "UML View");
mpUI->tabWidget->insertTab(true == getSettingsManager()->getGroupedViewFeatureActive() ? 3 : 2, pUMLWidget, "UML View");
}
}
}
Expand Down Expand Up @@ -344,7 +388,28 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,
}
else
{
mpUI->tabWidget->insertTab(true == getSettingsManager()->getUML_FeatureActive() ? 4 : 3, pPlotViewWidget, "Plot view");
auto bGroupedViewFeatureActive = getSettingsManager()->getGroupedViewFeatureActive();
auto bUML_FeatureActive = getSettingsManager()->getUML_FeatureActive();
int tabIndex = 0;

if(true == bGroupedViewFeatureActive &&
true == bUML_FeatureActive)
{
tabIndex = 4;
}
else if((true == bGroupedViewFeatureActive &&
false == bUML_FeatureActive) ||
(false == bGroupedViewFeatureActive &&
true == bUML_FeatureActive))
{
tabIndex = 3;
}
else
{
tabIndex = 2;
}

mpUI->tabWidget->insertTab(tabIndex, pPlotViewWidget, "Plot view");
}
}
}
Expand Down

0 comments on commit d3e3c91

Please sign in to comment.