diff --git a/easy_profiler_core/CMakeLists.txt b/easy_profiler_core/CMakeLists.txt
index 1d1b08e7..ebacffe2 100644
--- a/easy_profiler_core/CMakeLists.txt
+++ b/easy_profiler_core/CMakeLists.txt
@@ -159,7 +159,12 @@ set(SOURCES
${INCLUDE_FILES}
)
-add_library(easy_profiler ${SOURCES} resources.rc)
+set(LIBRARY_TYPE SHARED)
+if (NOT BUILD_SHARED_LIBS)
+ set(LIBRARY_TYPE STATIC)
+endif ()
+
+add_library(easy_profiler ${LIBRARY_TYPE} ${SOURCES} resources.rc)
# End adding source files.
#################################################
diff --git a/profiler_gui/blocks_graphics_view.cpp b/profiler_gui/blocks_graphics_view.cpp
index c89037fe..763b9900 100644
--- a/profiler_gui/blocks_graphics_view.cpp
+++ b/profiler_gui/blocks_graphics_view.cpp
@@ -614,6 +614,18 @@ const BlocksGraphicsView::Items &BlocksGraphicsView::getItems() const
return m_items;
}
+void BlocksGraphicsView::saveSelectionToFile(const QString& _filename) const
+{
+ if (m_selectedBlocks.empty())
+ return;
+
+// profiler::timestamp_t beginTime = ~0ULL;
+// for (const auto& selection : m_selectedBlocks)
+// {
+// const auto& tree = easy
+// }
+}
+
qreal BlocksGraphicsView::setTree(BlocksGraphicsItem* _item, const ::profiler::BlocksTree::children_t& _children, qreal& _height, uint32_t& _maxDepthChild, qreal _y, short _level)
{
if (_children.empty())
diff --git a/profiler_gui/blocks_graphics_view.h b/profiler_gui/blocks_graphics_view.h
index 5f440893..ce7b6e3b 100644
--- a/profiler_gui/blocks_graphics_view.h
+++ b/profiler_gui/blocks_graphics_view.h
@@ -190,6 +190,8 @@ class BlocksGraphicsView : public QGraphicsView
const Items& getItems() const;
+ void saveSelectionToFile(const QString& _filename) const;
+
void inspectCurrentView(bool _strict) {
onInspectCurrentView(_strict);
}
diff --git a/profiler_gui/images/attribution.txt b/profiler_gui/images/attribution.txt
index 0d0a6cf1..e3ead568 100644
--- a/profiler_gui/images/attribution.txt
+++ b/profiler_gui/images/attribution.txt
@@ -29,6 +29,7 @@ default/binoculars.svg - Icon made by Gregor Cresnar from www.flaticon
default/close-white.svg - Icon made by Cole Bemis from www.flaticon.com
default/close-white-hover.svg - Icon made by Cole Bemis from www.flaticon.com
default/close-white-pressed.svg - Icon made by Cole Bemis from www.flaticon.com
+default/crop.svg - Icon made by Freepik from www.flaticon.com
default/maximize-white.svg - Icon made by Freepik from www.flaticon.com
default/maximize-white-hover.svg - Icon made by Freepik from www.flaticon.com
default/maximize-white-pressed.svg - Icon made by Freepik from www.flaticon.com
@@ -46,3 +47,4 @@ 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/crop.svg b/profiler_gui/images/default/crop.svg
new file mode 100644
index 00000000..d4162e0d
--- /dev/null
+++ b/profiler_gui/images/default/crop.svg
@@ -0,0 +1,15 @@
+
+
+
diff --git a/profiler_gui/main_window.cpp b/profiler_gui/main_window.cpp
index fd60508b..e8ec9e26 100644
--- a/profiler_gui/main_window.cpp
+++ b/profiler_gui/main_window.cpp
@@ -378,6 +378,10 @@ MainWindow::MainWindow() : Parent(), m_theme("default"), m_lastAddress("localhos
static_cast(m_graphicsView->widget())->view()->inspectCurrentView(true);
});
+ action = toolbar->addAction(QIcon(imagePath("crop")), "Crop and save");
+ action->setToolTip("Crop and save selected area\nas separate .prof file.");
+ connect(action, &QAction::triggered, this, &This::onCropAndSaveClicked);
+
toolbar->addSeparator();
auto menu = new QMenu("Settings", this);
menu->setToolTipsVisible(true);
@@ -2142,6 +2146,28 @@ void MainWindow::onFrameTimeChanged()
//////////////////////////////////////////////////////////////////////////
+void MainWindow::onCropAndSaveClicked(bool)
+{
+ QString lastFile = m_lastFiles.empty() ? QString() : m_lastFiles.front();
+
+ const auto i = lastFile.lastIndexOf(QChar('/'));
+ const auto j = lastFile.lastIndexOf(QChar('\\'));
+ auto k = std::max(i, j);
+
+ QString dir;
+ if (k > 0)
+ dir = lastFile.mid(0, ++k);
+
+ auto filename = QFileDialog::getSaveFileName(this, "Save cropped area to EasyProfiler File", dir,
+ "EasyProfiler File (*.prof);;All Files (*.*)");
+ if (filename.isEmpty())
+ return;
+
+ static_cast(m_graphicsView->widget())->view()->saveSelectionToFile(filename);
+}
+
+//////////////////////////////////////////////////////////////////////////
+
void MainWindow::onConnectClicked(bool)
{
if (EASY_GLOBALS.connected)
diff --git a/profiler_gui/main_window.h b/profiler_gui/main_window.h
index bfeb21a0..94838336 100644
--- a/profiler_gui/main_window.h
+++ b/profiler_gui/main_window.h
@@ -326,6 +326,7 @@ protected slots:
void onEventTracingEnableChange(bool _checked);
void onFrameTimeEditFinish();
void onFrameTimeChanged();
+ void onCropAndSaveClicked(bool);
void onBlockStatusChange(profiler::block_id_t _id, profiler::EasyBlockStatus _status);
diff --git a/profiler_gui/resources.qrc b/profiler_gui/resources.qrc
index be736129..78b03c7f 100644
--- a/profiler_gui/resources.qrc
+++ b/profiler_gui/resources.qrc
@@ -7,6 +7,7 @@
images/default/binoculars.svg
+ images/default/crop.svg
images/default/off.svg
images/default/open-folder2.svg
images/default/reload.svg