aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 21:25:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-22 21:31:45 -0700
commit115e5e5fbc5fcf190ceafaa2b800160cec93d52e (patch)
tree81f8308c48c11b7b3ff393ab35b3ae6999351d5c /qt-ui
parent775736395363ddfe65387b6e05d37546a4601ab9 (diff)
downloadsubsurface-115e5e5fbc5fcf190ceafaa2b800160cec93d52e.tar.gz
The never ending, futile fight for whitespace consistency
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelistview.cpp10
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp20
-rw-r--r--qt-ui/downloadfromdivecomputer.h8
-rw-r--r--qt-ui/globe.cpp46
-rw-r--r--qt-ui/globe.h6
-rw-r--r--qt-ui/maintab.cpp14
-rw-r--r--qt-ui/maintab.h4
-rw-r--r--qt-ui/mainwindow.cpp2
-rw-r--r--qt-ui/modeldelegates.cpp7
-rw-r--r--qt-ui/modeldelegates.h10
-rw-r--r--qt-ui/models.cpp26
-rw-r--r--qt-ui/models.h4
-rw-r--r--qt-ui/profilegraphics.cpp71
-rw-r--r--qt-ui/profilegraphics.h6
-rw-r--r--qt-ui/starwidget.cpp6
15 files changed, 113 insertions, 127 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index 9ee99394b..abd9d4ede 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -34,7 +34,7 @@ void DiveListView::reload()
m->setSourceModel(new DiveTripModel(this));
sortByColumn(0, Qt::DescendingOrder);
QModelIndex firstDiveOrTrip = m->index(0,0);
- if (firstDiveOrTrip.isValid()){
+ if (firstDiveOrTrip.isValid()) {
if (m->index(0,0, firstDiveOrTrip).isValid())
setCurrentIndex(m->index(0,0, firstDiveOrTrip));
else
@@ -42,12 +42,12 @@ void DiveListView::reload()
}
// Populate the context menu of the headers that will show
// the menu to show / hide columns.
- if (!header()->actions().size()){
+ if (!header()->actions().size()) {
QAction *visibleAction = new QAction("Visible:", header());
header()->addAction(visibleAction);
QSettings s;
s.beginGroup("DiveListColumnState");
- for(int i = 0; i < model()->columnCount(); i++){
+ for(int i = 0; i < model()->columnCount(); i++) {
QString title = QString("show %1").arg(model()->headerData( i, Qt::Horizontal).toString());
QAction *a = new QAction(title, header());
a->setCheckable(true);
@@ -103,7 +103,7 @@ void DiveListView::mouseReleaseEvent(QMouseEvent* event)
void DiveListView::keyPressEvent(QKeyEvent* event)
{
- if(event->modifiers())
+ if (event->modifiers())
mouseClickSelection = true;
QTreeView::keyPressEvent(event);
}
@@ -124,7 +124,7 @@ void DiveListView::currentChanged(const QModelIndex& current, const QModelIndex&
if (!dive) { // it's a trip! select first child.
dive = (struct dive*) model->data(current.child(0,0), TreeItemDT::DIVE_ROLE).value<void*>();
selectedDive = get_divenr(dive);
- }else{
+ } else {
selectedDive = get_divenr(dive);
}
if (selectedDive == selected_dive)
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index e621096ff..9b8ad29ef 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -69,11 +69,11 @@ void DownloadFromDCWidget::fill_computer_list()
const char *vendor = dc_descriptor_get_vendor(descriptor);
const char *product = dc_descriptor_get_product(descriptor);
- if (!vendorList.contains( vendor ))
- vendorList.append( vendor );
+ if (!vendorList.contains(vendor))
+ vendorList.append(vendor);
- if( !productList[vendor].contains( product ))
- productList[vendor].push_back( product );
+ if (!productList[vendor].contains(product))
+ productList[vendor].push_back(product);
descriptorLookup[QString(vendor) + QString(product)] = descriptor;
}
@@ -91,11 +91,11 @@ void DownloadFromDCWidget::fill_computer_list()
mydescriptor->type = DC_FAMILY_NULL;
mydescriptor->model = 0;
- if(!vendorList.contains( "Uemis"))
+ if (!vendorList.contains("Uemis"))
vendorList.append("Uemis");
- if( !productList["Uemis"].contains( "Zurich" ))
- productList["Uemis"].push_back( "Zurich" );
+ if (!productList["Uemis"].contains("Zurich"))
+ productList["Uemis"].push_back("Zurich");
descriptorLookup[QString("UemisZurich")] = (dc_descriptor_t *)mydescriptor;
}
@@ -103,7 +103,7 @@ void DownloadFromDCWidget::fill_computer_list()
void DownloadFromDCWidget::on_cancel_clicked()
{
import_thread_cancelled = true;
- if(thread){
+ if (thread) {
thread->wait();
thread->deleteLater();
thread = 0;
@@ -119,7 +119,7 @@ void DownloadFromDCWidget::on_ok_clicked()
ui->progressBar->setValue(0);
ui->progressBar->show();
- if(thread){
+ if (thread) {
thread->deleteLater();
}
@@ -159,7 +159,7 @@ void InterfaceThread::run()
DownloadThread *download = new DownloadThread(data);
download->start();
- while(download->isRunning()){
+ while (download->isRunning()) {
msleep(200);
updateInterface(progress_bar_fraction *100);
}
diff --git a/qt-ui/downloadfromdivecomputer.h b/qt-ui/downloadfromdivecomputer.h
index eccea8ac7..fdc730753 100644
--- a/qt-ui/downloadfromdivecomputer.h
+++ b/qt-ui/downloadfromdivecomputer.h
@@ -15,8 +15,8 @@ struct device_data_t;
class DownloadThread : public QThread{
Q_OBJECT
public:
- explicit DownloadThread(device_data_t* data);
- virtual void run();
+ explicit DownloadThread(device_data_t* data);
+ virtual void run();
private:
device_data_t *data;
};
@@ -25,7 +25,7 @@ class InterfaceThread : public QThread{
Q_OBJECT
public:
InterfaceThread(QObject *parent, device_data_t *data) ;
- virtual void run();
+ virtual void run();
Q_SIGNALS:
void updateInterface(int value);
@@ -37,7 +37,7 @@ class QStringListModel;
class DownloadFromDCWidget : public QDialog{
Q_OBJECT
public:
- explicit DownloadFromDCWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ explicit DownloadFromDCWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
public slots:
void on_ok_clicked();
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 6f9574fdd..7eee4fb2a 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -21,33 +21,33 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
setMapThemeId("earth/bluemarble/bluemarble.dgml");
//setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
- setProjection( Marble::Spherical );
+ setProjection(Marble::Spherical);
setAnimationsEnabled(true);
- setShowClouds( false );
- setShowBorders( false );
- setShowPlaces( true );
- setShowCrosshairs( false );
- setShowGrid( false );
+ setShowClouds(false);
+ setShowBorders(false);
+ setShowPlaces(true);
+ setShowCrosshairs(false);
+ setShowGrid(false);
setShowOverviewMap(false);
setShowScaleBar(true);
- Q_FOREACH( AbstractFloatItem * floatItem, floatItems() ){
- if ( floatItem && floatItem->nameId() == "compass" ) {
- floatItem->setPosition( QPoint( 10, 10 ) );
- floatItem->setContentSize( QSize( 50, 50 ) );
+ Q_FOREACH(AbstractFloatItem * floatItem, floatItems()) {
+ if (floatItem && floatItem->nameId() == "compass") {
+ floatItem->setPosition(QPoint(10, 10));
+ floatItem->setContentSize(QSize(50, 50));
}
}
}
void GlobeGPS::reload()
{
- if (loadedDives){
+ if (loadedDives) {
model()->treeModel()->removeDocument(loadedDives);
delete loadedDives;
}
- if (editingDiveCoords){
+ if (editingDiveCoords) {
editingDiveCoords = 0;
}
@@ -61,22 +61,22 @@ void GlobeGPS::reload()
for_each_dive(idx, dive) {
if (dive_has_gps_location(dive)) {
// don't add dive locations twice.
- if( diveLocations.contains( QString(dive->location)))
+ if (diveLocations.contains(QString(dive->location)))
continue;
- diveLocations.append( QString(dive->location) );
- GeoDataPlacemark *place = new GeoDataPlacemark( dive->location );
- place->setCoordinate(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0 , 0, GeoDataCoordinates::Degree );
- loadedDives->append( place );
+ diveLocations.append(QString(dive->location));
+ GeoDataPlacemark *place = new GeoDataPlacemark(dive->location);
+ place->setCoordinate(dive->longitude.udeg / 1000000.0,dive->latitude.udeg / 1000000.0 , 0, GeoDataCoordinates::Degree);
+ loadedDives->append(place);
}
}
- model()->treeModel()->addDocument( loadedDives );
+ model()->treeModel()->addDocument(loadedDives);
}
void GlobeGPS::centerOn(dive* dive)
{
// dive has changed, if we had the 'editingDive', hide it.
- if(messageWidget->isVisible() && (!dive || dive_has_gps_location(dive))){
+ if (messageWidget->isVisible() && (!dive || dive_has_gps_location(dive))) {
messageWidget->animatedHide();
}
@@ -85,7 +85,7 @@ void GlobeGPS::centerOn(dive* dive)
qreal longitude = dive->longitude.udeg / 1000000.0;
qreal latitude = dive->latitude.udeg / 1000000.0;
- if (!longitude || !latitude){
+ if (!longitude || !latitude) {
prepareForGetDiveCoordinates(dive);
return;
}
@@ -107,12 +107,12 @@ void GlobeGPS::prepareForGetDiveCoordinates(dive* dive)
void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
{
// convert to degrees if in radian.
- if (unit == GeoDataCoordinates::Radian){
+ if (unit == GeoDataCoordinates::Radian) {
lon = lon * 180 / M_PI;
lat = lat * 180 / M_PI;
}
- if (!editingDiveCoords){
+ if (!editingDiveCoords) {
return;
}
@@ -127,7 +127,7 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
void GlobeGPS::mousePressEvent(QMouseEvent* event)
{
qreal lat, lon;
- if (editingDiveCoords && geoCoordinates(event->pos().x(), event->pos().y(), lon,lat, GeoDataCoordinates::Radian)){
+ if (editingDiveCoords && geoCoordinates(event->pos().x(), event->pos().y(), lon,lat, GeoDataCoordinates::Radian)) {
changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Radian);
}
}
diff --git a/qt-ui/globe.h b/qt-ui/globe.h
index 650d55716..1e0960b76 100644
--- a/qt-ui/globe.h
+++ b/qt-ui/globe.h
@@ -12,7 +12,7 @@ struct dive;
class GlobeGPS : public MarbleWidget{
Q_OBJECT
- void prepareForGetDiveCoordinates(struct dive* dive);
+ void prepareForGetDiveCoordinates(struct dive* dive);
public:
using MarbleWidget::centerOn;
GlobeGPS(QWidget *parent);
@@ -20,12 +20,12 @@ public:
void centerOn(struct dive* dive);
protected:
- virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mousePressEvent(QMouseEvent* event);
private:
GeoDataDocument *loadedDives;
QStringList diveLocations;
- struct dive* editingDiveCoords;
+ struct dive* editingDiveCoords;
KMessageWidget* messageWidget;
public Q_SLOTS:
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index fd33457d9..6c3b61173 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -79,10 +79,10 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), ui->cylinders->model(), SLOT(remove(QModelIndex)));
connect(ui->weights, SIGNAL(clicked(QModelIndex)), ui->weights->model(), SLOT(remove(QModelIndex)));
- ui->cylinders->setColumnWidth( CylindersModel::REMOVE, 24);
+ ui->cylinders->setColumnWidth(CylindersModel::REMOVE, 24);
ui->cylinders->horizontalHeader()->setResizeMode (CylindersModel::REMOVE , QHeaderView::Fixed);
ui->cylinders->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate());
- ui->weights->setColumnWidth( WeightModel::REMOVE, 24);
+ ui->weights->setColumnWidth(WeightModel::REMOVE, 24);
ui->cylinders->horizontalHeader()->setResizeMode (WeightModel::REMOVE , QHeaderView::Fixed);
}
@@ -90,19 +90,19 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
void MainTab::resizeEvent(QResizeEvent* event)
{
if (ui->cylindersGroup->isVisible())
- addCylinder->setGeometry( ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
+ addCylinder->setGeometry(ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
if (ui->weightGroup->isVisible())
- addWeight->setGeometry( ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
+ addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
- QTabWidget::resizeEvent(event);
+ QTabWidget::resizeEvent(event);
}
void MainTab::showEvent(QShowEvent* event)
{
QTabWidget::showEvent(event);
- addCylinder->setGeometry( ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
- addWeight->setGeometry( ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
+ addCylinder->setGeometry(ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
+ addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
}
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 4b10e7a6b..e835b6366 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -38,8 +38,8 @@ public:
void reload();
bool eventFilter(QObject* , QEvent*);
- virtual void resizeEvent(QResizeEvent* );
- virtual void showEvent(QShowEvent* );
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void showEvent(QShowEvent*);
public Q_SLOTS:
void addCylinder_clicked();
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 12c803786..cff62db48 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -405,7 +405,7 @@ void MainWindow::readSettings()
#if ONCE_WE_HAVE_MAPS
v = settings.value(QString_int("map_provider"));
- if(v.isValid())
+ if (v.isValid())
prefs.map_provider = v.toInt();
#endif
}
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index c05e59ea8..ea27ed253 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -51,15 +51,14 @@ QSize StarWidgetsDelegate::sizeHint(const QStyleOptionViewItem& option, const QM
QWidget* TankInfoDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
- QComboBox *comboDelegate = new QComboBox(parent);
+ QComboBox *comboDelegate = new QComboBox(parent);
TankInfoModel *model = new TankInfoModel;
QString data = index.model()->data(index, Qt::DisplayRole).toString();
comboDelegate->setModel(model);
int i;
- for(i = 0; i < model->rowCount(); i++){
- if (model->data(model->index(i,0), Qt::DisplayRole).toString() == data){
+ for (i = 0; i < model->rowCount(); i++) {
+ if (model->data(model->index(i,0), Qt::DisplayRole).toString() == data)
break;
- }
}
if (i != model->rowCount())
comboDelegate->setCurrentIndex(i);
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index 0a56d14d6..baf7d50c3 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -6,9 +6,9 @@
class StarWidgetsDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
- explicit StarWidgetsDelegate(QWidget* parent = 0);
- virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ explicit StarWidgetsDelegate(QWidget* parent = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
private:
QWidget *parentWidget;
};
@@ -16,8 +16,8 @@ private:
class TankInfoDelegate : public QStyledItemDelegate{
Q_OBJECT
public:
- explicit TankInfoDelegate(QObject* parent = 0);
- virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ explicit TankInfoDelegate(QObject* parent = 0);
+ virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
};
#endif
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index eb5a9a5b4..7ccbe1e49 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -103,12 +103,9 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
ret = QString("%1%").arg((cyl->gasmix.he.permille + 5) / 10);
break;
}
- }
-
- else if (role == Qt::DecorationRole){
- if (index.column() == REMOVE){
+ } else if (role == Qt::DecorationRole) {
+ if (index.column() == REMOVE)
ret = QIcon(":trash");
- }
}
return ret;
@@ -237,7 +234,7 @@ void CylindersModel::setDive(dive* d)
clear();
int amount = MAX_CYLINDERS;
- for(int i = 0; i < MAX_CYLINDERS; i++){
+ for(int i = 0; i < MAX_CYLINDERS; i++) {
cylinder_t *cylinder = &d->cylinder[i];
if (cylinder_none(cylinder)) {
amount = i;
@@ -260,7 +257,7 @@ Qt::ItemFlags CylindersModel::flags(const QModelIndex& index) const
void CylindersModel::remove(const QModelIndex& index)
{
- if (index.column() != REMOVE){
+ if (index.column() != REMOVE) {
return;
}
beginRemoveRows(QModelIndex(), index.row(), index.row()); // yah, know, ugly.
@@ -272,7 +269,7 @@ void CylindersModel::remove(const QModelIndex& index)
void WeightModel::remove(const QModelIndex& index)
{
- if (index.column() != REMOVE){
+ if (index.column() != REMOVE) {
return;
}
beginRemoveRows(QModelIndex(), index.row(), index.row()); // yah, know, ugly.
@@ -312,12 +309,9 @@ QVariant WeightModel::data(const QModelIndex& index, int role) const
ret = get_weight_string(ws->weight, TRUE);
break;
}
- }
-
- else if (role == Qt::DecorationRole){
- if (index.column() == REMOVE){
+ } else if (role == Qt::DecorationRole) {
+ if (index.column() == REMOVE)
ret = QIcon(":trash");
- }
}
return ret;
}
@@ -493,7 +487,7 @@ TankInfoModel::TankInfoModel() : QAbstractTableModel(), rows(-1)
void TankInfoModel::update()
{
- if(rows > -1) {
+ if (rows > -1) {
beginRemoveRows(QModelIndex(), 0, rows);
endRemoveRows();
}
@@ -548,7 +542,7 @@ QVariant TreeItemDT::data(int column, int role) const
ret = tr("min");
break;
case TEMPERATURE:
- ret = QString("%1%2").arg(UTF8_DEGREE).arg( (get_units()->temperature == units::CELSIUS) ? "C" : "F");
+ ret = QString("%1%2").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F");
break;
case TOTALWEIGHT:
ret = (get_units()->weight == units::KG) ? tr("kg") : tr("lbs");
@@ -789,7 +783,7 @@ QVariant DiveTripModel::data(const QModelIndex& index, int role) const
if (!index.isValid())
return QVariant();
- if (role == Qt::FontRole){
+ if (role == Qt::FontRole) {
QFont font;
font.setPointSizeF(font.pointSizeF() * 0.7);
return font;
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 6793a7fa8..5fa97eb56 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -90,7 +90,7 @@ private:
*/
struct TreeItemDT {
- Q_DECLARE_TR_FUNCTIONS ( TreeItemDT );
+ Q_DECLARE_TR_FUNCTIONS (TreeItemDT);
public:
enum Column {NR, DATE, RATING, DEPTH, DURATION, TEMPERATURE, TOTALWEIGHT,
SUIT, CYLINDER, NITROX, SAC, OTU, MAXCNS, LOCATION, DIVE, COLUMNS };
@@ -102,7 +102,7 @@ public:
return COLUMNS;
};
- virtual QVariant data ( int column, int role ) const;
+ virtual QVariant data (int column, int role) const;
int row() const;
QList<TreeItemDT *> children;
TreeItemDT *parent;
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 17217f967..deef8a9d5 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -130,8 +130,8 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
defaultPen.setWidth(2);
defaultPen.setCosmetic(true);
- setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
- setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff );
+ setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
fill_profile_color();
}
@@ -141,20 +141,20 @@ void ProfileGraphicsView::wheelEvent(QWheelEvent* event)
if (!toolTip)
return;
- setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
- // Scale the view / do the zoom
+ // Scale the view / do the zoom
QPoint toolTipPos = mapFromScene(toolTip->pos());
- double scaleFactor = 1.15;
- if(event->delta() > 0 && zoomLevel <= 10) {
- scale(scaleFactor, scaleFactor);
+ double scaleFactor = 1.15;
+ if (event->delta() > 0 && zoomLevel <= 10) {
+ scale(scaleFactor, scaleFactor);
zoomLevel++;
- } else if (zoomLevel >= 0) {
- // Zooming out
- scale(1.0 / scaleFactor, 1.0 / scaleFactor);
+ } else if (zoomLevel >= 0) {
+ // Zooming out
+ scale(1.0 / scaleFactor, 1.0 / scaleFactor);
zoomLevel--;
- }
- toolTip->setPos(mapToScene(toolTipPos).x(), mapToScene(toolTipPos).y());
+ }
+ toolTip->setPos(mapToScene(toolTipPos).x(), mapToScene(toolTipPos).y());
}
void ProfileGraphicsView::mouseMoveEvent(QMouseEvent* event)
@@ -206,7 +206,7 @@ void ProfileGraphicsView::showEvent(QShowEvent* event)
// but the dive was not ploted.
// force a replot by modifying the dive
// hold by the view, and issuing a plot.
- if (dive){
+ if (dive) {
dive = 0;
plot(get_dive(selected_dive));
}
@@ -234,7 +234,7 @@ void ProfileGraphicsView::plot(struct dive *d)
dive = d;
diveDC = d ? dc : NULL;
- if(!isVisible() || !dive){
+ if (!isVisible() || !dive) {
return;
}
@@ -358,7 +358,7 @@ void ProfileGraphicsView::plot(struct dive *d)
QRectF r = scene()->itemsBoundingRect();
scene()->setSceneRect(r.x() - 15, r.y() -15, r.width() + 30, r.height() + 30);
- if(zoomLevel == 0){
+ if (zoomLevel == 0) {
fitInView(sceneRect());
}
}
@@ -430,7 +430,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->pn2));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->pn2 < prefs.pp_graphs.pn2_threshold){
+ if (entry->pn2 < prefs.pp_graphs.pn2_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->pn2));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
@@ -438,8 +438,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->pn2));
}
}
@@ -449,7 +448,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->pn2));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->pn2 >= prefs.pp_graphs.pn2_threshold){
+ if (entry->pn2 >= prefs.pp_graphs.pn2_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->pn2));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
@@ -457,8 +456,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->pn2));
}
}
@@ -471,7 +469,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->phe));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->phe < prefs.pp_graphs.phe_threshold){
+ if (entry->phe < prefs.pp_graphs.phe_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->phe));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
@@ -479,8 +477,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->phe));
}
}
@@ -490,7 +487,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->phe));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->phe >= prefs.pp_graphs.phe_threshold){
+ if (entry->phe >= prefs.pp_graphs.phe_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->phe));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
@@ -498,8 +495,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->phe));
}
}
@@ -510,7 +506,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->po2));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->po2 < prefs.pp_graphs.po2_threshold){
+ if (entry->po2 < prefs.pp_graphs.po2_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->po2));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
QPen pen(defaultPen);
@@ -518,8 +514,7 @@ void ProfileGraphicsView::plot_pp_gas_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->po2));
}
}
@@ -529,14 +524,13 @@ void ProfileGraphicsView::plot_pp_gas_profile()
from = QPointF(SCALEGC(entry->sec, entry->po2));
for (i = 1; i < pi->nr; i++) {
entry++;
- if (entry->po2 >= prefs.pp_graphs.po2_threshold){
+ if (entry->po2 >= prefs.pp_graphs.po2_threshold) {
to = QPointF(SCALEGC(entry->sec, entry->po2));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
item->setPen(QPen(c));
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(entry->sec, entry->po2));
}
}
@@ -806,7 +800,7 @@ void ProfileGraphicsView::plot_events(struct divecomputer *dc)
{
struct event *event = dc->events;
-// if (gc->printer){
+// if (gc->printer) {
// return;
// }
@@ -1130,7 +1124,7 @@ QGraphicsSimpleTextItem *ProfileGraphicsView::plot_text(text_render_options_t *t
item->setBrush(QBrush(profile_color[tro->color].first()));
item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
- if(!parent)
+ if (!parent)
scene()->addItem(item);
return item;
}
@@ -1168,8 +1162,7 @@ void ProfileGraphicsView::plot_temperature_profile()
item->setPen(pen);
scene()->addItem(item);
from = to;
- }
- else{
+ } else {
from = QPointF(SCALEGC(sec, mkelvin));
}
last = mkelvin;
@@ -1292,7 +1285,7 @@ void ToolTipItem::collapse()
void ToolTipItem::expand()
{
- if (!title){
+ if (!title) {
return;
}
@@ -1309,7 +1302,7 @@ void ToolTipItem::expand()
if (width < title->boundingRect().width() + SPACING*2)
width = title->boundingRect().width() + SPACING*2;
- if(height < ICON_SMALL)
+ if (height < ICON_SMALL)
height = ICON_SMALL;
nextRectangle.setWidth(width);
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index b8757b09a..715c81ebf 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -68,9 +68,9 @@ public:
protected:
void resizeEvent(QResizeEvent *event);
- void mouseMoveEvent(QMouseEvent* event);
- void wheelEvent(QWheelEvent* event);
- void showEvent(QShowEvent* event);
+ void mouseMoveEvent(QMouseEvent* event);
+ void wheelEvent(QWheelEvent* event);
+ void showEvent(QShowEvent* event);
private:
void plot_depth_profile();
diff --git a/qt-ui/starwidget.cpp b/qt-ui/starwidget.cpp
index c43ad1111..30c38808c 100644
--- a/qt-ui/starwidget.cpp
+++ b/qt-ui/starwidget.cpp
@@ -26,7 +26,7 @@ int StarWidget::currentStars() const
void StarWidget::mouseReleaseEvent(QMouseEvent* event)
{
- if (readOnly){
+ if (readOnly) {
return;
}
@@ -65,7 +65,7 @@ StarWidget::StarWidget(QWidget* parent, Qt::WindowFlags f):
QWidget(parent, f),
current(0)
{
- if(!activeStar){
+ if (!activeStar) {
activeStar = new QPixmap();
QSvgRenderer render(QString(":star"));
QPixmap renderedStar(IMG_SIZE, IMG_SIZE);
@@ -76,7 +76,7 @@ StarWidget::StarWidget(QWidget* parent, Qt::WindowFlags f):
render.render(&painter, QRectF(0, 0, IMG_SIZE, IMG_SIZE));
(*activeStar) = renderedStar;
}
- if(!inactiveStar){
+ if (!inactiveStar) {
inactiveStar = new QPixmap();
(*inactiveStar) = grayImage(activeStar);
}