mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'nitpicks' of github.com:tcanabrava/subsurface
This commit is contained in:
commit
be6e6638de
6 changed files with 269 additions and 123 deletions
2
Makefile
2
Makefile
|
@ -52,6 +52,7 @@ HEADERS = \
|
||||||
qt-ui/divecomputermanagementdialog.h \
|
qt-ui/divecomputermanagementdialog.h \
|
||||||
qt-ui/diveplanner.h \
|
qt-ui/diveplanner.h \
|
||||||
qt-ui/about.h \
|
qt-ui/about.h \
|
||||||
|
qt-ui/graphicsview-common.h \
|
||||||
|
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
|
@ -92,6 +93,7 @@ SOURCES = \
|
||||||
qt-ui/divecomputermanagementdialog.cpp \
|
qt-ui/divecomputermanagementdialog.cpp \
|
||||||
qt-ui/diveplanner.cpp \
|
qt-ui/diveplanner.cpp \
|
||||||
qt-ui/about.cpp \
|
qt-ui/about.cpp \
|
||||||
|
qt-ui/graphicsview-common.cpp \
|
||||||
$(RESFILE)
|
$(RESFILE)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "diveplanner.h"
|
#include "diveplanner.h"
|
||||||
|
#include "graphicsview-common.h"
|
||||||
|
|
||||||
#include "../dive.h"
|
#include "../dive.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
@ -6,24 +8,43 @@
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QGraphicsProxyWidget>
|
#include <QGraphicsProxyWidget>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
|
||||||
#include "ui_diveplanner.h"
|
#include "ui_diveplanner.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#define TIME_INITIAL_MAX 30
|
#define TIME_INITIAL_MAX 30
|
||||||
|
|
||||||
|
#define MAX_DEEPNESS 150
|
||||||
|
#define MIN_DEEPNESS 40
|
||||||
|
|
||||||
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0),
|
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0),
|
||||||
lastValidPos(0.0, 0.0)
|
lastValidPos(0.0, 0.0)
|
||||||
{
|
{
|
||||||
|
fill_profile_color();
|
||||||
|
setBackgroundBrush(profile_color[BACKGROUND].at(0));
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setScene(new QGraphicsScene());
|
setScene(new QGraphicsScene());
|
||||||
scene()->setSceneRect(0,0,200,200);
|
scene()->setSceneRect(0,0,1920,1080);
|
||||||
|
|
||||||
|
QRectF r = scene()->sceneRect();
|
||||||
|
|
||||||
|
verticalLine = new QGraphicsLineItem(
|
||||||
|
fromPercent(0, Qt::Horizontal),
|
||||||
|
fromPercent(0, Qt::Vertical),
|
||||||
|
fromPercent(0, Qt::Horizontal),
|
||||||
|
fromPercent(100, Qt::Vertical)
|
||||||
|
);
|
||||||
|
|
||||||
verticalLine = new QGraphicsLineItem(0,0,0, 200);
|
|
||||||
verticalLine->setPen(QPen(Qt::DotLine));
|
verticalLine->setPen(QPen(Qt::DotLine));
|
||||||
scene()->addItem(verticalLine);
|
scene()->addItem(verticalLine);
|
||||||
|
|
||||||
horizontalLine = new QGraphicsLineItem(0,0,200,0);
|
horizontalLine = new QGraphicsLineItem(
|
||||||
|
fromPercent(0, Qt::Horizontal),
|
||||||
|
fromPercent(0, Qt::Vertical),
|
||||||
|
fromPercent(100, Qt::Horizontal),
|
||||||
|
fromPercent(0, Qt::Vertical)
|
||||||
|
);
|
||||||
horizontalLine->setPen(QPen(Qt::DotLine));
|
horizontalLine->setPen(QPen(Qt::DotLine));
|
||||||
scene()->addItem(horizontalLine);
|
scene()->addItem(horizontalLine);
|
||||||
|
|
||||||
|
@ -31,8 +52,15 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
timeLine->setMinimum(0);
|
timeLine->setMinimum(0);
|
||||||
timeLine->setMaximum(TIME_INITIAL_MAX);
|
timeLine->setMaximum(TIME_INITIAL_MAX);
|
||||||
timeLine->setTickInterval(10);
|
timeLine->setTickInterval(10);
|
||||||
timeLine->setLine(10, 190, 190, 190);
|
timeLine->setLine(
|
||||||
|
fromPercent(10, Qt::Horizontal),
|
||||||
|
fromPercent(90, Qt::Vertical),
|
||||||
|
fromPercent(90, Qt::Horizontal),
|
||||||
|
fromPercent(90, Qt::Vertical)
|
||||||
|
);
|
||||||
timeLine->setOrientation(Qt::Horizontal);
|
timeLine->setOrientation(Qt::Horizontal);
|
||||||
|
timeLine->setTickSize(fromPercent(1, Qt::Vertical));
|
||||||
|
timeLine->setColor(profile_color[TIME_GRID].at(0));
|
||||||
timeLine->updateTicks();
|
timeLine->updateTicks();
|
||||||
scene()->addItem(timeLine);
|
scene()->addItem(timeLine);
|
||||||
|
|
||||||
|
@ -40,32 +68,43 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
depthLine->setMinimum(0);
|
depthLine->setMinimum(0);
|
||||||
depthLine->setMaximum(40);
|
depthLine->setMaximum(40);
|
||||||
depthLine->setTickInterval(10);
|
depthLine->setTickInterval(10);
|
||||||
depthLine->setLine(10, 1, 10, 190);
|
depthLine->setLine(
|
||||||
|
fromPercent(10, Qt::Horizontal),
|
||||||
|
fromPercent(10, Qt::Vertical),
|
||||||
|
fromPercent(10, Qt::Horizontal),
|
||||||
|
fromPercent(90, Qt::Vertical)
|
||||||
|
);
|
||||||
depthLine->setOrientation(Qt::Vertical);
|
depthLine->setOrientation(Qt::Vertical);
|
||||||
|
depthLine->setTickSize(fromPercent(1, Qt::Horizontal));
|
||||||
|
depthLine->setColor(profile_color[DEPTH_GRID].at(0));
|
||||||
depthLine->updateTicks();
|
depthLine->updateTicks();
|
||||||
scene()->addItem(depthLine);
|
scene()->addItem(depthLine);
|
||||||
|
|
||||||
timeString = new QGraphicsSimpleTextItem();
|
timeString = new QGraphicsSimpleTextItem();
|
||||||
timeString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
timeString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
|
timeString->setBrush(profile_color[TIME_TEXT].at(0));
|
||||||
scene()->addItem(timeString);
|
scene()->addItem(timeString);
|
||||||
|
|
||||||
depthString = new QGraphicsSimpleTextItem();
|
depthString = new QGraphicsSimpleTextItem();
|
||||||
depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
|
depthString->setBrush(profile_color[SAMPLE_DEEP].at(0));
|
||||||
scene()->addItem(depthString);
|
scene()->addItem(depthString);
|
||||||
|
|
||||||
diveBg = new QGraphicsPolygonItem();
|
diveBg = new QGraphicsPolygonItem();
|
||||||
diveBg->setBrush(QBrush(Qt::green));
|
diveBg->setPen(QPen(QBrush(),0));
|
||||||
scene()->addItem(diveBg);
|
scene()->addItem(diveBg);
|
||||||
|
|
||||||
plusDepth = new Button();
|
plusDepth = new Button();
|
||||||
plusDepth->setPixmap(QPixmap(":plus"));
|
plusDepth->setPixmap(QPixmap(":plus"));
|
||||||
plusDepth->setPos(0, 1);
|
plusDepth->setPos(fromPercent(5, Qt::Horizontal), fromPercent(5, Qt::Vertical));
|
||||||
|
plusDepth->setToolTip("Increase maximum depth by 10m");
|
||||||
scene()->addItem(plusDepth);
|
scene()->addItem(plusDepth);
|
||||||
connect(plusDepth, SIGNAL(clicked()), this, SLOT(increaseDepth()));
|
connect(plusDepth, SIGNAL(clicked()), this, SLOT(increaseDepth()));
|
||||||
|
|
||||||
plusTime = new Button();
|
plusTime = new Button();
|
||||||
plusTime->setPixmap(QPixmap(":plus"));
|
plusTime->setPixmap(QPixmap(":plus"));
|
||||||
plusTime->setPos(180, 190);
|
plusTime->setPos(fromPercent(90, Qt::Horizontal), fromPercent(95, Qt::Vertical));
|
||||||
|
plusTime->setToolTip("Increase minimum dive time by 10m");
|
||||||
scene()->addItem(plusTime);
|
scene()->addItem(plusTime);
|
||||||
connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime()));
|
connect(plusTime, SIGNAL(clicked()), this, SLOT(increaseTime()));
|
||||||
|
|
||||||
|
@ -81,9 +120,17 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
|
||||||
scene()->addItem(cancelBtn);
|
scene()->addItem(cancelBtn);
|
||||||
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
||||||
|
|
||||||
|
minMinutes = TIME_INITIAL_MAX;
|
||||||
setRenderHint(QPainter::Antialiasing);
|
setRenderHint(QPainter::Antialiasing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation)
|
||||||
|
{
|
||||||
|
qreal total = orientation == Qt::Horizontal ? sceneRect().width() : sceneRect().height();
|
||||||
|
qreal result = (total * percent) / 100;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void DivePlannerGraphics::cancelClicked()
|
void DivePlannerGraphics::cancelClicked()
|
||||||
{
|
{
|
||||||
qDebug() << "clicked";
|
qDebug() << "clicked";
|
||||||
|
@ -97,12 +144,19 @@ void DivePlannerGraphics::okClicked()
|
||||||
|
|
||||||
void DivePlannerGraphics::increaseDepth()
|
void DivePlannerGraphics::increaseDepth()
|
||||||
{
|
{
|
||||||
qDebug() << "Increase Depth Clicked";
|
if (depthLine->maximum() + 10 > MAX_DEEPNESS)
|
||||||
|
return;
|
||||||
|
depthLine->setMaximum( depthLine->maximum() + 10);
|
||||||
|
depthLine->updateTicks();
|
||||||
|
createDecoStops();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerGraphics::increaseTime()
|
void DivePlannerGraphics::increaseTime()
|
||||||
{
|
{
|
||||||
qDebug() << "Increase Time Clicked";
|
minMinutes += 10;
|
||||||
|
timeLine->setMaximum( minMinutes );
|
||||||
|
timeLine->updateTicks();
|
||||||
|
createDecoStops();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
|
void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
|
@ -129,10 +183,6 @@ void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
createDecoStops();
|
createDecoStops();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerGraphics::clearGeneratedDeco()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivePlannerGraphics::createDecoStops()
|
void DivePlannerGraphics::createDecoStops()
|
||||||
{
|
{
|
||||||
qDeleteAll(lines);
|
qDeleteAll(lines);
|
||||||
|
@ -177,14 +227,14 @@ void DivePlannerGraphics::createDecoStops()
|
||||||
|
|
||||||
if (timeLine->maximum() < dp->time / 60.0 + 5 ||
|
if (timeLine->maximum() < dp->time / 60.0 + 5 ||
|
||||||
dp->time / 60.0 + 15 < timeLine->maximum()) {
|
dp->time / 60.0 + 15 < timeLine->maximum()) {
|
||||||
double newMax = fmax(dp->time / 60.0 + 5, TIME_INITIAL_MAX);
|
double newMax = fmax(dp->time / 60.0 + 5, minMinutes);
|
||||||
timeLine->setMaximum(newMax);
|
timeLine->setMaximum(newMax);
|
||||||
timeLine->updateTicks();
|
timeLine->updateTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-position the user generated dive handlers
|
// Re-position the user generated dive handlers
|
||||||
Q_FOREACH(DiveHandler *h, handles){
|
Q_FOREACH(DiveHandler *h, handles){
|
||||||
h->setPos(timeLine->posAtValue(h->sec / 60), depthLine->posAtValue(h->mm) / 1000);
|
h->setPos(timeLine->posAtValue(h->sec / 60), depthLine->posAtValue(h->mm / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
// (re-) create the profile with different colors for segments that were
|
// (re-) create the profile with different colors for segments that were
|
||||||
|
@ -197,27 +247,29 @@ void DivePlannerGraphics::createDecoStops()
|
||||||
for (dp = diveplan.dp; dp != NULL; dp = dp->next) {
|
for (dp = diveplan.dp; dp != NULL; dp = dp->next) {
|
||||||
double xpos = timeLine->posAtValue(dp->time / 60.0);
|
double xpos = timeLine->posAtValue(dp->time / 60.0);
|
||||||
double ypos = depthLine->posAtValue(dp->depth / 1000.0);
|
double ypos = depthLine->posAtValue(dp->depth / 1000.0);
|
||||||
QGraphicsLineItem *item = new QGraphicsLineItem(lastx, lasty, xpos, ypos);
|
if(!dp->entered){
|
||||||
item->setPen(QPen(QBrush(dp->entered ? Qt::black : Qt::red),0));
|
QGraphicsLineItem *item = new QGraphicsLineItem(lastx, lasty, xpos, ypos);
|
||||||
|
item->setPen(QPen(QBrush(Qt::red),0));
|
||||||
|
scene()->addItem(item);
|
||||||
|
lines << item;
|
||||||
|
}
|
||||||
lastx = xpos;
|
lastx = xpos;
|
||||||
lasty = ypos;
|
lasty = ypos;
|
||||||
scene()->addItem(item);
|
|
||||||
lines << item;
|
|
||||||
poly.append(QPointF(lastx, lasty));
|
poly.append(QPointF(lastx, lasty));
|
||||||
}
|
}
|
||||||
|
|
||||||
diveBg->setPolygon(poly);
|
diveBg->setPolygon(poly);
|
||||||
QRectF b = poly.boundingRect();
|
QRectF b = poly.boundingRect();
|
||||||
QLinearGradient linearGrad(
|
QLinearGradient pat(
|
||||||
b.x(),
|
b.x(),
|
||||||
b.y(),
|
b.y(),
|
||||||
b.x(),
|
b.x(),
|
||||||
b.height() + b.y()
|
b.height() + b.y()
|
||||||
);
|
);
|
||||||
|
|
||||||
linearGrad.setColorAt(0, Qt::green);
|
pat.setColorAt(1, profile_color[DEPTH_BOTTOM].first());
|
||||||
linearGrad.setColorAt(1, Qt::white);
|
pat.setColorAt(0, profile_color[DEPTH_TOP].first());
|
||||||
diveBg->setBrush(linearGrad);
|
diveBg->setBrush(pat);
|
||||||
|
|
||||||
deleteTemporaryDivePlan(diveplan.dp);
|
deleteTemporaryDivePlan(diveplan.dp);
|
||||||
}
|
}
|
||||||
|
@ -248,12 +300,23 @@ void DivePlannerGraphics::mouseMoveEvent(QMouseEvent* event)
|
||||||
if (isPointOutOfBoundaries(mappedPos))
|
if (isPointOutOfBoundaries(mappedPos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
verticalLine->setLine(mappedPos.x(), 0, mappedPos.x(), 200);
|
verticalLine->setPos(mappedPos.x(), fromPercent(0, Qt::Vertical));
|
||||||
horizontalLine->setLine(0, mappedPos.y(), 200, mappedPos.y());
|
horizontalLine->setPos(fromPercent(0, Qt::Horizontal), mappedPos.y());
|
||||||
|
|
||||||
depthString->setText(QString::number(rint(depthLine->valueAt(mappedPos))) + "m" );
|
depthString->setText(QString::number(rint(depthLine->valueAt(mappedPos))) + "m" );
|
||||||
depthString->setPos(0, mappedPos.y());
|
depthString->setPos(fromPercent(5, Qt::Horizontal), mappedPos.y());
|
||||||
timeString->setText(QString::number(rint(timeLine->valueAt(mappedPos))) + "min");
|
timeString->setText(QString::number(rint(timeLine->valueAt(mappedPos))) + "min");
|
||||||
timeString->setPos(mappedPos.x()+1, 180);
|
timeString->setPos(mappedPos.x()+1, fromPercent(95, Qt::Vertical));
|
||||||
|
|
||||||
|
// calculate the correct color for the depthString.
|
||||||
|
// QGradient doesn't returns it's interpolation, meh.
|
||||||
|
double percent = depthLine->percentAt(mappedPos);
|
||||||
|
QColor& startColor = profile_color[SAMPLE_SHALLOW].first();
|
||||||
|
QColor& endColor = profile_color[SAMPLE_DEEP].first();
|
||||||
|
short redDelta = (endColor.red() - startColor.red()) * percent + startColor.red();
|
||||||
|
short greenDelta = (endColor.green() - startColor.green()) * percent + startColor.green();
|
||||||
|
short blueDelta = (endColor.blue() - startColor.blue()) * percent + startColor.blue();
|
||||||
|
depthString->setBrush( QColor(redDelta, greenDelta, blueDelta));
|
||||||
|
|
||||||
if (activeDraggedHandler)
|
if (activeDraggedHandler)
|
||||||
moveActiveHandler(mappedPos);
|
moveActiveHandler(mappedPos);
|
||||||
|
@ -370,21 +433,41 @@ void Ruler::updateTicks()
|
||||||
qDeleteAll(ticks);
|
qDeleteAll(ticks);
|
||||||
ticks.clear();
|
ticks.clear();
|
||||||
QLineF m = line();
|
QLineF m = line();
|
||||||
|
QGraphicsLineItem *item = NULL;
|
||||||
|
|
||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal) {
|
||||||
double steps = (max - min) / interval;
|
double steps = (max - min) / interval;
|
||||||
double stepSize = (m.x2() - m.x1()) / steps;
|
double stepSize = (m.x2() - m.x1()) / steps;
|
||||||
|
qreal pos;
|
||||||
for (qreal pos = m.x1(); pos < m.x2(); pos += stepSize) {
|
for (qreal pos = m.x1(); pos < m.x2(); pos += stepSize) {
|
||||||
ticks.push_back(new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + 1, this));
|
item = new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + tickSize, this);
|
||||||
|
item->setPen(pen());
|
||||||
|
ticks.push_back(item);
|
||||||
}
|
}
|
||||||
|
item = new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + tickSize, this);
|
||||||
|
item->setPen(pen());
|
||||||
|
ticks.push_back(item);
|
||||||
} else {
|
} else {
|
||||||
double steps = (max - min) / interval;
|
double steps = (max - min) / interval;
|
||||||
double stepSize = (m.y2() - m.y1()) / steps;
|
double stepSize = (m.y2() - m.y1()) / steps;
|
||||||
for (qreal pos = m.y1(); pos < m.y2(); pos += stepSize) {
|
qreal pos;
|
||||||
ticks.push_back(new QGraphicsLineItem(m.x1(), pos, m.x1() - 1, pos, this));
|
for (pos = m.y1(); pos < m.y2(); pos += stepSize) {
|
||||||
|
item = new QGraphicsLineItem(m.x1(), pos, m.x1() - tickSize, pos, this);
|
||||||
|
item->setPen(pen());
|
||||||
|
ticks.push_back(item);
|
||||||
}
|
}
|
||||||
|
item = new QGraphicsLineItem(m.x1(), pos, m.x1() - tickSize, pos, this);
|
||||||
|
item->setPen(pen());
|
||||||
|
ticks.push_back(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ruler::setTickSize(qreal size)
|
||||||
|
{
|
||||||
|
tickSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Ruler::setTickInterval(double i)
|
void Ruler::setTickInterval(double i)
|
||||||
{
|
{
|
||||||
interval = i;
|
interval = i;
|
||||||
|
@ -414,6 +497,16 @@ qreal Ruler::posAtValue(qreal value)
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal Ruler::percentAt(const QPointF& p)
|
||||||
|
{
|
||||||
|
qreal value = valueAt(p);
|
||||||
|
QLineF m = line();
|
||||||
|
double size = max - min;
|
||||||
|
double percent = value / size;
|
||||||
|
return percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double Ruler::maximum() const
|
double Ruler::maximum() const
|
||||||
{
|
{
|
||||||
return max;
|
return max;
|
||||||
|
@ -424,6 +517,11 @@ double Ruler::minimum() const
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ruler::setColor(const QColor& color)
|
||||||
|
{
|
||||||
|
setPen(QPen(color));
|
||||||
|
}
|
||||||
|
|
||||||
Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
|
Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
|
||||||
{
|
{
|
||||||
icon = new QGraphicsPixmapItem(this);
|
icon = new QGraphicsPixmapItem(this);
|
||||||
|
@ -431,12 +529,12 @@ Button::Button(QObject* parent): QObject(parent), QGraphicsRectItem()
|
||||||
icon->setPos(0,0);
|
icon->setPos(0,0);
|
||||||
text->setPos(0,0);
|
text->setPos(0,0);
|
||||||
setFlag(ItemIgnoresTransformations);
|
setFlag(ItemIgnoresTransformations);
|
||||||
setPen(QPen(QBrush(Qt::white), 0));
|
setPen(QPen(QBrush(), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setPixmap(const QPixmap& pixmap)
|
void Button::setPixmap(const QPixmap& pixmap)
|
||||||
{
|
{
|
||||||
icon->setPixmap(pixmap.scaled(20,20));
|
icon->setPixmap(pixmap.scaled(20,20, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
if(pixmap.isNull()){
|
if(pixmap.isNull()){
|
||||||
icon->hide();
|
icon->hide();
|
||||||
}else{
|
}else{
|
||||||
|
@ -460,5 +558,6 @@ void Button::setText(const QString& t)
|
||||||
|
|
||||||
void Button::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
void Button::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||||
{
|
{
|
||||||
|
event->ignore();
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,14 @@ public:
|
||||||
void setMaximum(double maximum);
|
void setMaximum(double maximum);
|
||||||
void setTickInterval(double interval);
|
void setTickInterval(double interval);
|
||||||
void setOrientation(Qt::Orientation orientation);
|
void setOrientation(Qt::Orientation orientation);
|
||||||
|
void setTickSize(qreal size);
|
||||||
void updateTicks();
|
void updateTicks();
|
||||||
double minimum() const;
|
double minimum() const;
|
||||||
double maximum() const;
|
double maximum() const;
|
||||||
qreal valueAt(const QPointF& p);
|
qreal valueAt(const QPointF& p);
|
||||||
|
qreal percentAt(const QPointF& p);
|
||||||
qreal posAtValue(qreal value);
|
qreal posAtValue(qreal value);
|
||||||
|
void setColor(const QColor& color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt::Orientation orientation;
|
Qt::Orientation orientation;
|
||||||
|
@ -51,6 +54,7 @@ private:
|
||||||
double interval;
|
double interval;
|
||||||
double posBegin;
|
double posBegin;
|
||||||
double posEnd;
|
double posEnd;
|
||||||
|
double tickSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DivePlannerGraphics : public QGraphicsView {
|
class DivePlannerGraphics : public QGraphicsView {
|
||||||
|
@ -65,10 +69,11 @@ protected:
|
||||||
virtual void mousePressEvent(QMouseEvent* event);
|
virtual void mousePressEvent(QMouseEvent* event);
|
||||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void clearGeneratedDeco();
|
|
||||||
void createDecoStops();
|
void createDecoStops();
|
||||||
bool isPointOutOfBoundaries(const QPointF& point);
|
bool isPointOutOfBoundaries(const QPointF& point);
|
||||||
void deleteTemporaryDivePlan(struct divedatapoint* dp);
|
void deleteTemporaryDivePlan(struct divedatapoint* dp);
|
||||||
|
qreal fromPercent(qreal percent, Qt::Orientation orientation);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void increaseTime();
|
void increaseTime();
|
||||||
void increaseDepth();
|
void increaseDepth();
|
||||||
|
@ -77,25 +82,43 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void moveActiveHandler(const QPointF& pos);
|
void moveActiveHandler(const QPointF& pos);
|
||||||
|
|
||||||
|
/* This are the lines of the plotted dive. */
|
||||||
QList<QGraphicsLineItem*> lines;
|
QList<QGraphicsLineItem*> lines;
|
||||||
|
|
||||||
|
/* This is the user-entered handles. */
|
||||||
QList<DiveHandler *> handles;
|
QList<DiveHandler *> handles;
|
||||||
|
|
||||||
|
/* those are the lines that follows the mouse. */
|
||||||
QGraphicsLineItem *verticalLine;
|
QGraphicsLineItem *verticalLine;
|
||||||
QGraphicsLineItem *horizontalLine;
|
QGraphicsLineItem *horizontalLine;
|
||||||
|
|
||||||
|
/* This is the handler that's being dragged. */
|
||||||
DiveHandler *activeDraggedHandler;
|
DiveHandler *activeDraggedHandler;
|
||||||
|
|
||||||
|
// helper to save the positions where the drag-handler is valid.
|
||||||
|
QPointF lastValidPos;
|
||||||
|
|
||||||
|
/* this is the background of the dive, the blue-gradient. */
|
||||||
QGraphicsPolygonItem *diveBg;
|
QGraphicsPolygonItem *diveBg;
|
||||||
|
|
||||||
|
/* This is the bottom ruler - the x axis, and it's associated text */
|
||||||
Ruler *timeLine;
|
Ruler *timeLine;
|
||||||
QGraphicsSimpleTextItem *timeString;
|
QGraphicsSimpleTextItem *timeString;
|
||||||
|
|
||||||
|
/* this is the left ruler, the y axis, and it's associated text. */
|
||||||
Ruler *depthLine;
|
Ruler *depthLine;
|
||||||
QGraphicsSimpleTextItem *depthString;
|
QGraphicsSimpleTextItem *depthString;
|
||||||
|
|
||||||
Button *plusTime;
|
/* Buttons */
|
||||||
Button *plusDepth;
|
Button *plusTime; // adds 10 minutes to the time ruler.
|
||||||
Button *lessTime;
|
Button *plusDepth; // adds 10 meters to the depth ruler.
|
||||||
Button *lessDepth;
|
Button *lessTime; // remove 10 minutes to the time ruler.
|
||||||
Button *okBtn;
|
Button *lessDepth; // remove 10 meters to the depth ruler.
|
||||||
Button *cancelBtn;
|
Button *okBtn; // accepts, and creates a new dive based on the plan.
|
||||||
QPointF lastValidPos;
|
Button *cancelBtn; // rejects, and clears the dive plan.
|
||||||
|
|
||||||
|
int minMinutes; // this holds the minimum duration of the dive.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
58
qt-ui/graphicsview-common.cpp
Normal file
58
qt-ui/graphicsview-common.cpp
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#include "graphicsview-common.h"
|
||||||
|
|
||||||
|
QMap<color_indice_t, QVector<QColor> > profile_color;
|
||||||
|
|
||||||
|
void fill_profile_color()
|
||||||
|
{
|
||||||
|
#define COLOR(x, y, z) QVector<QColor>() << x << y << z;
|
||||||
|
profile_color[SAC_1] = COLOR(FUNGREEN1, BLACK1_LOW_TRANS, FUNGREEN1);
|
||||||
|
profile_color[SAC_2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
|
||||||
|
profile_color[SAC_3] = COLOR(ATLANTIS1, BLACK1_LOW_TRANS, ATLANTIS1);
|
||||||
|
profile_color[SAC_4] = COLOR(ATLANTIS2, BLACK1_LOW_TRANS, ATLANTIS2);
|
||||||
|
profile_color[SAC_5] = COLOR(EARLSGREEN1, BLACK1_LOW_TRANS, EARLSGREEN1);
|
||||||
|
profile_color[SAC_6] = COLOR(HOKEYPOKEY1, BLACK1_LOW_TRANS, HOKEYPOKEY1);
|
||||||
|
profile_color[SAC_7] = COLOR(TUSCANY1, BLACK1_LOW_TRANS, TUSCANY1);
|
||||||
|
profile_color[SAC_8] = COLOR(CINNABAR1, BLACK1_LOW_TRANS, CINNABAR1);
|
||||||
|
profile_color[SAC_9] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
|
||||||
|
|
||||||
|
profile_color[VELO_STABLE] = COLOR(CAMARONE1, BLACK1_LOW_TRANS, CAMARONE1);
|
||||||
|
profile_color[VELO_SLOW] = COLOR(LIMENADE1, BLACK1_LOW_TRANS, LIMENADE1);
|
||||||
|
profile_color[VELO_MODERATE] = COLOR(RIOGRANDE1, BLACK1_LOW_TRANS, RIOGRANDE1);
|
||||||
|
profile_color[VELO_FAST] = COLOR(PIRATEGOLD1, BLACK1_LOW_TRANS, PIRATEGOLD1);
|
||||||
|
profile_color[VELO_CRAZY] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
||||||
|
|
||||||
|
profile_color[PO2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
|
||||||
|
profile_color[PO2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
||||||
|
profile_color[PN2] = COLOR(BLACK1_LOW_TRANS, BLACK1_LOW_TRANS, BLACK1_LOW_TRANS);
|
||||||
|
profile_color[PN2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
||||||
|
profile_color[PHE] = COLOR(PEANUT, BLACK1_LOW_TRANS, PEANUT);
|
||||||
|
profile_color[PHE_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
||||||
|
profile_color[PP_LINES] = COLOR(BLACK1_HIGH_TRANS, BLACK1_HIGH_TRANS, BLACK1_HIGH_TRANS);
|
||||||
|
|
||||||
|
profile_color[TEXT_BACKGROUND] = COLOR(CONCRETE1_LOWER_TRANS, WHITE1, CONCRETE1_LOWER_TRANS);
|
||||||
|
profile_color[ALERT_BG] = COLOR(BROOM1_LOWER_TRANS, BLACK1_LOW_TRANS, BROOM1_LOWER_TRANS);
|
||||||
|
profile_color[ALERT_FG] = COLOR(BLACK1_LOW_TRANS, BLACK1_LOW_TRANS, BLACK1_LOW_TRANS);
|
||||||
|
profile_color[EVENTS] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
|
||||||
|
profile_color[SAMPLE_DEEP] = COLOR(QColor(Qt::red).darker(), BLACK1_LOW_TRANS, PERSIANRED1);
|
||||||
|
profile_color[SAMPLE_SHALLOW] = COLOR(QColor(Qt::red).lighter(), BLACK1_LOW_TRANS, PERSIANRED1);
|
||||||
|
profile_color[SMOOTHED] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_LOW_TRANS, REDORANGE1_HIGH_TRANS);
|
||||||
|
profile_color[MINUTE] = COLOR(MEDIUMREDVIOLET1_HIGHER_TRANS, BLACK1_LOW_TRANS, MEDIUMREDVIOLET1_HIGHER_TRANS);
|
||||||
|
profile_color[TIME_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
|
||||||
|
profile_color[TIME_TEXT] = COLOR(FORESTGREEN1, BLACK1_LOW_TRANS, FORESTGREEN1);
|
||||||
|
profile_color[DEPTH_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
|
||||||
|
profile_color[MEAN_DEPTH] = COLOR(REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS, REDORANGE1_MED_TRANS);
|
||||||
|
profile_color[DEPTH_BOTTOM] = COLOR(GOVERNORBAY1_MED_TRANS, BLACK1_HIGH_TRANS, GOVERNORBAY1_MED_TRANS);
|
||||||
|
profile_color[DEPTH_TOP] = COLOR(MERCURY1_MED_TRANS, WHITE1_MED_TRANS, MERCURY1_MED_TRANS);
|
||||||
|
profile_color[TEMP_TEXT] = COLOR(GOVERNORBAY2, BLACK1_LOW_TRANS, GOVERNORBAY2);
|
||||||
|
profile_color[TEMP_PLOT] = COLOR(ROYALBLUE2_LOW_TRANS, BLACK1_LOW_TRANS, ROYALBLUE2_LOW_TRANS);
|
||||||
|
profile_color[SAC_DEFAULT] = COLOR(WHITE1, BLACK1_LOW_TRANS, FORESTGREEN1);
|
||||||
|
profile_color[BOUNDING_BOX] = COLOR(WHITE1, BLACK1_LOW_TRANS, TUNDORA1_MED_TRANS);
|
||||||
|
profile_color[PRESSURE_TEXT] = COLOR(KILLARNEY1, BLACK1_LOW_TRANS, KILLARNEY1);
|
||||||
|
profile_color[BACKGROUND] = COLOR(SPRINGWOOD1, BLACK1_LOW_TRANS, SPRINGWOOD1);
|
||||||
|
profile_color[CEILING_SHALLOW] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_HIGH_TRANS, REDORANGE1_HIGH_TRANS);
|
||||||
|
profile_color[CEILING_DEEP] = COLOR(RED1_MED_TRANS, BLACK1_HIGH_TRANS, RED1_MED_TRANS);
|
||||||
|
profile_color[CALC_CEILING_SHALLOW] = COLOR(FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS);
|
||||||
|
profile_color[CALC_CEILING_DEEP] = COLOR(APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS, APPLE1_HIGH_TRANS);
|
||||||
|
#undef COLOR
|
||||||
|
}
|
||||||
|
|
41
qt-ui/graphicsview-common.h
Normal file
41
qt-ui/graphicsview-common.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#ifndef GRAPHICSVIEW_COMMON_H
|
||||||
|
#define GRAPHICSVIEW_COMMON_H
|
||||||
|
|
||||||
|
#include "../color.h"
|
||||||
|
#include <QMap>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QColor>
|
||||||
|
|
||||||
|
#define SAC_COLORS_START_IDX SAC_1
|
||||||
|
#define SAC_COLORS 9
|
||||||
|
#define VELOCITY_COLORS_START_IDX VELO_STABLE
|
||||||
|
#define VELOCITY_COLORS 5
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* SAC colors. Order is important, the SAC_COLORS_START_IDX define above. */
|
||||||
|
SAC_1, SAC_2, SAC_3, SAC_4, SAC_5, SAC_6, SAC_7, SAC_8, SAC_9,
|
||||||
|
|
||||||
|
/* Velocity colors. Order is still important, ref VELOCITY_COLORS_START_IDX. */
|
||||||
|
VELO_STABLE, VELO_SLOW, VELO_MODERATE, VELO_FAST, VELO_CRAZY,
|
||||||
|
|
||||||
|
/* gas colors */
|
||||||
|
PO2, PO2_ALERT, PN2, PN2_ALERT, PHE, PHE_ALERT, PP_LINES,
|
||||||
|
|
||||||
|
/* Other colors */
|
||||||
|
TEXT_BACKGROUND, ALERT_BG, ALERT_FG, EVENTS, SAMPLE_DEEP, SAMPLE_SHALLOW,
|
||||||
|
SMOOTHED, MINUTE, TIME_GRID, TIME_TEXT, DEPTH_GRID, MEAN_DEPTH, DEPTH_TOP,
|
||||||
|
DEPTH_BOTTOM, TEMP_TEXT, TEMP_PLOT, SAC_DEFAULT, BOUNDING_BOX, PRESSURE_TEXT, BACKGROUND,
|
||||||
|
CEILING_SHALLOW, CEILING_DEEP, CALC_CEILING_SHALLOW, CALC_CEILING_DEEP
|
||||||
|
} color_indice_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* profile_color[color indice] = COLOR(screen color, b/w printer color, color printer}} printer & screen colours could be different */
|
||||||
|
|
||||||
|
extern QMap<color_indice_t, QVector<QColor> > profile_color;
|
||||||
|
|
||||||
|
void fill_profile_color();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,7 @@
|
||||||
#include "profilegraphics.h"
|
#include "profilegraphics.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "divelistview.h"
|
#include "divelistview.h"
|
||||||
|
#include "graphicsview-common.h"
|
||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
|
@ -26,89 +27,9 @@
|
||||||
#include <libdivecomputer/parser.h>
|
#include <libdivecomputer/parser.h>
|
||||||
#include <libdivecomputer/version.h>
|
#include <libdivecomputer/version.h>
|
||||||
|
|
||||||
#define SAC_COLORS_START_IDX SAC_1
|
|
||||||
#define SAC_COLORS 9
|
|
||||||
#define VELOCITY_COLORS_START_IDX VELO_STABLE
|
|
||||||
#define VELOCITY_COLORS 5
|
|
||||||
|
|
||||||
static struct graphics_context last_gc;
|
static struct graphics_context last_gc;
|
||||||
static double plot_scale = SCALE_SCREEN;
|
static double plot_scale = SCALE_SCREEN;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
/* SAC colors. Order is important, the SAC_COLORS_START_IDX define above. */
|
|
||||||
SAC_1, SAC_2, SAC_3, SAC_4, SAC_5, SAC_6, SAC_7, SAC_8, SAC_9,
|
|
||||||
|
|
||||||
/* Velocity colors. Order is still important, ref VELOCITY_COLORS_START_IDX. */
|
|
||||||
VELO_STABLE, VELO_SLOW, VELO_MODERATE, VELO_FAST, VELO_CRAZY,
|
|
||||||
|
|
||||||
/* gas colors */
|
|
||||||
PO2, PO2_ALERT, PN2, PN2_ALERT, PHE, PHE_ALERT, PP_LINES,
|
|
||||||
|
|
||||||
/* Other colors */
|
|
||||||
TEXT_BACKGROUND, ALERT_BG, ALERT_FG, EVENTS, SAMPLE_DEEP, SAMPLE_SHALLOW,
|
|
||||||
SMOOTHED, MINUTE, TIME_GRID, TIME_TEXT, DEPTH_GRID, MEAN_DEPTH, DEPTH_TOP,
|
|
||||||
DEPTH_BOTTOM, TEMP_TEXT, TEMP_PLOT, SAC_DEFAULT, BOUNDING_BOX, PRESSURE_TEXT, BACKGROUND,
|
|
||||||
CEILING_SHALLOW, CEILING_DEEP, CALC_CEILING_SHALLOW, CALC_CEILING_DEEP
|
|
||||||
} color_indice_t;
|
|
||||||
|
|
||||||
|
|
||||||
#define COLOR(x, y, z) QVector<QColor>() << x << y << z;
|
|
||||||
/* profile_color[color indice] = COLOR(screen color, b/w printer color, color printer}} printer & screen colours could be different */
|
|
||||||
QMap<color_indice_t, QVector<QColor> > profile_color;
|
|
||||||
void fill_profile_color()
|
|
||||||
{
|
|
||||||
profile_color[SAC_1] = COLOR(FUNGREEN1, BLACK1_LOW_TRANS, FUNGREEN1);
|
|
||||||
profile_color[SAC_2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
|
|
||||||
profile_color[SAC_3] = COLOR(ATLANTIS1, BLACK1_LOW_TRANS, ATLANTIS1);
|
|
||||||
profile_color[SAC_4] = COLOR(ATLANTIS2, BLACK1_LOW_TRANS, ATLANTIS2);
|
|
||||||
profile_color[SAC_5] = COLOR(EARLSGREEN1, BLACK1_LOW_TRANS, EARLSGREEN1);
|
|
||||||
profile_color[SAC_6] = COLOR(HOKEYPOKEY1, BLACK1_LOW_TRANS, HOKEYPOKEY1);
|
|
||||||
profile_color[SAC_7] = COLOR(TUSCANY1, BLACK1_LOW_TRANS, TUSCANY1);
|
|
||||||
profile_color[SAC_8] = COLOR(CINNABAR1, BLACK1_LOW_TRANS, CINNABAR1);
|
|
||||||
profile_color[SAC_9] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
|
|
||||||
|
|
||||||
profile_color[VELO_STABLE] = COLOR(CAMARONE1, BLACK1_LOW_TRANS, CAMARONE1);
|
|
||||||
profile_color[VELO_SLOW] = COLOR(LIMENADE1, BLACK1_LOW_TRANS, LIMENADE1);
|
|
||||||
profile_color[VELO_MODERATE] = COLOR(RIOGRANDE1, BLACK1_LOW_TRANS, RIOGRANDE1);
|
|
||||||
profile_color[VELO_FAST] = COLOR(PIRATEGOLD1, BLACK1_LOW_TRANS, PIRATEGOLD1);
|
|
||||||
profile_color[VELO_CRAZY] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
|
||||||
|
|
||||||
profile_color[PO2] = COLOR(APPLE1, BLACK1_LOW_TRANS, APPLE1);
|
|
||||||
profile_color[PO2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
|
||||||
profile_color[PN2] = COLOR(BLACK1_LOW_TRANS, BLACK1_LOW_TRANS, BLACK1_LOW_TRANS);
|
|
||||||
profile_color[PN2_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
|
||||||
profile_color[PHE] = COLOR(PEANUT, BLACK1_LOW_TRANS, PEANUT);
|
|
||||||
profile_color[PHE_ALERT] = COLOR(RED1, BLACK1_LOW_TRANS, RED1);
|
|
||||||
profile_color[PP_LINES] = COLOR(BLACK1_HIGH_TRANS, BLACK1_HIGH_TRANS, BLACK1_HIGH_TRANS);
|
|
||||||
|
|
||||||
profile_color[TEXT_BACKGROUND] = COLOR(CONCRETE1_LOWER_TRANS, WHITE1, CONCRETE1_LOWER_TRANS);
|
|
||||||
profile_color[ALERT_BG] = COLOR(BROOM1_LOWER_TRANS, BLACK1_LOW_TRANS, BROOM1_LOWER_TRANS);
|
|
||||||
profile_color[ALERT_FG] = COLOR(BLACK1_LOW_TRANS, BLACK1_LOW_TRANS, BLACK1_LOW_TRANS);
|
|
||||||
profile_color[EVENTS] = COLOR(REDORANGE1, BLACK1_LOW_TRANS, REDORANGE1);
|
|
||||||
profile_color[SAMPLE_DEEP] = COLOR(PERSIANRED1, BLACK1_LOW_TRANS, PERSIANRED1);
|
|
||||||
profile_color[SAMPLE_SHALLOW] = COLOR(PERSIANRED1, BLACK1_LOW_TRANS, PERSIANRED1);
|
|
||||||
profile_color[SMOOTHED] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_LOW_TRANS, REDORANGE1_HIGH_TRANS);
|
|
||||||
profile_color[MINUTE] = COLOR(MEDIUMREDVIOLET1_HIGHER_TRANS, BLACK1_LOW_TRANS, MEDIUMREDVIOLET1_HIGHER_TRANS);
|
|
||||||
profile_color[TIME_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
|
|
||||||
profile_color[TIME_TEXT] = COLOR(FORESTGREEN1, BLACK1_LOW_TRANS, FORESTGREEN1);
|
|
||||||
profile_color[DEPTH_GRID] = COLOR(WHITE1, BLACK1_HIGH_TRANS, TUNDORA1_MED_TRANS);
|
|
||||||
profile_color[MEAN_DEPTH] = COLOR(REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS, REDORANGE1_MED_TRANS);
|
|
||||||
profile_color[DEPTH_BOTTOM] = COLOR(GOVERNORBAY1_MED_TRANS, BLACK1_HIGH_TRANS, GOVERNORBAY1_MED_TRANS);
|
|
||||||
profile_color[DEPTH_TOP] = COLOR(MERCURY1_MED_TRANS, WHITE1_MED_TRANS, MERCURY1_MED_TRANS);
|
|
||||||
profile_color[TEMP_TEXT] = COLOR(GOVERNORBAY2, BLACK1_LOW_TRANS, GOVERNORBAY2);
|
|
||||||
profile_color[TEMP_PLOT] = COLOR(ROYALBLUE2_LOW_TRANS, BLACK1_LOW_TRANS, ROYALBLUE2_LOW_TRANS);
|
|
||||||
profile_color[SAC_DEFAULT] = COLOR(WHITE1, BLACK1_LOW_TRANS, FORESTGREEN1);
|
|
||||||
profile_color[BOUNDING_BOX] = COLOR(WHITE1, BLACK1_LOW_TRANS, TUNDORA1_MED_TRANS);
|
|
||||||
profile_color[PRESSURE_TEXT] = COLOR(KILLARNEY1, BLACK1_LOW_TRANS, KILLARNEY1);
|
|
||||||
profile_color[BACKGROUND] = COLOR(SPRINGWOOD1, BLACK1_LOW_TRANS, SPRINGWOOD1);
|
|
||||||
profile_color[CEILING_SHALLOW] = COLOR(REDORANGE1_HIGH_TRANS, BLACK1_HIGH_TRANS, REDORANGE1_HIGH_TRANS);
|
|
||||||
profile_color[CEILING_DEEP] = COLOR(RED1_MED_TRANS, BLACK1_HIGH_TRANS, RED1_MED_TRANS);
|
|
||||||
profile_color[CALC_CEILING_SHALLOW] = COLOR(FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS);
|
|
||||||
profile_color[CALC_CEILING_DEEP] = COLOR(APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS, APPLE1_HIGH_TRANS);
|
|
||||||
|
|
||||||
}
|
|
||||||
#undef COLOR
|
|
||||||
|
|
||||||
struct text_render_options{
|
struct text_render_options{
|
||||||
double size;
|
double size;
|
||||||
color_indice_t color;
|
color_indice_t color;
|
||||||
|
@ -122,8 +43,10 @@ extern int evn_used;
|
||||||
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
|
ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0), diveDC(0)
|
||||||
{
|
{
|
||||||
gc.printer = false;
|
gc.printer = false;
|
||||||
|
fill_profile_color();
|
||||||
setScene(new QGraphicsScene());
|
setScene(new QGraphicsScene());
|
||||||
setBackgroundBrush(QColor("#F3F3E6"));
|
|
||||||
|
setBackgroundBrush(profile_color[BACKGROUND].at(0));
|
||||||
scene()->installEventFilter(this);
|
scene()->installEventFilter(this);
|
||||||
|
|
||||||
setRenderHint(QPainter::Antialiasing);
|
setRenderHint(QPainter::Antialiasing);
|
||||||
|
@ -138,7 +61,7 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
|
||||||
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
fill_profile_color();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileGraphicsView::wheelEvent(QWheelEvent* event)
|
void ProfileGraphicsView::wheelEvent(QWheelEvent* event)
|
||||||
|
|
Loading…
Add table
Reference in a new issue