From 6104e99df780f00ec10c682460f950782f7a82f2 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 24 Nov 2020 21:24:33 +0300 Subject: [PATCH] 0031362: Inspectors - MessageView plugin for message alerts --- adm/TOOLS | 2 +- tools/MessageModel/MessageModel_Actions.cxx | 2 +- tools/MessageModel/MessageModel_ItemAlert.cxx | 4 +-- .../MessageModel/MessageModel_ItemReport.cxx | 2 +- tools/MessageView/MessageView_ActionsTest.cxx | 14 +++++++++ tools/MessageView/MessageView_Window.cxx | 29 ++++++++++--------- 6 files changed, 34 insertions(+), 19 deletions(-) diff --git a/adm/TOOLS b/adm/TOOLS index b106a7c10b..57ddcfcc64 100644 --- a/adm/TOOLS +++ b/adm/TOOLS @@ -1,4 +1,4 @@ -TModelingData TKShapeView +TModelingData TKShapeView TKMessageModel TKMessageView TVisualization TKView TKVInspector TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser TTool TKTInspector TKToolsDraw TInspectorEXE \ No newline at end of file diff --git a/tools/MessageModel/MessageModel_Actions.cxx b/tools/MessageModel/MessageModel_Actions.cxx index 8ca4217c74..ddc083b49d 100644 --- a/tools/MessageModel/MessageModel_Actions.cxx +++ b/tools/MessageModel/MessageModel_Actions.cxx @@ -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(); diff --git a/tools/MessageModel/MessageModel_ItemAlert.cxx b/tools/MessageModel/MessageModel_ItemAlert.cxx index a0904ec5c1..1e2fbbdaa7 100644 --- a/tools/MessageModel/MessageModel_ItemAlert.cxx +++ b/tools/MessageModel/MessageModel_ItemAlert.cxx @@ -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); diff --git a/tools/MessageModel/MessageModel_ItemReport.cxx b/tools/MessageModel/MessageModel_ItemReport.cxx index bf4fc5a7f7..9efaf20c58 100644 --- a/tools/MessageModel/MessageModel_ItemReport.cxx +++ b/tools/MessageModel/MessageModel_ItemReport.cxx @@ -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); diff --git a/tools/MessageView/MessageView_ActionsTest.cxx b/tools/MessageView/MessageView_ActionsTest.cxx index 743a4540c1..f26ca8653e 100644 --- a/tools/MessageView/MessageView_ActionsTest.cxx +++ b/tools/MessageView/MessageView_ActionsTest.cxx @@ -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 } diff --git a/tools/MessageView/MessageView_Window.cxx b/tools/MessageView/MessageView_Window.cxx index a2270827d1..b619b898c6 100644 --- a/tools/MessageView/MessageView_Window.cxx +++ b/tools/MessageView/MessageView_Window.cxx @@ -43,9 +43,9 @@ #include #include -#define DEBUG_ALERTS +//#define DEBUG_ALERTS -#include +//#include #include #include @@ -382,6 +382,7 @@ void MessageView_Window::Init (NCollection_List& 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 (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& anActiveMetrics = aReport->ActiveMetrics(); - + const NCollection_IndexedMap& anActiveMetrics = aReport->ActiveMetrics(); aReport->SetActiveMetric (aMetricType, !anActiveMetrics.Contains (aMetricType)); updateVisibleColumns(); @@ -912,11 +913,11 @@ void MessageView_Window::updateVisibleColumns() { MessageModel_TreeModel* aViewModel = dynamic_cast (myTreeView->model()); - NCollection_Map anActiveMetrics; + NCollection_IndexedMap anActiveMetrics; for (NCollection_List::Iterator anIterator (aViewModel->Reports()); anIterator.More(); anIterator.Next()) { Handle(Message_Report) aReport = anIterator.Value().myReport; - for (NCollection_Map::Iterator aMetricsIterator (aReport->ActiveMetrics()); aMetricsIterator.More(); aMetricsIterator.Next()) + for (NCollection_IndexedMap::Iterator aMetricsIterator (aReport->ActiveMetrics()); aMetricsIterator.More(); aMetricsIterator.Next()) { if (anActiveMetrics.Contains (aMetricsIterator.Value())) continue; -- 2.39.5