summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-01 16:28:37 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-01 16:28:37 -0800
commitc4954d90a1e4f3fc3d2601e6bd6d95f27b0d78ed (patch)
tree24197fe017b66afe680093b8a8adea376a27b2e0 /qt-ui/profile
parentb6f47883c3bd3c05f1f5ef4d933a7b138d30b313 (diff)
downloadsubsurface-c4954d90a1e4f3fc3d2601e6bd6d95f27b0d78ed.tar.gz
Whitespace cleanup
Quite a bit of wild white space going on... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp28
-rw-r--r--qt-ui/profile/diveprofileitem.h10
-rw-r--r--qt-ui/profile/profilewidget2.cpp62
-rw-r--r--qt-ui/profile/profilewidget2.h5
4 files changed, 53 insertions, 52 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 07d622260..8e3d99fa6 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -575,7 +575,7 @@ DiveMeanDepthItem::DiveMeanDepthItem()
pen.setCosmetic(true);
pen.setWidth(2);
setPen(pen);
- settingsChanged();
+ settingsChanged();
}
void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
@@ -583,18 +583,18 @@ void DiveMeanDepthItem::modelDataChanged(const QModelIndex &topLeft, const QMode
double meandepthvalue;
// We don't have enougth data to calculate things, quit.
if (!shouldCalculateStuff(topLeft, bottomRight))
- return;
+ return;
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++) {
- // Ignore empty values
- if (entry->running_sum == 0 || entry->sec == 0)
- continue;
+ // Ignore empty values
+ if (entry->running_sum == 0 || entry->sec == 0)
+ continue;
- meandepthvalue = entry->running_sum / entry->sec ;
- QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(meandepthvalue));
- poly.append(point);
+ meandepthvalue = entry->running_sum / entry->sec;
+ QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(meandepthvalue));
+ poly.append(point);
}
setPolygon(poly);
@@ -686,7 +686,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo
if (!seen_cyl[cyl]) {
plotPressureValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignTop);
plotGasValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom,
- displayed_dive.cylinder[cyl].gasmix);
+ displayed_dive.cylinder[cyl].gasmix);
seen_cyl[cyl] = true;
}
}
@@ -869,7 +869,8 @@ MeanDepthLine::MeanDepthLine() : meanDepth(0), leftText(new DiveTextItem(this)),
rightText->setPos(line().length(), 0);
}
-void MeanDepthLine::setModel(DivePlotDataModel *m){
+void MeanDepthLine::setModel(DivePlotDataModel *m)
+{
model = m;
}
@@ -977,9 +978,8 @@ void PartialPressureGasItem::setColors(const QColor &normal, const QColor &alert
alertColor = alert;
}
-InstantMeanDepthLine::InstantMeanDepthLine(): vAxis(NULL), hAxis(NULL)
+InstantMeanDepthLine::InstantMeanDepthLine() : vAxis(NULL), hAxis(NULL)
{
-
}
void InstantMeanDepthLine::mouseMoved(int time, int depth)
@@ -988,7 +988,7 @@ void InstantMeanDepthLine::mouseMoved(int time, int depth)
return;
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];
if (pI.sec == time && pI.sec != 0) {
setMeanDepth(pI.running_sum / time);
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index d235d22fd..b0693cd93 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -78,6 +78,7 @@ public:
virtual void settingsChanged();
void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color);
int maxCeiling(int row);
+
private:
unsigned int show_reported_ceiling;
unsigned int reported_ceiling_in_red;
@@ -91,9 +92,9 @@ public:
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
virtual void settingsChanged();
+
private:
QString visibilityKey;
-
};
class DiveTemperatureItem : public AbstractProfilePolygonItem {
@@ -114,6 +115,7 @@ public:
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual void settingsChanged();
+
private:
void createTextItem(int seconds, int hr);
QString visibilityKey;
@@ -126,6 +128,7 @@ public:
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual void settingsChanged();
+
private:
QString visibilityKey;
};
@@ -137,6 +140,7 @@ public:
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual void settingsChanged();
+
private:
QString visibilityKey;
};
@@ -148,6 +152,7 @@ public:
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual void settingsChanged();
+
private:
QString visibilityKey;
};
@@ -224,7 +229,8 @@ public:
DiveCartesianAxis *hAxis;
DiveCartesianAxis *vAxis;
InstantMeanDepthLine();
-public slots:
+public
+slots:
void mouseMoved(int time, int depth);
};
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 4fafef075..e4dd81856 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -86,7 +86,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
temperatureItem(new DiveTemperatureItem()),
cylinderPressureAxis(new DiveCartesianAxis()),
gasPressureItem(new DiveGasPressureItem()),
- meanDepthItem(new DiveMeanDepthItem()),
+ meanDepthItem(new DiveMeanDepthItem()),
diveComputerText(new DiveTextItem()),
diveCeiling(new DiveCalculatedCeiling()),
reportedCeiling(new DiveReportedCeiling()),
@@ -117,7 +117,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
addItemsToScene();
scene()->installEventFilter(this);
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;
#define ADD_ACTION(SHORTCUT, Slot) \
action = new QAction(this); \
@@ -153,7 +153,7 @@ ProfileWidget2::~ProfileWidget2()
delete timeAxis;
delete diveProfileItem;
delete temperatureItem;
- delete meanDepthItem;
+ delete meanDepthItem;
delete cylinderPressureAxis;
delete gasPressureItem;
delete diveComputerText;
@@ -188,7 +188,7 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(diveProfileItem);
scene()->addItem(cylinderPressureAxis);
scene()->addItem(temperatureItem);
- scene()->addItem(meanDepthItem);
+ scene()->addItem(meanDepthItem);
scene()->addItem(gasPressureItem);
// 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
@@ -299,8 +299,7 @@ void ProfileWidget2::setupItemOnScene()
setupItem(ambPressureItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::AMBPRESSURE, DivePlotDataModel::TIME, 1);
setupItem(gflineItem, timeAxis, percentageAxis, dataModel, DivePlotDataModel::GFLINE, DivePlotDataModel::TIME, 1);
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) \
@@ -440,8 +439,8 @@ void ProfileWidget2::setupItemSizes()
}
void ProfileWidget2::setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis,
- DiveCartesianAxis *vAxis, DivePlotDataModel *model,
- int vData, int hData, int zValue)
+ DiveCartesianAxis *vAxis, DivePlotDataModel *model,
+ int vData, int hData, int zValue)
{
item->setHorizontalAxis(hAxis);
item->setVerticalAxis(vAxis);
@@ -537,7 +536,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
*/
plotInfo = calculate_max_limits_new(&displayed_dive, currentdc);
create_plot_info_new(&displayed_dive, currentdc, &plotInfo, !shouldCalculateMaxDepth);
- if(shouldCalculateMaxTime)
+ if (shouldCalculateMaxTime)
maxtime = get_maxtime(&plotInfo);
/* 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.
*/
int newMaxDepth = get_maxdepth(&plotInfo);
- if(!shouldCalculateMaxDepth) {
+ if (!shouldCalculateMaxDepth) {
if (maxdepth < newMaxDepth) {
maxdepth = newMaxDepth;
}
@@ -727,7 +726,7 @@ void ProfileWidget2::resizeEvent(QResizeEvent *event)
void ProfileWidget2::mousePressEvent(QMouseEvent *event)
{
QGraphicsView::mousePressEvent(event);
- if(currentState == PLAN)
+ if (currentState == PLAN)
shouldCalculateMaxTime = false;
}
@@ -746,7 +745,7 @@ void ProfileWidget2::divePlannerHandlerReleased()
void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
{
QGraphicsView::mouseReleaseEvent(event);
- if(currentState == PLAN){
+ if (currentState == PLAN) {
shouldCalculateMaxTime = true;
replot();
}
@@ -770,7 +769,7 @@ void ProfileWidget2::wheelEvent(QWheelEvent *event)
if (currentState == EMPTY)
return;
QPoint toolTipPos = mapFromScene(toolTipItem->pos());
- if(event->buttons() == Qt::LeftButton)
+ if (event->buttons() == Qt::LeftButton)
return;
if (event->delta() > 0 && zoomLevel < 20) {
scale(zoomFactor, zoomFactor);
@@ -836,18 +835,13 @@ void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
QPointF pos = mapToScene(event->pos());
qreal vValue = profileYAxis->valueAt(pos);
qreal hValue = timeAxis->valueAt(pos);
- if ( profileYAxis->maximum() >= vValue
- && profileYAxis->minimum() <= vValue){
+ if (profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue) {
mouseFollowerHorizontal->setPos(timeAxis->pos().x(), pos.y());
}
- if ( timeAxis->maximum() >= hValue
- && timeAxis->minimum() <= hValue){
+ if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue) {
mouseFollowerVertical->setPos(pos.x(), profileYAxis->line().y1());
}
- if ( timeAxis->maximum() >= hValue
- && timeAxis->minimum() <= hValue
- && profileYAxis->maximum() >= vValue
- && profileYAxis->minimum() <= vValue )
+ if (timeAxis->maximum() >= hValue && timeAxis->minimum() <= hValue && profileYAxis->maximum() >= vValue && profileYAxis->minimum() <= vValue)
emit mouseMoved(hValue, vValue);
}
@@ -895,14 +889,14 @@ void ProfileWidget2::setEmptyState()
mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(false);
- #define HIDE_ALL(TYPE, CONTAINER) \
+#define HIDE_ALL(TYPE, CONTAINER) \
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
HIDE_ALL(DiveCalculatedTissue, allTissues);
HIDE_ALL(DivePercentageItem, allPercentages);
HIDE_ALL(DiveEventItem, eventItems);
HIDE_ALL(DiveHandler, handles);
HIDE_ALL(QGraphicsSimpleTextItem, gases);
- #undef HIDE_ALL
+#undef HIDE_ALL
}
void ProfileWidget2::setProfileState()
@@ -913,8 +907,8 @@ void ProfileWidget2::setProfileState()
disconnectTemporaryConnections();
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(rowsRemoved(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()));
/* show the same stuff that the profile shows. */
//TODO: Move the DC handling to another method.
@@ -994,7 +988,7 @@ void ProfileWidget2::setProfileState()
cylinderPressureAxis->setPos(itemPos.cylinder.pos.on);
heartBeatItem->setVisible(prefs.hrgraph);
- meanDepthItem->setVisible(prefs.show_average_depth);
+ meanDepthItem->setVisible(prefs.show_average_depth);
diveComputerText->setVisible(true);
diveComputerText->setPos(itemPos.dcLabel.on);
@@ -1021,11 +1015,11 @@ void ProfileWidget2::setProfileState()
tankItem->setVisible(prefs.tankbar);
tankItem->setPos(itemPos.tankBar.on);
- #define HIDE_ALL(TYPE, CONTAINER) \
+#define HIDE_ALL(TYPE, CONTAINER) \
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
HIDE_ALL(DiveHandler, handles);
HIDE_ALL(QGraphicsSimpleTextItem, gases);
- #undef HIDE_ALL
+#undef HIDE_ALL
mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(false);
}
@@ -1399,8 +1393,8 @@ void ProfileWidget2::setPrintMode(bool mode, bool grayscale)
{
printMode = mode;
isGrayscale = mode ? grayscale : false;
- mouseFollowerHorizontal->setVisible( !mode );
- mouseFollowerVertical->setVisible( !mode );
+ mouseFollowerHorizontal->setVisible(!mode);
+ mouseFollowerVertical->setVisible(!mode);
}
void ProfileWidget2::setFontPrintScale(double scale)
@@ -1704,7 +1698,7 @@ void ProfileWidget2::keyEscAction()
void ProfileWidget2::plotPictures()
{
- Q_FOREACH(DivePictureItem *item, pictures){
+ Q_FOREACH (DivePictureItem *item, pictures) {
item->hide();
item->deleteLater();
}
@@ -1716,14 +1710,14 @@ void ProfileWidget2::plotPictures()
double x, y, lastX = -1.0, lastY = -1.0;
DivePictureModel *m = DivePictureModel::instance();
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
// information area.
if (!offsetSeconds)
continue;
DivePictureItem *item = new DivePictureItem();
- item->setPixmap(m->index(i,0).data(Qt::DecorationRole).value<QPixmap>());
- item->setFileUrl(m->index(i,1).data().toString());
+ item->setPixmap(m->index(i, 0).data(Qt::DecorationRole).value<QPixmap>());
+ 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
// not sure this is ideal, but it seems to look right.
x = timeAxis->posAtValue(offsetSeconds);
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 8a043664d..2de60ccbd 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -123,6 +123,7 @@ slots: // Necessary to call from QAction's signals.
void divePlannerHandlerClicked();
void divePlannerHandlerReleased();
+
protected:
virtual ~ProfileWidget2();
virtual void resizeEvent(QResizeEvent *event);
@@ -162,7 +163,7 @@ private:
TimeAxis *timeAxis;
DiveProfileItem *diveProfileItem;
DiveTemperatureItem *temperatureItem;
- DiveMeanDepthItem *meanDepthItem;
+ DiveMeanDepthItem *meanDepthItem;
DiveCartesianAxis *cylinderPressureAxis;
DiveGasPressureItem *gasPressureItem;
QList<DiveEventItem *> eventItems;
@@ -190,7 +191,7 @@ private:
//specifics for ADD and PLAN
QList<DiveHandler *> handles;
QList<QGraphicsSimpleTextItem *> gases;
- QList<DivePictureItem*> pictures;
+ QList<DivePictureItem *> pictures;
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
friend class DiveHandler;