1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031362: Inspectors - MessageView plugin for message alerts

This commit is contained in:
nds
2020-11-24 21:24:33 +03:00
parent dea3e24f68
commit 6104e99df7
6 changed files with 34 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
TModelingData TKShapeView
TModelingData TKShapeView TKMessageModel TKMessageView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE

View File

@@ -169,7 +169,7 @@ void MessageModel_Actions::OnActivateReport()
Message::DefaultMessenger()->ChangePrinters().Clear();
Message::DefaultMessenger()->AddPrinter (MyPrinterToReport);
Message::DefaultMessenger()->SetTraceLevel (1);
//Message::DefaultMessenger()->SetTraceLevel (1);
Message::DefaultReport()->UpdateActiveInMessenger();
myTreeModel->UpdateTreeModel();

View File

@@ -122,8 +122,8 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
if (!anAttribute->IsMetricValid (aMetricType))
return QVariant ("in process");
if (aMetricType == Message_MetricType_UserTimeCPU ||
aMetricType == Message_MetricType_SystemTimeInfo ||
if (aMetricType == Message_MetricType_ProcessCPUUserTime ||
aMetricType == Message_MetricType_ProcessCPUSystemTime ||
aMetricType == Message_MetricType_WallClock)
{
Standard_Real aCumulativeMetric = anAttribute->StopValue (aMetricType) - anAttribute->StartValue (aMetricType);

View File

@@ -67,7 +67,7 @@ QVariant MessageModel_ItemReport::initValue (const int theRole) const
Message_MetricType aMetricType;
int aPosition;
if (MessageModel_TreeModel::IsMetricColumn (Column(), aMetricType, aPosition) &&
(aMetricType == Message_MetricType_UserTimeCPU || aMetricType == Message_MetricType_SystemTimeInfo ||
(aMetricType == Message_MetricType_ProcessCPUUserTime || aMetricType == Message_MetricType_ProcessCPUSystemTime ||
aMetricType == Message_MetricType_WallClock))
{
if (aPosition == 0) return CumulativeMetric (aReport, aMetricType);

View File

@@ -310,6 +310,7 @@ void MessageView_ActionsTest::OnTestPropertyPanel()
// =======================================================================
void createShapeOnLevel()
{
#ifdef DEBUG_ALERTS
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("createShapeOnLevel")
Message_Messenger::StreamBuffer sout = Message::SendInfo();
@@ -319,6 +320,7 @@ void createShapeOnLevel()
MESSAGE_INFO_SHAPE (aShape, "Shape message edge ON LEVEL");
//sout << "Shape message edge" << aShape;
#endif
}
// =======================================================================
@@ -327,6 +329,7 @@ void createShapeOnLevel()
// =======================================================================
void createShape()
{
#ifdef DEBUG_ALERTS
Message_Messenger::StreamBuffer sout = Message::SendInfo();
BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
@@ -336,6 +339,7 @@ void createShape()
//sout << "Shape message edge" << aShape;
createShapeOnLevel();
#endif
}
// =======================================================================
@@ -344,6 +348,7 @@ void createShape()
// =======================================================================
void MessageView_ActionsTest::OnTestMessenger()
{
#ifdef DEBUG_ALERTS
// string messages
Message_Messenger::StreamBuffer sout = Message::SendInfo();
Standard_Integer aTraceLevel_prev = Message::DefaultMessenger()->TraceLevel();
@@ -393,6 +398,7 @@ void MessageView_ActionsTest::OnTestMessenger()
}
myTreeModel->UpdateTreeModel();
Message::DefaultMessenger()->SetTraceLevel (aTraceLevel_prev);
#endif
}
// =======================================================================
@@ -401,6 +407,7 @@ void MessageView_ActionsTest::OnTestMessenger()
// =======================================================================
void levelAlerts (const int theCurrentLevel, const int theTopLevel)
{
#ifdef DEBUG_ALERTS
if (theTopLevel - theCurrentLevel <= 0)
return;
@@ -414,6 +421,7 @@ void levelAlerts (const int theCurrentLevel, const int theTopLevel)
levelAlerts (theCurrentLevel + 1, theTopLevel);
sout << "Alert(" << theCurrentLevel << "): " << 4 << ", " << 5 << std::endl;
#endif
}
// =======================================================================
@@ -422,6 +430,7 @@ void levelAlerts (const int theCurrentLevel, const int theTopLevel)
// =======================================================================
void levelAlert (const int theCurrentLevel, const int theTopLevel)
{
#ifdef DEBUG_ALERTS
if (theTopLevel - theCurrentLevel <= 0)
return;
@@ -432,6 +441,7 @@ void levelAlert (const int theCurrentLevel, const int theTopLevel)
//for (int i = 0; i < 2; i++)
levelAlerts (theCurrentLevel + 1, theTopLevel);
#endif
}
// =======================================================================
@@ -440,6 +450,7 @@ void levelAlert (const int theCurrentLevel, const int theTopLevel)
// =======================================================================
void MessageView_ActionsTest::OnTestReportTree()
{
#ifdef DEBUG_ALERTS
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
Message_Messenger::StreamBuffer sout = Message::SendInfo();
@@ -457,6 +468,7 @@ void MessageView_ActionsTest::OnTestReportTree()
levelAlert (1, aTopLevel);
myTreeModel->UpdateTreeModel();
#endif
}
// =======================================================================
@@ -465,6 +477,7 @@ void MessageView_ActionsTest::OnTestReportTree()
// =======================================================================
void MessageView_ActionsTest::OnTestReportTree2()
{
#ifdef DEBUG_ALERTS
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
Message_Messenger::StreamBuffer sout = Message::SendInfo();
@@ -482,4 +495,5 @@ void MessageView_ActionsTest::OnTestReportTree2()
//levelAlert (1, aTopLevel);
myTreeModel->UpdateTreeModel();
#endif
}

View File

@@ -43,9 +43,9 @@
#include <Message.hxx>
#include <TCollection_AsciiString.hxx>
#define DEBUG_ALERTS
//#define DEBUG_ALERTS
#include <XmlDrivers_MessageReportStorage.hxx>
//#include <XmlDrivers_MessageReportStorage.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <inspector/View_Displayer.hxx>
@@ -382,6 +382,7 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
// =======================================================================
void MessageView_Window::openFile(const TCollection_AsciiString& theFileName)
{
#ifdef DEBUG_ALERTS
if (theFileName.IsEmpty())
return;
@@ -395,6 +396,7 @@ void MessageView_Window::openFile(const TCollection_AsciiString& theFileName)
aReport->MessageWriter()->ImportReport (aReport);
addReport (aReport, theFileName);
#endif
}
// =======================================================================
@@ -501,7 +503,7 @@ void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePositi
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Reload"), SLOT (onReloadReport()), myMainWindow, this));
}
Handle(Message_Report) aReport = aReportItem->GetReport();
QAction* anAction = ViewControl_Tools::CreateAction (tr ("Export by alert"), SLOT (onAutoExportActivate()), myMainWindow, this);
/*QAction* anAction = ViewControl_Tools::CreateAction (tr ("Export by alert"), SLOT (onAutoExportActivate()), myMainWindow, this);
anAction->setCheckable (true);
anAction->setChecked (aReport->WriteFileOnEachAlert());
aMenu->addAction (anAction);
@@ -510,7 +512,7 @@ void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePositi
anAction->setCheckable (true);
bool isTraceOnly = aReport->MessageWriter().IsNull() ? false : aReport->MessageWriter()->Gravity() == Message_Trace;
anAction->setChecked (isTraceOnly);
aMenu->addAction (anAction);
aMenu->addAction (anAction);*/
}
aMenu->addSeparator();
@@ -683,13 +685,13 @@ void MessageView_Window::onReloadReport()
return;
Handle(Message_Report) aReport = aReportItem->GetReport();
aReport->Clear();
/*aReport->Clear();
if (aReport->MessageWriter().IsNull())
aReport->SetMessageWriter (new XmlDrivers_MessageReportStorage());
aReport->MessageWriter()->SetFileName (TCollection_AsciiString (aDescription));
if (!aReport->MessageWriter()->ImportReport (aReport))
return;
return;*/
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
aModel->clearSelection();
@@ -702,7 +704,7 @@ void MessageView_Window::onReloadReport()
// =======================================================================
void MessageView_Window::onAutoExportActivate()
{
QItemSelectionModel* aModel = myTreeView->selectionModel();
/*QItemSelectionModel* aModel = myTreeView->selectionModel();
if (!aModel)
return;
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
@@ -718,7 +720,7 @@ void MessageView_Window::onAutoExportActivate()
Handle(Message_Report) aReport = aReportItem->GetReport();
QAction* anAction = (QAction*)(sender());
aReport->SetWriteFileOnEachAlert (anAction->isChecked());
aReport->SetWriteFileOnEachAlert (anAction->isChecked());*/
}
// =======================================================================
@@ -727,7 +729,7 @@ void MessageView_Window::onAutoExportActivate()
// =======================================================================
void MessageView_Window::onExportTraceOnly()
{
QItemSelectionModel* aModel = myTreeView->selectionModel();
/*QItemSelectionModel* aModel = myTreeView->selectionModel();
if (!aModel)
return;
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
@@ -746,7 +748,7 @@ void MessageView_Window::onExportTraceOnly()
return;
QAction* anAction = (QAction*)(sender());
aReport->MessageWriter()->SetGravity (anAction->isChecked() ? Message_Trace : Message_Info);
aReport->MessageWriter()->SetGravity (anAction->isChecked() ? Message_Trace : Message_Info);*/
}
// =======================================================================
@@ -807,8 +809,7 @@ void MessageView_Window::OnActivateMetric()
return;
Handle(Message_Report) aReport = Message::DefaultReport();
const NCollection_Map<Message_MetricType>& anActiveMetrics = aReport->ActiveMetrics();
const NCollection_IndexedMap<Message_MetricType>& anActiveMetrics = aReport->ActiveMetrics();
aReport->SetActiveMetric (aMetricType, !anActiveMetrics.Contains (aMetricType));
updateVisibleColumns();
@@ -912,11 +913,11 @@ void MessageView_Window::updateVisibleColumns()
{
MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
NCollection_Map<Message_MetricType> anActiveMetrics;
NCollection_IndexedMap<Message_MetricType> anActiveMetrics;
for (NCollection_List<MessageModel_ReportInformation>::Iterator anIterator (aViewModel->Reports()); anIterator.More(); anIterator.Next())
{
Handle(Message_Report) aReport = anIterator.Value().myReport;
for (NCollection_Map<Message_MetricType>::Iterator aMetricsIterator (aReport->ActiveMetrics()); aMetricsIterator.More(); aMetricsIterator.Next())
for (NCollection_IndexedMap<Message_MetricType>::Iterator aMetricsIterator (aReport->ActiveMetrics()); aMetricsIterator.More(); aMetricsIterator.Next())
{
if (anActiveMetrics.Contains (aMetricsIterator.Value()))
continue;