mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 00:31:02 +08:00
#31 [Gui] Arbitrary values viewer bug fixes
This commit is contained in:
parent
230f7d1463
commit
1f6d3c2a7d
@ -64,6 +64,7 @@
|
|||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <cmath>
|
||||||
#include "arbitrary_value_inspector.h"
|
#include "arbitrary_value_inspector.h"
|
||||||
#include "treeview_first_column_delegate.h"
|
#include "treeview_first_column_delegate.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
@ -150,7 +151,7 @@ ArbitraryValuesCollection::ArbitraryValuesCollection()
|
|||||||
|
|
||||||
ArbitraryValuesCollection::~ArbitraryValuesCollection()
|
ArbitraryValuesCollection::~ArbitraryValuesCollection()
|
||||||
{
|
{
|
||||||
interrupt();
|
join();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ArbitraryValuesMap& ArbitraryValuesCollection::valuesMap() const
|
const ArbitraryValuesMap& ArbitraryValuesCollection::valuesMap() const
|
||||||
@ -243,16 +244,26 @@ bool ArbitraryValuesCollection::calculatePoints(profiler::timestamp_t _beginTime
|
|||||||
|
|
||||||
void ArbitraryValuesCollection::interrupt()
|
void ArbitraryValuesCollection::interrupt()
|
||||||
{
|
{
|
||||||
if (!m_collectorThread.joinable())
|
if (m_collectorThread.joinable())
|
||||||
return;
|
{
|
||||||
|
m_bInterrupt.store(true, std::memory_order_release);
|
||||||
|
m_collectorThread.join();
|
||||||
|
m_bInterrupt.store(false, std::memory_order_release);
|
||||||
|
|
||||||
m_bInterrupt.store(true, std::memory_order_release);
|
setStatus(Idle);
|
||||||
m_collectorThread.join();
|
m_jobType = None;
|
||||||
m_bInterrupt.store(false, std::memory_order_release);
|
m_values.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setStatus(Idle);
|
void ArbitraryValuesCollection::join()
|
||||||
m_jobType = None;
|
{
|
||||||
m_values.clear();
|
if (m_collectorThread.joinable())
|
||||||
|
{
|
||||||
|
m_bInterrupt.store(true, std::memory_order_release);
|
||||||
|
m_collectorThread.join();
|
||||||
|
m_bInterrupt.store(false, std::memory_order_release);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArbitraryValuesCollection::setStatus(JobStatus _status)
|
void ArbitraryValuesCollection::setStatus(JobStatus _status)
|
||||||
@ -733,6 +744,7 @@ void ArbitraryValuesChartItem::updateImageAsync(QRectF _boundingRect, qreal _cur
|
|||||||
|
|
||||||
if (c.chartType == ChartType::Points)
|
if (c.chartType == ChartType::Points)
|
||||||
{
|
{
|
||||||
|
qreal prevX = 1e300, prevY = 1e300;
|
||||||
for (auto it = first; it != points.end() && it->x() < _maximum; ++it)
|
for (auto it = first; it != points.end() && it->x() < _maximum; ++it)
|
||||||
{
|
{
|
||||||
if (it->x() < _minimum)
|
if (it->x() < _minimum)
|
||||||
@ -743,7 +755,14 @@ void ArbitraryValuesChartItem::updateImageAsync(QRectF _boundingRect, qreal _cur
|
|||||||
|
|
||||||
const qreal x = it->x() * realScale - offset;
|
const qreal x = it->x() * realScale - offset;
|
||||||
const qreal y = gety(it->y());
|
const qreal y = gety(it->y());
|
||||||
p.drawPoint(QPointF {x, y});
|
const auto dx = fabs(x - prevX), dy = fabs(y - prevY);
|
||||||
|
|
||||||
|
if (dx > 1 || dy > 1)
|
||||||
|
{
|
||||||
|
p.drawPoint(QPointF{x, y});
|
||||||
|
prevX = x;
|
||||||
|
prevY = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (first != points.end() && first->x() < _maximum)
|
else if (first != points.end() && first->x() < _maximum)
|
||||||
@ -767,7 +786,13 @@ void ArbitraryValuesChartItem::updateImageAsync(QRectF _boundingRect, qreal _cur
|
|||||||
p2.setY(y);
|
p2.setY(y);
|
||||||
|
|
||||||
if (it->x() >= _minimum)
|
if (it->x() >= _minimum)
|
||||||
p.drawLine(p1, p2);
|
{
|
||||||
|
const auto dx = fabs(x - p1.x()), dy = fabs(y - p1.y());
|
||||||
|
if (dx > 1 || dy > 1)
|
||||||
|
p.drawLine(p1, p2);
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (it->x() >= _maximum)
|
if (it->x() >= _maximum)
|
||||||
break;
|
break;
|
||||||
@ -783,7 +808,7 @@ void ArbitraryValuesChartItem::updateImageAsync(QRectF _boundingRect, qreal _cur
|
|||||||
p.setPen(QColor::fromRgba(profiler::colors::modify_alpha32(0xc0000000, color)));
|
p.setPen(QColor::fromRgba(profiler::colors::modify_alpha32(0xc0000000, color)));
|
||||||
else
|
else
|
||||||
p.setPen(QColor::fromRgba(color));
|
p.setPen(QColor::fromRgba(color));
|
||||||
p.setBrush(QColor::fromRgba(0xc0ffffff));
|
p.setBrush(QColor::fromRgba(0xc8ffffff));
|
||||||
|
|
||||||
qreal prevX = -offset * 2, prevY = -500;
|
qreal prevX = -offset * 2, prevY = -500;
|
||||||
for (auto it = first; it != points.end() && it->x() < _maximum; ++it)
|
for (auto it = first; it != points.end() && it->x() < _maximum; ++it)
|
||||||
@ -853,20 +878,7 @@ GraphicsChart::GraphicsChart(QWidget* _parent)
|
|||||||
m_chartItem->setPos(0, 0);
|
m_chartItem->setPos(0, 0);
|
||||||
m_chartItem->setBoundingRect(0, rect.top() + margin(), scene()->width(), rect.height() - margins() - 1);
|
m_chartItem->setBoundingRect(0, rect.top() + margin(), scene()->width(), rect.height() - margins() - 1);
|
||||||
|
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::autoAdjustChartChanged, [this]
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::autoAdjustChartChanged, this, &This::onAutoAdjustChartChanged);
|
||||||
{
|
|
||||||
if (m_chartItem->isVisible())
|
|
||||||
m_chartItem->onModeChanged();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!EASY_GLOBALS.scene.empty)
|
|
||||||
{
|
|
||||||
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
|
||||||
setRange(EASY_GLOBALS.scene.left, EASY_GLOBALS.scene.right);
|
|
||||||
setSliderWidth(EASY_GLOBALS.scene.window);
|
|
||||||
setValue(EASY_GLOBALS.scene.offset);
|
|
||||||
m_slider->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_chartItem->updateImage();
|
m_chartItem->updateImage();
|
||||||
}
|
}
|
||||||
@ -876,12 +888,23 @@ GraphicsChart::~GraphicsChart()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsChart::onAutoAdjustChartChanged()
|
||||||
|
{
|
||||||
|
if (m_chartItem->isVisible())
|
||||||
|
m_chartItem->onModeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsChart::clear()
|
void GraphicsChart::clear()
|
||||||
{
|
{
|
||||||
m_chartItem->clear();
|
cancelImageUpdate();
|
||||||
Parent::clear();
|
Parent::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsChart::cancelImageUpdate()
|
||||||
|
{
|
||||||
|
m_chartItem->clear();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsChart::update(Collections _collections)
|
void GraphicsChart::update(Collections _collections)
|
||||||
{
|
{
|
||||||
m_chartItem->update(std::move(_collections));
|
m_chartItem->update(std::move(_collections));
|
||||||
@ -927,7 +950,7 @@ ArbitraryTreeWidgetItem::ArbitraryTreeWidgetItem(QTreeWidgetItem* _parent, profi
|
|||||||
|
|
||||||
ArbitraryTreeWidgetItem::~ArbitraryTreeWidgetItem()
|
ArbitraryTreeWidgetItem::~ArbitraryTreeWidgetItem()
|
||||||
{
|
{
|
||||||
|
interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ArbitraryTreeWidgetItem::data(int _column, int _role) const
|
QVariant ArbitraryTreeWidgetItem::data(int _column, int _role) const
|
||||||
@ -954,6 +977,11 @@ const ArbitraryValuesCollection* ArbitraryTreeWidgetItem::collection() const
|
|||||||
return m_collection.get();
|
return m_collection.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArbitraryValuesCollection* ArbitraryTreeWidgetItem::collection()
|
||||||
|
{
|
||||||
|
return m_collection.get();
|
||||||
|
}
|
||||||
|
|
||||||
void ArbitraryTreeWidgetItem::collectValues(profiler::thread_id_t _threadId)
|
void ArbitraryTreeWidgetItem::collectValues(profiler::thread_id_t _threadId)
|
||||||
{
|
{
|
||||||
if (!m_collection)
|
if (!m_collection)
|
||||||
@ -1046,6 +1074,7 @@ void ArbitraryValuesWidget::clear()
|
|||||||
{
|
{
|
||||||
if (m_collectionsTimer.isActive())
|
if (m_collectionsTimer.isActive())
|
||||||
m_collectionsTimer.stop();
|
m_collectionsTimer.stop();
|
||||||
|
m_chart->cancelImageUpdate();
|
||||||
m_checkedItems.clear();
|
m_checkedItems.clear();
|
||||||
m_treeWidget->clear();
|
m_treeWidget->clear();
|
||||||
m_boldItem = nullptr;
|
m_boldItem = nullptr;
|
||||||
@ -1153,6 +1182,7 @@ void ArbitraryValuesWidget::onCollectionsTimeout()
|
|||||||
{
|
{
|
||||||
if (item->collection()->status() != ArbitraryValuesCollection::InProgress)
|
if (item->collection()->status() != ArbitraryValuesCollection::InProgress)
|
||||||
{
|
{
|
||||||
|
item->collection()->join();
|
||||||
collections.push_back(CollectionPaintData {item->collection(), item->color(),
|
collections.push_back(CollectionPaintData {item->collection(), item->color(),
|
||||||
ChartType::Line, item == m_treeWidget->currentItem()});
|
ChartType::Line, item == m_treeWidget->currentItem()});
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ public:
|
|||||||
void collectValues(profiler::thread_id_t _threadId, profiler::vin_t _valueId, const char* _valueName, profiler::timestamp_t _beginTime);
|
void collectValues(profiler::thread_id_t _threadId, profiler::vin_t _valueId, const char* _valueName, profiler::timestamp_t _beginTime);
|
||||||
bool calculatePoints(profiler::timestamp_t _beginTime);
|
bool calculatePoints(profiler::timestamp_t _beginTime);
|
||||||
void interrupt();
|
void interrupt();
|
||||||
|
void join();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -211,9 +212,14 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void cancelImageUpdate();
|
||||||
void update(Collections _collections);
|
void update(Collections _collections);
|
||||||
void update(const ArbitraryValuesCollection* _selected);
|
void update(const ArbitraryValuesCollection* _selected);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void onAutoAdjustChartChanged();
|
||||||
|
|
||||||
}; // end of class GraphicsChart.
|
}; // end of class GraphicsChart.
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -241,6 +247,7 @@ public:
|
|||||||
void setBold(bool _isBold);
|
void setBold(bool _isBold);
|
||||||
|
|
||||||
const ArbitraryValuesCollection* collection() const;
|
const ArbitraryValuesCollection* collection() const;
|
||||||
|
ArbitraryValuesCollection* collection();
|
||||||
void collectValues(profiler::thread_id_t _threadId);
|
void collectValues(profiler::thread_id_t _threadId);
|
||||||
void interrupt();
|
void interrupt();
|
||||||
|
|
||||||
|
@ -1134,38 +1134,17 @@ EasyGraphicsScrollbar::EasyGraphicsScrollbar(int _initialHeight, QWidget* _paren
|
|||||||
m_histogramItem->setBoundingRect(0, scene()->sceneRect().top() + margin(), scene()->width(), sceneHeight - margins() - 1);
|
m_histogramItem->setBoundingRect(0, scene()->sceneRect().top() + margin(), scene()->width(), sceneHeight - margins() - 1);
|
||||||
m_histogramItem->hide();
|
m_histogramItem->hide();
|
||||||
|
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::expectedFrameTimeChanged, [this]()
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::expectedFrameTimeChanged,
|
||||||
{
|
this, &This::onExpectedFrameTimeChanged);
|
||||||
if (m_histogramItem->isVisible())
|
|
||||||
{
|
|
||||||
m_histogramItem->updateImage();
|
|
||||||
scene()->update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::autoAdjustHistogramChanged, [this]()
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::autoAdjustHistogramChanged,
|
||||||
{
|
this, &This::onAutoAdjustHistogramChanged);
|
||||||
if (m_histogramItem->isVisible())
|
|
||||||
m_histogramItem->onModeChanged();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::displayOnlyFramesOnHistogramChanged, [this]()
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::displayOnlyFramesOnHistogramChanged,
|
||||||
{
|
this, &This::onDisplayOnlyFramesOnHistogramChanged);
|
||||||
if (m_histogramItem->isVisible())
|
|
||||||
m_histogramItem->rebuildSource(GraphicsHistogramItem::Hist_Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::threadNameDecorationChanged, this, &This::onThreadViewChanged);
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::threadNameDecorationChanged, this, &This::onThreadViewChanged);
|
||||||
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::hexThreadIdChanged, this, &This::onThreadViewChanged);
|
connect(&EASY_GLOBALS.events, &profiler_gui::EasyGlobalSignals::hexThreadIdChanged, this, &This::onThreadViewChanged);
|
||||||
|
|
||||||
if (!EASY_GLOBALS.scene.empty)
|
|
||||||
{
|
|
||||||
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
|
||||||
setRange(EASY_GLOBALS.scene.left, EASY_GLOBALS.scene.right);
|
|
||||||
setSliderWidth(EASY_GLOBALS.scene.window);
|
|
||||||
setValue(EASY_GLOBALS.scene.offset);
|
|
||||||
m_slider->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EasyGraphicsScrollbar::~EasyGraphicsScrollbar()
|
EasyGraphicsScrollbar::~EasyGraphicsScrollbar()
|
||||||
@ -1184,6 +1163,27 @@ void EasyGraphicsScrollbar::onThreadViewChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EasyGraphicsScrollbar::onExpectedFrameTimeChanged()
|
||||||
|
{
|
||||||
|
if (m_histogramItem->isVisible())
|
||||||
|
{
|
||||||
|
m_histogramItem->updateImage();
|
||||||
|
scene()->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EasyGraphicsScrollbar::onAutoAdjustHistogramChanged()
|
||||||
|
{
|
||||||
|
if (m_histogramItem->isVisible())
|
||||||
|
m_histogramItem->onModeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EasyGraphicsScrollbar::onDisplayOnlyFramesOnHistogramChanged()
|
||||||
|
{
|
||||||
|
if (m_histogramItem->isVisible())
|
||||||
|
m_histogramItem->rebuildSource(GraphicsHistogramItem::Hist_Id);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void EasyGraphicsScrollbar::clear()
|
void EasyGraphicsScrollbar::clear()
|
||||||
|
@ -176,6 +176,9 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void onThreadViewChanged();
|
void onThreadViewChanged();
|
||||||
|
void onExpectedFrameTimeChanged();
|
||||||
|
void onAutoAdjustHistogramChanged();
|
||||||
|
void onDisplayOnlyFramesOnHistogramChanged();
|
||||||
|
|
||||||
}; // END of class EasyGraphicsScrollbar.
|
}; // END of class EasyGraphicsScrollbar.
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
EasyQTimer::EasyQTimer()
|
EasyQTimer::EasyQTimer()
|
||||||
: QObject()
|
: QObject()
|
||||||
{
|
{
|
||||||
connect(&m_timer, &QTimer::timeout, [this] { m_handler(); });
|
connect(&m_timer, &QTimer::timeout, this, &EasyQTimer::onTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
EasyQTimer::EasyQTimer(::std::function<void()>&& handler, bool signleShot)
|
EasyQTimer::EasyQTimer(::std::function<void()>&& handler, bool signleShot)
|
||||||
@ -68,7 +68,7 @@ EasyQTimer::EasyQTimer(::std::function<void()>&& handler, bool signleShot)
|
|||||||
, m_handler(::std::forward<::std::function<void()>&&>(handler))
|
, m_handler(::std::forward<::std::function<void()>&&>(handler))
|
||||||
{
|
{
|
||||||
m_timer.setSingleShot(signleShot);
|
m_timer.setSingleShot(signleShot);
|
||||||
connect(&m_timer, &QTimer::timeout, [this] { m_handler(); });
|
connect(&m_timer, &QTimer::timeout, this, &EasyQTimer::onTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
EasyQTimer::~EasyQTimer()
|
EasyQTimer::~EasyQTimer()
|
||||||
@ -76,6 +76,11 @@ EasyQTimer::~EasyQTimer()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EasyQTimer::onTimeout()
|
||||||
|
{
|
||||||
|
m_handler();
|
||||||
|
}
|
||||||
|
|
||||||
void EasyQTimer::setHandler(::std::function<void()>&& handler)
|
void EasyQTimer::setHandler(::std::function<void()>&& handler)
|
||||||
{
|
{
|
||||||
m_handler = handler;
|
m_handler = handler;
|
||||||
|
@ -87,6 +87,10 @@ public:
|
|||||||
void stop();
|
void stop();
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void onTimeout();
|
||||||
|
|
||||||
}; // END of class EasyQTimer.
|
}; // END of class EasyQTimer.
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -179,6 +179,7 @@ GraphicsSliderArea::GraphicsSliderArea(QWidget* _parent)
|
|||||||
, m_bLocked(false)
|
, m_bLocked(false)
|
||||||
, m_bUpdatingPos(false)
|
, m_bUpdatingPos(false)
|
||||||
, m_bEmitChange(true)
|
, m_bEmitChange(true)
|
||||||
|
, m_bValidated(false)
|
||||||
{
|
{
|
||||||
setCacheMode(QGraphicsView::CacheNone);
|
setCacheMode(QGraphicsView::CacheNone);
|
||||||
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||||
@ -220,23 +221,8 @@ GraphicsSliderArea::GraphicsSliderArea(QWidget* _parent)
|
|||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneCleared, this, &This::clear);
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneCleared, this, &This::clear);
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneVisibleRegionSizeChanged, this, &This::setSliderWidth);
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneVisibleRegionSizeChanged, this, &This::setSliderWidth);
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneVisibleRegionPosChanged, this, &This::setValue);
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneVisibleRegionPosChanged, this, &This::setValue);
|
||||||
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::chartSliderChanged, this, &This::onExternalChartSliderChanged);
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::chartSliderChanged, [this] (qreal pos)
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneSizeChanged, this, &This::onSceneSizeChanged);
|
||||||
{
|
|
||||||
if (!m_bUpdatingPos)
|
|
||||||
{
|
|
||||||
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
|
||||||
setValue(pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::sceneSizeChanged, [this] (qreal left, qreal right)
|
|
||||||
{
|
|
||||||
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
|
||||||
setRange(left, right);
|
|
||||||
m_slider->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::lockCharts, this, &This::lock);
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::lockCharts, this, &This::lock);
|
||||||
connect(globalEvents, &profiler_gui::EasyGlobalSignals::unlockCharts, this, &This::unlock);
|
connect(globalEvents, &profiler_gui::EasyGlobalSignals::unlockCharts, this, &This::unlock);
|
||||||
}
|
}
|
||||||
@ -246,6 +232,45 @@ GraphicsSliderArea::~GraphicsSliderArea()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsSliderArea::showEvent(QShowEvent* _event)
|
||||||
|
{
|
||||||
|
Parent::showEvent(_event);
|
||||||
|
if (!m_bValidated)
|
||||||
|
{
|
||||||
|
m_bValidated = true;
|
||||||
|
validateScene();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsSliderArea::validateScene()
|
||||||
|
{
|
||||||
|
if (!EASY_GLOBALS.scene.empty)
|
||||||
|
{
|
||||||
|
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
||||||
|
setRange(EASY_GLOBALS.scene.left, EASY_GLOBALS.scene.right);
|
||||||
|
setSliderWidth(EASY_GLOBALS.scene.window);
|
||||||
|
setValue(EASY_GLOBALS.scene.offset);
|
||||||
|
m_slider->show();
|
||||||
|
scene()->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsSliderArea::onExternalChartSliderChanged(qreal _pos)
|
||||||
|
{
|
||||||
|
if (!m_bUpdatingPos)
|
||||||
|
{
|
||||||
|
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
||||||
|
setValue(_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsSliderArea::onSceneSizeChanged(qreal _left, qreal _right)
|
||||||
|
{
|
||||||
|
const profiler_gui::BoolFlagGuard guard(m_bEmitChange, false);
|
||||||
|
setRange(_left, _right);
|
||||||
|
m_slider->show();
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GraphicsSliderArea::clear()
|
void GraphicsSliderArea::clear()
|
||||||
|
@ -108,6 +108,7 @@ protected:
|
|||||||
bool m_bLocked;
|
bool m_bLocked;
|
||||||
bool m_bUpdatingPos;
|
bool m_bUpdatingPos;
|
||||||
bool m_bEmitChange;
|
bool m_bEmitChange;
|
||||||
|
bool m_bValidated;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -116,6 +117,7 @@ public:
|
|||||||
|
|
||||||
// Public virtual methods
|
// Public virtual methods
|
||||||
|
|
||||||
|
void showEvent(QShowEvent* _event) override;
|
||||||
void mousePressEvent(QMouseEvent* _event) override;
|
void mousePressEvent(QMouseEvent* _event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent* _event) override;
|
void mouseReleaseEvent(QMouseEvent* _event) override;
|
||||||
void mouseMoveEvent(QMouseEvent* _event) override;
|
void mouseMoveEvent(QMouseEvent* _event) override;
|
||||||
@ -150,6 +152,10 @@ public:
|
|||||||
void showSelectionIndicator();
|
void showSelectionIndicator();
|
||||||
void hideSelectionIndicator();
|
void hideSelectionIndicator();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void validateScene();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void lock() { m_bLocked = true; }
|
void lock() { m_bLocked = true; }
|
||||||
@ -157,6 +163,8 @@ public slots:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
void onExternalChartSliderChanged(qreal _pos);
|
||||||
|
void onSceneSizeChanged(qreal _left, qreal _right);
|
||||||
void onWindowWidthChange(qreal _width);
|
void onWindowWidthChange(qreal _width);
|
||||||
|
|
||||||
}; // END of class GraphicsSliderArea.
|
}; // END of class GraphicsSliderArea.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user