aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-16 11:50:56 +0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-16 11:50:56 +0700
commita27f67c02612791fad73b4e0550d942dc3a5a339 (patch)
tree4417a2be34c8bcd7c03db23ba5f307ad463657a9 /qt-ui/profile
parent3387ccc6f676636fe3fb8b11c8c371f627d74551 (diff)
downloadsubsurface-a27f67c02612791fad73b4e0550d942dc3a5a339.tar.gz
Whitespace and coding style updates
Another futile attempt to cleanup the code and make coding style and whitespace consistent. I tried to add a file that describes the key points of our coding style. I have no illusions that this will help the least bit... This commit should ONLY change whitespace Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/animationfunctions.cpp2
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp25
-rw-r--r--qt-ui/profile/divepixmapitem.cpp3
-rw-r--r--qt-ui/profile/diveplotdatamodel.cpp38
-rw-r--r--qt-ui/profile/diveprofileitem.cpp7
-rw-r--r--qt-ui/profile/diverectitem.cpp1
-rw-r--r--qt-ui/profile/divetextitem.cpp6
-rw-r--r--qt-ui/profile/profilewidget2.cpp32
8 files changed, 58 insertions, 56 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index 1e307db87..baf180241 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -2,7 +2,7 @@
#include <QPropertyAnimation>
#include <QPointF>
-namespace Animations{
+namespace Animations {
void hide(QObject* obj)
{
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index a12175461..84ab8ffcf 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -27,6 +27,7 @@ void DiveCartesianAxis::setTextColor(const QColor& color)
DiveCartesianAxis::DiveCartesianAxis() : orientation(Qt::Horizontal)
{
+
}
DiveCartesianAxis::~DiveCartesianAxis()
@@ -50,8 +51,8 @@ void DiveCartesianAxis::updateTicks()
double currValue = min;
// Remove the uneeded Ticks / Texts.
- if (ticks.size() > steps){
- while (ticks.size() > steps){
+ if (ticks.size() > steps) {
+ while (ticks.size() > steps) {
DiveLineItem *removedLine = ticks.takeLast();
removedLine->animatedHide();
DiveTextItem *removedText = labels.takeLast();
@@ -65,21 +66,20 @@ void DiveCartesianAxis::updateTicks()
qreal end = orientation == Qt::Horizontal ? m.x2() : m.y2();
double stepSize = orientation == Qt::Horizontal ? (m.x2() - m.x1()) : (m.y2() - m.y1());
stepSize = stepSize / steps;
- for(int i = 0, count = ticks.size(); i < count; i++, currValue += interval){
+ for (int i = 0, count = ticks.size(); i < count; i++, currValue += interval) {
qreal childPos = begin + i * stepSize;
labels[i]->setText(textForValue(currValue));
- if ( orientation == Qt::Horizontal ){
+ if ( orientation == Qt::Horizontal ) {
ticks[i]->animateMoveTo(childPos, m.y1() + tickSize);
labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
- }
- else{
+ } else {
ticks[i]->animateMoveTo(m.x1() - tickSize, childPos);
labels[i]->animateMoveTo(m.x1() - tickSize, childPos);
}
}
// Add's the rest of the needed Ticks / Text.
- for(int i = ticks.size(); i < steps; i++, currValue += interval){
+ for (int i = ticks.size(); i < steps; i++, currValue += interval) {
qreal childPos = begin + i * stepSize;
DiveLineItem *item = new DiveLineItem(this);
item->setPen(pen());
@@ -90,15 +90,14 @@ void DiveCartesianAxis::updateTicks()
label->setBrush(QBrush(textColor));
labels.push_back(label);
- if(orientation == Qt::Horizontal){
+ if (orientation == Qt::Horizontal) {
item->setLine(0, 0, 0, tickSize);
item->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene
item->animateMoveTo(childPos, m.y1() + tickSize); // anim it to scene.
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
label->animateMoveTo(childPos, m.y1() + tickSize);
- }
- else{
+ } else {
item->setLine(0, 0, tickSize, 0);
item->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
item->animateMoveTo(m.x1() - tickSize, childPos);
@@ -146,7 +145,7 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
m.y2() - m.y1();
double retValue = realSize * percent;
retValue = (orientation == Qt::Horizontal) ?
- retValue + m.x1() + p.x():
+ retValue + m.x1() + p.x() :
retValue + m.y1() + p.y();
return retValue;
}
@@ -186,5 +185,5 @@ QString DepthAxis::textForValue(double value)
QString TimeAxis::textForValue(double value)
{
- return QString::number(value / 60);
-} \ No newline at end of file
+ return QString::number(value / 60);
+}
diff --git a/qt-ui/profile/divepixmapitem.cpp b/qt-ui/profile/divepixmapitem.cpp
index 5065396fb..c62a7a20b 100644
--- a/qt-ui/profile/divepixmapitem.cpp
+++ b/qt-ui/profile/divepixmapitem.cpp
@@ -2,4 +2,5 @@
DivePixmapItem::DivePixmapItem(QObject* parent): QObject(parent), QGraphicsPixmapItem()
{
-} \ No newline at end of file
+
+}
diff --git a/qt-ui/profile/diveplotdatamodel.cpp b/qt-ui/profile/diveplotdatamodel.cpp
index a5506139f..4ecf3ebb5 100644
--- a/qt-ui/profile/diveplotdatamodel.cpp
+++ b/qt-ui/profile/diveplotdatamodel.cpp
@@ -23,19 +23,19 @@ QVariant DivePlotDataModel::data(const QModelIndex& index, int role) const
return QVariant();
plot_data item = plotData[index.row()];
- if (role == Qt::DisplayRole){
- switch(index.column()){
- case DEPTH: return item.depth;
- case TIME: return item.sec;
- case PRESSURE: return item.pressure[0];
- case TEMPERATURE: return item.temperature;
- case COLOR: return item.velocity;
- case USERENTERED: return false;
+ if (role == Qt::DisplayRole) {
+ switch (index.column()) {
+ case DEPTH: return item.depth;
+ case TIME: return item.sec;
+ case PRESSURE: return item.pressure[0];
+ case TEMPERATURE: return item.temperature;
+ case COLOR: return item.velocity;
+ case USERENTERED: return false;
}
}
- if (role == Qt::BackgroundRole){
- switch(index.column()){
- case COLOR: return getColor((color_indice_t)(VELOCITY_COLORS_START_IDX + item.velocity));
+ if (role == Qt::BackgroundRole) {
+ switch (index.column()) {
+ case COLOR: return getColor((color_indice_t)(VELOCITY_COLORS_START_IDX + item.velocity));
}
}
return QVariant();
@@ -54,20 +54,20 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation,
if (role != Qt::DisplayRole)
return QVariant();
- switch(section){
- case DEPTH: return tr("Depth");
- case TIME: return tr("Time");
- case PRESSURE: return tr("Pressure");
- case TEMPERATURE: return tr("Temperature");
- case COLOR: return tr("Color");
- case USERENTERED: return tr("User Entered");
+ switch (section) {
+ case DEPTH: return tr("Depth");
+ case TIME: return tr("Time");
+ case PRESSURE: return tr("Pressure");
+ case TEMPERATURE: return tr("Temperature");
+ case COLOR: return tr("Color");
+ case USERENTERED: return tr("User Entered");
}
return QVariant();
}
void DivePlotDataModel::clear()
{
- if(rowCount() != 0){
+ if (rowCount() != 0) {
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
endRemoveRows();
}
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index dbdddbb8b..94aaf4363 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -10,6 +10,7 @@
DiveProfileItem::DiveProfileItem(): QObject(), QGraphicsPolygonItem(),
hAxis(NULL), hDataColumn(-1), dataModel(NULL), vAxis(NULL), vDataColumn(-1)
{
+
}
void DiveProfileItem::setHorizontalAxis(DiveCartesianAxis* horizontal)
@@ -54,7 +55,7 @@ void DiveProfileItem::modelDataChanged()
// is an array of QPointF's, so we basically get the point from the model, convert
// to our coordinates, store. no painting is done here.
QPolygonF poly;
- for(int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++){
+ for (int i = 0, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
qreal horizontalValue = dataModel->index(i, hDataColumn).data().toReal();
qreal verticalValue = dataModel->index(i, vDataColumn).data().toReal();
QPointF point( hAxis->posAtValue(horizontalValue), vAxis->posAtValue(verticalValue));
@@ -70,7 +71,7 @@ void DiveProfileItem::modelDataChanged()
setBrush(QBrush(pat));
}
-void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget){
+void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
Q_UNUSED(widget);
// This paints the Polygon + Background. I'm setting the pen to QPen() so we don't get a black line here,
@@ -84,7 +85,7 @@ void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
pen.setCosmetic(true);
pen.setWidth(2);
// This paints the colors of the velocities.
- for(int i = 1, count = dataModel->rowCount(); i < count; i++){
+ for (int i = 1, count = dataModel->rowCount(); i < count; i++) {
QModelIndex colorIndex = dataModel->index(i, DivePlotDataModel::COLOR);
pen.setBrush(QBrush(colorIndex.data(Qt::BackgroundRole).value<QColor>()));
painter->setPen(pen);
diff --git a/qt-ui/profile/diverectitem.cpp b/qt-ui/profile/diverectitem.cpp
index 8f224fa6a..6bdad1142 100644
--- a/qt-ui/profile/diverectitem.cpp
+++ b/qt-ui/profile/diverectitem.cpp
@@ -2,4 +2,5 @@
DiveRectItem::DiveRectItem(QObject* parent, QGraphicsItem* parentItem): QObject(parent), QGraphicsRectItem(parentItem )
{
+
}
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index 7f9adf181..37f4bfc6c 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -29,9 +29,9 @@ void DiveTextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opti
//
// // if (internalAlignFlags & Qt::AlignLeft )
// // painter->translate(); // This is the default, uneeded.
-// if(internalAlignFlags & Qt::AlignHCenter)
+// if (internalAlignFlags & Qt::AlignHCenter)
// painter->translate(-rect.width()/2, 0);
-// else if(internalAlignFlags & Qt::AlignRight)
+// else if (internalAlignFlags & Qt::AlignRight)
// painter->translate(-rect.width(), 0);
QGraphicsSimpleTextItem::paint(painter, option, widget);
@@ -45,4 +45,4 @@ void DiveTextItem::animatedHide()
void DiveTextItem::animateMoveTo(qreal x, qreal y)
{
Animations::moveTo(this, x, y);
-} \ No newline at end of file
+}
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 68b42f1b9..0c6b2dc6d 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -46,7 +46,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
gasYAxis->setOrientation(Qt::Vertical);
timeAxis->setOrientation(Qt::Horizontal);
- // Defaults of the Axis Coordinates:
+ // Defaults of the Axis Coordinates:
profileYAxis->setMinimum(0);
profileYAxis->setTickInterval(M_OR_FT(10,30)); //TODO: This one should be also hooked up on the Settings change.
timeAxis->setMinimum(0);
@@ -65,15 +65,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
timeController->setX(sceneRect().width() - timeController->boundingRect().width()); // Position it on the right spot.
// insert in the same way it's declared on the Enum. This is needed so we don't use an map.
- QList<QGraphicsItem*> stateItems; stateItems << background << profileYAxis << gasYAxis
- << timeAxis << depthController << timeController;
- Q_FOREACH(QGraphicsItem *item, stateItems){
+ QList<QGraphicsItem*> stateItems; stateItems << background << profileYAxis << gasYAxis <<
+ timeAxis << depthController << timeController;
+ Q_FOREACH(QGraphicsItem *item, stateItems) {
scene()->addItem(item);
}
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
- //enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
+ //enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
stateMachine = new QStateMachine(this);
// TopLevel States
@@ -135,7 +135,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
const QLineF profileYAxisExpanded = QLineF(0,0,0,timeAxisOnCanvas);
const QLineF timeAxisLine = QLineF(0, 0, 96, 0);
- // State Defaults:
+ // State Defaults:
// Empty State, everything but the background is hidden.
emptyState->assignProperty(this, "backgroundBrush", QBrush(Qt::white));
emptyState->assignProperty(background, "y", backgroundOnCanvas);
@@ -145,7 +145,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
emptyState->assignProperty(depthController, "y", depthControllerOffCanvas);
emptyState->assignProperty(timeController, "y", timeControllerOffCanvas);
- // Profile, everything but the background, depthController and timeController are shown.
+ // Profile, everything but the background, depthController and timeController are shown.
profileState->assignProperty(this, "backgroundBrush", getColor(::BACKGROUND));
profileState->assignProperty(background, "y", backgroundOffCanvas);
profileState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas);
@@ -196,10 +196,10 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
// Animations
QList<QSignalTransition*> transitions;
- transitions << tAddToEmpty << tAddToPlan << tAddToProfile << tEditToAdd << tEditToEmpty << tEditToPlan
- << tEditToProfile << tEmptyToAdd << tEmptyToPlan << tEmptyToProfile << tProfileToAdd << tProfileToEdit
- << tProfileToEmpty << tProfileToPlan << tPlanToAdd << tPlanToEmpty << tPlanToProfile;
- Q_FOREACH(QSignalTransition *s, transitions){
+ transitions << tAddToEmpty << tAddToPlan << tAddToProfile << tEditToAdd << tEditToEmpty << tEditToPlan <<
+ tEditToProfile << tEmptyToAdd << tEmptyToPlan << tEmptyToProfile << tProfileToAdd <<
+ tProfileToEdit << tProfileToEmpty << tProfileToPlan << tPlanToAdd << tPlanToEmpty << tPlanToProfile;
+ Q_FOREACH(QSignalTransition *s, transitions) {
s->addAnimation(backgroundYAnim);
s->addAnimation(depthAxisAnim);
s->addAnimation(gasAxisanim);
@@ -232,7 +232,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
// I Know that it's a list, but currently we are
// using just the first.
struct dive *d = dives.first();
- if(!d)
+ if (!d)
return;
// Here we need to probe for the limits of the dive.
@@ -257,7 +257,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
timeAxis->updateTicks();
dataModel->setDive(current_dive, pInfo);
- if(diveProfileItem){
+ if (diveProfileItem) {
//diveProfileItem->animateDelete();
scene()->removeItem(diveProfileItem);
delete diveProfileItem;
@@ -294,10 +294,10 @@ void ProfileWidget2::resizeEvent(QResizeEvent* event)
QGraphicsView::resizeEvent(event);
fitInView(sceneRect(), Qt::IgnoreAspectRatio);
- if(!stateMachine->configuration().count())
+ if (!stateMachine->configuration().count())
return;
- if ((*stateMachine->configuration().begin())->objectName() == "Empty State"){
+ if ((*stateMachine->configuration().begin())->objectName() == "Empty State") {
fixBackgroundPos();
}
}
@@ -305,7 +305,7 @@ void ProfileWidget2::resizeEvent(QResizeEvent* event)
void ProfileWidget2::fixBackgroundPos()
{
QPixmap p = QPixmap(":background").scaledToHeight(viewport()->height());
- int x = viewport()->width()/2 - p.width()/2;
+ int x = viewport()->width() / 2 - p.width() / 2;
DivePixmapItem *bg = background;
bg->setPixmap(p);
bg->setX(mapToScene(x, 0).x());