mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use 'struct membuffer' for profile info string generation
The profile info was generated using nasty string concatenation that the membuffers are much better at anyway. And membuffers don't need those arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
77da20196f
commit
50424df653
4 changed files with 57 additions and 79 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "divetooltipitem.h"
|
||||
#include "divecartesianaxis.h"
|
||||
#include "profile.h"
|
||||
#include "dive.h"
|
||||
#include "membuffer.h"
|
||||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPen>
|
||||
|
@ -39,9 +41,11 @@ void ToolTipItem::refresh(struct graphics_context *gc, QPointF pos)
|
|||
{
|
||||
clear();
|
||||
int time = (pos.x() * gc->maxtime) / gc->maxx;
|
||||
char buffer[500];
|
||||
get_plot_details(gc, time, buffer, 500);
|
||||
addToolTip(QString(buffer));
|
||||
struct membuffer mb = { 0 };
|
||||
|
||||
get_plot_details(gc, time, &mb);
|
||||
addToolTip(QString::fromUtf8(mb.buffer, mb.len));
|
||||
free_buffer(&mb);
|
||||
|
||||
QList<QGraphicsItem*> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
|
||||
Q_FOREACH(QGraphicsItem *item, items) {
|
||||
|
@ -229,9 +233,11 @@ void ToolTipItem::refresh(const QPointF& pos)
|
|||
{
|
||||
clear();
|
||||
int time = timeAxis->valueAt( pos );
|
||||
char buffer[500];
|
||||
get_plot_details_new(&pInfo, time, buffer, 500);
|
||||
addToolTip(QString(buffer));
|
||||
struct membuffer mb = { 0 };
|
||||
|
||||
get_plot_details_new(&pInfo, time, &mb);
|
||||
addToolTip(QString::fromUtf8(mb.buffer, mb.len));
|
||||
free_buffer(&mb);
|
||||
|
||||
QList<QGraphicsItem*> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
|
||||
Q_FOREACH(QGraphicsItem *item, items) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue