diff --git a/profiler_gui/arbitrary_value_inspector.cpp b/profiler_gui/arbitrary_value_inspector.cpp index 5f0fe80..581e4cc 100644 --- a/profiler_gui/arbitrary_value_inspector.cpp +++ b/profiler_gui/arbitrary_value_inspector.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,7 @@ #include #include #include +#include #include #include "arbitrary_value_inspector.h" #include "globals.h" @@ -691,6 +693,8 @@ void ArbitraryValuesChartItem::paintMouseIndicator(QPainter* _painter, qreal _to { const auto value = m_minValue + ((_bottom - ChartBound - yvalue) / _height) * (m_maxValue - m_minValue); valueString = QString::number(value, 'f', 3); + if (valueString.endsWith(QStringLiteral(".000"))) + valueString.chop(4); } else { @@ -1797,7 +1801,8 @@ profiler::color_t ArbitraryTreeWidgetItem::color() const ////////////////////////////////////////////////////////////////////////// -ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) +ArbitraryValuesWidget::ArbitraryValuesWidget(bool _isMainWidget, profiler::thread_id_t _threadId + , profiler::block_index_t _blockIndex, profiler::block_id_t _blockId, QWidget* _parent) : Parent(_parent) , m_splitter(new QSplitter(Qt::Horizontal, this)) , m_treeWidget(new QTreeWidget(this)) @@ -1808,7 +1813,13 @@ ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) , m_filterWindowPicker(new QSpinBox(this)) , m_exportToCsvAction(nullptr) , m_boldItem(nullptr) + , m_threadId(_threadId) + , m_blockIndex(_blockIndex) + , m_blockId(_blockId) + , m_bMainWidget(_isMainWidget) { + m_collectionsTimer.setInterval(100); + m_splitter->setHandleWidth(1); m_splitter->setContentsMargins(0, 0, 0, 0); m_splitter->addWidget(m_treeWidget); @@ -1831,9 +1842,11 @@ ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) auto action = tb->addAction(QIcon(imagePath("reload")), tr("Refresh values list")); connect(action, &QAction::triggered, this, Overload::of(&This::rebuild)); + action = tb->addAction(QIcon(imagePath("window")), tr("Open new window")); + connect(action, &QAction::triggered, this, &This::onOpenInNewWindowClicked); + m_exportToCsvAction = tb->addAction(QIcon(imagePath("csv")), tr("Export to csv")); connect(m_exportToCsvAction, &QAction::triggered, this, &This::onExportToCsvClicked); - m_exportToCsvAction->setEnabled(false); tb->addSeparator(); @@ -1881,14 +1894,21 @@ ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) connect(&m_collectionsTimer, &QTimer::timeout, this, &This::onCollectionsTimeout); - connect(m_treeWidget, &QTreeWidget::itemDoubleClicked, this, &This::onItemDoubleClicked); - connect(m_treeWidget, &QTreeWidget::itemChanged, this, &This::onItemChanged); - connect(m_treeWidget, &QTreeWidget::currentItemChanged, this, &This::onCurrentItemChanged); - + using profiler_gui::GlobalSignals; auto globalEvents = &EASY_GLOBALS.events; - connect(globalEvents, &profiler_gui::GlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChanged); - connect(globalEvents, &profiler_gui::GlobalSignals::selectedBlockIdChanged, this, &This::onSelectedBlockIdChanged); - connect(globalEvents, &profiler_gui::GlobalSignals::fileOpened, this, Overload::of(&This::rebuild)); + connect(globalEvents, &GlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChanged); + connect(globalEvents, &GlobalSignals::selectedBlockIdChanged, this, &This::onSelectedBlockIdChanged); + connect(globalEvents, &GlobalSignals::allDataGoingToBeDeleted, this, &This::clear); + + if (_isMainWidget) + { + connect(m_treeWidget, &QTreeWidget::itemDoubleClicked, this, &This::onItemDoubleClicked); + connect(m_treeWidget, &QTreeWidget::itemChanged, this, &This::onItemChanged); + connect(m_treeWidget, &QTreeWidget::currentItemChanged, this, &This::onCurrentItemChanged); + + connect(globalEvents, &GlobalSignals::fileOpened, this, Overload::of(&This::rebuild)); + connect(globalEvents, &GlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChanged); + } loadSettings(); @@ -1910,7 +1930,128 @@ ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) connect(m_filterComboBox, Overload::of(&QComboBox::currentIndexChanged), this, &This::onFilterComboBoxChanged); connect(m_filterWindowPicker, Overload::of(&QSpinBox::valueChanged), this, &This::onFilterWindowSizeChanged); - rebuild(); + rebuild(_threadId, _blockIndex, _blockId); +} + +ArbitraryValuesWidget::ArbitraryValuesWidget(QWidget* _parent) + : ArbitraryValuesWidget(true, EASY_GLOBALS.selected_thread, EASY_GLOBALS.selected_block, EASY_GLOBALS.selected_block_id, _parent) +{ + m_exportToCsvAction->setEnabled(false); +} + +ArbitraryTreeWidgetItem* findSimilarItem(QTreeWidgetItem* _parentItem, ArbitraryTreeWidgetItem* _item) +{ + for (int c = 0, childrenCount = _parentItem->childCount(); c < childrenCount; ++c) + { + auto child = _parentItem->child(c); + if (child->type() == ValueItemType) + { + auto item = reinterpret_cast(child); + if (&_item->value() == &item->value()) + return item; + + if (_item->value().value_id() == item->value().value_id() && + _item->value().type() == item->value().type() && + _item->value().isArray() == item->value().isArray() && + _item->text(int_cast(ArbitraryColumns::Name)) == item->text(int_cast(ArbitraryColumns::Name))) + { + return item; + } + } + + auto item = findSimilarItem(child, _item); + if (item != nullptr) + return item; + } + + return nullptr; +} + +ArbitraryValuesWidget::ArbitraryValuesWidget(const QList& _checkedItems + , QTreeWidgetItem* _currentItem, profiler::thread_id_t _threadId, profiler::block_index_t _blockIndex + , profiler::block_id_t _blockId, QWidget* _parent) + : ArbitraryValuesWidget(false, _threadId, _blockIndex, _blockId, _parent) +{ + for (auto item : _checkedItems) + { + for (int i = 0, topLevelItemsCount = m_treeWidget->topLevelItemCount(); i < topLevelItemsCount; ++i) + { + auto foundItem = findSimilarItem(m_treeWidget->topLevelItem(i), item); + if (foundItem != nullptr) + { + const auto checkState = item->checkState(CheckColumn); + foundItem->setCheckState(CheckColumn, checkState); + if (checkState == Qt::Checked) + { + m_checkedItems.push_back(foundItem); + foundItem->collectValues(m_threadId, m_chart->chartType()); + } + } + } + } + + if (!m_checkedItems.empty()) + { + m_collectionsTimer.start(); + + std::set checked; + for (auto item : m_checkedItems) + { + if (item->getSelfIndexInArray() >= 0) + { + auto parentItem = item->parent(); + if (checked.find(parentItem) != checked.end()) + continue; + + checked.insert(parentItem); + + Qt::CheckState newState = Qt::Checked; + for (int i = 0, childCount = parentItem->childCount(); i < childCount; ++i) + { + auto child = parentItem->child(i); + if (child->checkState(CheckColumn) != Qt::Checked) + { + newState = Qt::PartiallyChecked; + break; + } + } + + parentItem->setCheckState(CheckColumn, newState); + } + } + } + else + { + m_exportToCsvAction->setEnabled(false); + } + + if (_currentItem != nullptr) + { + if (_currentItem->type() == ValueItemType) + { + auto item = reinterpret_cast(_currentItem); + for (int i = 0, topLevelItemsCount = m_treeWidget->topLevelItemCount(); i < topLevelItemsCount; ++i) + { + auto foundItem = findSimilarItem(m_treeWidget->topLevelItem(i), item); + if (foundItem != nullptr) + { + m_treeWidget->setCurrentItem(foundItem); + break; + } + } + } + else + { + const int col = static_cast(ArbitraryColumns::Name); + auto items = m_treeWidget->findItems(_currentItem->text(col), Qt::MatchExactly | Qt::MatchCaseSensitive | Qt::MatchRecursive, col); + if (!items.empty()) + m_treeWidget->setCurrentItem(items.front()); + } + } + + connect(m_treeWidget, &QTreeWidget::itemDoubleClicked, this, &This::onItemDoubleClicked); + connect(m_treeWidget, &QTreeWidget::itemChanged, this, &This::onItemChanged); + connect(m_treeWidget, &QTreeWidget::currentItemChanged, this, &This::onCurrentItemChanged); } ArbitraryValuesWidget::~ArbitraryValuesWidget() @@ -1933,6 +2074,11 @@ void ArbitraryValuesWidget::clear() m_boldItem = nullptr; } +void ArbitraryValuesWidget::onSelectedThreadChanged(profiler::thread_id_t) +{ + //rebuild(); +} + void ArbitraryValuesWidget::onSelectedBlockChanged(uint32_t) { if (profiler_gui::is_max(EASY_GLOBALS.selected_block)) @@ -2032,7 +2178,7 @@ void ArbitraryValuesWidget::onItemChanged(QTreeWidgetItem* _item, int _column) if (prevSize != m_checkedItems.size()) { if (!m_collectionsTimer.isActive()) - m_collectionsTimer.start(100); + m_collectionsTimer.start(); } } else @@ -2089,7 +2235,9 @@ void ArbitraryValuesWidget::onItemChanged(QTreeWidgetItem* _item, int _column) if (!uncheckedItems.isEmpty()) { - m_exportToCsvAction->setEnabled(!m_checkedItems.empty()); + const bool hasCheckedItems = !m_checkedItems.empty(); + m_exportToCsvAction->setEnabled(hasCheckedItems); + onCollectionsTimeout(); for (auto uncheckedItem : uncheckedItems) @@ -2112,14 +2260,19 @@ void ArbitraryValuesWidget::onCurrentItemChanged(QTreeWidgetItem* _current, QTre void ArbitraryValuesWidget::rebuild() { - rebuild(EASY_GLOBALS.selected_thread); + rebuild(EASY_GLOBALS.selected_thread, EASY_GLOBALS.selected_block, EASY_GLOBALS.selected_block_id); } -void ArbitraryValuesWidget::rebuild(profiler::thread_id_t _threadId) +void ArbitraryValuesWidget::rebuild(profiler::thread_id_t _threadId, profiler::block_index_t _blockIndex + , profiler::block_id_t _blockId) { clear(); - buildTree(_threadId, EASY_GLOBALS.selected_block, EASY_GLOBALS.selected_block_id); + m_threadId = _threadId; + m_blockIndex = _blockIndex; + m_blockId = _blockId; + + buildTree(_threadId, _blockIndex, _blockId); m_treeWidget->expandAll(); for (int i = 0, columns = m_treeWidget->columnCount(); i < columns; ++i) @@ -2144,6 +2297,7 @@ void ArbitraryValuesWidget::select(const profiler::ArbitraryValue& _value, bool decltype(m_checkedItems) uncheckedItems(std::move(m_checkedItems)); m_exportToCsvAction->setEnabled(false); + onCollectionsTimeout(); for (auto item : uncheckedItems) @@ -2212,7 +2366,7 @@ void ArbitraryValuesWidget::repaint() item->collectValues(EASY_GLOBALS.selected_thread, m_chart->chartType()); if (!m_collectionsTimer.isActive()) - m_collectionsTimer.start(100); + m_collectionsTimer.start(); } } @@ -2367,6 +2521,35 @@ void ArbitraryValuesWidget::onExportToCsvClicked(bool) csv.write("\n"); } +void ArbitraryValuesWidget::onOpenInNewWindowClicked(bool) +{ + saveSettings(); + + auto dialog = new QDialog(nullptr); + dialog->setAttribute(Qt::WA_DeleteOnClose, true); + dialog->setWindowTitle("EasyProfiler"); + connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::allDataGoingToBeDeleted, dialog, &QDialog::reject); + + auto viewer = new ArbitraryValuesWidget(m_checkedItems, m_treeWidget->currentItem(), m_threadId, m_blockIndex, m_blockId, dialog); + + auto layout = new QHBoxLayout(dialog); + layout->setContentsMargins(0, 0, 0, 0); + layout->addWidget(viewer); + + // Load last dialog geometry + { + QSettings settings(profiler_gui::ORGANAZATION_NAME, profiler_gui::APPLICATION_NAME); + settings.beginGroup("ArbitraryValuesWidgetWindow"); + auto geometry = settings.value("dialog/geometry").toByteArray(); + settings.endGroup(); + + if (!geometry.isEmpty()) + dialog->restoreGeometry(geometry); + } + + dialog->show(); +} + void ArbitraryValuesWidget::buildTree(profiler::thread_id_t _threadId, profiler::block_index_t _blockIndex, profiler::block_id_t _blockId) { m_treeWidget->clear(); @@ -2637,14 +2820,6 @@ void ArbitraryValuesWidget::loadSettings() QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME); settings.beginGroup("ArbitraryValuesWidget"); - auto geometry = settings.value("hsplitter/geometry").toByteArray(); - if (!geometry.isEmpty()) - m_splitter->restoreGeometry(geometry); - - auto state = settings.value("hsplitter/state").toByteArray(); - if (!state.isEmpty()) - m_splitter->restoreState(state); - auto value = settings.value("chart/filterWindow"); if (!value.isNull()) m_chart->setFilterWindowSize(value.toInt()); @@ -2657,17 +2832,43 @@ void ArbitraryValuesWidget::loadSettings() if (!value.isNull()) m_chart->setChartType(static_cast(value.toInt())); + if (!m_bMainWidget) + { + settings.endGroup(); + settings.beginGroup("ArbitraryValuesWidgetWindow"); + } + + auto geometry = settings.value("hsplitter/geometry").toByteArray(); + if (!geometry.isEmpty()) + m_splitter->restoreGeometry(geometry); + + auto state = settings.value("hsplitter/state").toByteArray(); + if (!state.isEmpty()) + m_splitter->restoreState(state); + settings.endGroup(); } void ArbitraryValuesWidget::saveSettings() { QSettings settings(::profiler_gui::ORGANAZATION_NAME, ::profiler_gui::APPLICATION_NAME); - settings.beginGroup("ArbitraryValuesWidget"); - settings.setValue("hsplitter/geometry", m_splitter->saveGeometry()); - settings.setValue("hsplitter/state", m_splitter->saveState()); - settings.setValue("chart/type", static_cast(m_chart->chartType())); - settings.setValue("chart/filter", static_cast(m_chart->filterType())); - settings.setValue("chart/filterWindow", m_chart->filterWindowSize()); + + if (!m_bMainWidget) + { + settings.beginGroup("ArbitraryValuesWidgetWindow"); + settings.setValue("dialog/geometry", parentWidget()->saveGeometry()); + settings.setValue("hsplitter/geometry", m_splitter->saveGeometry()); + settings.setValue("hsplitter/state", m_splitter->saveState()); + } + else + { + settings.beginGroup("ArbitraryValuesWidget"); + settings.setValue("hsplitter/geometry", m_splitter->saveGeometry()); + settings.setValue("hsplitter/state", m_splitter->saveState()); + settings.setValue("chart/type", static_cast(m_chart->chartType())); + settings.setValue("chart/filter", static_cast(m_chart->filterType())); + settings.setValue("chart/filterWindow", m_chart->filterWindowSize()); + } + settings.endGroup(); } diff --git a/profiler_gui/arbitrary_value_inspector.h b/profiler_gui/arbitrary_value_inspector.h index 3c149a3..2620380 100644 --- a/profiler_gui/arbitrary_value_inspector.h +++ b/profiler_gui/arbitrary_value_inspector.h @@ -350,6 +350,16 @@ class ArbitraryValuesWidget : public QWidget class QSpinBox* m_filterWindowPicker; class QAction* m_exportToCsvAction; ArbitraryTreeWidgetItem* m_boldItem; + profiler::thread_id_t m_threadId; + profiler::block_index_t m_blockIndex; + profiler::block_id_t m_blockId; + const bool m_bMainWidget; + + explicit ArbitraryValuesWidget(bool _isMainWidget, profiler::thread_id_t _threadId + , profiler::block_index_t _blockIndex, profiler::block_id_t _blockId, QWidget* _parent); + explicit ArbitraryValuesWidget(const QList& _checkedItems + , QTreeWidgetItem* _currentItem, profiler::thread_id_t _threadId + , profiler::block_index_t _blockIndex, profiler::block_id_t _blockId, QWidget* _parent = nullptr); public: @@ -362,11 +372,12 @@ public slots: void clear(); void rebuild(); - void rebuild(profiler::thread_id_t _threadId); + void rebuild(profiler::thread_id_t _threadId, profiler::block_index_t _blockIndex, profiler::block_id_t _blockId); void select(const profiler::ArbitraryValue& _value, bool _resetOthers = true); private slots: + void onSelectedThreadChanged(profiler::thread_id_t); void onSelectedBlockChanged(uint32_t _block_index); void onSelectedBlockIdChanged(profiler::block_id_t _id); void onItemDoubleClicked(QTreeWidgetItem* _item, int _column); @@ -378,6 +389,7 @@ private slots: void onFilterComboBoxChanged(int _index); void onFilterWindowSizeChanged(int _size); void onExportToCsvClicked(bool); + void onOpenInNewWindowClicked(bool); private: diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp index 36fe505..cc8dacc 100644 --- a/profiler_gui/blocks_graphics_view.cpp +++ b/profiler_gui/blocks_graphics_view.cpp @@ -1094,7 +1094,7 @@ void BlocksGraphicsView::mouseReleaseEvent(QMouseEvent* _event) } else if (easyDescriptor(selectedBlock->tree.node->id()).type() == profiler::BlockType::Value) { - emit EASY_GLOBALS.events.selectValue(selectedBlockThread, *selectedBlock->tree.value); + emit EASY_GLOBALS.events.selectValue(selectedBlockThread, EASY_GLOBALS.selected_block, *selectedBlock->tree.value); } } @@ -1395,16 +1395,22 @@ void BlocksGraphicsView::initMode() connect(&m_flickerTimer, &QTimer::timeout, this, &This::onFlickerTimeout); connect(&m_idleTimer, &QTimer::timeout, this, &This::onIdleTimeout); + using profiler_gui::GlobalSignals; auto globalSignals = &EASY_GLOBALS.events; - connect(globalSignals, &::profiler_gui::GlobalSignals::hierarchyFlagChanged, this, &This::onHierarchyFlagChange); - connect(globalSignals, &::profiler_gui::GlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange); - connect(globalSignals, &::profiler_gui::GlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChange); - connect(globalSignals, &::profiler_gui::GlobalSignals::itemsExpandStateChanged, this, &This::onRefreshRequired); - connect(globalSignals, &::profiler_gui::GlobalSignals::refreshRequired, this, &This::onRefreshRequired); + connect(globalSignals, &GlobalSignals::hierarchyFlagChanged, this, &This::onHierarchyFlagChange); + connect(globalSignals, &GlobalSignals::selectedThreadChanged, this, &This::onSelectedThreadChange); + connect(globalSignals, &GlobalSignals::selectedBlockChanged, this, &This::onSelectedBlockChange); + connect(globalSignals, &GlobalSignals::itemsExpandStateChanged, this, &This::onRefreshRequired); + connect(globalSignals, &GlobalSignals::refreshRequired, this, &This::onRefreshRequired); + connect(globalSignals, &GlobalSignals::allDataGoingToBeDeleted, this, &This::clear); - connect(globalSignals, &::profiler_gui::GlobalSignals::selectedBlockIdChanged, [this](::profiler::block_id_t) + connect(globalSignals, &GlobalSignals::fileOpened, [this] { + setTree(EASY_GLOBALS.profiler_blocks); + }); + + connect(globalSignals, &GlobalSignals::selectedBlockIdChanged, [this](::profiler::block_id_t) { - if (::profiler_gui::is_max(EASY_GLOBALS.selected_block_id)) + if (profiler_gui::is_max(EASY_GLOBALS.selected_block_id)) { if (EASY_GLOBALS.selected_thread != 0) { @@ -2253,10 +2259,13 @@ ThreadNamesWidget::ThreadNamesWidget(BlocksGraphicsView* _view, int _additionalH setFixedWidth(m_maxLength); connect(&EASY_GLOBALS.events, &::profiler_gui::GlobalSignals::selectedThreadChanged, [this](::profiler::thread_id_t){ repaintScene(); }); + connect(&EASY_GLOBALS.events, &::profiler_gui::GlobalSignals::allDataGoingToBeDeleted, this, &This::clear); + connect(m_view, &BlocksGraphicsView::treeChanged, this, &This::onTreeChange); connect(m_view, &BlocksGraphicsView::sceneUpdated, this, &This::repaintScene); connect(m_view->verticalScrollBar(), &QScrollBar::valueChanged, verticalScrollBar(), &QScrollBar::setValue, Qt::QueuedConnection); connect(m_view->verticalScrollBar(), &QScrollBar::rangeChanged, this, &This::setVerticalScrollbarRange, Qt::QueuedConnection); + connect(&m_idleTimer, &QTimer::timeout, this, &This::onIdleTimeout); } diff --git a/profiler_gui/blocks_tree_widget.cpp b/profiler_gui/blocks_tree_widget.cpp index 4048f9b..259069e 100644 --- a/profiler_gui/blocks_tree_widget.cpp +++ b/profiler_gui/blocks_tree_widget.cpp @@ -1142,6 +1142,9 @@ HierarchyWidget::HierarchyWidget(QWidget* _parent) : Parent(_parent) lay->addWidget(m_tree); connect(m_searchBox, &QLineEdit::returnPressed, this, &This::onSeachBoxReturnPressed); + connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::allDataGoingToBeDeleted, [this] { + clear(true); + }); } HierarchyWidget::~HierarchyWidget() diff --git a/profiler_gui/descriptors_tree_widget.cpp b/profiler_gui/descriptors_tree_widget.cpp index 825ab11..d6e303f 100644 --- a/profiler_gui/descriptors_tree_widget.cpp +++ b/profiler_gui/descriptors_tree_widget.cpp @@ -841,6 +841,8 @@ BlockDescriptorsWidget::BlockDescriptorsWidget(QWidget* _parent) : Parent(_paren connect(m_searchBox, &QLineEdit::returnPressed, this, &This::onSeachBoxReturnPressed); connect(&EASY_GLOBALS.events, &::profiler_gui::GlobalSignals::connectionChanged, refreshButton, &QAction::setEnabled); + connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::allDataGoingToBeDeleted, this, &This::clear); + connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::fileOpened, this, &This::build); loadSettings(); caseSensitiveSwitch->setChecked(m_bCaseSensitiveSearch); diff --git a/profiler_gui/easy_graphics_scrollbar.cpp b/profiler_gui/easy_graphics_scrollbar.cpp index b7d927b..a540de0 100644 --- a/profiler_gui/easy_graphics_scrollbar.cpp +++ b/profiler_gui/easy_graphics_scrollbar.cpp @@ -1167,6 +1167,8 @@ BlocksGraphicsScrollbar::BlocksGraphicsScrollbar(int _initialHeight, QWidget* _p connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::threadNameDecorationChanged, this, &This::onThreadViewChanged); connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::hexThreadIdChanged, this, &This::onThreadViewChanged); + + connect(&EASY_GLOBALS.events, &profiler_gui::GlobalSignals::allDataGoingToBeDeleted, this, &This::clear); } BlocksGraphicsScrollbar::~BlocksGraphicsScrollbar() diff --git a/profiler_gui/globals_qobjects.h b/profiler_gui/globals_qobjects.h index 4f250fa..4749227 100644 --- a/profiler_gui/globals_qobjects.h +++ b/profiler_gui/globals_qobjects.h @@ -73,6 +73,7 @@ namespace profiler_gui { signals: + void allDataGoingToBeDeleted(); void fileOpened(); void selectedThreadChanged(::profiler::thread_id_t _id); @@ -102,7 +103,7 @@ namespace profiler_gui { void chartWheeled(qreal pos, int delta); void chartSliderChanged(qreal pos); - void selectValue(::profiler::thread_id_t _threadId, const ::profiler::ArbitraryValue& _value); + void selectValue(::profiler::thread_id_t _thread_id, uint32_t _value_index, const ::profiler::ArbitraryValue& _value); }; // END of class GlobalSignals. diff --git a/profiler_gui/images/attribution.txt b/profiler_gui/images/attribution.txt index e14e449..dce4f6d 100644 --- a/profiler_gui/images/attribution.txt +++ b/profiler_gui/images/attribution.txt @@ -44,3 +44,4 @@ default/arrow-right.svg - Icon made by Freepik from www.flaticon.com default/yx.svg - Icon made by Freepik from www.flaticon.com default/svg2.svg - Icon made by Freepik from www.flaticon.com default/svg3.svg - Icon made by Freepik from www.flaticon.com +default/window.svg - Icon made by Freepik from www.flaticon.com diff --git a/profiler_gui/images/default/window.svg b/profiler_gui/images/default/window.svg new file mode 100644 index 0000000..ed0cd5b --- /dev/null +++ b/profiler_gui/images/default/window.svg @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp index f05b447..fdae4a2 100644 --- a/profiler_gui/main_window.cpp +++ b/profiler_gui/main_window.cpp @@ -1096,14 +1096,7 @@ void MainWindow::onSaveFileClicked(bool) void MainWindow::clear() { - static_cast(m_treeWidget->widget())->clear(true); - static_cast(m_graphicsView->widget())->clear(); - -#if EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW != 0 - static_cast(m_descTreeWidget->widget())->clear(); -#endif - if (m_dialogDescTree != nullptr) - m_dialogDescTree->clear(); + emit EASY_GLOBALS.events.allDataGoingToBeDeleted(); EASY_GLOBALS.selected_thread = 0; ::profiler_gui::set_max(EASY_GLOBALS.selected_block); @@ -1821,7 +1814,7 @@ void MainWindow::onFileReaderTimeout() const auto nblocks = m_reader.size(); if (nblocks != 0) { - static_cast(m_treeWidget->widget())->clear(true); + emit EASY_GLOBALS.events.allDataGoingToBeDeleted(); ::profiler::SerializedData serialized_blocks; ::profiler::SerializedData serialized_descriptors; @@ -1899,14 +1892,6 @@ void MainWindow::onFileReaderTimeout() #endif } - static_cast(m_graphicsView->widget())->view()->setTree(EASY_GLOBALS.profiler_blocks); - -#if EASY_GUI_USE_DESCRIPTORS_DOCK_WINDOW != 0 - static_cast(m_descTreeWidget->widget())->build(); -#endif - if (m_dialogDescTree != nullptr) - m_dialogDescTree->build(); - m_saveAction->setEnabled(true); m_deleteAction->setEnabled(true); } @@ -1936,9 +1921,9 @@ void MainWindow::onFileReaderTimeout() if (nblocks != 0) { + emit EASY_GLOBALS.events.fileOpened(); if (EASY_GLOBALS.all_items_expanded_by_default) onExpandAllClicked(true); - emit EASY_GLOBALS.events.fileOpened(); } } else if (m_progress != nullptr) @@ -2418,10 +2403,10 @@ void MainWindow::onBlockStatusChange(::profiler::block_id_t _id, ::profiler::Eas m_listener.send(profiler::net::BlockStatusMessage(_id, static_cast(_status))); } -void MainWindow::onSelectValue(profiler::thread_id_t _threadId, const profiler::ArbitraryValue& _value) +void MainWindow::onSelectValue(profiler::thread_id_t _thread_id, uint32_t _value_index, const profiler::ArbitraryValue& _value) { onEditBlocksClicked(true); - m_dialogDescTree->dataViewer()->rebuild(_threadId); + m_dialogDescTree->dataViewer()->rebuild(_thread_id, _value_index, _value.id()); } void DialogWithGeometry::create() diff --git a/profiler_gui/main_window.h b/profiler_gui/main_window.h index fb5d7f0..07372c0 100644 --- a/profiler_gui/main_window.h +++ b/profiler_gui/main_window.h @@ -328,7 +328,7 @@ protected slots: void onBlockStatusChange(profiler::block_id_t _id, profiler::EasyBlockStatus _status); - void onSelectValue(profiler::thread_id_t _threadId, const profiler::ArbitraryValue& _value); + void onSelectValue(profiler::thread_id_t _thread_id, uint32_t _value_index, const profiler::ArbitraryValue& _value); void checkFrameTimeReady(); diff --git a/profiler_gui/resources.qrc b/profiler_gui/resources.qrc index 42b4d4c..2f7ec2b 100644 --- a/profiler_gui/resources.qrc +++ b/profiler_gui/resources.qrc @@ -52,5 +52,6 @@ images/default/yx.svg images/default/big-o.svg images/default/csv.svg + images/default/window.svg