summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/animationfunctions.cpp10
-rw-r--r--qt-ui/profile/animationfunctions.h3
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp32
-rw-r--r--qt-ui/profile/diveprofileitem.cpp7
-rw-r--r--qt-ui/profile/divetooltipitem.cpp8
-rw-r--r--qt-ui/profile/profilewidget2.cpp22
-rw-r--r--qt-ui/profile/profilewidget2.h2
-rw-r--r--qt-ui/profile/ruleritem.cpp6
-rw-r--r--qt-ui/profile/ruleritem.h7
9 files changed, 47 insertions, 50 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index 05e437cf0..bd08a22ee 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -4,8 +4,7 @@
#include <QPropertyAnimation>
#include <QPointF>
-namespace Animations
-{
+namespace Animations {
void hide(QObject *obj)
{
@@ -26,15 +25,14 @@ namespace Animations
void moveTo(QObject *obj, qreal x, qreal y)
{
- if (prefs.animation != 0){
+ if (prefs.animation != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
animation->setDuration(prefs.animation);
animation->setStartValue(obj->property("pos").toPointF());
animation->setEndValue(QPointF(x, y));
animation->start(QAbstractAnimation::DeleteWhenStopped);
- }
- else{
- obj->setProperty("pos", QPointF(x,y));
+ } else {
+ obj->setProperty("pos", QPointF(x, y));
}
}
diff --git a/qt-ui/profile/animationfunctions.h b/qt-ui/profile/animationfunctions.h
index e0338393e..9269e6dd3 100644
--- a/qt-ui/profile/animationfunctions.h
+++ b/qt-ui/profile/animationfunctions.h
@@ -6,8 +6,7 @@
class QObject;
-namespace Animations
-{
+namespace Animations {
void hide(QObject *obj);
void moveTo(QObject *obj, qreal x, qreal y);
void moveTo(QObject *obj, const QPointF &pos);
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index f5feea519..353f9880c 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -97,7 +97,7 @@ void DiveCartesianAxis::setTextVisible(bool arg1)
return;
}
textVisibility = arg1;
- Q_FOREACH(DiveTextItem * item, labels) {
+ Q_FOREACH (DiveTextItem *item, labels) {
item->setVisible(textVisibility);
}
}
@@ -108,7 +108,7 @@ void DiveCartesianAxis::setLinesVisible(bool arg1)
return;
}
lineVisibility = arg1;
- Q_FOREACH(DiveLineItem * item, lines) {
+ Q_FOREACH (DiveLineItem *item, lines) {
item->setVisible(lineVisibility);
}
}
@@ -161,8 +161,8 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
for (int i = 0, count = labels.size(); i < count; i++, currValueText += interval) {
qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
- begin + i * stepSize :
- begin - i * stepSize;
+ begin + i * stepSize :
+ begin - i * stepSize;
labels[i]->setText(textForValue(currValueText));
if (orientation == LeftToRight || orientation == RightToLeft) {
@@ -174,8 +174,8 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
for (int i = 0, count = lines.size(); i < count; i++, currValueLine += interval) {
qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
- begin + i * stepSize :
- begin - i * stepSize;
+ begin + i * stepSize :
+ begin - i * stepSize;
if (orientation == LeftToRight || orientation == RightToLeft) {
lines[i]->animateMoveTo(childPos, m.y1());
@@ -237,9 +237,9 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
}
}
- Q_FOREACH(DiveTextItem * item, labels)
+ Q_FOREACH (DiveTextItem *item, labels)
item->setVisible(textVisibility);
- Q_FOREACH(DiveLineItem * item, lines)
+ Q_FOREACH (DiveLineItem *item, lines)
item->setVisible(lineVisibility);
}
@@ -272,8 +272,8 @@ qreal DiveCartesianAxis::valueAt(const QPointF &p) const
relativePosition -= pos(); // normalize p based on the axis' offset on screen
double retValue = (orientation == LeftToRight || orientation == RightToLeft) ?
- max * (relativePosition.x() - m.x1()) / (m.x2() - m.x1()) :
- max * (relativePosition.y() - m.y1()) / (m.y2() - m.y1());
+ max * (relativePosition.x() - m.x1()) / (m.x2() - m.x1()) :
+ max * (relativePosition.y() - m.y1()) / (m.y2() - m.y1());
return retValue;
}
@@ -289,8 +289,8 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
double realSize = orientation == LeftToRight || orientation == RightToLeft ?
- m.x2() - m.x1() :
- m.y2() - m.y1();
+ m.x2() - m.x1() :
+ m.y2() - m.y1();
// Inverted axis, just invert the percentage.
if (orientation == RightToLeft || orientation == BottomToTop)
@@ -298,10 +298,10 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
double retValue = realSize * percent;
double adjusted =
- orientation == LeftToRight ? retValue + m.x1() + p.x() :
- orientation == RightToLeft ? retValue + m.x1() + p.x() :
- orientation == TopToBottom ? retValue + m.y1() + p.y() :
- /* entation == BottomToTop */ retValue + m.y1() + p.y();
+ orientation == LeftToRight ? retValue + m.x1() + p.x() :
+ orientation == RightToLeft ? retValue + m.x1() + p.x() :
+ orientation == TopToBottom ? retValue + m.y1() + p.y() :
+ /* entation == BottomToTop */ retValue + m.y1() + p.y();
return adjusted;
}
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 954eb60e1..2a6d5ac2f 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -156,7 +156,7 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
if (!entry->in_deco) {
/* not in deco implies this is a safety stop, no ceiling */
p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0)));
- } else{
+ } else {
p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(qMin(entry->stopdepth, entry->depth))));
}
}
@@ -489,7 +489,7 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
pen.setWidth(2);
struct dive *d = get_dive_by_uniq_id(dataModel->id());
struct plot_data *entry = dataModel->data().entry;
- Q_FOREACH(const QPolygonF & poly, polygons) {
+ Q_FOREACH (const QPolygonF &poly, polygons) {
for (int i = 1, count = poly.count(); i < count; i++, entry++) {
pen.setBrush(getSacColor(entry->sac, d->sac));
painter->setPen(pen);
@@ -682,9 +682,8 @@ void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphics
QPolygonF poly;
painter->setPen(QPen(alertColor, pWidth));
- Q_FOREACH(const QPolygonF & poly, alertPolygons)
+ Q_FOREACH (const QPolygonF &poly, alertPolygons)
painter->drawPolyline(poly);
-
}
void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey)
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index 0e68685b9..45f415419 100644
--- a/qt-ui/profile/divetooltipitem.cpp
+++ b/qt-ui/profile/divetooltipitem.cpp
@@ -21,7 +21,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
{
QGraphicsPixmapItem *iconItem = 0;
double yValue = title->boundingRect().height() + SPACING;
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
yValue += t.second->boundingRect().height();
}
if (!icon.isNull()) {
@@ -39,7 +39,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
void ToolTipItem::clear()
{
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
delete t.first;
delete t.second;
}
@@ -96,7 +96,7 @@ void ToolTipItem::expand()
return;
double width = 0, height = title->boundingRect().height() + SPACING;
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
if (t.second->boundingRect().width() > width)
width = t.second->boundingRect().width();
height += t.second->boundingRect().height();
@@ -226,7 +226,7 @@ void ToolTipItem::refresh(const QPointF &pos)
free_buffer(&mb);
QList<QGraphicsItem *> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, scene()->views().first()->transform());
- Q_FOREACH(QGraphicsItem * item, items) {
+ Q_FOREACH (QGraphicsItem *item, items) {
if (!item->toolTip().isEmpty())
addToolTip(item->toolTip());
}
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 6e565e77e..81ed98619 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -138,7 +138,7 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(rulerItem);
scene()->addItem(rulerItem->sourceNode());
scene()->addItem(rulerItem->destNode());
- Q_FOREACH (DiveCalculatedTissue * tissue, allTissues) {
+ Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
scene()->addItem(tissue);
}
}
@@ -211,7 +211,7 @@ void ProfileWidget2::setupItemOnScene()
ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS); \
ITEM->setVisibilitySettingsKey(VISIBILITY_SETTINGS); \
ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale)); \
- ITEM->settingsChanged(); \
+ ITEM->settingsChanged(); \
ITEM->setZValue(99);
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, "pn2threshold", "pn2graph");
@@ -479,7 +479,7 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
event = event->next;
}
// Only set visible the events that should be visible
- Q_FOREACH(DiveEventItem * event, eventItems) {
+ Q_FOREACH (DiveEventItem *event, eventItems) {
event->setVisible(!event->shouldBeHidden());
// qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds << "is hidden:" << event->isHidden();
}
@@ -649,10 +649,10 @@ void ProfileWidget2::setEmptyState()
pn2GasItem->setVisible(false);
po2GasItem->setVisible(false);
pheGasItem->setVisible(false);
- Q_FOREACH(DiveCalculatedTissue * tissue, allTissues) {
+ Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
tissue->setVisible(false);
}
- Q_FOREACH(DiveEventItem * event, eventItems) {
+ Q_FOREACH (DiveEventItem *event, eventItems) {
event->setVisible(false);
}
}
@@ -711,7 +711,7 @@ void ProfileWidget2::setProfileState()
reportedCeiling->setVisible(prefs.dcceiling);
if (prefs.calcalltissues) {
- Q_FOREACH(DiveCalculatedTissue * tissue, allTissues) {
+ Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
tissue->setVisible(true);
}
}
@@ -855,7 +855,7 @@ void ProfileWidget2::hideEvents()
}
}
Q_FOREACH (DiveEventItem *evItem, eventItems) {
- if(same_string(evItem->getEvent()->name, event->name))
+ if (same_string(evItem->getEvent()->name, event->name))
evItem->hide();
}
} else {
@@ -880,8 +880,8 @@ void ProfileWidget2::removeEvent()
struct event *event = item->getEvent();
if (QMessageBox::question(MainWindow::instance(), TITLE_OR_TEXT(
- tr("Remove the selected event?"),
- tr("%1 @ %2:%3").arg(event->name).arg(event->time.seconds / 60).arg(event->time.seconds % 60, 2, 10, QChar('0'))),
+ tr("Remove the selected event?"),
+ tr("%1 @ %2:%3").arg(event->name).arg(event->time.seconds / 60).arg(event->time.seconds % 60, 2, 10, QChar('0'))),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
remove_event(event);
mark_divelist_changed(true);
@@ -953,9 +953,9 @@ void ProfileWidget2::disconnectTemporaryConnections()
disconnect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
disconnect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(pointInserted(const QModelIndex &, int, int)));
+ this, SLOT(pointInserted(const QModelIndex &, int, int)));
disconnect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
- this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
+ this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
}
void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 9b9802ed0..895b82c78 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -70,7 +70,7 @@ public:
virtual bool eventFilter(QObject *, QEvent *);
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
void setPrintMode(bool mode, bool grayscale = false);
- bool isPointOutOfBoundaries(const QPointF& point) const;
+ bool isPointOutOfBoundaries(const QPointF &point) const;
State currentState;
public
diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp
index 92e8f12c5..0f2a24a80 100644
--- a/qt-ui/profile/ruleritem.cpp
+++ b/qt-ui/profile/ruleritem.cpp
@@ -26,7 +26,7 @@ RulerNodeItem2::RulerNodeItem2() : entry(NULL), ruler(NULL)
setFlag(ItemIgnoresTransformations);
}
-void RulerNodeItem2::setPlotInfo(plot_info& info)
+void RulerNodeItem2::setPlotInfo(plot_info &info)
{
pInfo = info;
entry = pInfo.entry;
@@ -87,8 +87,8 @@ RulerItem2::RulerItem2() : source(new RulerNodeItem2()),
void RulerItem2::settingsChanged()
{
ProfileWidget2 *profWidget = NULL;
- if(scene() && scene()->views().count())
- profWidget = qobject_cast<ProfileWidget2*>(scene()->views().first());
+ if (scene() && scene()->views().count())
+ profWidget = qobject_cast<ProfileWidget2 *>(scene()->views().first());
setVisible(profWidget->currentState == ProfileWidget2::PROFILE ? prefs.rulergraph : false);
}
diff --git a/qt-ui/profile/ruleritem.h b/qt-ui/profile/ruleritem.h
index 2ee1703a6..3eda33225 100644
--- a/qt-ui/profile/ruleritem.h
+++ b/qt-ui/profile/ruleritem.h
@@ -17,7 +17,7 @@ class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem {
public:
explicit RulerNodeItem2();
void setRuler(RulerItem2 *r);
- void setPlotInfo(struct plot_info& info);
+ void setPlotInfo(struct plot_info &info);
void recalculate();
protected:
@@ -31,7 +31,7 @@ private:
DiveCartesianAxis *depthAxis;
};
-class RulerItem2 :public QObject, public QGraphicsLineItem {
+class RulerItem2 : public QObject, public QGraphicsLineItem {
Q_OBJECT
public:
explicit RulerItem2();
@@ -43,7 +43,8 @@ public:
void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth);
void setVisible(bool visible);
-public slots:
+public
+slots:
void settingsChanged();
private: