0
0
mirror of https://github.com/yse/easy_profiler.git synced 2025-01-14 00:27:55 +08:00

#0 [GUI] HierarchyTree: Finally replaced colored rows with colored squares in front of block name. These squares can not be turned off from now.

This commit is contained in:
Victor Zarubkin 2017-12-06 22:04:08 +03:00
parent f03fa50dd5
commit 2b24ea635f
7 changed files with 88 additions and 113 deletions

View File

@ -78,6 +78,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QByteArray> #include <QByteArray>
#include <QDebug> #include <QDebug>
#include <QApplication>
#include "blocks_tree_widget.h" #include "blocks_tree_widget.h"
#include "globals.h" #include "globals.h"
@ -142,7 +143,6 @@ EasyTreeWidget::EasyTreeWidget(QWidget* _parent)
, m_progress(nullptr) , m_progress(nullptr)
, m_hintLabel(nullptr) , m_hintLabel(nullptr)
, m_mode(EasyTreeMode_Plain) , m_mode(EasyTreeMode_Plain)
, m_bColorRows(true)
, m_bLocked(false) , m_bLocked(false)
, m_bSilentExpandCollapse(false) , m_bSilentExpandCollapse(false)
{ {
@ -227,8 +227,8 @@ EasyTreeWidget::EasyTreeWidget(QWidget* _parent)
setHeaderItem(header_item); setHeaderItem(header_item);
connect(&EASY_GLOBALS.events, &::profiler_gui::EasyGlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange); connect(&EASY_GLOBALS.events, &::profiler_gui::EasyGlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange, Qt::QueuedConnection);
connect(&EASY_GLOBALS.events, &::profiler_gui::EasyGlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChange); connect(&EASY_GLOBALS.events, &::profiler_gui::EasyGlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChange, Qt::QueuedConnection);
connect(&m_fillTimer, &QTimer::timeout, this, &This::onFillTimerTimeout); connect(&m_fillTimer, &QTimer::timeout, this, &This::onFillTimerTimeout);
loadSettings(); loadSettings();
@ -327,7 +327,7 @@ void EasyTreeWidget::setTree(const unsigned int _blocksNumber, const ::profiler:
m_bLocked = true; m_bLocked = true;
m_hintLabel->hide(); m_hintLabel->hide();
createProgressDialog(); createProgressDialog();
m_hierarchyBuilder.fillTree(m_beginTime, _blocksNumber, _blocksTree, m_bColorRows, m_mode); m_hierarchyBuilder.fillTree(m_beginTime, _blocksNumber, _blocksTree, m_mode);
m_fillTimer.start(HIERARCHY_BUILDER_TIMER_INTERVAL); m_fillTimer.start(HIERARCHY_BUILDER_TIMER_INTERVAL);
} }
@ -341,7 +341,7 @@ void EasyTreeWidget::setTree(const unsigned int _blocksNumber, const ::profiler:
// addTopLevelItem(item.second); // addTopLevelItem(item.second);
// m_roots[item.first] = item.second; // m_roots[item.first] = item.second;
// if (item.first == EASY_GLOBALS.selected_thread) // if (item.first == EASY_GLOBALS.selected_thread)
// item.second->colorize(true); // item.second->setMain(true);
// } // }
//} //}
} }
@ -360,7 +360,7 @@ void EasyTreeWidget::setTreeBlocks(const ::profiler_gui::TreeBlocks& _blocks, ::
m_bLocked = true; m_bLocked = true;
m_hintLabel->hide(); m_hintLabel->hide();
createProgressDialog(); createProgressDialog();
m_hierarchyBuilder.fillTreeBlocks(m_inputBlocks, _session_begin_time, _left, _right, _strict, m_bColorRows, m_mode); m_hierarchyBuilder.fillTreeBlocks(m_inputBlocks, _session_begin_time, _left, _right, _strict, m_mode);
m_fillTimer.start(HIERARCHY_BUILDER_TIMER_INTERVAL); m_fillTimer.start(HIERARCHY_BUILDER_TIMER_INTERVAL);
} }
@ -374,7 +374,7 @@ void EasyTreeWidget::setTreeBlocks(const ::profiler_gui::TreeBlocks& _blocks, ::
// addTopLevelItem(item.second); // addTopLevelItem(item.second);
// m_roots[item.first] = item.second; // m_roots[item.first] = item.second;
// if (item.first == EASY_GLOBALS.selected_thread) // if (item.first == EASY_GLOBALS.selected_thread)
// item.second->colorize(true); // item.second->setMain(true);
// } // }
//} //}
@ -621,23 +621,6 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
menu.addSeparator(); menu.addSeparator();
action = menu.addAction("Color rows");
action->setToolTip("Colorize rows with same colors as on diagram");
action->setCheckable(true);
action->setChecked(m_bColorRows);
connect(action, &QAction::triggered, this, &This::onColorizeRowsTriggered);
if (m_bColorRows)
{
auto f = action->font();
f.setBold(true);
action->setFont(f);
action->setIcon(QIcon(imagePath("color")));
}
else
{
action->setIcon(QIcon(imagePath("no-color")));
}
if (item != nullptr && item->parent() != nullptr) if (item != nullptr && item->parent() != nullptr)
{ {
if (col >= 0) if (col >= 0)
@ -675,6 +658,9 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
break; break;
} }
default:
break;
} }
} }
@ -703,8 +689,6 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
submenu->setTitle(QString("%1 (connection needed)").arg(submenu->title())); submenu->setTitle(QString("%1 (connection needed)").arg(submenu->title()));
} }
menu.addSeparator();
auto hidemenu = menu.addMenu("Select columns"); auto hidemenu = menu.addMenu("Select columns");
auto hdr = headerItem(); auto hdr = headerItem();
@ -949,49 +933,21 @@ void EasyTreeWidget::onCurrentItemChange(QTreeWidgetItem* _item, QTreeWidgetItem
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void EasyTreeWidget::onColorizeRowsTriggered(bool _colorize)
{
const QSignalBlocker b(this);
m_bColorRows = _colorize;
auto current = currentItem();
collapseAll(); // Without collapseAll() changing items process is VERY VERY SLOW.
// TODO: Find the reason of such behavior. QSignalBlocker(this) does not help. QSignalBlocker(item) does not work, because items are not inherited from QObject.
#ifdef EASY_TREE_WIDGET__USE_VECTOR
for (auto item : m_items)
{
if (item->parent() != nullptr)
item->colorize(m_bColorRows);
}
#else
for (auto& item : m_items)
{
if (item.second->parent() != nullptr)
item.second->colorize(m_bColorRows);
}
#endif
// Scroll back to previously selected item
if (current)
{
scrollToItem(current, QAbstractItemView::PositionAtCenter);
setCurrentItem(current);
}
}
//////////////////////////////////////////////////////////////////////////
void EasyTreeWidget::onSelectedThreadChange(::profiler::thread_id_t _id) void EasyTreeWidget::onSelectedThreadChange(::profiler::thread_id_t _id)
{ {
for (auto& it : m_roots) for (auto& it : m_roots)
{ {
auto item = it.second; auto item = it.second;
item->setMain(it.first == _id); item->setMain(it.first == _id);
item->colorize(it.first == _id);
} }
// Calling update() or repaint() (or both!) does not work even if setUpdatesEnabled(true) have been set in constructor.
// Have to set focus to this widget to force update/repaint. :(
// TODO: Find valid solution instead of this workaround.
auto f = qApp->focusWidget();
setFocus();
if (f != nullptr)
f->setFocus();
} }
void EasyTreeWidget::onSelectedBlockChange(uint32_t _block_index) void EasyTreeWidget::onSelectedBlockChange(uint32_t _block_index)
@ -1111,11 +1067,7 @@ void EasyTreeWidget::loadSettings()
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME); QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
settings.beginGroup("tree_widget"); settings.beginGroup("tree_widget");
auto val = settings.value("color_rows"); auto val = settings.value("regime");
if (!val.isNull())
m_bColorRows = val.toBool();
val = settings.value("regime");
if (!val.isNull()) if (!val.isNull())
m_mode = static_cast<EasyTreeMode>(val.toUInt()); m_mode = static_cast<EasyTreeMode>(val.toUInt());
@ -1137,7 +1089,6 @@ void EasyTreeWidget::saveSettings()
{ {
QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME); QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME);
settings.beginGroup("tree_widget"); settings.beginGroup("tree_widget");
settings.setValue("color_rows", m_bColorRows);
settings.setValue("regime", static_cast<uint8_t>(m_mode)); settings.setValue("regime", static_cast<uint8_t>(m_mode));
settings.setValue("columns", QByteArray(m_columnsHiddenStatus, COL_COLUMNS_NUMBER)); settings.setValue("columns", QByteArray(m_columnsHiddenStatus, COL_COLUMNS_NUMBER));
settings.setValue("headerState", header()->saveState()); settings.setValue("headerState", header()->saveState());

View File

@ -93,7 +93,6 @@ protected:
class QProgressDialog* m_progress; class QProgressDialog* m_progress;
class QLabel* m_hintLabel; class QLabel* m_hintLabel;
EasyTreeMode m_mode; EasyTreeMode m_mode;
bool m_bColorRows;
bool m_bLocked; bool m_bLocked;
bool m_bSilentExpandCollapse; bool m_bSilentExpandCollapse;
char m_columnsHiddenStatus[COL_COLUMNS_NUMBER]; char m_columnsHiddenStatus[COL_COLUMNS_NUMBER];
@ -136,8 +135,6 @@ private slots:
void onItemCollapse(QTreeWidgetItem* _item); void onItemCollapse(QTreeWidgetItem* _item);
void onCurrentItemChange(QTreeWidgetItem* _item, QTreeWidgetItem*); void onCurrentItemChange(QTreeWidgetItem* _item, QTreeWidgetItem*);
void onColorizeRowsTriggered(bool _colorize);
void onSelectedThreadChange(::profiler::thread_id_t _id); void onSelectedThreadChange(::profiler::thread_id_t _id);
void onSelectedBlockChange(uint32_t _block_index); void onSelectedBlockChange(uint32_t _block_index);

View File

@ -12,8 +12,6 @@
<file alias="reload">images/default/reload.svg</file> <file alias="reload">images/default/reload.svg</file>
<file alias="expand">images/default/expand.svg</file> <file alias="expand">images/default/expand.svg</file>
<file alias="collapse">images/default/collapse.svg</file> <file alias="collapse">images/default/collapse.svg</file>
<file alias="color">images/default/colors.svg</file>
<file alias="no-color">images/default/colors-black.svg</file>
<file alias="save">images/default/save.svg</file> <file alias="save">images/default/save.svg</file>
<file alias="stats">images/default/statistics.svg</file> <file alias="stats">images/default/statistics.svg</file>
<file alias="stats-off">images/default/statistics2.svg</file> <file alias="stats-off">images/default/statistics2.svg</file>

View File

@ -113,7 +113,6 @@ EasyTreeWidgetItem::EasyTreeWidgetItem(const ::profiler::block_index_t _treeBloc
: Parent(_parent, QTreeWidgetItem::UserType) : Parent(_parent, QTreeWidgetItem::UserType)
, m_block(_treeBlock) , m_block(_treeBlock)
, m_customBGColor(0) , m_customBGColor(0)
, m_bColorized(false)
, m_bMain(false) , m_bMain(false)
{ {
@ -198,7 +197,7 @@ QVariant EasyTreeWidgetItem::data(int _column, int _role) const
if (_role == BlockColorRole) if (_role == BlockColorRole)
{ {
if (m_bColorized) if (parent() != nullptr || m_bMain)
return QBrush(QColor::fromRgba(m_customBGColor)); return QBrush(QColor::fromRgba(m_customBGColor));
return QVariant(); return QVariant();
} }
@ -310,11 +309,6 @@ void EasyTreeWidgetItem::setMain(bool _main)
m_bMain = _main; m_bMain = _main;
} }
void EasyTreeWidgetItem::colorize(bool _colorize)
{
m_bColorized = _colorize;
}
void EasyTreeWidgetItem::collapseAll() void EasyTreeWidgetItem::collapseAll()
{ {
for (int i = 0, childrenNumber = childCount(); i < childrenNumber; ++i) for (int i = 0, childrenNumber = childCount(); i < childrenNumber; ++i)

View File

@ -122,7 +122,6 @@ class EasyTreeWidgetItem : public QTreeWidgetItem
const ::profiler::block_index_t m_block; const ::profiler::block_index_t m_block;
QRgb m_customBGColor; QRgb m_customBGColor;
std::bitset<17> m_bHasToolTip; std::bitset<17> m_bHasToolTip;
bool m_bColorized;
bool m_bMain; bool m_bMain;
public: public:
@ -152,8 +151,6 @@ public:
void setMain(bool _main); void setMain(bool _main);
void colorize(bool _colorize);
void collapseAll(); void collapseAll();
void expandAll(); void expandAll();

View File

@ -170,27 +170,27 @@ void EasyTreeWidgetLoader::interrupt(bool _wait)
m_iditems.clear(); m_iditems.clear();
} }
void EasyTreeWidgetLoader::fillTree(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows, EasyTreeMode _mode) void EasyTreeWidgetLoader::fillTree(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, EasyTreeMode _mode)
{ {
interrupt(); interrupt();
m_mode = _mode; m_mode = _mode;
m_thread = ::std::thread(&EasyTreeWidgetLoader::setTreeInternal1, this, m_thread = ::std::thread(&EasyTreeWidgetLoader::setTreeInternal1, this,
::std::ref(_beginTime), _blocksNumber, ::std::ref(_blocksTree), _colorizeRows, ::std::ref(_beginTime), _blocksNumber, ::std::ref(_blocksTree), EASY_GLOBALS.add_zero_blocks_to_hierarchy,
EASY_GLOBALS.add_zero_blocks_to_hierarchy, EASY_GLOBALS.use_decorated_thread_name, EASY_GLOBALS.hex_thread_id, EASY_GLOBALS.time_units); EASY_GLOBALS.use_decorated_thread_name, EASY_GLOBALS.hex_thread_id, EASY_GLOBALS.time_units);
} }
void EasyTreeWidgetLoader::fillTreeBlocks(const::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _beginTime, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, bool _colorizeRows, EasyTreeMode _mode) void EasyTreeWidgetLoader::fillTreeBlocks(const::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _beginTime, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, EasyTreeMode _mode)
{ {
interrupt(); interrupt();
m_mode = _mode; m_mode = _mode;
m_thread = ::std::thread(&EasyTreeWidgetLoader::setTreeInternal2, this, m_thread = ::std::thread(&EasyTreeWidgetLoader::setTreeInternal2, this,
_beginTime, ::std::ref(_blocks), _left, _right, _strict, _colorizeRows, _beginTime, ::std::ref(_blocks), _left, _right, _strict, EASY_GLOBALS.add_zero_blocks_to_hierarchy,
EASY_GLOBALS.add_zero_blocks_to_hierarchy, EASY_GLOBALS.use_decorated_thread_name, EASY_GLOBALS.hex_thread_id, EASY_GLOBALS.time_units); EASY_GLOBALS.use_decorated_thread_name, EASY_GLOBALS.hex_thread_id, EASY_GLOBALS.time_units);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void EasyTreeWidgetLoader::setTreeInternal1(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units) void EasyTreeWidgetLoader::setTreeInternal1(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units)
{ {
m_items.reserve(_blocksNumber + _blocksTree.size()); // _blocksNumber does not include Thread root blocks m_items.reserve(_blocksNumber + _blocksTree.size()); // _blocksNumber does not include Thread root blocks
@ -233,7 +233,9 @@ void EasyTreeWidgetLoader::setTreeInternal1(::profiler::timestamp_t& _beginTime,
item->setTimeSmart(COL_SELF_DURATION, _units, root.profiled_time); item->setTimeSmart(COL_SELF_DURATION, _units, root.profiled_time);
::profiler::timestamp_t children_duration = 0; ::profiler::timestamp_t children_duration = 0;
const auto children_items_number = setTreeInternal(root, 0, _beginTime, root.children, item, nullptr, _beginTime, finishtime + 1000000000ULL, false, children_duration, _colorizeRows, _addZeroBlocks, _units); const auto children_items_number = setTreeInternal(root, 0, _beginTime, root.children, item, nullptr,
_beginTime, finishtime + 1000000000ULL, false,
children_duration, _addZeroBlocks, _units);
if (children_items_number > 0) if (children_items_number > 0)
{ {
@ -265,9 +267,18 @@ void EasyTreeWidgetLoader::setTreeInternal1(::profiler::timestamp_t& _beginTime,
// return children_number; // return children_number;
// } // }
typedef ::std::unordered_map<::profiler::thread_id_t, ::profiler::block_index_t, ::profiler::passthrough_hash<::profiler::thread_id_t> > BeginEndIndicesMap; using BeginEndIndicesMap = ::std::unordered_map<::profiler::thread_id_t, ::profiler::block_index_t,
::profiler::passthrough_hash<::profiler::thread_id_t> >;
void EasyTreeWidgetLoader::setTreeInternal2(const ::profiler::timestamp_t& _beginTime, const ::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, bool _colorizeRows, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units) void EasyTreeWidgetLoader::setTreeInternal2(const ::profiler::timestamp_t& _beginTime,
const ::profiler_gui::TreeBlocks& _blocks,
::profiler::timestamp_t _left,
::profiler::timestamp_t _right,
bool _strict,
bool _addZeroBlocks,
bool _decoratedThreadNames,
bool _hexThreadId,
::profiler_gui::TimeUnits _units)
{ {
//size_t blocksNumber = 0; //size_t blocksNumber = 0;
//for (const auto& block : _blocks) //for (const auto& block : _blocks)
@ -452,7 +463,11 @@ void EasyTreeWidgetLoader::setTreeInternal2(const ::profiler::timestamp_t& _begi
if (!gui_block.tree.children.empty()) if (!gui_block.tree.children.empty())
{ {
m_iditems.clear(); m_iditems.clear();
children_items_number = (this->*setTree)(*block.root, firstCswitch, _beginTime, gui_block.tree.children, item, item, _left, _right, _strict, children_duration, _colorizeRows, _addZeroBlocks, _units);
children_items_number = (this->*setTree)(*block.root, firstCswitch, _beginTime, gui_block.tree.children,
item, item, _left, _right, _strict, children_duration,
_addZeroBlocks, _units);
if (interrupted()) if (interrupted())
break; break;
} }
@ -475,9 +490,6 @@ void EasyTreeWidgetLoader::setTreeInternal2(const ::profiler::timestamp_t& _begi
gui_block.tree_item = item_index; gui_block.tree_item = item_index;
#endif #endif
if (_colorizeRows)
item->colorize(_colorizeRows);
if (gui_block.expanded) if (gui_block.expanded)
item->setExpanded(true); item->setExpanded(true);
@ -526,7 +538,18 @@ void EasyTreeWidgetLoader::setTreeInternal2(const ::profiler::timestamp_t& _begi
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
size_t EasyTreeWidgetLoader::setTreeInternal(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem* _parent, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _colorizeRows, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units) size_t EasyTreeWidgetLoader::setTreeInternal(const ::profiler::BlocksTreeRoot& _threadRoot,
::profiler::block_index_t _firstCswitch,
const ::profiler::timestamp_t& _beginTime,
const ::profiler::BlocksTree::children_t& _children,
EasyTreeWidgetItem* _parent,
EasyTreeWidgetItem* _frame,
::profiler::timestamp_t _left,
::profiler::timestamp_t _right,
bool _strict,
::profiler::timestamp_t& _duration,
bool _addZeroBlocks,
::profiler_gui::TimeUnits _units)
{ {
auto const setTree = m_mode == EasyTreeMode_Full ? &EasyTreeWidgetLoader::setTreeInternal : &EasyTreeWidgetLoader::setTreeInternalPlain; auto const setTree = m_mode == EasyTreeMode_Full ? &EasyTreeWidgetLoader::setTreeInternal : &EasyTreeWidgetLoader::setTreeInternalPlain;
@ -700,7 +723,11 @@ size_t EasyTreeWidgetLoader::setTreeInternal(const ::profiler::BlocksTreeRoot& _
if (!child.children.empty()) if (!child.children.empty())
{ {
m_iditems.clear(); m_iditems.clear();
children_items_number = (this->*setTree)(_threadRoot, _firstCswitch, _beginTime, child.children, item, _frame ? _frame : item, _left, _right, _strict, children_duration, _colorizeRows, _addZeroBlocks, _units);
children_items_number = (this->*setTree)(_threadRoot, _firstCswitch, _beginTime, child.children, item,
_frame ? _frame : item, _left, _right, _strict, children_duration,
_addZeroBlocks, _units);
if (interrupted()) if (interrupted())
break; break;
} }
@ -723,9 +750,6 @@ size_t EasyTreeWidgetLoader::setTreeInternal(const ::profiler::BlocksTreeRoot& _
gui_block.tree_item = item_index; gui_block.tree_item = item_index;
#endif #endif
if (_colorizeRows)
item->colorize(_colorizeRows);
if (gui_block.expanded) if (gui_block.expanded)
item->setExpanded(true); item->setExpanded(true);
@ -765,9 +789,21 @@ size_t EasyTreeWidgetLoader::setTreeInternal(const ::profiler::BlocksTreeRoot& _
return total_duration; return total_duration;
} }
size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem*, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _colorizeRows, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units) size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRoot& _threadRoot,
::profiler::block_index_t _firstCswitch,
const ::profiler::timestamp_t& _beginTime,
const ::profiler::BlocksTree::children_t& _children,
EasyTreeWidgetItem*,
EasyTreeWidgetItem* _frame,
::profiler::timestamp_t _left,
::profiler::timestamp_t _right,
bool _strict,
::profiler::timestamp_t& _duration,
bool _addZeroBlocks,
::profiler_gui::TimeUnits _units)
{ {
size_t total_items = 0; size_t total_items = 0;
for (auto child_index : _children) for (auto child_index : _children)
{ {
if (interrupted()) if (interrupted())
@ -789,7 +825,9 @@ size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRo
::profiler::timestamp_t children_duration = 0; ::profiler::timestamp_t children_duration = 0;
if (!child.children.empty()) if (!child.children.empty())
{ {
setTreeInternalPlain(_threadRoot, _firstCswitch, _beginTime, child.children, _frame, _frame, _left, _right, _strict, children_duration, _colorizeRows, _addZeroBlocks, _units); setTreeInternalPlain(_threadRoot, _firstCswitch, _beginTime, child.children, _frame, _frame, _left,
_right, _strict, children_duration, _addZeroBlocks, _units);
if (interrupted()) if (interrupted())
break; break;
} }
@ -935,7 +973,10 @@ size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRo
::profiler::timestamp_t children_duration = 0; ::profiler::timestamp_t children_duration = 0;
if (!child.children.empty()) if (!child.children.empty())
{ {
children_items_number = setTreeInternalPlain(_threadRoot, _firstCswitch, _beginTime, child.children, _frame, _frame, _left, _right, _strict, children_duration, _colorizeRows, _addZeroBlocks, _units); children_items_number = setTreeInternalPlain(_threadRoot, _firstCswitch, _beginTime, child.children, _frame,
_frame, _left, _right, _strict, children_duration,
_addZeroBlocks, _units);
if (interrupted()) if (interrupted())
break; break;
} }
@ -967,9 +1008,6 @@ size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRo
gui_block.tree_item = item_index; gui_block.tree_item = item_index;
#endif #endif
if (_colorizeRows)
item->colorize(_colorizeRows);
if (gui_block.expanded) if (gui_block.expanded)
item->setExpanded(true); item->setExpanded(true);

View File

@ -113,8 +113,8 @@ public:
void takeItems(Items& _output); void takeItems(Items& _output);
void interrupt(bool _wait = false); void interrupt(bool _wait = false);
void fillTree(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows, EasyTreeMode _mode); void fillTree(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, EasyTreeMode _mode);
void fillTreeBlocks(const::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _beginTime, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, bool _colorizeRows, EasyTreeMode _mode); void fillTreeBlocks(const::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _beginTime, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, EasyTreeMode _mode);
private: private:
@ -122,10 +122,10 @@ private:
void setDone(); void setDone();
void setProgress(int _progress); void setProgress(int _progress);
void setTreeInternal1(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _colorizeRows, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units); void setTreeInternal1(::profiler::timestamp_t& _beginTime, const unsigned int _blocksNumber, const ::profiler::thread_blocks_tree_t& _blocksTree, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units);
void setTreeInternal2(const ::profiler::timestamp_t& _beginTime, const ::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, bool _colorizeRows, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units); void setTreeInternal2(const ::profiler::timestamp_t& _beginTime, const ::profiler_gui::TreeBlocks& _blocks, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, bool _addZeroBlocks, bool _decoratedThreadNames, bool _hexThreadId, ::profiler_gui::TimeUnits _units);
size_t setTreeInternal(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem* _parent, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _colorizeRows, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units); size_t setTreeInternal(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem* _parent, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units);
size_t setTreeInternalPlain(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem* _parent, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _colorizeRows, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units); size_t setTreeInternalPlain(const ::profiler::BlocksTreeRoot& _threadRoot, ::profiler::block_index_t _firstCswitch, const ::profiler::timestamp_t& _beginTime, const ::profiler::BlocksTree::children_t& _children, EasyTreeWidgetItem* _parent, EasyTreeWidgetItem* _frame, ::profiler::timestamp_t _left, ::profiler::timestamp_t _right, bool _strict, ::profiler::timestamp_t& _duration, bool _addZeroBlocks, ::profiler_gui::TimeUnits _units);
::profiler::timestamp_t calculateChildrenDurationRecursive(const ::profiler::BlocksTree::children_t& _children, ::profiler::block_id_t _id); ::profiler::timestamp_t calculateChildrenDurationRecursive(const ::profiler::BlocksTree::children_t& _children, ::profiler::block_id_t _id);