mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Whitespace cleanup
Quite a bit of wild white space going on... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b6f47883c3
commit
c4954d90a1
4 changed files with 53 additions and 52 deletions
|
@ -575,7 +575,7 @@ DiveMeanDepthItem::DiveMeanDepthItem()
|
||||||
pen.setCosmetic(true);
|
pen.setCosmetic(true);
|
||||||
pen.setWidth(2);
|
pen.setWidth(2);
|
||||||
setPen(pen);
|
setPen(pen);
|
||||||
settingsChanged();
|
settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||||
|
@ -583,18 +583,18 @@ void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QMode
|
||||||
double meandepthvalue;
|
double meandepthvalue;
|
||||||
// We don't have enougth data to calculate things, quit.
|
// We don't have enougth data to calculate things, quit.
|
||||||
if (!shouldCalculateStuff(topLeft, bottomRight))
|
if (!shouldCalculateStuff(topLeft, bottomRight))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPolygonF poly;
|
QPolygonF poly;
|
||||||
plot_data *entry = dataModel->data().entry;
|
plot_data *entry = dataModel->data().entry;
|
||||||
for (int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++, entry++) {
|
for (int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++, entry++) {
|
||||||
// Ignore empty values
|
// Ignore empty values
|
||||||
if (entry->running_sum == 0 || entry->sec == 0)
|
if (entry->running_sum == 0 || entry->sec == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
meandepthvalue = entry->running_sum / entry->sec ;
|
meandepthvalue = entry->running_sum / entry->sec;
|
||||||
QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(meandepthvalue));
|
QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(meandepthvalue));
|
||||||
poly.append(point);
|
poly.append(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
setPolygon(poly);
|
setPolygon(poly);
|
||||||
|
@ -686,7 +686,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
|
||||||
if (!seen_cyl[cyl]) {
|
if (!seen_cyl[cyl]) {
|
||||||
plotPressureValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignTop);
|
plotPressureValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignTop);
|
||||||
plotGasValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom,
|
plotGasValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom,
|
||||||
displayed_dive.cylinder[cyl].gasmix);
|
displayed_dive.cylinder[cyl].gasmix);
|
||||||
seen_cyl[cyl] = true;
|
seen_cyl[cyl] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,7 +869,8 @@ MeanDepthLine::MeanDepthLine() : meanDepth(0), leftText(new DiveTextItem(this)),
|
||||||
rightText->setPos(line().length(), 0);
|
rightText->setPos(line().length(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeanDepthLine::setModel(DivePlotDataModel *m){
|
void MeanDepthLine::setModel(DivePlotDataModel *m)
|
||||||
|
{
|
||||||
model = m;
|
model = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,9 +978,8 @@ void PartialPressureGasItem::setColors(const QColor &normal, const QColor &alert
|
||||||
alertColor = alert;
|
alertColor = alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstantMeanDepthLine::InstantMeanDepthLine(): vAxis(NULL), hAxis(NULL)
|
InstantMeanDepthLine::InstantMeanDepthLine() : vAxis(NULL), hAxis(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstantMeanDepthLine::mouseMoved(int time, int depth)
|
void InstantMeanDepthLine::mouseMoved(int time, int depth)
|
||||||
|
@ -988,7 +988,7 @@ void InstantMeanDepthLine::mouseMoved(int time, int depth)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int count = model->data().nr;
|
int count = model->data().nr;
|
||||||
for(int i = 0; i < count; i++){
|
for (int i = 0; i < count; i++) {
|
||||||
struct plot_data pI = model->data().entry[i];
|
struct plot_data pI = model->data().entry[i];
|
||||||
if (pI.sec == time && pI.sec != 0) {
|
if (pI.sec == time && pI.sec != 0) {
|
||||||
setMeanDepth(pI.running_sum / time);
|
setMeanDepth(pI.running_sum / time);
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
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);
|
||||||
int maxCeiling(int row);
|
int maxCeiling(int row);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int show_reported_ceiling;
|
unsigned int show_reported_ceiling;
|
||||||
unsigned int reported_ceiling_in_red;
|
unsigned int reported_ceiling_in_red;
|
||||||
|
@ -91,9 +92,9 @@ public:
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString visibilityKey;
|
QString visibilityKey;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiveTemperatureItem : public AbstractProfilePolygonItem {
|
class DiveTemperatureItem : public AbstractProfilePolygonItem {
|
||||||
|
@ -114,6 +115,7 @@ public:
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createTextItem(int seconds, int hr);
|
void createTextItem(int seconds, int hr);
|
||||||
QString visibilityKey;
|
QString visibilityKey;
|
||||||
|
@ -126,6 +128,7 @@ public:
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString visibilityKey;
|
QString visibilityKey;
|
||||||
};
|
};
|
||||||
|
@ -137,6 +140,7 @@ public:
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString visibilityKey;
|
QString visibilityKey;
|
||||||
};
|
};
|
||||||
|
@ -148,6 +152,7 @@ public:
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void settingsChanged();
|
virtual void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString visibilityKey;
|
QString visibilityKey;
|
||||||
};
|
};
|
||||||
|
@ -224,7 +229,8 @@ public:
|
||||||
DiveCartesianAxis *hAxis;
|
DiveCartesianAxis *hAxis;
|
||||||
DiveCartesianAxis *vAxis;
|
DiveCartesianAxis *vAxis;
|
||||||
InstantMeanDepthLine();
|
InstantMeanDepthLine();
|
||||||
public slots:
|
public
|
||||||
|
slots:
|
||||||
void mouseMoved(int time, int depth);
|
void mouseMoved(int time, int depth);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
temperatureItem(new DiveTemperatureItem()),
|
temperatureItem(new DiveTemperatureItem()),
|
||||||
cylinderPressureAxis(new DiveCartesianAxis()),
|
cylinderPressureAxis(new DiveCartesianAxis()),
|
||||||
gasPressureItem(new DiveGasPressureItem()),
|
gasPressureItem(new DiveGasPressureItem()),
|
||||||
meanDepthItem(new DiveMeanDepthItem()),
|
meanDepthItem(new DiveMeanDepthItem()),
|
||||||
diveComputerText(new DiveTextItem()),
|
diveComputerText(new DiveTextItem()),
|
||||||
diveCeiling(new DiveCalculatedCeiling()),
|
diveCeiling(new DiveCalculatedCeiling()),
|
||||||
reportedCeiling(new DiveReportedCeiling()),
|
reportedCeiling(new DiveReportedCeiling()),
|
||||||
|
@ -117,7 +117,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
addItemsToScene();
|
addItemsToScene();
|
||||||
scene()->installEventFilter(this);
|
scene()->installEventFilter(this);
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
connect(this, SIGNAL(mouseMoved(int,int)), instantMeanDepth, SLOT(mouseMoved(int,int)));
|
connect(this, SIGNAL(mouseMoved(int, int)), instantMeanDepth, SLOT(mouseMoved(int, int)));
|
||||||
QAction *action = NULL;
|
QAction *action = NULL;
|
||||||
#define ADD_ACTION(SHORTCUT, Slot) \
|
#define ADD_ACTION(SHORTCUT, Slot) \
|
||||||
action = new QAction(this); \
|
action = new QAction(this); \
|
||||||
|
@ -153,7 +153,7 @@ ProfileWidget2::~ProfileWidget2()
|
||||||
delete timeAxis;
|
delete timeAxis;
|
||||||
delete diveProfileItem;
|
delete diveProfileItem;
|
||||||
delete temperatureItem;
|
delete temperatureItem;
|
||||||
delete meanDepthItem;
|
delete meanDepthItem;
|
||||||
delete cylinderPressureAxis;
|
delete cylinderPressureAxis;
|
||||||
delete gasPressureItem;
|
delete gasPressureItem;
|
||||||
delete diveComputerText;
|
delete diveComputerText;
|
||||||
|
@ -188,7 +188,7 @@ void ProfileWidget2::addItemsToScene()
|
||||||
scene()->addItem(diveProfileItem);
|
scene()->addItem(diveProfileItem);
|
||||||
scene()->addItem(cylinderPressureAxis);
|
scene()->addItem(cylinderPressureAxis);
|
||||||
scene()->addItem(temperatureItem);
|
scene()->addItem(temperatureItem);
|
||||||
scene()->addItem(meanDepthItem);
|
scene()->addItem(meanDepthItem);
|
||||||
scene()->addItem(gasPressureItem);
|
scene()->addItem(gasPressureItem);
|
||||||
// I cannot seem to figure out if an object that I find with itemAt() on the scene
|
// I cannot seem to figure out if an object that I find with itemAt() on the scene
|
||||||
// is the object I am looking for - my guess is there's a simple way in Qt to do that
|
// is the object I am looking for - my guess is there's a simple way in Qt to do that
|
||||||
|
@ -299,8 +299,7 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
setupItem(ambPressureItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::AMBPRESSURE, DivePlotDataModel::TIME, 1);
|
setupItem(ambPressureItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::AMBPRESSURE, DivePlotDataModel::TIME, 1);
|
||||||
setupItem(gflineItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::GFLINE, DivePlotDataModel::TIME, 1);
|
setupItem(gflineItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::GFLINE, DivePlotDataModel::TIME, 1);
|
||||||
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
||||||
setupItem(meanDepthItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
|
setupItem(meanDepthItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
|
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
|
||||||
|
@ -440,8 +439,8 @@ void ProfileWidget2::setupItemSizes()
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis,
|
void ProfileWidget2::setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis,
|
||||||
DiveCartesianAxis *vAxis, DivePlotDataModel *model,
|
DiveCartesianAxis *vAxis, DivePlotDataModel *model,
|
||||||
int vData, int hData, int zValue)
|
int vData, int hData, int zValue)
|
||||||
{
|
{
|
||||||
item->setHorizontalAxis(hAxis);
|
item->setHorizontalAxis(hAxis);
|
||||||
item->setVerticalAxis(vAxis);
|
item->setVerticalAxis(vAxis);
|
||||||
|
@ -537,7 +536,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
*/
|
*/
|
||||||
plotInfo = calculate_max_limits_new(&displayed_dive, currentdc);
|
plotInfo = calculate_max_limits_new(&displayed_dive, currentdc);
|
||||||
create_plot_info_new(&displayed_dive, currentdc, &plotInfo, !shouldCalculateMaxDepth);
|
create_plot_info_new(&displayed_dive, currentdc, &plotInfo, !shouldCalculateMaxDepth);
|
||||||
if(shouldCalculateMaxTime)
|
if (shouldCalculateMaxTime)
|
||||||
maxtime = get_maxtime(&plotInfo);
|
maxtime = get_maxtime(&plotInfo);
|
||||||
|
|
||||||
/* Only update the max depth if it's bigger than the current ones
|
/* Only update the max depth if it's bigger than the current ones
|
||||||
|
@ -545,7 +544,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
* otherwhise, update normally.
|
* otherwhise, update normally.
|
||||||
*/
|
*/
|
||||||
int newMaxDepth = get_maxdepth(&plotInfo);
|
int newMaxDepth = get_maxdepth(&plotInfo);
|
||||||
if(!shouldCalculateMaxDepth) {
|
if (!shouldCalculateMaxDepth) {
|
||||||
if (maxdepth < newMaxDepth) {
|
if (maxdepth < newMaxDepth) {
|
||||||
maxdepth = newMaxDepth;
|
maxdepth = newMaxDepth;
|
||||||
}
|
}
|
||||||
|
@ -727,7 +726,7 @@ void ProfileWidget2::resizeEvent(QResizeEvent *event)
|
||||||
void ProfileWidget2::mousePressEvent(QMouseEvent *event)
|
void ProfileWidget2::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QGraphicsView::mousePressEvent(event);
|
QGraphicsView::mousePressEvent(event);
|
||||||
if(currentState == PLAN)
|
if (currentState == PLAN)
|
||||||
shouldCalculateMaxTime = false;
|
shouldCalculateMaxTime = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +745,7 @@ void ProfileWidget2::divePlannerHandlerReleased()
|
||||||
void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
|
void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QGraphicsView::mouseReleaseEvent(event);
|
QGraphicsView::mouseReleaseEvent(event);
|
||||||
if(currentState == PLAN){
|
if (currentState == PLAN) {
|
||||||
shouldCalculateMaxTime = true;
|
shouldCalculateMaxTime = true;
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
@ -770,7 +769,7 @@ void ProfileWidget2::wheelEvent(QWheelEvent *event)
|
||||||
if (currentState == EMPTY)
|
if (currentState == EMPTY)
|
||||||
return;
|
return;
|
||||||
QPoint toolTipPos = mapFromScene(toolTipItem->pos());
|
QPoint toolTipPos = mapFromScene(toolTipItem->pos());
|
||||||
if(event->buttons() == Qt::LeftButton)
|
if (event->buttons() == Qt::LeftButton)
|
||||||
return;
|
return;
|
||||||
if (event->delta() > 0 && zoomLevel < 20) {
|
if (event->delta() > 0 && zoomLevel < 20) {
|
||||||
scale(zoomFactor, zoomFactor);
|
scale(zoomFactor, zoomFactor);
|
||||||
|
@ -836,18 +835,13 @@ void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
|
||||||
QPointF pos = mapToScene(event->pos());
|
QPointF pos = mapToScene(event->pos());
|
||||||
qreal vValue = profileYAxis->valueAt(pos);
|
qreal vValue = profileYAxis->valueAt(pos);
|
||||||
qreal hValue = timeAxis->valueAt(pos);
|
qreal hValue = timeAxis->valueAt(pos);
|
||||||
if ( profileYAxis->maximum() >= vValue
|
if (profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue) {
|
||||||
&& profileYAxis->minimum() <= vValue){
|
|
||||||
mouseFollowerHorizontal->setPos(timeAxis->pos().x(), pos.y());
|
mouseFollowerHorizontal->setPos(timeAxis->pos().x(), pos.y());
|
||||||
}
|
}
|
||||||
if ( timeAxis->maximum() >= hValue
|
if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue) {
|
||||||
&& timeAxis->minimum() <= hValue){
|
|
||||||
mouseFollowerVertical->setPos(pos.x(), profileYAxis->line().y1());
|
mouseFollowerVertical->setPos(pos.x(), profileYAxis->line().y1());
|
||||||
}
|
}
|
||||||
if ( timeAxis->maximum() >= hValue
|
if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue && profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue)
|
||||||
&& timeAxis->minimum() <= hValue
|
|
||||||
&& profileYAxis->maximum() >= vValue
|
|
||||||
&& profileYAxis->minimum() <= vValue )
|
|
||||||
emit mouseMoved(hValue, vValue);
|
emit mouseMoved(hValue, vValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,14 +889,14 @@ void ProfileWidget2::setEmptyState()
|
||||||
mouseFollowerHorizontal->setVisible(false);
|
mouseFollowerHorizontal->setVisible(false);
|
||||||
mouseFollowerVertical->setVisible(false);
|
mouseFollowerVertical->setVisible(false);
|
||||||
|
|
||||||
#define HIDE_ALL(TYPE, CONTAINER) \
|
#define HIDE_ALL(TYPE, CONTAINER) \
|
||||||
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
|
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
|
||||||
HIDE_ALL(DiveCalculatedTissue, allTissues);
|
HIDE_ALL(DiveCalculatedTissue, allTissues);
|
||||||
HIDE_ALL(DivePercentageItem, allPercentages);
|
HIDE_ALL(DivePercentageItem, allPercentages);
|
||||||
HIDE_ALL(DiveEventItem, eventItems);
|
HIDE_ALL(DiveEventItem, eventItems);
|
||||||
HIDE_ALL(DiveHandler, handles);
|
HIDE_ALL(DiveHandler, handles);
|
||||||
HIDE_ALL(QGraphicsSimpleTextItem, gases);
|
HIDE_ALL(QGraphicsSimpleTextItem, gases);
|
||||||
#undef HIDE_ALL
|
#undef HIDE_ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setProfileState()
|
void ProfileWidget2::setProfileState()
|
||||||
|
@ -913,8 +907,8 @@ void ProfileWidget2::setProfileState()
|
||||||
|
|
||||||
disconnectTemporaryConnections();
|
disconnectTemporaryConnections();
|
||||||
connect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures()));
|
connect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures()));
|
||||||
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
|
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
|
||||||
connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
|
connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
|
|
||||||
//TODO: Move the DC handling to another method.
|
//TODO: Move the DC handling to another method.
|
||||||
|
@ -994,7 +988,7 @@ void ProfileWidget2::setProfileState()
|
||||||
|
|
||||||
cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
|
cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
|
||||||
heartBeatItem->setVisible(prefs.hrgraph);
|
heartBeatItem->setVisible(prefs.hrgraph);
|
||||||
meanDepthItem->setVisible(prefs.show_average_depth);
|
meanDepthItem->setVisible(prefs.show_average_depth);
|
||||||
|
|
||||||
diveComputerText->setVisible(true);
|
diveComputerText->setVisible(true);
|
||||||
diveComputerText->setPos(itemPos.dcLabel.on);
|
diveComputerText->setPos(itemPos.dcLabel.on);
|
||||||
|
@ -1021,11 +1015,11 @@ void ProfileWidget2::setProfileState()
|
||||||
tankItem->setVisible(prefs.tankbar);
|
tankItem->setVisible(prefs.tankbar);
|
||||||
tankItem->setPos(itemPos.tankBar.on);
|
tankItem->setPos(itemPos.tankBar.on);
|
||||||
|
|
||||||
#define HIDE_ALL(TYPE, CONTAINER) \
|
#define HIDE_ALL(TYPE, CONTAINER) \
|
||||||
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
|
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
|
||||||
HIDE_ALL(DiveHandler, handles);
|
HIDE_ALL(DiveHandler, handles);
|
||||||
HIDE_ALL(QGraphicsSimpleTextItem, gases);
|
HIDE_ALL(QGraphicsSimpleTextItem, gases);
|
||||||
#undef HIDE_ALL
|
#undef HIDE_ALL
|
||||||
mouseFollowerHorizontal->setVisible(false);
|
mouseFollowerHorizontal->setVisible(false);
|
||||||
mouseFollowerVertical->setVisible(false);
|
mouseFollowerVertical->setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -1399,8 +1393,8 @@ void ProfileWidget2::setPrintMode(bool mode, bool grayscale)
|
||||||
{
|
{
|
||||||
printMode = mode;
|
printMode = mode;
|
||||||
isGrayscale = mode ? grayscale : false;
|
isGrayscale = mode ? grayscale : false;
|
||||||
mouseFollowerHorizontal->setVisible( !mode );
|
mouseFollowerHorizontal->setVisible(!mode);
|
||||||
mouseFollowerVertical->setVisible( !mode );
|
mouseFollowerVertical->setVisible(!mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setFontPrintScale(double scale)
|
void ProfileWidget2::setFontPrintScale(double scale)
|
||||||
|
@ -1704,7 +1698,7 @@ void ProfileWidget2::keyEscAction()
|
||||||
|
|
||||||
void ProfileWidget2::plotPictures()
|
void ProfileWidget2::plotPictures()
|
||||||
{
|
{
|
||||||
Q_FOREACH(DivePictureItem *item, pictures){
|
Q_FOREACH (DivePictureItem *item, pictures) {
|
||||||
item->hide();
|
item->hide();
|
||||||
item->deleteLater();
|
item->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -1716,14 +1710,14 @@ void ProfileWidget2::plotPictures()
|
||||||
double x, y, lastX = -1.0, lastY = -1.0;
|
double x, y, lastX = -1.0, lastY = -1.0;
|
||||||
DivePictureModel *m = DivePictureModel::instance();
|
DivePictureModel *m = DivePictureModel::instance();
|
||||||
for (int i = 0; i < m->rowCount(); i++) {
|
for (int i = 0; i < m->rowCount(); i++) {
|
||||||
int offsetSeconds = m->index(i,1).data(Qt::UserRole).value<int>();
|
int offsetSeconds = m->index(i, 1).data(Qt::UserRole).value<int>();
|
||||||
// it's a correct picture, but doesn't have a timestamp: only show on the widget near the
|
// it's a correct picture, but doesn't have a timestamp: only show on the widget near the
|
||||||
// information area.
|
// information area.
|
||||||
if (!offsetSeconds)
|
if (!offsetSeconds)
|
||||||
continue;
|
continue;
|
||||||
DivePictureItem *item = new DivePictureItem();
|
DivePictureItem *item = new DivePictureItem();
|
||||||
item->setPixmap(m->index(i,0).data(Qt::DecorationRole).value<QPixmap>());
|
item->setPixmap(m->index(i, 0).data(Qt::DecorationRole).value<QPixmap>());
|
||||||
item->setFileUrl(m->index(i,1).data().toString());
|
item->setFileUrl(m->index(i, 1).data().toString());
|
||||||
// let's put the picture at the correct time, but at a fixed "depth" on the profile
|
// let's put the picture at the correct time, but at a fixed "depth" on the profile
|
||||||
// not sure this is ideal, but it seems to look right.
|
// not sure this is ideal, but it seems to look right.
|
||||||
x = timeAxis->posAtValue(offsetSeconds);
|
x = timeAxis->posAtValue(offsetSeconds);
|
||||||
|
|
|
@ -123,6 +123,7 @@ slots: // Necessary to call from QAction's signals.
|
||||||
|
|
||||||
void divePlannerHandlerClicked();
|
void divePlannerHandlerClicked();
|
||||||
void divePlannerHandlerReleased();
|
void divePlannerHandlerReleased();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~ProfileWidget2();
|
virtual ~ProfileWidget2();
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -162,7 +163,7 @@ private:
|
||||||
TimeAxis *timeAxis;
|
TimeAxis *timeAxis;
|
||||||
DiveProfileItem *diveProfileItem;
|
DiveProfileItem *diveProfileItem;
|
||||||
DiveTemperatureItem *temperatureItem;
|
DiveTemperatureItem *temperatureItem;
|
||||||
DiveMeanDepthItem *meanDepthItem;
|
DiveMeanDepthItem *meanDepthItem;
|
||||||
DiveCartesianAxis *cylinderPressureAxis;
|
DiveCartesianAxis *cylinderPressureAxis;
|
||||||
DiveGasPressureItem *gasPressureItem;
|
DiveGasPressureItem *gasPressureItem;
|
||||||
QList<DiveEventItem *> eventItems;
|
QList<DiveEventItem *> eventItems;
|
||||||
|
@ -190,7 +191,7 @@ private:
|
||||||
//specifics for ADD and PLAN
|
//specifics for ADD and PLAN
|
||||||
QList<DiveHandler *> handles;
|
QList<DiveHandler *> handles;
|
||||||
QList<QGraphicsSimpleTextItem *> gases;
|
QList<QGraphicsSimpleTextItem *> gases;
|
||||||
QList<DivePictureItem*> pictures;
|
QList<DivePictureItem *> pictures;
|
||||||
void repositionDiveHandlers();
|
void repositionDiveHandlers();
|
||||||
int fixHandlerIndex(DiveHandler *activeHandler);
|
int fixHandlerIndex(DiveHandler *activeHandler);
|
||||||
friend class DiveHandler;
|
friend class DiveHandler;
|
||||||
|
|
Loading…
Add table
Reference in a new issue