]> OCCT Git - occt-copy.git/commitdiff
0031362: Inspectors - MessageView plugin for message alerts
authornds <nds@opencascade.com>
Tue, 24 Nov 2020 18:24:33 +0000 (21:24 +0300)
committernds <nds@opencascade.com>
Tue, 24 Nov 2020 19:08:47 +0000 (22:08 +0300)
adm/TOOLS
tools/MessageModel/MessageModel_Actions.cxx
tools/MessageModel/MessageModel_ItemAlert.cxx
tools/MessageModel/MessageModel_ItemReport.cxx
tools/MessageView/MessageView_ActionsTest.cxx
tools/MessageView/MessageView_Window.cxx

index b106a7c10bca46ca90821160ae370e4e3d4d8a06..57ddcfcc647d3402a54f4626ffc7134b7bd1e7f1 100644 (file)
--- 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
index 8ca4217c74cb80f8607ed1cd8309824ce1caddba..ddc083b49d00d3fdfbba8dedf0c6f5856e1a06af 100644 (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();
index a0904ec5c11d8f3a9892954f47d3439ae7d8f6d5..1e2fbbdaa738c06d1c36aabf25dcf8f00c5b54cb 100644 (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);
index bf4fc5a7f7541b134c2fb35160a957383f52f1f0..9efaf20c582ebf4fa963954aadeca398dc754138 100644 (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);
index 743a4540c125b2c2fd3c5077e6bd1ba7fb52a670..f26ca8653eccfd63f04212d9a793f1960c856cfe 100644 (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
 }
index a2270827d1cc2302f9bcf11006fcbd882fff879a..b619b898c6a5a051f9fce774983455bae7763b99 100644 (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;