diff options
48 files changed, 290 insertions, 290 deletions
diff --git a/android.cpp b/android.cpp index 4dfaccb07..93f26730b 100644 --- a/android.cpp +++ b/android.cpp @@ -18,8 +18,8 @@ const char *system_default_filename(void) { /* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */ QAndroidJniObject externalStorage = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;"); - QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" ); - QString system_default_filename = externalStorageAbsolute.toString()+"/subsurface.xml"; + QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod("getAbsolutePath", "()Ljava/lang/String;"); + QString system_default_filename = externalStorageAbsolute.toString() + "/subsurface.xml"; QAndroidJniEnvironment env; if (env->ExceptionCheck()) { // FIXME: Handle exception here. @@ -29,7 +29,7 @@ const char *system_default_filename(void) return strdup(system_default_filename.toUtf8().data()); } -int enumerate_devices (device_callback_t callback, void *userdata, int dc_type) +int enumerate_devices(device_callback_t callback, void *userdata, int dc_type) { /* FIXME: we need to enumerate in some other way on android */ /* qtserialport maybee? */ @@ -77,5 +77,4 @@ void subsurface_console_exit(void) { /* NOP */ } - } @@ -26,7 +26,7 @@ static inline int same_string(const char *a, const char *b) { - return !strcmp(a ? : "", b ? : ""); + return !strcmp(a ?: "", b ?: ""); } #include <libxml/tree.h> @@ -429,7 +429,7 @@ static inline struct dive *get_dive_by_uemis_diveid(uint32_t diveid, uint32_t de int i; struct dive *dive; - for_each_dive(i, dive) { + for_each_dive (i, dive) { struct divecomputer *dc = &dive->dc; do { if (dc->diveid == diveid && dc->deviceid == deviceid) @@ -444,12 +444,12 @@ static inline struct dive *get_dive_by_uniq_id(int id) int i; struct dive *dive = NULL; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (dive->id == id) break; } #ifdef DEBUG - if(dive == NULL){ + if (dive == NULL) { fprintf(stderr, "Invalid id %x passed to get_dive_by_diveid, try to fix the code\n", id); exit(1); } @@ -462,12 +462,12 @@ static inline int get_idx_by_uniq_id(int id) int i; struct dive *dive = NULL; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (dive->id == id) break; } #ifdef DEBUG - if(dive == NULL){ + if (dive == NULL) { fprintf(stderr, "Invalid id %x passed to get_dive_by_diveid, try to fix the code\n", id); exit(1); } @@ -508,7 +508,7 @@ extern int export_dives_xslt(const char *filename, const bool selected, const ch struct git_oid; struct git_repository; -#define dummy_git_repository ((git_repository *) 3ul) /* Random bogus pointer, not NULL */ +#define dummy_git_repository ((git_repository *)3ul) /* Random bogus pointer, not NULL */ extern struct git_repository *is_git_repository(const char *filename, const char **branchp); extern int git_save_dives(struct git_repository *, const char *, bool select_only); extern int git_load_dives(struct git_repository *, const char *); @@ -562,7 +562,7 @@ extern void copy_samples(struct dive *s, struct dive *d); extern void fill_default_cylinder(cylinder_t *cyl); extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx); extern void add_event(struct divecomputer *dc, int time, int type, int flags, int value, const char *name); -extern void remove_event(struct event* event); +extern void remove_event(struct event *event); extern void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration); extern int get_cylinder_index(struct dive *dive, struct event *ev); extern int nr_cylinders(struct dive *dive); @@ -693,7 +693,7 @@ extern double strtod_flags(const char *str, const char **ptr, unsigned int flags #define ascii_strtod(str, ptr) strtod_flags(str, ptr, STRTOD_ASCII) extern void set_save_userid_local(short value); -extern void set_userid(char* user_id); +extern void set_userid(char *user_id); #ifdef __cplusplus } diff --git a/divecomputer.cpp b/divecomputer.cpp index c714137a2..f427bd42c 100644 --- a/divecomputer.cpp +++ b/divecomputer.cpp @@ -41,7 +41,7 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const (nickName != b.nickName); } -const DiveComputerNode *DiveComputerList::getExact(const QString& m, uint32_t d) +const DiveComputerNode *DiveComputerList::getExact(const QString &m, uint32_t d) { for (QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it) if (it->deviceId == d) @@ -49,7 +49,7 @@ const DiveComputerNode *DiveComputerList::getExact(const QString& m, uint32_t d) return NULL; } -const DiveComputerNode *DiveComputerList::get(const QString& m) +const DiveComputerNode *DiveComputerList::get(const QString &m) { QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); if (it != dcMap.end()) @@ -57,7 +57,7 @@ const DiveComputerNode *DiveComputerList::get(const QString& m) return NULL; } -void DiveComputerList::addDC(const QString& m, uint32_t d, const QString& n, const QString& s,const QString& f) +void DiveComputerList::addDC(const QString &m, uint32_t d, const QString &n, const QString &s, const QString &f) { if (m.isEmpty() || d == 0) return; @@ -79,7 +79,7 @@ void DiveComputerList::addDC(const QString& m, uint32_t d, const QString& n, con dcMap.insert(m, newNode); } -void DiveComputerList::rmDC(const QString& m, uint32_t d) +void DiveComputerList::rmDC(const QString &m, uint32_t d) { const DiveComputerNode *existNode = this->getExact(m, d); dcMap.remove(m, *existNode); @@ -96,8 +96,8 @@ extern "C" bool compareDC(const DiveComputerNode &a, const DiveComputerNode &b) return a.deviceId < b.deviceId; } -extern "C" void call_for_each_dc(void *f, void (*callback)(void *, const char *, uint32_t, - const char *, const char *, const char *)) +extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t, + const char *, const char *, const char *)) { QList<DiveComputerNode> values = dcList.dcMap.values(); qSort(values.begin(), values.end(), compareDC); @@ -164,7 +164,7 @@ extern "C" void set_dc_nickname(struct dive *dive) struct divecomputer *dc; - for_each_dc(dive, dc) { + for_each_dc (dive, dc) { if (dc->model && *dc->model && dc->deviceid && !dcList.getExact(dc->model, dc->deviceid)) { // we don't have this one, yet diff --git a/divecomputer.h b/divecomputer.h index e515a6b06..54752abf7 100644 --- a/divecomputer.h +++ b/divecomputer.h @@ -23,12 +23,12 @@ class DiveComputerList { public: DiveComputerList(); ~DiveComputerList(); - const DiveComputerNode *getExact(const QString& m, uint32_t d); - const DiveComputerNode *get(const QString& m); - void addDC(const QString& m, uint32_t d,const QString& n = QString(),const QString& s = QString(), const QString& f = QString()); - void rmDC(const QString& m, uint32_t d); - DiveComputerNode matchDC(const QString& m, uint32_t d); - DiveComputerNode matchModel(const QString& m); + const DiveComputerNode *getExact(const QString &m, uint32_t d); + const DiveComputerNode *get(const QString &m); + void addDC(const QString &m, uint32_t d, const QString &n = QString(), const QString &s = QString(), const QString &f = QString()); + void rmDC(const QString &m, uint32_t d); + DiveComputerNode matchDC(const QString &m, uint32_t d); + DiveComputerNode matchModel(const QString &m); QMultiMap<QString, DiveComputerNode> dcMap; QMultiMap<QString, DiveComputerNode> dcWorkingMap; }; @@ -26,7 +26,7 @@ int main(int argc, char **argv) QStringList arguments = QCoreApplication::arguments(); bool dedicated_console = arguments.length() > 1 && - (arguments.at(1) == QString("--win32console")); + (arguments.at(1) == QString("--win32console")); subsurface_console_init(dedicated_console); for (i = 1; i < arguments.length(); i++) { @@ -80,7 +80,6 @@ int get_maxtime(struct plot_info *pi); int get_maxdepth(struct plot_info *pi); - #define SENSOR_PR 0 #define INTERPOLATED_PR 1 #define SENSOR_PRESSURE(_entry) (_entry)->pressure[SENSOR_PR] diff --git a/qt-gui.cpp b/qt-gui.cpp index 9d6dde45f..f342e20e1 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -391,12 +391,12 @@ QString get_dive_date_string(timestamp_t when) struct tm tm; utc_mkdate(when, &tm); return translate("gettextFromC", "%1, %2 %3, %4 %5:%6") - .arg(weekday(tm.tm_wday)) - .arg(monthname(tm.tm_mon)) - .arg(tm.tm_mday) - .arg(tm.tm_year + 1900) - .arg(tm.tm_hour, 2, 10, QChar('0')) - .arg(tm.tm_min, 2, 10, QChar('0')); + .arg(weekday(tm.tm_wday)) + .arg(monthname(tm.tm_mon)) + .arg(tm.tm_mday) + .arg(tm.tm_year + 1900) + .arg(tm.tm_hour, 2, 10, QChar('0')) + .arg(tm.tm_min, 2, 10, QChar('0')); } QString get_short_dive_date_string(timestamp_t when) @@ -404,11 +404,11 @@ QString get_short_dive_date_string(timestamp_t when) struct tm tm; utc_mkdate(when, &tm); return translate("gettextFromC", "%1 %2, %3\n%4:%5") - .arg(monthname(tm.tm_mon)) - .arg(tm.tm_mday) - .arg(tm.tm_year + 1900) - .arg(tm.tm_hour, 2, 10, QChar('0')) - .arg(tm.tm_min, 2, 10, QChar('0')); + .arg(monthname(tm.tm_mon)) + .arg(tm.tm_mday) + .arg(tm.tm_year + 1900) + .arg(tm.tm_hour, 2, 10, QChar('0')) + .arg(tm.tm_min, 2, 10, QChar('0')); } QString get_trip_date_string(timestamp_t when, int nr) @@ -417,11 +417,11 @@ QString get_trip_date_string(timestamp_t when, int nr) utc_mkdate(when, &tm); if (nr != 1) return translate("gettextFromC", "%1 %2 (%3 dives)") - .arg(monthname(tm.tm_mon)) - .arg(tm.tm_year + 1900) - .arg(nr); + .arg(monthname(tm.tm_mon)) + .arg(tm.tm_year + 1900) + .arg(nr); else return translate("gettextFromC", "%1 %2 (1 dive)") - .arg(monthname(tm.tm_mon)) - .arg(tm.tm_year + 1900); + .arg(monthname(tm.tm_mon)) + .arg(tm.tm_year + 1900); } diff --git a/qt-ui/completionmodels.cpp b/qt-ui/completionmodels.cpp index 30e69d26a..7d7f7cd2b 100644 --- a/qt-ui/completionmodels.cpp +++ b/qt-ui/completionmodels.cpp @@ -8,7 +8,7 @@ QStringList list; \ struct dive *dive; \ int i = 0; \ - for_each_dive(i, dive) \ + for_each_dive (i, dive) \ { \ QString buddy(dive->diveStructMember); \ if (!list.contains(buddy)) { \ @@ -24,10 +24,10 @@ QSet<QString> set; \ struct dive *dive; \ int i = 0; \ - for_each_dive(i, dive) \ + for_each_dive (i, dive) \ { \ QString buddy(dive->diveStructMember); \ - foreach(const QString &value, buddy.split(",", QString::SkipEmptyParts)) \ + foreach (const QString &value, buddy.split(",", QString::SkipEmptyParts)) \ { \ set.insert(value.trimmed()); \ } \ diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 0e022d1cf..49fdce127 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -123,7 +123,7 @@ void DiveListView::backupExpandedRows() void DiveListView::restoreExpandedRows() { setAnimated(false); - Q_FOREACH(const int & i, expandedRows) + Q_FOREACH (const int &i, expandedRows) setExpanded(model()->index(i, 0), true); setAnimated(true); } @@ -140,7 +140,7 @@ void DiveListView::rememberSelection() { selectedDives.clear(); QItemSelection selection = selectionModel()->selection(); - Q_FOREACH(const QModelIndex & index, selection.indexes()) { + Q_FOREACH (const QModelIndex &index, selection.indexes()) { if (index.column() != 0) // We only care about the dives, so, let's stick to rows and discard columns. continue; struct dive *d = (struct dive *)index.data(DiveTripModel::DIVE_ROLE).value<void *>(); @@ -152,18 +152,18 @@ void DiveListView::rememberSelection() void DiveListView::restoreSelection() { unselectDives(); - Q_FOREACH(dive_trip_t * trip, selectedDives.keys()) { + Q_FOREACH (dive_trip_t *trip, selectedDives.keys()) { QList<int> divesOnTrip = getDivesInTrip(trip); QList<int> selectedDivesOnTrip = selectedDives.values(trip); // Trip was not selected, let's select single-dives. if (trip == NULL || divesOnTrip.count() != selectedDivesOnTrip.count()) { - Q_FOREACH(int i, selectedDivesOnTrip) { + Q_FOREACH (int i, selectedDivesOnTrip) { selectDive(i); } } else { selectTrip(trip); - Q_FOREACH(int i, selectedDivesOnTrip) { + Q_FOREACH (int i, selectedDivesOnTrip) { selectDive(i); } } @@ -198,7 +198,7 @@ QList<dive_trip_t *> DiveListView::selectedTrips() { QModelIndexList indexes = selectionModel()->selectedRows(); QList<dive_trip_t *> ret; - Q_FOREACH(const QModelIndex & index, indexes) { + Q_FOREACH (const QModelIndex &index, indexes) { dive_trip_t *trip = static_cast<dive_trip_t *>(index.data(DiveTripModel::TRIP_ROLE).value<void *>()); if (!trip) continue; @@ -254,7 +254,7 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection) /* context for temp. variables. */ { int i = 0; struct dive *dive; - for_each_dive(i, dive) { + for_each_dive (i, dive) { dive->selected = newDiveSelection.contains(i) == true; if (firstSelectedDive == -1 && dive->selected) { firstSelectedDive = i; @@ -263,11 +263,11 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection) } } select_dive(firstSelectedDive); - Q_FOREACH(int i, newDiveSelection) { + Q_FOREACH (int i, newDiveSelection) { diveList.append(m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, i, 2, Qt::MatchRecursive).first()); } - Q_FOREACH(const QModelIndex & idx, diveList) { + Q_FOREACH (const QModelIndex &idx, diveList) { selectionModel()->select(idx, flags); if (idx.parent().isValid() && !isExpanded(idx.parent())) { expand(idx.parent()); @@ -401,7 +401,7 @@ void DiveListView::reloadHeaderActions() QString settingName = QString("showColumn%1").arg(i); QAction *a = new QAction(title, header()); bool showHeaderFirstRun = !( - i == DiveTripModel::MAXCNS || i == DiveTripModel::NITROX || i == DiveTripModel::OTU || i == DiveTripModel::TEMPERATURE || i == DiveTripModel::TOTALWEIGHT || i == DiveTripModel::SUIT || i == DiveTripModel::CYLINDER || i == DiveTripModel::SAC); + i == DiveTripModel::MAXCNS || i == DiveTripModel::NITROX || i == DiveTripModel::OTU || i == DiveTripModel::TEMPERATURE || i == DiveTripModel::TOTALWEIGHT || i == DiveTripModel::SUIT || i == DiveTripModel::CYLINDER || i == DiveTripModel::SAC); bool shown = s.value(settingName, showHeaderFirstRun).toBool(); a->setCheckable(true); a->setChecked(shown); @@ -450,7 +450,7 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection))); disconnect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex))); - Q_FOREACH(const QModelIndex & index, newDeselected.indexes()) { + Q_FOREACH (const QModelIndex &index, newDeselected.indexes()) { if (index.column() != 0) continue; const QAbstractItemModel *model = index.model(); @@ -468,7 +468,7 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS deselect_dive(get_divenr(dive)); } } - Q_FOREACH(const QModelIndex & index, newSelected.indexes()) { + Q_FOREACH (const QModelIndex &index, newSelected.indexes()) { if (index.column() != 0) continue; @@ -517,7 +517,7 @@ void DiveListView::mergeDives() int i; struct dive *dive, *maindive = NULL; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (dive->selected) { if (!can_merge(maindive, dive)) { maindive = dive; @@ -577,7 +577,7 @@ void DiveListView::removeFromTrip() //TODO: move this to C-code. int i; struct dive *d; - for_each_dive(i, d) { + for_each_dive (i, d) { if (d->selected) remove_dive_from_trip(d, false); } @@ -598,7 +598,7 @@ void DiveListView::newTripAbove() int idx; rememberSelection(); trip = create_and_hookup_trip_from_dive(d); - for_each_dive(idx, d) { + for_each_dive (idx, d) { if (d->selected) add_dive_to_trip(d, trip); } @@ -621,7 +621,7 @@ void DiveListView::addToTripAbove() void DiveListView::addToTrip(bool below) { - int delta = (currentOrder == Qt::AscendingOrder) ? -1 : +1; + int delta = (currentOrder == Qt::AscendingOrder) ? -1 : +1; struct dive *d = (struct dive *)contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void *>(); rememberSelection(); @@ -635,13 +635,13 @@ void DiveListView::addToTrip(bool below) if (d->selected) { // we are right-clicking on one of possibly many selected dive(s) // find the top selected dive, depending on the list order if (delta == 1) { - for_each_dive(idx, d) { + for_each_dive (idx, d) { if (d->selected) pd = d; } d = pd; // this way we have the chronologically last } else { - for_each_dive(idx, d) { + for_each_dive (idx, d) { if (d->selected) break; // now that's the chronologically first } @@ -656,7 +656,7 @@ void DiveListView::addToTrip(bool below) return; add_dive_to_trip(d, trip); if (d->selected) { // there are possibly other selected dives that we should add - for_each_dive(idx, d) { + for_each_dive (idx, d) { if (d->selected) add_dive_to_trip(d, trip); } @@ -675,7 +675,7 @@ void DiveListView::markDiveInvalid() struct dive *d = (struct dive *)contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void *>(); if (!d) return; - for_each_dive(i, d) { + for_each_dive (i, d) { if (!d->selected) continue; //TODO: this should be done in the future @@ -865,10 +865,10 @@ void DiveListView::loadImages() imagetime += shiftDialog.amount(); // TODO: this should be cached and passed to the C-function int j = 0; struct dive *dive; - for_each_dive(j, dive) { + for_each_dive (j, dive) { if (!dive->selected) continue; - for_each_dc(dive, dc) { + for_each_dc (dive, dc) { when = dc->when ? dc->when : dive->when; duration_s = dc->duration.seconds ? dc->duration.seconds : dive->duration.seconds; if (when - 3600 < imagetime && when + duration_s + 3600 > imagetime) { diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 06d1757c9..7f77cef2f 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -8,8 +8,7 @@ #include "subsurfacewebservices.h" #include "worldmap-save.h" -DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : - QDialog(parent), +DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent), ui(new Ui::DiveLogExportDialog) { ui->setupUi(this); @@ -43,7 +42,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() return; } else if (ui->exportWorldMap->isChecked()) { filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(), - tr("HTML files (*.html)")); + tr("HTML files (*.html)")); if (!filename.isNull() && !filename.isEmpty()) export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked()); return; diff --git a/qt-ui/divelogexportdialog.h b/qt-ui/divelogexportdialog.h index 9e2bed25d..998df4971 100644 --- a/qt-ui/divelogexportdialog.h +++ b/qt-ui/divelogexportdialog.h @@ -4,18 +4,18 @@ #include <QDialog> namespace Ui { -class DiveLogExportDialog; + class DiveLogExportDialog; } -class DiveLogExportDialog : public QDialog -{ +class DiveLogExportDialog : public QDialog { Q_OBJECT public: explicit DiveLogExportDialog(QWidget *parent = 0); ~DiveLogExportDialog(); -private slots: +private +slots: void on_buttonBox_accepted(); private: diff --git a/qt-ui/divelogimportdialog.h b/qt-ui/divelogimportdialog.h index 4c499b03e..fb44faa94 100644 --- a/qt-ui/divelogimportdialog.h +++ b/qt-ui/divelogimportdialog.h @@ -6,8 +6,7 @@ #include "../dive.h" #include "../divelist.h" -namespace Ui -{ +namespace Ui { class DiveLogImportDialog; } diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index c2d74173c..d081d0d96 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -129,7 +129,7 @@ void DivePlannerGraphics::settingsChanged() void DivePlannerGraphics::keyDownAction() { #if 0 - Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { + Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { int row = handles.indexOf(handler); divedatapoint dp = plannerModel->at(row); @@ -146,7 +146,7 @@ void DivePlannerGraphics::keyDownAction() void DivePlannerGraphics::keyUpAction() { #if 0 - Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { + Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { int row = handles.indexOf(handler); divedatapoint dp = plannerModel->at(row); @@ -165,7 +165,7 @@ void DivePlannerGraphics::keyUpAction() void DivePlannerGraphics::keyLeftAction() { #if 0 - Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { + Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { int row = handles.indexOf(handler); divedatapoint dp = plannerModel->at(row); @@ -177,7 +177,7 @@ void DivePlannerGraphics::keyLeftAction() // maybe this is a good place for a 'goto'? double xpos = timeLine->posAtValue((dp.time - 60) / 60); bool nextStep = false; - Q_FOREACH(DiveHandler * h, handles) { + Q_FOREACH (DiveHandler *h, handles) { if (IS_FP_SAME(h->pos().x(), xpos)) { nextStep = true; break; @@ -196,7 +196,7 @@ void DivePlannerGraphics::keyLeftAction() void DivePlannerGraphics::keyRightAction() { #if 0 - Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { + Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { int row = handles.indexOf(handler); divedatapoint dp = plannerModel->at(row); @@ -207,7 +207,7 @@ void DivePlannerGraphics::keyRightAction() // maybe this is a good place for a 'goto'? double xpos = timeLine->posAtValue((dp.time + 60) / 60); bool nextStep = false; - Q_FOREACH(DiveHandler * h, handles) { + Q_FOREACH (DiveHandler *h, handles) { if (IS_FP_SAME(h->pos().x(), xpos)) { nextStep = true; break; @@ -229,7 +229,7 @@ void DivePlannerGraphics::keyDeleteAction() int selCount = scene()->selectedItems().count(); if (selCount) { QVector<int> selectedIndexes; - Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { + Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { selectedIndexes.push_back(handles.indexOf(handler)); } @@ -301,7 +301,7 @@ void DivePlannerGraphics::decreaseDepth() if (depthLine->maximum() - M_OR_FT(10, 30) < MIN_DEPTH) return; - Q_FOREACH(DiveHandler * d, handles) { + Q_FOREACH (DiveHandler *d, handles) { if (depthLine->valueAt(d->pos()) > depthLine->maximum() - M_OR_FT(10, 30)) { QMessageBox::warning(MainWindow::instance(), tr("Handler Position Error"), @@ -519,7 +519,7 @@ void DivePlannerGraphics::mousePressEvent(QMouseEvent *event) QPointF mappedPos = mapToScene(event->pos()); if (event->button() == Qt::LeftButton) { - Q_FOREACH(QGraphicsItem * item, scene()->items(mappedPos, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, transform())) { + Q_FOREACH (QGraphicsItem *item, scene()->items(mappedPos, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, transform())) { if (DiveHandler *h = qgraphicsitem_cast<DiveHandler *>(item)) { activeDraggedHandler = h; activeDraggedHandler->setBrush(Qt::red); @@ -1068,7 +1068,7 @@ void DivePlannerPointsModel::remove(const QModelIndex &index) endRemoveRows(); } -struct diveplan& DivePlannerPointsModel::getDiveplan() +struct diveplan &DivePlannerPointsModel::getDiveplan() { return diveplan; } @@ -1330,7 +1330,7 @@ ExpanderGraphics::ExpanderGraphics(QGraphicsItem *parent) : QGraphicsRectItem(pa //I need to bottom align the items, I need to make the 0,0 ( orgin ) to be // the bottom of this item, so shift everything up. QRectF r = childrenBoundingRect(); - Q_FOREACH(QGraphicsItem * i, childItems()) { + Q_FOREACH (QGraphicsItem *i, childItems()) { i->setPos(i->pos().x(), i->pos().y() - r.height()); } setScale(0.7); diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 24f01c6e5..0166e433b 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -55,7 +55,7 @@ public: void editStop(int row, divedatapoint newData); divedatapoint at(int row); int size(); - struct diveplan& getDiveplan(); + struct diveplan &getDiveplan(); QStringList &getGasList(); QVector<QPair<int, int> > collectGases(dive *d); int lastEnteredPoint(); diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 9760d1107..681b0d20c 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -34,8 +34,7 @@ struct mydescriptor { unsigned int model; }; -namespace DownloadFromDcGlobal -{ +namespace DownloadFromDcGlobal { const char *err_string; }; @@ -395,7 +394,7 @@ void DownloadFromDCWidget::onDownloadThreadFinished() idx = get_idx_by_uniq_id(uniqId); MainWindow::instance()->dive_list()->selectDive(idx, true); } - } else if (currentState == CANCELLING || currentState == CANCELLED){ + } else if (currentState == CANCELLING || currentState == CANCELLED) { if (import_thread_cancelled) { // walk backwards so we don't keep moving the dives // down in the dive_table diff --git a/qt-ui/exif.cpp b/qt-ui/exif.cpp index 82601577f..1aee47acb 100644 --- a/qt-ui/exif.cpp +++ b/qt-ui/exif.cpp @@ -34,8 +34,7 @@ using std::string; -namespace -{ +namespace { // IF Entry struct IFEntry { // Raw fields @@ -459,15 +458,15 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len) // GPS latitude if (format == 5 && length == 3) { this->GeoLocation.LatComponents.degrees = - parseEXIFRational(buf + data + tiff_header_start, alignIntel); + parseEXIFRational(buf + data + tiff_header_start, alignIntel); this->GeoLocation.LatComponents.minutes = - parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); + parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); this->GeoLocation.LatComponents.seconds = - parseEXIFRational(buf + data + tiff_header_start + 16, alignIntel); + parseEXIFRational(buf + data + tiff_header_start + 16, alignIntel); this->GeoLocation.Latitude = - this->GeoLocation.LatComponents.degrees + - this->GeoLocation.LatComponents.minutes / 60 + - this->GeoLocation.LatComponents.seconds / 3600; + this->GeoLocation.LatComponents.degrees + + this->GeoLocation.LatComponents.minutes / 60 + + this->GeoLocation.LatComponents.seconds / 3600; if ('S' == this->GeoLocation.LatComponents.direction) this->GeoLocation.Latitude = -this->GeoLocation.Latitude; } @@ -484,15 +483,15 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len) // GPS longitude if (format == 5 && length == 3) { this->GeoLocation.LonComponents.degrees = - parseEXIFRational(buf + data + tiff_header_start, alignIntel); + parseEXIFRational(buf + data + tiff_header_start, alignIntel); this->GeoLocation.LonComponents.minutes = - parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); + parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); this->GeoLocation.LonComponents.seconds = - parseEXIFRational(buf + data + tiff_header_start + 16, alignIntel); + parseEXIFRational(buf + data + tiff_header_start + 16, alignIntel); this->GeoLocation.Longitude = - this->GeoLocation.LonComponents.degrees + - this->GeoLocation.LonComponents.minutes / 60 + - this->GeoLocation.LonComponents.seconds / 3600; + this->GeoLocation.LonComponents.degrees + + this->GeoLocation.LonComponents.minutes / 60 + + this->GeoLocation.LonComponents.seconds / 3600; if ('W' == this->GeoLocation.LonComponents.direction) this->GeoLocation.Longitude = -this->GeoLocation.Longitude; } @@ -509,7 +508,7 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len) // GPS altitude reference if (format == 5) { this->GeoLocation.Altitude = - parseEXIFRational(buf + data + tiff_header_start, alignIntel); + parseEXIFRational(buf + data + tiff_header_start, alignIntel); if (1 == this->GeoLocation.AltitudeRef) this->GeoLocation.Altitude = -this->GeoLocation.Altitude; } diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index d24a44791..8d234194e 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -64,7 +64,7 @@ GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent), setProjection(Marble::Spherical); setAnimationsEnabled(true); - Q_FOREACH(AbstractFloatItem * i, floatItems()) { + Q_FOREACH (AbstractFloatItem *i, floatItems()) { i->setVisible(false); } @@ -142,7 +142,7 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit) struct dive *dive; bool clear = !(QApplication::keyboardModifiers() & Qt::ControlModifier); QList<int> selectedDiveIds; - for_each_dive(idx, dive) { + for_each_dive (idx, dive) { long lat_diff, lon_diff; if (!dive_has_gps_location(dive)) continue; @@ -175,7 +175,7 @@ void GlobeGPS::repopulateLabels() int idx = 0; struct dive *dive; - for_each_dive(idx, dive) { + for_each_dive (idx, dive) { if (dive_has_gps_location(dive)) { GeoDataPlacemark *place = new GeoDataPlacemark(dive->location); place->setCoordinate(dive->longitude.udeg / 1000000.0, dive->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree); @@ -211,8 +211,7 @@ void GlobeGPS::centerOnCurrentDive() { struct dive *dive = current_dive; // dive has changed, if we had the 'editingDive', hide it. - if (messageWidget->isVisible() - && (!dive || dive_has_gps_location(dive) || amount_selected != 1 )) + if (messageWidget->isVisible() && (!dive || dive_has_gps_location(dive) || amount_selected != 1)) messageWidget->hide(); editingDiveLocation = false; @@ -222,8 +221,7 @@ void GlobeGPS::centerOnCurrentDive() qreal longitude = dive->longitude.udeg / 1000000.0; qreal latitude = dive->latitude.udeg / 1000000.0; - if ((!dive_has_gps_location(dive) || MainWindow::instance()->information()->isEditing()) - && amount_selected == 1) { + if ((!dive_has_gps_location(dive) || MainWindow::instance()->information()->isEditing()) && amount_selected == 1) { prepareForGetDiveCoordinates(); return; } @@ -261,7 +259,7 @@ void GlobeGPS::zoomOutForNoGPS() // this is called if the dive has no GPS location. // zoom out quite a bit to show the globe and remember that the next time // we show a dive with GPS location we need to zoom in again - if(fixZoomTimer->isActive()) + if (fixZoomTimer->isActive()) fixZoomTimer->stop(); setZoom(1200, Marble::Automatic); if (!needResetZoom) { @@ -300,7 +298,7 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U // but we keep the code here that changes the coordinates for each selected dive int i; struct dive *dive; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (!dive->selected) continue; dive->latitude.udeg = lrint(lat * 1000000.0); @@ -341,10 +339,23 @@ void GlobeGPS::resizeEvent(QResizeEvent *event) } #else -GlobeGPS::GlobeGPS(QWidget* parent) { setText("MARBLE DISABLED AT BUILD TIME"); } -void GlobeGPS::repopulateLabels() {} -void GlobeGPS::centerOnCurrentDive() {} -bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) {} -void GlobeGPS::prepareForGetDiveCoordinates() {} -void GlobeGPS::reload() {} +GlobeGPS::GlobeGPS(QWidget *parent) +{ + setText("MARBLE DISABLED AT BUILD TIME"); +} +void GlobeGPS::repopulateLabels() +{ +} +void GlobeGPS::centerOnCurrentDive() +{ +} +bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) +{ +} +void GlobeGPS::prepareForGetDiveCoordinates() +{ +} +void GlobeGPS::reload() +{ +} #endif diff --git a/qt-ui/globe.h b/qt-ui/globe.h index 0f68f7350..c40eefc46 100644 --- a/qt-ui/globe.h +++ b/qt-ui/globe.h @@ -55,8 +55,9 @@ public: void reload(); void repopulateLabels(); void centerOnCurrentDive(); - bool eventFilter(QObject*, QEvent*); -public slots: + bool eventFilter(QObject *, QEvent *); +public +slots: void prepareForGetDiveCoordinates(); }; diff --git a/qt-ui/groupedlineedit.cpp b/qt-ui/groupedlineedit.cpp index 517623119..4ba6621e6 100644 --- a/qt-ui/groupedlineedit.cpp +++ b/qt-ui/groupedlineedit.cpp @@ -108,7 +108,7 @@ QStringList GroupedLineEdit::getBlockStringList() { QStringList retList; Private::Block block; - foreach(block, d->blocks) + foreach (block, d->blocks) retList.append(block.text); return retList; } @@ -149,10 +149,10 @@ void GroupedLineEdit::removeAllBlocks() QSize GroupedLineEdit::sizeHint() const { QSize rs( - 40, - document()->findBlock(0).layout()->lineAt(0).height() + - document()->documentMargin() * 2 + - frameWidth() * 2); + 40, + document()->findBlock(0).layout()->lineAt(0).height() + + document()->documentMargin() * 2 + + frameWidth() * 2); return rs; } @@ -189,15 +189,15 @@ void GroupedLineEdit::paintEvent(QPaintEvent *e) QVectorIterator<QColor> i(d->colors); i.toFront(); - foreach(const Private::Block & block, d->blocks) { + foreach (const Private::Block &block, d->blocks) { qreal start_x = line.cursorToX(block.start, QTextLine::Trailing); qreal end_x = line.cursorToX(block.end + 1, QTextLine::Leading); QPainterPath path; QRectF rectangle( - start_x - 1.0 - double(horizontalScrollBar()->value()), - 1.0, - end_x - start_x + 2.0, - double(viewport()->height() - 2)); + start_x - 1.0 - double(horizontalScrollBar()->value()), + 1.0, + end_x - start_x + 2.0, + double(viewport()->height() - 2)); if (!i.hasNext()) i.toFront(); path.addRoundedRect(rectangle, 5.0, 5.0); diff --git a/qt-ui/kmessagewidget.cpp b/qt-ui/kmessagewidget.cpp index c21dea867..2f9ac6870 100644 --- a/qt-ui/kmessagewidget.cpp +++ b/qt-ui/kmessagewidget.cpp @@ -74,7 +74,7 @@ void KMessageWidgetPrivate::createLayout() qDeleteAll(buttons); buttons.clear(); - Q_FOREACH(QAction * action, q->actions()) { + Q_FOREACH (QAction *action, q->actions()) { QToolButton *button = new QToolButton(content); button->setDefaultAction(action); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); @@ -94,7 +94,7 @@ void KMessageWidgetPrivate::createLayout() QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); - Q_FOREACH(QToolButton * button, buttons) { + Q_FOREACH (QToolButton *button, buttons) { // For some reason, calling show() is necessary if wordwrap is true, // otherwise the buttons do not show up. It is not needed if // wordwrap is false. @@ -108,7 +108,7 @@ void KMessageWidgetPrivate::createLayout() layout->addWidget(iconLabel); layout->addWidget(textLabel); - Q_FOREACH(QToolButton * button, buttons) { + Q_FOREACH (QToolButton *button, buttons) { layout->addWidget(button); } @@ -238,7 +238,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type) bg2 = bg1.darker(110); border = bg2.darker(110); d->content->setStyleSheet( - QString(".QFrame {" + QString(".QFrame {" "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," " stop: 0 %1," " stop: 0.1 %2," @@ -248,16 +248,16 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type) "margin: %5px;" "}" ".QLabel { color: %6; }").arg(bg0.name()) - .arg(bg1.name()) - .arg(bg2.name()) - .arg(border.name()) - /* + .arg(bg1.name()) + .arg(bg2.name()) + .arg(border.name()) + /* DefaultFrameWidth returns the size of the external margin + border width. We know our border is 1px, so we subtract this from the frame normal QStyle FrameWidth to get our margin */ - .arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this) - 1) - .arg(fg.name())); + .arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this) - 1) + .arg(fg.name())); } QSize KMessageWidget::sizeHint() const diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2fd07878b..2bb261448 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -70,7 +70,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.tagWidget->installEventFilter(this); QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children(); - Q_FOREACH(QObject * obj, statisticsTabWidgets) { + Q_FOREACH (QObject *obj, statisticsTabWidgets) { QLabel *label = qobject_cast<QLabel *>(obj); if (label) label->setAlignment(Qt::AlignHCenter); @@ -136,7 +136,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," " stop: 0 #E0E0E0, stop: 1 #FFFFFF);" "}"); - Q_FOREACH(QGroupBox * box, findChildren<QGroupBox *>()) { + Q_FOREACH (QGroupBox *box, findChildren<QGroupBox *>()) { box->setStyleSheet(gnomeCss); } } @@ -271,7 +271,7 @@ void MainTab::enableEdition(EditMode newEditMode) // We may be editing one or more dives here. backup everything. struct dive *mydive; int i; - for_each_dive(i, mydive) { + for_each_dive (i, mydive) { if (!mydive->selected) continue; @@ -667,7 +667,7 @@ void MainTab::acceptChanges() ui.coordinates->text().trimmed().isEmpty())) { struct dive *dive; int i = 0; - for_each_dive(i, dive) { + for_each_dive (i, dive) { QString location(dive->location); if (location == ui.location->text() && (dive->latitude.udeg || dive->longitude.udeg)) { @@ -691,7 +691,7 @@ void MainTab::acceptChanges() DivePlannerPointsModel::instance()->copyCylinders(curr); } else if (editMode != ADD && cylindersModel->changed) { mark_divelist_changed(true); - Q_FOREACH(dive * d, notesBackup.keys()) { + Q_FOREACH (dive *d, notesBackup.keys()) { for (int i = 0; i < MAX_CYLINDERS; i++) { if (notesBackup.keys().count() > 1) // only copy the cylinder type, none of the other values @@ -705,7 +705,7 @@ void MainTab::acceptChanges() if (weightModel->changed) { mark_divelist_changed(true); - Q_FOREACH(dive * d, notesBackup.keys()) { + Q_FOREACH (dive *d, notesBackup.keys()) { for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { d->weightsystem[i] = multiEditEquipmentPlaceholder.weightsystem[i]; } @@ -730,7 +730,7 @@ void MainTab::acceptChanges() } // each dive that was selected might have had the temperatures in its active divecomputer changed // so re-populate the temperatures - easiest way to do this is by calling fixup_dive - Q_FOREACH(dive * d, notesBackup.keys()) { + Q_FOREACH (dive *d, notesBackup.keys()) { if (d) fixup_dive(d); } @@ -747,7 +747,7 @@ void MainTab::acceptChanges() // and then clear that flag out on the other side of the sort_table() d->selected = true; sort_table(&dive_table); - for_each_dive(rememberSelected, d) { + for_each_dive (rememberSelected, d) { if (d->selected) { d->selected = false; break; @@ -939,7 +939,7 @@ void MainTab::on_watertemp_textChanged(const QString &text) validate_temp_field(ui.watertemp, text); } -void MainTab::validate_temp_field(QLineEdit *tempField,const QString &text) +void MainTab::validate_temp_field(QLineEdit *tempField, const QString &text) { static bool missing_unit = false; static bool missing_precision = false; @@ -981,11 +981,11 @@ void MainTab::on_dateTimeEdit_dateTimeChanged(const QDateTime &datetime) void MainTab::saveTags() { EDIT_SELECTED_DIVES( - QString tag; - taglist_free(mydive->tag_list); - mydive->tag_list = NULL; - foreach(tag, ui.tagWidget->getBlockStringList()) - taglist_add_tag(&mydive->tag_list, tag.toUtf8().data());); + QString tag; + taglist_free(mydive->tag_list); + mydive->tag_list = NULL; + foreach (tag, ui.tagWidget->getBlockStringList()) + taglist_add_tag(&mydive->tag_list, tag.toUtf8().data());); } void MainTab::on_tagWidget_textChanged() diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 939e387d2..90d3c49ef 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -85,7 +85,7 @@ slots: void on_notes_textChanged(); void on_airtemp_textChanged(const QString &text); void on_watertemp_textChanged(const QString &text); - void validate_temp_field(QLineEdit *tempField,const QString &text); + void validate_temp_field(QLineEdit *tempField, const QString &text); void on_dateTimeEdit_dateTimeChanged(const QDateTime &datetime); void on_rating_valueChanged(int value); void on_visibility_valueChanged(int value); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 9b00db2f1..6cb318b07 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -196,7 +196,7 @@ void MainWindow::on_actionSaveAs_triggered() file_save_as(); } -ProfileWidget2* MainWindow::graphics() const +ProfileWidget2 *MainWindow::graphics() const { return ui.newProfile; } @@ -314,8 +314,8 @@ void MainWindow::on_actionDivePlanner_triggered() DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->clear(); CylindersModel::instance()->clear(); - for_each_dive(i,dive) { - if(dive->selected){ + for_each_dive (i, dive) { + if (dive->selected) { DivePlannerPointsModel::instance()->copyCylindersFrom(dive); CylindersModel::instance()->copyFromDive(dive); break; @@ -443,11 +443,11 @@ void MainWindow::on_actionYearlyStatistics_triggered() yearlyStats->setMinimumWidth(600); yearlyStats->setWindowTitle(tr("Yearly Statistics")); yearlyStats->setWindowIcon(QIcon(":subsurface-icon")); - QShortcut* closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), yearlyStats); + QShortcut *closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), yearlyStats); connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close())); closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), yearlyStats); connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close())); - QShortcut* quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), yearlyStats); + QShortcut *quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), yearlyStats); connect(quitKey, SIGNAL(activated()), this, SLOT(close())); } /* problem here is that without more MainWindow variables or a separate YearlyStatistics @@ -854,7 +854,7 @@ void MainWindow::addRecentFile(const QStringList &newFiles) } } - foreach(const QString & file, newFiles) { + foreach (const QString &file, newFiles) { int index = files.indexOf(file); if (index >= 0) { @@ -862,7 +862,7 @@ void MainWindow::addRecentFile(const QStringList &newFiles) } } - foreach(const QString & file, newFiles) { + foreach (const QString &file, newFiles) { if (QFile::exists(file)) { files.prepend(file); } @@ -910,7 +910,7 @@ void MainWindow::removeRecentFile(QStringList failedFiles) } } - foreach(QString file, failedFiles) + foreach (QString file, failedFiles) files.removeAll(file); for (int c = 1; c <= 4; c++) { diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 9073ac158..d06c6621f 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -171,7 +171,7 @@ bool ComboBoxDelegate::eventFilter(QObject *object, QEvent *event) QKeyEvent *ev = static_cast<QKeyEvent *>(event); if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) { currCombo.ignoreSelection = true; - if (!currCombo.comboEditor->completer()->popup()->isVisible()){ + if (!currCombo.comboEditor->completer()->popup()->isVisible()) { currCombo.comboEditor->showPopup(); return true; } diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 722ac328d..dc9a7189a 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -68,7 +68,7 @@ CylindersModel::CylindersModel(QObject *parent) : current(0), rows(0) // enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH}; setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%") #ifdef ENABLE_PLANNER - << tr("Switch at") + << tr("Switch at") #endif ); } @@ -364,11 +364,10 @@ void CylindersModel::remove(const QModelIndex &index) cylinder_t *cyl = ¤t->cylinder[index.row()]; if ((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING && DivePlannerPointsModel::instance()->tankInUse(cyl->gasmix.o2.permille, cyl->gasmix.he.permille)) || - (DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING && cyl->used)) - { + (DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING && cyl->used)) { QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT( - tr("Cylinder cannot be removed"), - tr("This gas in use. Only cylinders that are not used in the dive can be removed.")), + tr("Cylinder cannot be removed"), + tr("This gas in use. Only cylinders that are not used in the dive can be removed.")), QMessageBox::Ok); return; } @@ -1199,7 +1198,7 @@ bool DiveItem::setData(const QModelIndex &index, const QVariant &value, int role int i; struct dive *d; - for_each_dive(i, d) { + for_each_dive (i, d) { if (d->number == v) return false; } @@ -2056,7 +2055,7 @@ LanguageModel::LanguageModel(QObject *parent) : QAbstractListModel(parent) QSettings s; QDir d(getSubsurfaceDataPath("translations")); QStringList result = d.entryList(); - Q_FOREACH(const QString & s, result) { + Q_FOREACH (const QString &s, result) { if (s.startsWith("subsurface_") && s.endsWith(".qm")) { languages.push_back((s == "subsurface_source.qm") ? "English" : s); } diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 47f8541db..768275d26 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -236,7 +236,7 @@ void PreferencesDialog::syncSettings() // Animation s.beginGroup("Animations"); - s.setValue("animation_speed",ui.velocitySlider->value()); + s.setValue("animation_speed", ui.velocitySlider->value()); s.endGroup(); loadSettings(); diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp index c30ff9cd1..159b51822 100644 --- a/qt-ui/printlayout.cpp +++ b/qt-ui/printlayout.cpp @@ -98,7 +98,7 @@ int PrintLayout::estimateTotalDives() const { int total = 0, i = 0; struct dive *dive; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (!dive->selected && printOptions->print_selected) continue; total++; @@ -168,7 +168,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) yOffsetTable = scaledH - tableH; // plot the dives at specific rows and columns on the page - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (!dive->selected && printOptions->print_selected) continue; if (col == divesPerColumn) { @@ -183,7 +183,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) // draw a profile painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile); - profile->plotDives(QList<struct dive*>() << dive); + profile->plotDives(QList<struct dive *>() << dive); profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT)); painter.setTransform(origTransform); @@ -202,7 +202,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) profile->setFrameStyle(profileFrameStyle); profile->setPrintMode(false); profile->resize(originalSize); - profile->plotDives(QList<struct dive*>() << current_dive); + profile->plotDives(QList<struct dive *>() << current_dive); } /* we create a table that has a fixed height, but can stretch to fit certain width */ @@ -309,7 +309,7 @@ void PrintLayout::printTable() addTablePrintHeadingRow(&model, row); // add one heading row row++; progress = 0; - for_each_dive(i, dive) { + for_each_dive (i, dive) { if (!dive->selected && printOptions->print_selected) continue; addTablePrintDataRow(&model, row, dive); 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: diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index b34f74c50..99e0ba362 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -171,10 +171,10 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) } } -void ShiftTimesDialog::showEvent(QShowEvent * event) +void ShiftTimesDialog::showEvent(QShowEvent *event) { ui.timeEdit->setTime(QTime(0, 0, 0, 0)); - when = get_times();//get time of first selected dive + when = get_times(); //get time of first selected dive ui.currentTime->setText(get_dive_date_string(when)); ui.shiftedTime->setText(get_dive_date_string(when)); } @@ -187,7 +187,7 @@ void ShiftTimesDialog::changeTime() if (ui.backwards->isChecked()) amount *= -1; - ui.shiftedTime->setText (get_dive_date_string(amount+when)); + ui.shiftedTime->setText(get_dive_date_string(amount + when)); } ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent) diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index aa82e4a29..cecb52815 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -55,11 +55,11 @@ class ShiftTimesDialog : public QDialog { Q_OBJECT public: static ShiftTimesDialog *instance(); - void showEvent ( QShowEvent * event ); + void showEvent(QShowEvent *event); private slots: void buttonClicked(QAbstractButton *button); - void changeTime (); + void changeTime(); private: explicit ShiftTimesDialog(QWidget *parent); diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index fb4ec2c90..c430deec6 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -49,7 +49,7 @@ static bool merge_locations_into_dives(void) sort_table(&gps_location_table); - for_each_gps_location(i, gpsfix) { + for_each_gps_location (i, gpsfix) { if (is_automatic_fix(gpsfix)) { dive = find_dive_including(gpsfix->when); if (dive && !dive_has_gps_location(dive)) { @@ -135,7 +135,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, /* walk the dive list in chronological order */ int i; struct dive *dive; - for_each_dive(i, dive) { + for_each_dive (i, dive) { FILE *f; char filename[PATH_MAX]; int streamsize; @@ -526,8 +526,8 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { result.errorCondition = invalidXmlError; result.errorDetails = - DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") - .arg(reader.name().toString()); + DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") + .arg(reader.name().toString()); goto out; } @@ -580,8 +580,8 @@ out: // if there was an XML error, overwrite the result or other error conditions result.errorCondition = invalidXmlError; result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2") - .arg(reader.lineNumber()) - .arg(reader.errorString()); + .arg(reader.lineNumber()) + .arg(reader.errorString()); } return result; } diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp index 432aea923..8c45dceec 100644 --- a/qt-ui/tagwidget.cpp +++ b/qt-ui/tagwidget.cpp @@ -138,13 +138,13 @@ void TagWidget::reparse() } } -void TagWidget::completionSelected(const QString& completion) +void TagWidget::completionSelected(const QString &completion) { completionHighlighted(completion); emit textChanged(); } -void TagWidget::completionHighlighted(const QString& completion) +void TagWidget::completionHighlighted(const QString &completion) { QPair<int, int> pos = getCursorTagPosition(); setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion)); @@ -158,7 +158,7 @@ void TagWidget::setCursorPosition(int position) blockSignals(false); } -void TagWidget::setText(const QString& text) +void TagWidget::setText(const QString &text) { blockSignals(true); GroupedLineEdit::setText(text); @@ -185,7 +185,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e) setText(text().remove(pos.first, pos.second - pos.first)); setCursorPosition(pos.first); } - popup= m_completer->popup(); + popup = m_completer->popup(); if (popup) popup->hide(); return; @@ -203,8 +203,8 @@ void TagWidget::keyPressEvent(QKeyEvent *e) } finishedTag = true; } - if (e->key() == Qt::Key_Tab && lastFinishedTag) { // if we already end in comma, go to next/prev field - MainWindow::instance()->information()->nextInputField(e); // by sending the key event to the MainTab widget + if (e->key() == Qt::Key_Tab && lastFinishedTag) { // if we already end in comma, go to next/prev field + MainWindow::instance()->information()->nextInputField(e); // by sending the key event to the MainTab widget } else if (e->key() == Qt::Key_Tab || e->key() == Qt::Key_Return) { // otherwise let's pretend this is a comma instead QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(",")); GroupedLineEdit::keyPressEvent(&fakeEvent); diff --git a/qt-ui/tagwidget.h b/qt-ui/tagwidget.h index 003e9283d..08984f712 100644 --- a/qt-ui/tagwidget.h +++ b/qt-ui/tagwidget.h @@ -12,15 +12,15 @@ public: void setCompleter(QCompleter *completer); QPair<int, int> getCursorTagPosition(); void highlight(); - void setText(const QString& text); + void setText(const QString &text); void clear(); void setCursorPosition(int position); void wheelEvent(QWheelEvent *event); public slots: void reparse(); - void completionSelected(const QString& text); - void completionHighlighted(const QString& text); + void completionSelected(const QString &text); + void completionHighlighted(const QString &text); protected: void keyPressEvent(QKeyEvent *e); diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp index bcf58088d..75f454795 100644 --- a/qt-ui/updatemanager.cpp +++ b/qt-ui/updatemanager.cpp @@ -4,11 +4,10 @@ #include "subsurfacewebservices.h" #include "ssrf-version.h" -UpdateManager::UpdateManager(QObject *parent) : - QObject(parent) +UpdateManager::UpdateManager(QObject *parent) : QObject(parent) { manager = SubsurfaceWebServices::manager(); - connect (manager, SIGNAL(finished(QNetworkReply*)), SLOT(requestReceived(QNetworkReply*))); + connect(manager, SIGNAL(finished(QNetworkReply *)), SLOT(requestReceived(QNetworkReply *))); } void UpdateManager::checkForUpdates() diff --git a/qt-ui/updatemanager.h b/qt-ui/updatemanager.h index 18b47cfde..561c53d0b 100644 --- a/qt-ui/updatemanager.h +++ b/qt-ui/updatemanager.h @@ -6,16 +6,17 @@ class QNetworkAccessManager; class QNetworkReply; -class UpdateManager : public QObject -{ +class UpdateManager : public QObject { Q_OBJECT public: explicit UpdateManager(QObject *parent = 0); void checkForUpdates(); + private: QNetworkAccessManager *manager; -public slots: - void requestReceived(QNetworkReply* reply); +public +slots: + void requestReceived(QNetworkReply *reply); }; #endif // UPDATEMANAGER_H diff --git a/qt-ui/usermanual.cpp b/qt-ui/usermanual.cpp index 0dd39af33..60c94382f 100644 --- a/qt-ui/usermanual.cpp +++ b/qt-ui/usermanual.cpp @@ -11,9 +11,9 @@ UserManual::UserManual(QWidget *parent) : QMainWindow(parent), { ui->setupUi(this); - QShortcut* closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); connect(closeKey, SIGNAL(activated()), this, SLOT(close())); - QShortcut* quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); connect(quitKey, SIGNAL(activated()), parent, SLOT(close())); QAction *actionShowSearch = new QAction(this); diff --git a/qt-ui/usermanual.h b/qt-ui/usermanual.h index 7692a1143..de8770eba 100644 --- a/qt-ui/usermanual.h +++ b/qt-ui/usermanual.h @@ -4,8 +4,7 @@ #include <QMainWindow> #include <QWebPage> -namespace Ui -{ +namespace Ui { class UserManual; } diff --git a/qthelper.cpp b/qthelper.cpp index b2baedc1f..bcf78b5d1 100644 --- a/qthelper.cpp +++ b/qthelper.cpp @@ -10,7 +10,6 @@ #define tr(_arg) QObject::tr(_arg) - QString weight_string(int weight_in_grams) { QString str; @@ -87,39 +86,39 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude) gpsStyle = ISO6709D; regExp = QString("(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([NS%1%2])" "\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])") - .arg(trHemisphere[0]) - .arg(trHemisphere[1]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]); + .arg(trHemisphere[0]) + .arg(trHemisphere[1]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]); } else if (gps_text.count(QChar('"')) == 2) { gpsStyle = SECONDS; regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*" "([EW%5%6])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?") - .arg(trHemisphere[0]) - .arg(trHemisphere[1]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]); + .arg(trHemisphere[0]) + .arg(trHemisphere[1]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]); } else if (gps_text.count(QChar('\'')) == 2) { gpsStyle = MINUTES; regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*" "([EW%5%6])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?") - .arg(trHemisphere[0]) - .arg(trHemisphere[1]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]); + .arg(trHemisphere[0]) + .arg(trHemisphere[1]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]); } else { gpsStyle = DECIMAL; regExp = QString("\\s*([-NS%1%2]?)\\s*(\\d+)[,\\.](\\d+)[^-EW%3%4\\d]*([-EW%5%6]?)\\s*(\\d+)[,\\.](\\d+)") - .arg(trHemisphere[0]) - .arg(trHemisphere[1]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]) - .arg(trHemisphere[2]) - .arg(trHemisphere[3]); + .arg(trHemisphere[0]) + .arg(trHemisphere[1]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]) + .arg(trHemisphere[2]) + .arg(trHemisphere[3]); } QRegExp r(regExp); if (r.indexIn(gps_text) != -1) { diff --git a/worldmap-options.h b/worldmap-options.h index 6e7e8728b..177443563 100644 --- a/worldmap-options.h +++ b/worldmap-options.h @@ -1,7 +1,7 @@ #ifndef WORLDMAP_OPTIONS_H #define WORLDMAP_OPTIONS_H -const char* map_options = "center: new google.maps.LatLng(0,0),\n\tzoom: 3,\n\tminZoom: 2,\n\tmapTypeId: google.maps.MapTypeId.SATELLITE\n\t"; -const char* css = "\n\thtml { height: 100% }\n\tbody { height: 100%; margin: 0; padding: 0 }\n\t#map-canvas { height: 100% }\n"; +const char *map_options = "center: new google.maps.LatLng(0,0),\n\tzoom: 3,\n\tminZoom: 2,\n\tmapTypeId: google.maps.MapTypeId.SATELLITE\n\t"; +const char *css = "\n\thtml { height: 100% }\n\tbody { height: 100%; margin: 0; padding: 0 }\n\t#map-canvas { height: 100% }\n"; -#endif// WORLDMAP-OPTIONS_H +#endif // WORLDMAP-OPTIONS_H diff --git a/worldmap-save.h b/worldmap-save.h index 2aeaecd28..102ea40e5 100644 --- a/worldmap-save.h +++ b/worldmap-save.h @@ -5,7 +5,7 @@ extern "C" { #endif -extern void export_worldmap_HTML(const char* file_name, const bool selected_only); +extern void export_worldmap_HTML(const char *file_name, const bool selected_only); #ifdef __cplusplus |