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:
@@ -1,4 +1,4 @@
|
|||||||
TModelingData TKShapeView
|
TModelingData TKShapeView TKMessageModel TKMessageView
|
||||||
TVisualization TKView TKVInspector
|
TVisualization TKView TKVInspector
|
||||||
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
|
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
|
||||||
TTool TKTInspector TKToolsDraw TInspectorEXE
|
TTool TKTInspector TKToolsDraw TInspectorEXE
|
@@ -169,7 +169,7 @@ void MessageModel_Actions::OnActivateReport()
|
|||||||
Message::DefaultMessenger()->ChangePrinters().Clear();
|
Message::DefaultMessenger()->ChangePrinters().Clear();
|
||||||
|
|
||||||
Message::DefaultMessenger()->AddPrinter (MyPrinterToReport);
|
Message::DefaultMessenger()->AddPrinter (MyPrinterToReport);
|
||||||
Message::DefaultMessenger()->SetTraceLevel (1);
|
//Message::DefaultMessenger()->SetTraceLevel (1);
|
||||||
Message::DefaultReport()->UpdateActiveInMessenger();
|
Message::DefaultReport()->UpdateActiveInMessenger();
|
||||||
|
|
||||||
myTreeModel->UpdateTreeModel();
|
myTreeModel->UpdateTreeModel();
|
||||||
|
@@ -122,8 +122,8 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
|
|||||||
if (!anAttribute->IsMetricValid (aMetricType))
|
if (!anAttribute->IsMetricValid (aMetricType))
|
||||||
return QVariant ("in process");
|
return QVariant ("in process");
|
||||||
|
|
||||||
if (aMetricType == Message_MetricType_UserTimeCPU ||
|
if (aMetricType == Message_MetricType_ProcessCPUUserTime ||
|
||||||
aMetricType == Message_MetricType_SystemTimeInfo ||
|
aMetricType == Message_MetricType_ProcessCPUSystemTime ||
|
||||||
aMetricType == Message_MetricType_WallClock)
|
aMetricType == Message_MetricType_WallClock)
|
||||||
{
|
{
|
||||||
Standard_Real aCumulativeMetric = anAttribute->StopValue (aMetricType) - anAttribute->StartValue (aMetricType);
|
Standard_Real aCumulativeMetric = anAttribute->StopValue (aMetricType) - anAttribute->StartValue (aMetricType);
|
||||||
|
@@ -67,7 +67,7 @@ QVariant MessageModel_ItemReport::initValue (const int theRole) const
|
|||||||
Message_MetricType aMetricType;
|
Message_MetricType aMetricType;
|
||||||
int aPosition;
|
int aPosition;
|
||||||
if (MessageModel_TreeModel::IsMetricColumn (Column(), aMetricType, 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))
|
aMetricType == Message_MetricType_WallClock))
|
||||||
{
|
{
|
||||||
if (aPosition == 0) return CumulativeMetric (aReport, aMetricType);
|
if (aPosition == 0) return CumulativeMetric (aReport, aMetricType);
|
||||||
|
@@ -310,6 +310,7 @@ void MessageView_ActionsTest::OnTestPropertyPanel()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void createShapeOnLevel()
|
void createShapeOnLevel()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("createShapeOnLevel")
|
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("createShapeOnLevel")
|
||||||
|
|
||||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||||
@@ -319,6 +320,7 @@ void createShapeOnLevel()
|
|||||||
|
|
||||||
MESSAGE_INFO_SHAPE (aShape, "Shape message edge ON LEVEL");
|
MESSAGE_INFO_SHAPE (aShape, "Shape message edge ON LEVEL");
|
||||||
//sout << "Shape message edge" << aShape;
|
//sout << "Shape message edge" << aShape;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -327,6 +329,7 @@ void createShapeOnLevel()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void createShape()
|
void createShape()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||||
|
|
||||||
BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
|
BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
|
||||||
@@ -336,6 +339,7 @@ void createShape()
|
|||||||
//sout << "Shape message edge" << aShape;
|
//sout << "Shape message edge" << aShape;
|
||||||
|
|
||||||
createShapeOnLevel();
|
createShapeOnLevel();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -344,6 +348,7 @@ void createShape()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MessageView_ActionsTest::OnTestMessenger()
|
void MessageView_ActionsTest::OnTestMessenger()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
// string messages
|
// string messages
|
||||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||||
Standard_Integer aTraceLevel_prev = Message::DefaultMessenger()->TraceLevel();
|
Standard_Integer aTraceLevel_prev = Message::DefaultMessenger()->TraceLevel();
|
||||||
@@ -393,6 +398,7 @@ void MessageView_ActionsTest::OnTestMessenger()
|
|||||||
}
|
}
|
||||||
myTreeModel->UpdateTreeModel();
|
myTreeModel->UpdateTreeModel();
|
||||||
Message::DefaultMessenger()->SetTraceLevel (aTraceLevel_prev);
|
Message::DefaultMessenger()->SetTraceLevel (aTraceLevel_prev);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -401,6 +407,7 @@ void MessageView_ActionsTest::OnTestMessenger()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void levelAlerts (const int theCurrentLevel, const int theTopLevel)
|
void levelAlerts (const int theCurrentLevel, const int theTopLevel)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
if (theTopLevel - theCurrentLevel <= 0)
|
if (theTopLevel - theCurrentLevel <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -414,6 +421,7 @@ void levelAlerts (const int theCurrentLevel, const int theTopLevel)
|
|||||||
levelAlerts (theCurrentLevel + 1, theTopLevel);
|
levelAlerts (theCurrentLevel + 1, theTopLevel);
|
||||||
|
|
||||||
sout << "Alert(" << theCurrentLevel << "): " << 4 << ", " << 5 << std::endl;
|
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)
|
void levelAlert (const int theCurrentLevel, const int theTopLevel)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
if (theTopLevel - theCurrentLevel <= 0)
|
if (theTopLevel - theCurrentLevel <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -432,6 +441,7 @@ void levelAlert (const int theCurrentLevel, const int theTopLevel)
|
|||||||
|
|
||||||
//for (int i = 0; i < 2; i++)
|
//for (int i = 0; i < 2; i++)
|
||||||
levelAlerts (theCurrentLevel + 1, theTopLevel);
|
levelAlerts (theCurrentLevel + 1, theTopLevel);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -440,6 +450,7 @@ void levelAlert (const int theCurrentLevel, const int theTopLevel)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MessageView_ActionsTest::OnTestReportTree()
|
void MessageView_ActionsTest::OnTestReportTree()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
|
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
|
||||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||||
|
|
||||||
@@ -457,6 +468,7 @@ void MessageView_ActionsTest::OnTestReportTree()
|
|||||||
levelAlert (1, aTopLevel);
|
levelAlert (1, aTopLevel);
|
||||||
|
|
||||||
myTreeModel->UpdateTreeModel();
|
myTreeModel->UpdateTreeModel();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -465,6 +477,7 @@ void MessageView_ActionsTest::OnTestReportTree()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MessageView_ActionsTest::OnTestReportTree2()
|
void MessageView_ActionsTest::OnTestReportTree2()
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
|
OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
|
||||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||||
|
|
||||||
@@ -482,4 +495,5 @@ void MessageView_ActionsTest::OnTestReportTree2()
|
|||||||
//levelAlert (1, aTopLevel);
|
//levelAlert (1, aTopLevel);
|
||||||
|
|
||||||
myTreeModel->UpdateTreeModel();
|
myTreeModel->UpdateTreeModel();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -43,9 +43,9 @@
|
|||||||
#include <Message.hxx>
|
#include <Message.hxx>
|
||||||
#include <TCollection_AsciiString.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/ViewControl_Tools.hxx>
|
||||||
#include <inspector/View_Displayer.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)
|
void MessageView_Window::openFile(const TCollection_AsciiString& theFileName)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_ALERTS
|
||||||
if (theFileName.IsEmpty())
|
if (theFileName.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -395,6 +396,7 @@ void MessageView_Window::openFile(const TCollection_AsciiString& theFileName)
|
|||||||
aReport->MessageWriter()->ImportReport (aReport);
|
aReport->MessageWriter()->ImportReport (aReport);
|
||||||
|
|
||||||
addReport (aReport, theFileName);
|
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));
|
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Reload"), SLOT (onReloadReport()), myMainWindow, this));
|
||||||
}
|
}
|
||||||
Handle(Message_Report) aReport = aReportItem->GetReport();
|
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->setCheckable (true);
|
||||||
anAction->setChecked (aReport->WriteFileOnEachAlert());
|
anAction->setChecked (aReport->WriteFileOnEachAlert());
|
||||||
aMenu->addAction (anAction);
|
aMenu->addAction (anAction);
|
||||||
@@ -510,7 +512,7 @@ void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePositi
|
|||||||
anAction->setCheckable (true);
|
anAction->setCheckable (true);
|
||||||
bool isTraceOnly = aReport->MessageWriter().IsNull() ? false : aReport->MessageWriter()->Gravity() == Message_Trace;
|
bool isTraceOnly = aReport->MessageWriter().IsNull() ? false : aReport->MessageWriter()->Gravity() == Message_Trace;
|
||||||
anAction->setChecked (isTraceOnly);
|
anAction->setChecked (isTraceOnly);
|
||||||
aMenu->addAction (anAction);
|
aMenu->addAction (anAction);*/
|
||||||
}
|
}
|
||||||
aMenu->addSeparator();
|
aMenu->addSeparator();
|
||||||
|
|
||||||
@@ -683,13 +685,13 @@ void MessageView_Window::onReloadReport()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Handle(Message_Report) aReport = aReportItem->GetReport();
|
Handle(Message_Report) aReport = aReportItem->GetReport();
|
||||||
aReport->Clear();
|
/*aReport->Clear();
|
||||||
if (aReport->MessageWriter().IsNull())
|
if (aReport->MessageWriter().IsNull())
|
||||||
aReport->SetMessageWriter (new XmlDrivers_MessageReportStorage());
|
aReport->SetMessageWriter (new XmlDrivers_MessageReportStorage());
|
||||||
|
|
||||||
aReport->MessageWriter()->SetFileName (TCollection_AsciiString (aDescription));
|
aReport->MessageWriter()->SetFileName (TCollection_AsciiString (aDescription));
|
||||||
if (!aReport->MessageWriter()->ImportReport (aReport))
|
if (!aReport->MessageWriter()->ImportReport (aReport))
|
||||||
return;
|
return;*/
|
||||||
|
|
||||||
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
|
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
|
||||||
aModel->clearSelection();
|
aModel->clearSelection();
|
||||||
@@ -702,7 +704,7 @@ void MessageView_Window::onReloadReport()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MessageView_Window::onAutoExportActivate()
|
void MessageView_Window::onAutoExportActivate()
|
||||||
{
|
{
|
||||||
QItemSelectionModel* aModel = myTreeView->selectionModel();
|
/*QItemSelectionModel* aModel = myTreeView->selectionModel();
|
||||||
if (!aModel)
|
if (!aModel)
|
||||||
return;
|
return;
|
||||||
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
||||||
@@ -718,7 +720,7 @@ void MessageView_Window::onAutoExportActivate()
|
|||||||
|
|
||||||
Handle(Message_Report) aReport = aReportItem->GetReport();
|
Handle(Message_Report) aReport = aReportItem->GetReport();
|
||||||
QAction* anAction = (QAction*)(sender());
|
QAction* anAction = (QAction*)(sender());
|
||||||
aReport->SetWriteFileOnEachAlert (anAction->isChecked());
|
aReport->SetWriteFileOnEachAlert (anAction->isChecked());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@@ -727,7 +729,7 @@ void MessageView_Window::onAutoExportActivate()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void MessageView_Window::onExportTraceOnly()
|
void MessageView_Window::onExportTraceOnly()
|
||||||
{
|
{
|
||||||
QItemSelectionModel* aModel = myTreeView->selectionModel();
|
/*QItemSelectionModel* aModel = myTreeView->selectionModel();
|
||||||
if (!aModel)
|
if (!aModel)
|
||||||
return;
|
return;
|
||||||
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
|
||||||
@@ -746,7 +748,7 @@ void MessageView_Window::onExportTraceOnly()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QAction* anAction = (QAction*)(sender());
|
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;
|
return;
|
||||||
|
|
||||||
Handle(Message_Report) aReport = Message::DefaultReport();
|
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));
|
aReport->SetActiveMetric (aMetricType, !anActiveMetrics.Contains (aMetricType));
|
||||||
|
|
||||||
updateVisibleColumns();
|
updateVisibleColumns();
|
||||||
@@ -912,11 +913,11 @@ void MessageView_Window::updateVisibleColumns()
|
|||||||
{
|
{
|
||||||
MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
|
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())
|
for (NCollection_List<MessageModel_ReportInformation>::Iterator anIterator (aViewModel->Reports()); anIterator.More(); anIterator.Next())
|
||||||
{
|
{
|
||||||
Handle(Message_Report) aReport = anIterator.Value().myReport;
|
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()))
|
if (anActiveMetrics.Contains (aMetricsIterator.Value()))
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user