mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:13:23 +00:00
profile: rename printFontScale to dpr (device pixel ratio)
The printFontScale is used to scale up fonts (and icons) when rendering to high-DPI devices. With absolute scaling, this will also be used to scale the size of different chart regions, line thickness, etc. Therefore, give it an more appropriate name. "Device pixel ratio", which is a well established term, seems to appropriately describe the concept. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d28f4d5347
commit
f713858ba4
15 changed files with 97 additions and 98 deletions
|
@ -107,10 +107,10 @@ void Printer::render(int pages)
|
||||||
QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");
|
QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");
|
||||||
|
|
||||||
// A "standard" profile has about 600 pixels in height.
|
// A "standard" profile has about 600 pixels in height.
|
||||||
// Scale the fonts in the printed profile accordingly.
|
// Scale the items in the printed profile accordingly.
|
||||||
// This is arbitrary, but it seems to work reasonably well.
|
// This is arbitrary, but it seems to work reasonably well.
|
||||||
double printFontScale = collection.count() > 0 ? collection[0].geometry().size().height() / 600.0 : 1.0;
|
double dpr = collection.count() > 0 ? collection[0].geometry().size().height() / 600.0 : 1.0;
|
||||||
auto profile = std::make_unique<ProfileScene>(printFontScale, true, !printOptions.color_selected);
|
auto profile = std::make_unique<ProfileScene>(dpr, true, !printOptions.color_selected);
|
||||||
|
|
||||||
// render the Qwebview
|
// render the Qwebview
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
|
@ -47,7 +47,7 @@ void DiveCartesianAxis::setTextColor(const QColor &color)
|
||||||
textColor = color;
|
textColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveCartesianAxis::DiveCartesianAxis(double fontPrintScale, bool printMode, ProfileScene &scene) :
|
DiveCartesianAxis::DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene) :
|
||||||
printMode(printMode),
|
printMode(printMode),
|
||||||
scene(scene),
|
scene(scene),
|
||||||
orientation(LeftToRight),
|
orientation(LeftToRight),
|
||||||
|
@ -60,7 +60,7 @@ DiveCartesianAxis::DiveCartesianAxis(double fontPrintScale, bool printMode, Prof
|
||||||
labelScale(1.0),
|
labelScale(1.0),
|
||||||
line_size(1),
|
line_size(1),
|
||||||
changed(true),
|
changed(true),
|
||||||
fontPrintScale(fontPrintScale)
|
dpr(dpr)
|
||||||
{
|
{
|
||||||
setPen(gridPen());
|
setPen(gridPen());
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void DiveCartesianAxis::updateTicks(int animSpeed, color_index_t color)
|
||||||
} else {
|
} else {
|
||||||
childPos = begin - i * stepSize;
|
childPos = begin - i * stepSize;
|
||||||
}
|
}
|
||||||
DiveTextItem *label = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *label = new DiveTextItem(dpr, this);
|
||||||
label->setText(textForValue(currValueText));
|
label->setText(textForValue(currValueText));
|
||||||
label->setBrush(colorForValue(currValueText));
|
label->setBrush(colorForValue(currValueText));
|
||||||
label->setScale(labelScale);
|
label->setScale(labelScale);
|
||||||
|
@ -339,7 +339,7 @@ QColor DepthAxis::colorForValue(double) const
|
||||||
return QColor(Qt::red);
|
return QColor(Qt::red);
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthAxis::DepthAxis(double fontPrintScale, bool printMode, ProfileScene &scene) : DiveCartesianAxis(fontPrintScale, printMode, scene)
|
DepthAxis::DepthAxis(double dpr, bool printMode, ProfileScene &scene) : DiveCartesianAxis(dpr, printMode, scene)
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
@ -372,8 +372,8 @@ QString TemperatureAxis::textForValue(double value) const
|
||||||
return QString::number(mkelvin_to_C((int)value));
|
return QString::number(mkelvin_to_C((int)value));
|
||||||
}
|
}
|
||||||
|
|
||||||
PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, double fontPrintScale, bool printMode, ProfileScene &scene) :
|
PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene) :
|
||||||
DiveCartesianAxis(fontPrintScale, printMode, scene),
|
DiveCartesianAxis(dpr, printMode, scene),
|
||||||
model(model)
|
model(model)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
LeftToRight,
|
LeftToRight,
|
||||||
RightToLeft
|
RightToLeft
|
||||||
};
|
};
|
||||||
DiveCartesianAxis(double fontPrintScale, bool printMode, ProfileScene &scene);
|
DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene);
|
||||||
~DiveCartesianAxis();
|
~DiveCartesianAxis();
|
||||||
void setMinimum(double minimum);
|
void setMinimum(double minimum);
|
||||||
void setMaximum(double maximum);
|
void setMaximum(double maximum);
|
||||||
|
@ -70,13 +70,13 @@ protected:
|
||||||
double labelScale;
|
double labelScale;
|
||||||
qreal line_size;
|
qreal line_size;
|
||||||
bool changed;
|
bool changed;
|
||||||
double fontPrintScale;
|
double dpr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DepthAxis : public DiveCartesianAxis {
|
class DepthAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DepthAxis(double fontPrintScale, bool printMode, ProfileScene &scene);
|
DepthAxis(double dpr, bool printMode, ProfileScene &scene);
|
||||||
private:
|
private:
|
||||||
QString textForValue(double value) const override;
|
QString textForValue(double value) const override;
|
||||||
QColor colorForValue(double value) const override;
|
QColor colorForValue(double value) const override;
|
||||||
|
@ -103,7 +103,7 @@ private:
|
||||||
class PartialGasPressureAxis : public DiveCartesianAxis {
|
class PartialGasPressureAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PartialGasPressureAxis(const DivePlotDataModel &model, double fontPrintScale, bool printMode, ProfileScene &scene);
|
PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene);
|
||||||
void update(int animSpeed);
|
void update(int animSpeed);
|
||||||
private:
|
private:
|
||||||
const DivePlotDataModel &model;
|
const DivePlotDataModel &model;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
||||||
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
||||||
int speed, double fontPrintScale, QGraphicsItem *parent) : DivePixmapItem(parent),
|
int speed, double dpr, QGraphicsItem *parent) : DivePixmapItem(parent),
|
||||||
vAxis(vAxis),
|
vAxis(vAxis),
|
||||||
hAxis(hAxis),
|
hAxis(hAxis),
|
||||||
dataModel(model),
|
dataModel(model),
|
||||||
|
@ -26,7 +26,7 @@ DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasm
|
||||||
{
|
{
|
||||||
setFlag(ItemIgnoresTransformations);
|
setFlag(ItemIgnoresTransformations);
|
||||||
|
|
||||||
setupPixmap(lastgasmix, fontPrintScale);
|
setupPixmap(lastgasmix, dpr);
|
||||||
setupToolTipString(lastgasmix);
|
setupToolTipString(lastgasmix);
|
||||||
recalculatePos(0);
|
recalculatePos(0);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct event *DiveEventItem::getEventMutable()
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double fontPrintScale)
|
void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double dpr)
|
||||||
{
|
{
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
const IconMetrics& metrics = defaultIconMetrics();
|
const IconMetrics& metrics = defaultIconMetrics();
|
||||||
|
@ -65,10 +65,10 @@ void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double fontPrintScale)
|
||||||
int sz_bigger = metrics.sz_big + metrics.sz_med;
|
int sz_bigger = metrics.sz_big + metrics.sz_med;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
sz_bigger = lrint(sz_bigger * fontPrintScale);
|
sz_bigger = lrint(sz_bigger * dpr);
|
||||||
int sz_pix = sz_bigger/2; // ex 20px
|
int sz_pix = sz_bigger/2; // ex 20px
|
||||||
if (verbose)
|
if (verbose)
|
||||||
qDebug() << __FUNCTION__ << "fontPrintScale" << fontPrintScale << "metrics" << metrics.sz_med << metrics.sz_small << "sz_bigger" << sz_bigger;
|
qDebug() << __FUNCTION__ << "DPR" << dpr << "metrics" << metrics.sz_med << metrics.sz_small << "sz_bigger" << sz_bigger;
|
||||||
|
|
||||||
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
||||||
#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DiveEventItem : public DivePixmapItem {
|
||||||
public:
|
public:
|
||||||
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
||||||
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
||||||
int speed, double fontPrintScale, QGraphicsItem *parent = nullptr);
|
int speed, double dpr, QGraphicsItem *parent = nullptr);
|
||||||
~DiveEventItem();
|
~DiveEventItem();
|
||||||
const struct event *getEvent() const;
|
const struct event *getEvent() const;
|
||||||
struct event *getEventMutable();
|
struct event *getEventMutable();
|
||||||
|
@ -28,7 +28,7 @@ slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupToolTipString(struct gasmix lastgasmix);
|
void setupToolTipString(struct gasmix lastgasmix);
|
||||||
void setupPixmap(struct gasmix lastgasmix, double fontPrintScale);
|
void setupPixmap(struct gasmix lastgasmix, double dpr);
|
||||||
int depthAtTime(int time);
|
int depthAtTime(int time);
|
||||||
DiveCartesianAxis *vAxis;
|
DiveCartesianAxis *vAxis;
|
||||||
DiveCartesianAxis *hAxis;
|
DiveCartesianAxis *hAxis;
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include "profile-widget/profilewidget2.h"
|
#include "profile-widget/profilewidget2.h"
|
||||||
|
|
||||||
AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &horizontal, int hColumn,
|
AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &horizontal, int hColumn,
|
||||||
const DiveCartesianAxis &vertical, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vertical, int vColumn, double dpr) :
|
||||||
hAxis(horizontal), vAxis(vertical), dataModel(model), hDataColumn(hColumn), vDataColumn(vColumn), fontPrintScale(fontPrintScale)
|
hAxis(horizontal), vAxis(vertical), dataModel(model), hDataColumn(hColumn), vDataColumn(vColumn), dpr(dpr)
|
||||||
{
|
{
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ void AbstractProfilePolygonItem::replot(const dive *, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveProfileItem::DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveProfileItem::DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale),
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||||
show_reported_ceiling(0), reported_ceiling_in_red(0)
|
show_reported_ceiling(0), reported_ceiling_in_red(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ void DiveProfileItem::replot(const dive *d, bool in_planner)
|
||||||
|
|
||||||
void DiveProfileItem::plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color)
|
void DiveProfileItem::plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color)
|
||||||
{
|
{
|
||||||
DiveTextItem *item = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *item = new DiveTextItem(dpr, this);
|
||||||
item->setPos(hAxis.posAtValue(entry->sec), vAxis.posAtValue(entry->depth));
|
item->setPos(hAxis.posAtValue(entry->sec), vAxis.posAtValue(entry->depth));
|
||||||
item->setText(get_depth_string(entry->depth, true));
|
item->setText(get_depth_string(entry->depth, true));
|
||||||
item->setAlignment(flags);
|
item->setAlignment(flags);
|
||||||
|
@ -151,8 +151,8 @@ void DiveProfileItem::plot_depth_sample(struct plot_data *entry, QFlags<Qt::Alig
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveHeartrateItem::DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveHeartrateItem::DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setBrush(QBrush(getColor(::HR_PLOT)));
|
pen.setBrush(QBrush(getColor(::HR_PLOT)));
|
||||||
|
@ -214,7 +214,7 @@ void DiveHeartrateItem::replot(const dive *, bool)
|
||||||
|
|
||||||
void DiveHeartrateItem::createTextItem(int sec, int hr)
|
void DiveHeartrateItem::createTextItem(int sec, int hr)
|
||||||
{
|
{
|
||||||
DiveTextItem *text = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *text = new DiveTextItem(dpr, this);
|
||||||
text->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
text->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||||
text->setBrush(getColor(HR_TEXT));
|
text->setBrush(getColor(HR_TEXT));
|
||||||
text->setPos(QPointF(hAxis.posAtValue(sec), vAxis.posAtValue(hr)));
|
text->setPos(QPointF(hAxis.posAtValue(sec), vAxis.posAtValue(hr)));
|
||||||
|
@ -234,8 +234,8 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*
|
||||||
}
|
}
|
||||||
|
|
||||||
DivePercentageItem::DivePercentageItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DivePercentageItem::DivePercentageItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, int i, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, int i, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale),
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||||
tissueIndex(i)
|
tissueIndex(i)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -305,8 +305,8 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveTemperatureItem::DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveTemperatureItem::DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setBrush(QBrush(getColor(::TEMP_PLOT)));
|
pen.setBrush(QBrush(getColor(::TEMP_PLOT)));
|
||||||
|
@ -363,7 +363,7 @@ void DiveTemperatureItem::createTextItem(int sec, int mkelvin)
|
||||||
temperature_t temp;
|
temperature_t temp;
|
||||||
temp.mkelvin = mkelvin;
|
temp.mkelvin = mkelvin;
|
||||||
|
|
||||||
DiveTextItem *text = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *text = new DiveTextItem(dpr, this);
|
||||||
text->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
text->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||||
text->setBrush(getColor(TEMP_TEXT));
|
text->setBrush(getColor(TEMP_TEXT));
|
||||||
text->setPos(QPointF(hAxis.posAtValue(sec), vAxis.posAtValue(mkelvin)));
|
text->setPos(QPointF(hAxis.posAtValue(sec), vAxis.posAtValue(mkelvin)));
|
||||||
|
@ -383,8 +383,8 @@ void DiveTemperatureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setBrush(QBrush(getColor(::HR_AXIS)));
|
pen.setBrush(QBrush(getColor(::HR_AXIS)));
|
||||||
|
@ -431,7 +431,7 @@ void DiveMeanDepthItem::createTextItem()
|
||||||
int sec = entry[dataModel.rowCount()-1].sec;
|
int sec = entry[dataModel.rowCount()-1].sec;
|
||||||
qDeleteAll(texts);
|
qDeleteAll(texts);
|
||||||
texts.clear();
|
texts.clear();
|
||||||
DiveTextItem *text = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *text = new DiveTextItem(dpr, this);
|
||||||
text->setAlignment(Qt::AlignRight | Qt::AlignTop);
|
text->setAlignment(Qt::AlignRight | Qt::AlignTop);
|
||||||
text->setBrush(getColor(TEMP_TEXT));
|
text->setBrush(getColor(TEMP_TEXT));
|
||||||
text->setPos(QPointF(hAxis.posAtValue(sec) + 1, vAxis.posAtValue(lastRunningSum)));
|
text->setPos(QPointF(hAxis.posAtValue(sec) + 1, vAxis.posAtValue(lastRunningSum)));
|
||||||
|
@ -569,7 +569,7 @@ void DiveGasPressureItem::plotPressureValue(int mbar, int sec, QFlags<Qt::Alignm
|
||||||
{
|
{
|
||||||
const char *unit;
|
const char *unit;
|
||||||
int pressure = get_pressure_units(mbar, &unit);
|
int pressure = get_pressure_units(mbar, &unit);
|
||||||
DiveTextItem *text = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *text = new DiveTextItem(dpr, this);
|
||||||
text->setPos(hAxis.posAtValue(sec), vAxis.posAtValue(mbar) + pressure_offset );
|
text->setPos(hAxis.posAtValue(sec), vAxis.posAtValue(mbar) + pressure_offset );
|
||||||
text->setText(QString("%1%2").arg(pressure).arg(unit));
|
text->setText(QString("%1%2").arg(pressure).arg(unit));
|
||||||
text->setAlignment(align);
|
text->setAlignment(align);
|
||||||
|
@ -580,7 +580,7 @@ void DiveGasPressureItem::plotPressureValue(int mbar, int sec, QFlags<Qt::Alignm
|
||||||
void DiveGasPressureItem::plotGasValue(int mbar, int sec, struct gasmix gasmix, QFlags<Qt::AlignmentFlag> align, double gasname_offset)
|
void DiveGasPressureItem::plotGasValue(int mbar, int sec, struct gasmix gasmix, QFlags<Qt::AlignmentFlag> align, double gasname_offset)
|
||||||
{
|
{
|
||||||
QString gas = get_gas_string(gasmix);
|
QString gas = get_gas_string(gasmix);
|
||||||
DiveTextItem *text = new DiveTextItem(fontPrintScale, this);
|
DiveTextItem *text = new DiveTextItem(dpr, this);
|
||||||
text->setPos(hAxis.posAtValue(sec), vAxis.posAtValue(mbar) + gasname_offset );
|
text->setPos(hAxis.posAtValue(sec), vAxis.posAtValue(mbar) + gasname_offset );
|
||||||
text->setText(gas);
|
text->setText(gas);
|
||||||
text->setAlignment(align);
|
text->setAlignment(align);
|
||||||
|
@ -607,8 +607,8 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveCalculatedCeiling::DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveCalculatedCeiling::DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,14 +641,14 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveCalculatedTissue::DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveCalculatedTissue::DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
DiveCalculatedCeiling(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
DiveCalculatedCeiling(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale)
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -752,8 +752,8 @@ void PartialPressureGasItem::setThresholdSettingsKey(const double *prefPointerMi
|
||||||
}
|
}
|
||||||
|
|
||||||
PartialPressureGasItem::PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
PartialPressureGasItem::PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale) :
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr) :
|
||||||
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, fontPrintScale),
|
AbstractProfilePolygonItem(model, hAxis, hColumn, vAxis, vColumn, dpr),
|
||||||
thresholdPtrMin(NULL),
|
thresholdPtrMin(NULL),
|
||||||
thresholdPtrMax(NULL)
|
thresholdPtrMax(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
/* This is the Profile Item, it should be used for quite a lot of things
|
/* This is the Profile Item, it should be used for quite a lot of things
|
||||||
on the profile view. The usage should be pretty simple:
|
on the profile view. The usage should be pretty simple:
|
||||||
|
|
||||||
DiveProfileItem *profile = new DiveProfileItem(DiveDataModel, timeAxis, DiveDataModel::TIME, DiveDataModel, DiveDataModel::DEPTH, fontPrintScale);
|
DiveProfileItem *profile = new DiveProfileItem(DiveDataModel, timeAxis, DiveDataModel::TIME, DiveDataModel, DiveDataModel::DEPTH, dpr);
|
||||||
scene()->addItem(profile);
|
scene()->addItem(profile);
|
||||||
|
|
||||||
This is a generically item and should be used as a base for others, I think...
|
This is a generically item and should be used as a base for others, I think...
|
||||||
|
@ -30,7 +30,7 @@ class AbstractProfilePolygonItem : public QObject, public QGraphicsPolygonItem {
|
||||||
Q_PROPERTY(qreal x WRITE setX READ x)
|
Q_PROPERTY(qreal x WRITE setX READ x)
|
||||||
Q_PROPERTY(qreal y WRITE setY READ y)
|
Q_PROPERTY(qreal y WRITE setY READ y)
|
||||||
public:
|
public:
|
||||||
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
|
||||||
void clear();
|
void clear();
|
||||||
virtual void replot(const dive *d, bool in_planner);
|
virtual void replot(const dive *d, bool in_planner);
|
||||||
|
@ -41,7 +41,7 @@ protected:
|
||||||
const DivePlotDataModel &dataModel;
|
const DivePlotDataModel &dataModel;
|
||||||
int hDataColumn;
|
int hDataColumn;
|
||||||
int vDataColumn;
|
int vDataColumn;
|
||||||
double fontPrintScale;
|
double dpr;
|
||||||
QList<DiveTextItem *> texts;
|
QList<DiveTextItem *> texts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class DiveProfileItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color);
|
void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color);
|
||||||
|
@ -64,7 +64,7 @@ private:
|
||||||
class DiveMeanDepthItem : public AbstractProfilePolygonItem {
|
class DiveMeanDepthItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
class DiveTemperatureItem : public AbstractProfilePolygonItem {
|
class DiveTemperatureItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ private:
|
||||||
class DiveHeartrateItem : public AbstractProfilePolygonItem {
|
class DiveHeartrateItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ private:
|
||||||
class DivePercentageItem : public AbstractProfilePolygonItem {
|
class DivePercentageItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DivePercentageItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, int i, double fontPrintScale);
|
DivePercentageItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, int i, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,7 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
};
|
};
|
||||||
|
@ -153,13 +153,13 @@ class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
DiveCalculatedTissue(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
|
||||||
const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PartialPressureGasItem : public AbstractProfilePolygonItem {
|
class PartialPressureGasItem : public AbstractProfilePolygonItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double fontPrintScale);
|
PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, double dpr);
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
|
||||||
void replot(const dive *d, bool in_planner) override;
|
void replot(const dive *d, bool in_planner) override;
|
||||||
void setThresholdSettingsKey(const double *prefPointerMin, const double *prefPointerMax);
|
void setThresholdSettingsKey(const double *prefPointerMin, const double *prefPointerMax);
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
DiveTextItem::DiveTextItem(double printScale, QGraphicsItem *parent) : QGraphicsItemGroup(parent),
|
DiveTextItem::DiveTextItem(double dpr, QGraphicsItem *parent) : QGraphicsItemGroup(parent),
|
||||||
internalAlignFlags(Qt::AlignHCenter | Qt::AlignVCenter),
|
internalAlignFlags(Qt::AlignHCenter | Qt::AlignVCenter),
|
||||||
textBackgroundItem(new QGraphicsPathItem(this)),
|
textBackgroundItem(new QGraphicsPathItem(this)),
|
||||||
textItem(new QGraphicsPathItem(this)),
|
textItem(new QGraphicsPathItem(this)),
|
||||||
printScale(printScale),
|
dpr(dpr),
|
||||||
scale(1.0)
|
scale(1.0)
|
||||||
{
|
{
|
||||||
setFlag(ItemIgnoresTransformations);
|
setFlag(ItemIgnoresTransformations);
|
||||||
|
@ -69,11 +69,11 @@ void DiveTextItem::updateText()
|
||||||
QFont fnt(qApp->font());
|
QFont fnt(qApp->font());
|
||||||
if ((size = fnt.pixelSize()) > 0) {
|
if ((size = fnt.pixelSize()) > 0) {
|
||||||
// set in pixels - so the scale factor may not make a difference if it's too close to 1
|
// set in pixels - so the scale factor may not make a difference if it's too close to 1
|
||||||
size *= scale * printScale;
|
size *= scale * dpr;
|
||||||
fnt.setPixelSize(lrint(size));
|
fnt.setPixelSize(lrint(size));
|
||||||
} else {
|
} else {
|
||||||
size = fnt.pointSizeF();
|
size = fnt.pointSizeF();
|
||||||
size *= scale * printScale;
|
size *= scale * dpr;
|
||||||
fnt.setPointSizeF(size);
|
fnt.setPointSizeF(size);
|
||||||
}
|
}
|
||||||
QFontMetrics fm(fnt);
|
QFontMetrics fm(fnt);
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DiveTextItem : public QObject, public QGraphicsItemGroup {
|
||||||
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
||||||
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
||||||
public:
|
public:
|
||||||
DiveTextItem(double printScale, QGraphicsItem *parent = 0);
|
DiveTextItem(double dpr, QGraphicsItem *parent = 0);
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
void setAlignment(int alignFlags);
|
void setAlignment(int alignFlags);
|
||||||
void setScale(double newscale);
|
void setScale(double newscale);
|
||||||
|
@ -27,7 +27,7 @@ private:
|
||||||
QGraphicsPathItem *textBackgroundItem;
|
QGraphicsPathItem *textBackgroundItem;
|
||||||
QGraphicsPathItem *textItem;
|
QGraphicsPathItem *textItem;
|
||||||
QString internalText;
|
QString internalText;
|
||||||
double printScale;
|
double dpr;
|
||||||
double scale;
|
double scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,34 +55,34 @@ T *ProfileScene::createItem(const DiveCartesianAxis &vAxis, int vColumn, int z,
|
||||||
PartialPressureGasItem *ProfileScene::createPPGas(int column, color_index_t color, color_index_t colorAlert,
|
PartialPressureGasItem *ProfileScene::createPPGas(int column, color_index_t color, color_index_t colorAlert,
|
||||||
const double *thresholdSettingsMin, const double *thresholdSettingsMax)
|
const double *thresholdSettingsMin, const double *thresholdSettingsMax)
|
||||||
{
|
{
|
||||||
PartialPressureGasItem *item = createItem<PartialPressureGasItem>(*gasYAxis, column, 99, fontPrintScale);
|
PartialPressureGasItem *item = createItem<PartialPressureGasItem>(*gasYAxis, column, 99, dpr);
|
||||||
item->setThresholdSettingsKey(thresholdSettingsMin, thresholdSettingsMax);
|
item->setThresholdSettingsKey(thresholdSettingsMin, thresholdSettingsMax);
|
||||||
item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale));
|
item->setColors(getColor(color, isGrayscale), getColor(colorAlert, isGrayscale));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileScene::ProfileScene(double fontPrintScale, bool printMode, bool isGrayscale) :
|
ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
|
||||||
d(nullptr),
|
d(nullptr),
|
||||||
dc(-1),
|
dc(-1),
|
||||||
fontPrintScale(fontPrintScale),
|
dpr(dpr),
|
||||||
printMode(printMode),
|
printMode(printMode),
|
||||||
isGrayscale(isGrayscale),
|
isGrayscale(isGrayscale),
|
||||||
maxtime(-1),
|
maxtime(-1),
|
||||||
maxdepth(-1),
|
maxdepth(-1),
|
||||||
dataModel(new DivePlotDataModel(this)),
|
dataModel(new DivePlotDataModel(this)),
|
||||||
profileYAxis(new DepthAxis(fontPrintScale, printMode, *this)),
|
profileYAxis(new DepthAxis(dpr, printMode, *this)),
|
||||||
gasYAxis(new PartialGasPressureAxis(*dataModel, fontPrintScale, printMode, *this)),
|
gasYAxis(new PartialGasPressureAxis(*dataModel, dpr, printMode, *this)),
|
||||||
temperatureAxis(new TemperatureAxis(fontPrintScale, printMode, *this)),
|
temperatureAxis(new TemperatureAxis(dpr, printMode, *this)),
|
||||||
timeAxis(new TimeAxis(fontPrintScale, printMode, *this)),
|
timeAxis(new TimeAxis(dpr, printMode, *this)),
|
||||||
cylinderPressureAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
|
cylinderPressureAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||||
heartBeatAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
|
heartBeatAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||||
percentageAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
|
percentageAxis(new DiveCartesianAxis(dpr, printMode, *this)),
|
||||||
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH, 0, fontPrintScale)),
|
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH, 0, dpr)),
|
||||||
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1, fontPrintScale)),
|
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1, dpr)),
|
||||||
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1, fontPrintScale)),
|
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1, dpr)),
|
||||||
gasPressureItem(createItem<DiveGasPressureItem>(*cylinderPressureAxis, DivePlotDataModel::TEMPERATURE, 1, fontPrintScale)),
|
gasPressureItem(createItem<DiveGasPressureItem>(*cylinderPressureAxis, DivePlotDataModel::TEMPERATURE, 1, dpr)),
|
||||||
diveComputerText(new DiveTextItem(fontPrintScale)),
|
diveComputerText(new DiveTextItem(dpr)),
|
||||||
reportedCeiling(createItem<DiveReportedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1, fontPrintScale)),
|
reportedCeiling(createItem<DiveReportedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1, dpr)),
|
||||||
pn2GasItem(createPPGas(DivePlotDataModel::PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold)),
|
pn2GasItem(createPPGas(DivePlotDataModel::PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold)),
|
||||||
pheGasItem(createPPGas(DivePlotDataModel::PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold)),
|
pheGasItem(createPPGas(DivePlotDataModel::PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold)),
|
||||||
po2GasItem(createPPGas(DivePlotDataModel::PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
po2GasItem(createPPGas(DivePlotDataModel::PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
|
@ -91,10 +91,10 @@ ProfileScene::ProfileScene(double fontPrintScale, bool printMode, bool isGraysca
|
||||||
ccrsensor2GasItem(createPPGas(DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ccrsensor2GasItem(createPPGas(DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
ccrsensor3GasItem(createPPGas(DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ccrsensor3GasItem(createPPGas(DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
ocpo2GasItem(createPPGas(DivePlotDataModel::SCR_OC_PO2, SCR_OCPO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
ocpo2GasItem(createPPGas(DivePlotDataModel::SCR_OC_PO2, SCR_OCPO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max)),
|
||||||
diveCeiling(createItem<DiveCalculatedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1, fontPrintScale)),
|
diveCeiling(createItem<DiveCalculatedCeiling>(*profileYAxis, DivePlotDataModel::CEILING, 1, dpr)),
|
||||||
decoModelParameters(new DiveTextItem(fontPrintScale)),
|
decoModelParameters(new DiveTextItem(dpr)),
|
||||||
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis, DivePlotDataModel::HEARTBEAT, 1, fontPrintScale)),
|
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis, DivePlotDataModel::HEARTBEAT, 1, dpr)),
|
||||||
tankItem(new TankItem(*timeAxis, fontPrintScale))
|
tankItem(new TankItem(*timeAxis, dpr))
|
||||||
{
|
{
|
||||||
init_plot_info(&plotInfo);
|
init_plot_info(&plotInfo);
|
||||||
|
|
||||||
|
@ -167,9 +167,9 @@ ProfileScene::ProfileScene(double fontPrintScale, bool printMode, bool isGraysca
|
||||||
tankItem->setPos(itemPos.tankBar.on);
|
tankItem->setPos(itemPos.tankBar.on);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
DiveCalculatedTissue *tissueItem = createItem<DiveCalculatedTissue>(*profileYAxis, DivePlotDataModel::TISSUE_1 + i, i + 1, fontPrintScale);
|
DiveCalculatedTissue *tissueItem = createItem<DiveCalculatedTissue>(*profileYAxis, DivePlotDataModel::TISSUE_1 + i, i + 1, dpr);
|
||||||
allTissues.append(tissueItem);
|
allTissues.append(tissueItem);
|
||||||
DivePercentageItem *percentageItem = createItem<DivePercentageItem>(*percentageAxis, DivePlotDataModel::PERCENTAGE_1 + i, i + 1, i, fontPrintScale);
|
DivePercentageItem *percentageItem = createItem<DivePercentageItem>(*percentageAxis, DivePlotDataModel::PERCENTAGE_1 + i, i + 1, i, dpr);
|
||||||
allPercentages.append(percentageItem);
|
allPercentages.append(percentageItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,8 +637,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
||||||
// BUT events are wanted.
|
// BUT events are wanted.
|
||||||
#endif
|
#endif
|
||||||
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel,
|
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel,
|
||||||
timeAxis, profileYAxis, animSpeed,
|
timeAxis, profileYAxis, animSpeed, dpr);
|
||||||
fontPrintScale);
|
|
||||||
item->setZValue(2);
|
item->setZValue(2);
|
||||||
addItem(item);
|
addItem(item);
|
||||||
eventItems.push_back(item);
|
eventItems.push_back(item);
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TimeAxis;
|
||||||
|
|
||||||
class ProfileScene : public QGraphicsScene {
|
class ProfileScene : public QGraphicsScene {
|
||||||
public:
|
public:
|
||||||
ProfileScene(double fontPrintScale, bool printMode, bool isGrayscale);
|
ProfileScene(double dpr, bool printMode, bool isGrayscale);
|
||||||
~ProfileScene();
|
~ProfileScene();
|
||||||
|
|
||||||
void updateAxes(bool instant); // Update axes according to preferences
|
void updateAxes(bool instant); // Update axes according to preferences
|
||||||
|
@ -59,7 +59,7 @@ private:
|
||||||
void updateVisibility(); // Update visibility of non-interactive chart features according to preferences
|
void updateVisibility(); // Update visibility of non-interactive chart features according to preferences
|
||||||
|
|
||||||
friend class ProfileWidget2; // For now, give the ProfileWidget full access to the objects on the scene
|
friend class ProfileWidget2; // For now, give the ProfileWidget full access to the objects on the scene
|
||||||
double fontPrintScale;
|
double dpr; // Device Pixel Ratio. A DPR of one corresponds to a "standard" PC screen.
|
||||||
bool printMode;
|
bool printMode;
|
||||||
bool isGrayscale;
|
bool isGrayscale;
|
||||||
int maxtime;
|
int maxtime;
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
static const double thumbnailBaseZValue = 100.0;
|
static const double thumbnailBaseZValue = 100.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double fontPrintScale, QWidget *parent) : QGraphicsView(parent),
|
ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double dpr, QWidget *parent) : QGraphicsView(parent),
|
||||||
profileScene(new ProfileScene(fontPrintScale, false, false)),
|
profileScene(new ProfileScene(dpr, false, false)),
|
||||||
currentState(INIT),
|
currentState(INIT),
|
||||||
plannerModel(plannerModelIn),
|
plannerModel(plannerModelIn),
|
||||||
zoomLevel(0),
|
zoomLevel(0),
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pass null as plannerModel if no support for planning required
|
// Pass null as plannerModel if no support for planning required
|
||||||
ProfileWidget2(DivePlannerPointsModel *plannerModel, double fontPrintScale, QWidget *parent = 0);
|
ProfileWidget2(DivePlannerPointsModel *plannerModel, double dpr, QWidget *parent = 0);
|
||||||
~ProfileWidget2();
|
~ProfileWidget2();
|
||||||
void resetZoom();
|
void resetZoom();
|
||||||
void scale(qreal sx, qreal sy);
|
void scale(qreal sx, qreal sy);
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
static const qreal height = 3.0;
|
static const qreal height = 3.0;
|
||||||
|
|
||||||
TankItem::TankItem(const DiveCartesianAxis &axis, double fontPrintScale) :
|
TankItem::TankItem(const DiveCartesianAxis &axis, double dpr) :
|
||||||
hAxis(axis),
|
hAxis(axis),
|
||||||
plotEndTime(-1),
|
plotEndTime(-1),
|
||||||
fontPrintScale(fontPrintScale)
|
dpr(dpr)
|
||||||
{
|
{
|
||||||
QColor red(PERSIANRED1);
|
QColor red(PERSIANRED1);
|
||||||
QColor blue(AIR_BLUE);
|
QColor blue(AIR_BLUE);
|
||||||
|
@ -51,7 +51,7 @@ void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
|
||||||
rect->setBrush(nitrox);
|
rect->setBrush(nitrox);
|
||||||
rect->setPen(QPen(QBrush(), 0.0)); // get rid of the thick line around the rectangle
|
rect->setPen(QPen(QBrush(), 0.0)); // get rid of the thick line around the rectangle
|
||||||
rects.push_back(rect);
|
rects.push_back(rect);
|
||||||
DiveTextItem *label = new DiveTextItem(fontPrintScale, rect);
|
DiveTextItem *label = new DiveTextItem(dpr, rect);
|
||||||
label->setText(gasname(gas));
|
label->setText(gasname(gas));
|
||||||
label->setBrush(Qt::black);
|
label->setBrush(Qt::black);
|
||||||
label->setPos(x + 1, 0);
|
label->setPos(x + 1, 0);
|
||||||
|
|
|
@ -13,14 +13,14 @@ class DiveCartesianAxis;
|
||||||
class TankItem : public QGraphicsRectItem
|
class TankItem : public QGraphicsRectItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TankItem(const DiveCartesianAxis &axis, double fontPrintScale);
|
explicit TankItem(const DiveCartesianAxis &axis, double dpr);
|
||||||
void setData(const struct plot_info *plotInfo, const struct dive *d);
|
void setData(const struct plot_info *plotInfo, const struct dive *d);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createBar(int startTime, int stopTime, struct gasmix gas);
|
void createBar(int startTime, int stopTime, struct gasmix gas);
|
||||||
const DiveCartesianAxis &hAxis;
|
const DiveCartesianAxis &hAxis;
|
||||||
int plotEndTime;
|
int plotEndTime;
|
||||||
double fontPrintScale;
|
double dpr;
|
||||||
QBrush air, nitrox, oxygen, trimix;
|
QBrush air, nitrox, oxygen, trimix;
|
||||||
QList<QGraphicsRectItem *> rects;
|
QList<QGraphicsRectItem *> rects;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue