mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Do not set maxTime when the handler is moving.
Fixes massive cpu hog. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fe2eb1a9fc
commit
addec6b69f
2 changed files with 24 additions and 3 deletions
|
@ -87,7 +87,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
heartBeatItem(new DiveHeartrateItem()),
|
heartBeatItem(new DiveHeartrateItem()),
|
||||||
rulerItem(new RulerItem2()),
|
rulerItem(new RulerItem2()),
|
||||||
isGrayscale(false),
|
isGrayscale(false),
|
||||||
printMode(false)
|
printMode(false),
|
||||||
|
shouldCalculateMaxTime(true)
|
||||||
{
|
{
|
||||||
memset(&plotInfo, 0, sizeof(plotInfo));
|
memset(&plotInfo, 0, sizeof(plotInfo));
|
||||||
|
|
||||||
|
@ -421,7 +422,8 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
|
||||||
*/
|
*/
|
||||||
struct plot_info pInfo = calculate_max_limits_new(d, currentdc);
|
struct plot_info pInfo = calculate_max_limits_new(d, currentdc);
|
||||||
create_plot_info_new(d, currentdc, &pInfo);
|
create_plot_info_new(d, currentdc, &pInfo);
|
||||||
int maxtime = get_maxtime(&pInfo);
|
if(shouldCalculateMaxTime)
|
||||||
|
maxtime = get_maxtime(&pInfo);
|
||||||
int maxdepth = get_maxdepth(&pInfo);
|
int maxdepth = get_maxdepth(&pInfo);
|
||||||
|
|
||||||
dataModel->setDive(d, pInfo);
|
dataModel->setDive(d, pInfo);
|
||||||
|
@ -546,6 +548,22 @@ void ProfileWidget2::resizeEvent(QResizeEvent *event)
|
||||||
fixBackgroundPos();
|
fixBackgroundPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
QGraphicsView::mousePressEvent(event);
|
||||||
|
if(currentState == PLAN)
|
||||||
|
shouldCalculateMaxTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
QGraphicsView::mouseReleaseEvent(event);
|
||||||
|
if(currentState == PLAN){
|
||||||
|
shouldCalculateMaxTime = true;
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileWidget2::fixBackgroundPos()
|
void ProfileWidget2::fixBackgroundPos()
|
||||||
{
|
{
|
||||||
if (currentState != EMPTY)
|
if (currentState != EMPTY)
|
||||||
|
|
|
@ -108,7 +108,8 @@ protected:
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event);
|
virtual void mouseMoveEvent(QMouseEvent *event);
|
||||||
virtual void contextMenuEvent(QContextMenuEvent *event);
|
virtual void contextMenuEvent(QContextMenuEvent *event);
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||||
|
virtual void mousePressEvent(QMouseEvent *event);
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||||||
private: /*methods*/
|
private: /*methods*/
|
||||||
void fixBackgroundPos();
|
void fixBackgroundPos();
|
||||||
void scrollViewTo(const QPoint &pos);
|
void scrollViewTo(const QPoint &pos);
|
||||||
|
@ -160,6 +161,8 @@ private:
|
||||||
int fixHandlerIndex(DiveHandler *activeHandler);
|
int fixHandlerIndex(DiveHandler *activeHandler);
|
||||||
friend class DiveHandler;
|
friend class DiveHandler;
|
||||||
QHash<Qt::Key, QAction *> actionsForKeys;
|
QHash<Qt::Key, QAction *> actionsForKeys;
|
||||||
|
bool shouldCalculateMaxTime;
|
||||||
|
int maxtime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROFILEWIDGET2_H
|
#endif // PROFILEWIDGET2_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue