Gratuitous whitespace changes

I keep trying to get to consistenct.
Completely hopeless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-05-22 11:40:22 -07:00
parent c7e7cebed6
commit 5ba573240f
48 changed files with 290 additions and 290 deletions

View file

@ -18,8 +18,8 @@ const char *system_default_filename(void)
{ {
/* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */ /* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */
QAndroidJniObject externalStorage = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;"); QAndroidJniObject externalStorage = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod( "getAbsolutePath", "()Ljava/lang/String;" ); QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod("getAbsolutePath", "()Ljava/lang/String;");
QString system_default_filename = externalStorageAbsolute.toString()+"/subsurface.xml"; QString system_default_filename = externalStorageAbsolute.toString() + "/subsurface.xml";
QAndroidJniEnvironment env; QAndroidJniEnvironment env;
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
// FIXME: Handle exception here. // FIXME: Handle exception here.
@ -29,7 +29,7 @@ const char *system_default_filename(void)
return strdup(system_default_filename.toUtf8().data()); 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 */ /* FIXME: we need to enumerate in some other way on android */
/* qtserialport maybee? */ /* qtserialport maybee? */
@ -77,5 +77,4 @@ void subsurface_console_exit(void)
{ {
/* NOP */ /* NOP */
} }
} }

18
dive.h
View file

@ -26,7 +26,7 @@
static inline int same_string(const char *a, const char *b) static inline int same_string(const char *a, const char *b)
{ {
return !strcmp(a ? : "", b ? : ""); return !strcmp(a ?: "", b ?: "");
} }
#include <libxml/tree.h> #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; int i;
struct dive *dive; struct dive *dive;
for_each_dive(i, dive) { for_each_dive (i, dive) {
struct divecomputer *dc = &dive->dc; struct divecomputer *dc = &dive->dc;
do { do {
if (dc->diveid == diveid && dc->deviceid == deviceid) if (dc->diveid == diveid && dc->deviceid == deviceid)
@ -444,12 +444,12 @@ static inline struct dive *get_dive_by_uniq_id(int id)
int i; int i;
struct dive *dive = NULL; struct dive *dive = NULL;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (dive->id == id) if (dive->id == id)
break; break;
} }
#ifdef DEBUG #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); fprintf(stderr, "Invalid id %x passed to get_dive_by_diveid, try to fix the code\n", id);
exit(1); exit(1);
} }
@ -462,12 +462,12 @@ static inline int get_idx_by_uniq_id(int id)
int i; int i;
struct dive *dive = NULL; struct dive *dive = NULL;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (dive->id == id) if (dive->id == id)
break; break;
} }
#ifdef DEBUG #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); fprintf(stderr, "Invalid id %x passed to get_dive_by_diveid, try to fix the code\n", id);
exit(1); exit(1);
} }
@ -508,7 +508,7 @@ extern int export_dives_xslt(const char *filename, const bool selected, const ch
struct git_oid; struct git_oid;
struct git_repository; 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 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_save_dives(struct git_repository *, const char *, bool select_only);
extern int git_load_dives(struct git_repository *, const char *); 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 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_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 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 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 get_cylinder_index(struct dive *dive, struct event *ev);
extern int nr_cylinders(struct dive *dive); 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) #define ascii_strtod(str, ptr) strtod_flags(str, ptr, STRTOD_ASCII)
extern void set_save_userid_local(short value); extern void set_save_userid_local(short value);
extern void set_userid(char* user_id); extern void set_userid(char *user_id);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -41,7 +41,7 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const
(nickName != b.nickName); (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) for (QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); it != dcMap.end() && it.key() == m; ++it)
if (it->deviceId == d) if (it->deviceId == d)
@ -49,7 +49,7 @@ const DiveComputerNode *DiveComputerList::getExact(const QString& m, uint32_t d)
return NULL; return NULL;
} }
const DiveComputerNode *DiveComputerList::get(const QString& m) const DiveComputerNode *DiveComputerList::get(const QString &m)
{ {
QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m); QMap<QString, DiveComputerNode>::iterator it = dcMap.find(m);
if (it != dcMap.end()) if (it != dcMap.end())
@ -57,7 +57,7 @@ const DiveComputerNode *DiveComputerList::get(const QString& m)
return NULL; 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) if (m.isEmpty() || d == 0)
return; return;
@ -79,7 +79,7 @@ void DiveComputerList::addDC(const QString& m, uint32_t d, const QString& n, con
dcMap.insert(m, newNode); 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); const DiveComputerNode *existNode = this->getExact(m, d);
dcMap.remove(m, *existNode); dcMap.remove(m, *existNode);
@ -96,8 +96,8 @@ extern "C" bool compareDC(const DiveComputerNode &a, const DiveComputerNode &b)
return a.deviceId < b.deviceId; return a.deviceId < b.deviceId;
} }
extern "C" void call_for_each_dc(void *f, void (*callback)(void *, const char *, uint32_t, extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t,
const char *, const char *, const char *)) const char *, const char *, const char *))
{ {
QList<DiveComputerNode> values = dcList.dcMap.values(); QList<DiveComputerNode> values = dcList.dcMap.values();
qSort(values.begin(), values.end(), compareDC); qSort(values.begin(), values.end(), compareDC);
@ -164,7 +164,7 @@ extern "C" void set_dc_nickname(struct dive *dive)
struct divecomputer *dc; struct divecomputer *dc;
for_each_dc(dive, dc) { for_each_dc (dive, dc) {
if (dc->model && *dc->model && dc->deviceid && if (dc->model && *dc->model && dc->deviceid &&
!dcList.getExact(dc->model, dc->deviceid)) { !dcList.getExact(dc->model, dc->deviceid)) {
// we don't have this one, yet // we don't have this one, yet

View file

@ -23,12 +23,12 @@ class DiveComputerList {
public: public:
DiveComputerList(); DiveComputerList();
~DiveComputerList(); ~DiveComputerList();
const DiveComputerNode *getExact(const QString& m, uint32_t d); const DiveComputerNode *getExact(const QString &m, uint32_t d);
const DiveComputerNode *get(const QString& m); 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 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); void rmDC(const QString &m, uint32_t d);
DiveComputerNode matchDC(const QString& m, uint32_t d); DiveComputerNode matchDC(const QString &m, uint32_t d);
DiveComputerNode matchModel(const QString& m); DiveComputerNode matchModel(const QString &m);
QMultiMap<QString, DiveComputerNode> dcMap; QMultiMap<QString, DiveComputerNode> dcMap;
QMultiMap<QString, DiveComputerNode> dcWorkingMap; QMultiMap<QString, DiveComputerNode> dcWorkingMap;
}; };

View file

@ -26,7 +26,7 @@ int main(int argc, char **argv)
QStringList arguments = QCoreApplication::arguments(); QStringList arguments = QCoreApplication::arguments();
bool dedicated_console = arguments.length() > 1 && bool dedicated_console = arguments.length() > 1 &&
(arguments.at(1) == QString("--win32console")); (arguments.at(1) == QString("--win32console"));
subsurface_console_init(dedicated_console); subsurface_console_init(dedicated_console);
for (i = 1; i < arguments.length(); i++) { for (i = 1; i < arguments.length(); i++) {

View file

@ -80,7 +80,6 @@ int get_maxtime(struct plot_info *pi);
int get_maxdepth(struct plot_info *pi); int get_maxdepth(struct plot_info *pi);
#define SENSOR_PR 0 #define SENSOR_PR 0
#define INTERPOLATED_PR 1 #define INTERPOLATED_PR 1
#define SENSOR_PRESSURE(_entry) (_entry)->pressure[SENSOR_PR] #define SENSOR_PRESSURE(_entry) (_entry)->pressure[SENSOR_PR]

View file

@ -391,12 +391,12 @@ QString get_dive_date_string(timestamp_t when)
struct tm tm; struct tm tm;
utc_mkdate(when, &tm); utc_mkdate(when, &tm);
return translate("gettextFromC", "%1, %2 %3, %4 %5:%6") return translate("gettextFromC", "%1, %2 %3, %4 %5:%6")
.arg(weekday(tm.tm_wday)) .arg(weekday(tm.tm_wday))
.arg(monthname(tm.tm_mon)) .arg(monthname(tm.tm_mon))
.arg(tm.tm_mday) .arg(tm.tm_mday)
.arg(tm.tm_year + 1900) .arg(tm.tm_year + 1900)
.arg(tm.tm_hour, 2, 10, QChar('0')) .arg(tm.tm_hour, 2, 10, QChar('0'))
.arg(tm.tm_min, 2, 10, QChar('0')); .arg(tm.tm_min, 2, 10, QChar('0'));
} }
QString get_short_dive_date_string(timestamp_t when) 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; struct tm tm;
utc_mkdate(when, &tm); utc_mkdate(when, &tm);
return translate("gettextFromC", "%1 %2, %3\n%4:%5") return translate("gettextFromC", "%1 %2, %3\n%4:%5")
.arg(monthname(tm.tm_mon)) .arg(monthname(tm.tm_mon))
.arg(tm.tm_mday) .arg(tm.tm_mday)
.arg(tm.tm_year + 1900) .arg(tm.tm_year + 1900)
.arg(tm.tm_hour, 2, 10, QChar('0')) .arg(tm.tm_hour, 2, 10, QChar('0'))
.arg(tm.tm_min, 2, 10, QChar('0')); .arg(tm.tm_min, 2, 10, QChar('0'));
} }
QString get_trip_date_string(timestamp_t when, int nr) 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); utc_mkdate(when, &tm);
if (nr != 1) if (nr != 1)
return translate("gettextFromC", "%1 %2 (%3 dives)") return translate("gettextFromC", "%1 %2 (%3 dives)")
.arg(monthname(tm.tm_mon)) .arg(monthname(tm.tm_mon))
.arg(tm.tm_year + 1900) .arg(tm.tm_year + 1900)
.arg(nr); .arg(nr);
else else
return translate("gettextFromC", "%1 %2 (1 dive)") return translate("gettextFromC", "%1 %2 (1 dive)")
.arg(monthname(tm.tm_mon)) .arg(monthname(tm.tm_mon))
.arg(tm.tm_year + 1900); .arg(tm.tm_year + 1900);
} }

View file

@ -8,7 +8,7 @@
QStringList list; \ QStringList list; \
struct dive *dive; \ struct dive *dive; \
int i = 0; \ int i = 0; \
for_each_dive(i, dive) \ for_each_dive (i, dive) \
{ \ { \
QString buddy(dive->diveStructMember); \ QString buddy(dive->diveStructMember); \
if (!list.contains(buddy)) { \ if (!list.contains(buddy)) { \
@ -24,10 +24,10 @@
QSet<QString> set; \ QSet<QString> set; \
struct dive *dive; \ struct dive *dive; \
int i = 0; \ int i = 0; \
for_each_dive(i, dive) \ for_each_dive (i, dive) \
{ \ { \
QString buddy(dive->diveStructMember); \ QString buddy(dive->diveStructMember); \
foreach(const QString &value, buddy.split(",", QString::SkipEmptyParts)) \ foreach (const QString &value, buddy.split(",", QString::SkipEmptyParts)) \
{ \ { \
set.insert(value.trimmed()); \ set.insert(value.trimmed()); \
} \ } \

View file

@ -123,7 +123,7 @@ void DiveListView::backupExpandedRows()
void DiveListView::restoreExpandedRows() void DiveListView::restoreExpandedRows()
{ {
setAnimated(false); setAnimated(false);
Q_FOREACH(const int & i, expandedRows) Q_FOREACH (const int &i, expandedRows)
setExpanded(model()->index(i, 0), true); setExpanded(model()->index(i, 0), true);
setAnimated(true); setAnimated(true);
} }
@ -140,7 +140,7 @@ void DiveListView::rememberSelection()
{ {
selectedDives.clear(); selectedDives.clear();
QItemSelection selection = selectionModel()->selection(); 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. if (index.column() != 0) // We only care about the dives, so, let's stick to rows and discard columns.
continue; continue;
struct dive *d = (struct dive *)index.data(DiveTripModel::DIVE_ROLE).value<void *>(); struct dive *d = (struct dive *)index.data(DiveTripModel::DIVE_ROLE).value<void *>();
@ -152,18 +152,18 @@ void DiveListView::rememberSelection()
void DiveListView::restoreSelection() void DiveListView::restoreSelection()
{ {
unselectDives(); unselectDives();
Q_FOREACH(dive_trip_t * trip, selectedDives.keys()) { Q_FOREACH (dive_trip_t *trip, selectedDives.keys()) {
QList<int> divesOnTrip = getDivesInTrip(trip); QList<int> divesOnTrip = getDivesInTrip(trip);
QList<int> selectedDivesOnTrip = selectedDives.values(trip); QList<int> selectedDivesOnTrip = selectedDives.values(trip);
// Trip was not selected, let's select single-dives. // Trip was not selected, let's select single-dives.
if (trip == NULL || divesOnTrip.count() != selectedDivesOnTrip.count()) { if (trip == NULL || divesOnTrip.count() != selectedDivesOnTrip.count()) {
Q_FOREACH(int i, selectedDivesOnTrip) { Q_FOREACH (int i, selectedDivesOnTrip) {
selectDive(i); selectDive(i);
} }
} else { } else {
selectTrip(trip); selectTrip(trip);
Q_FOREACH(int i, selectedDivesOnTrip) { Q_FOREACH (int i, selectedDivesOnTrip) {
selectDive(i); selectDive(i);
} }
} }
@ -198,7 +198,7 @@ QList<dive_trip_t *> DiveListView::selectedTrips()
{ {
QModelIndexList indexes = selectionModel()->selectedRows(); QModelIndexList indexes = selectionModel()->selectedRows();
QList<dive_trip_t *> ret; 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 *>()); dive_trip_t *trip = static_cast<dive_trip_t *>(index.data(DiveTripModel::TRIP_ROLE).value<void *>());
if (!trip) if (!trip)
continue; continue;
@ -254,7 +254,7 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
/* context for temp. variables. */ { /* context for temp. variables. */ {
int i = 0; int i = 0;
struct dive *dive; struct dive *dive;
for_each_dive(i, dive) { for_each_dive (i, dive) {
dive->selected = newDiveSelection.contains(i) == true; dive->selected = newDiveSelection.contains(i) == true;
if (firstSelectedDive == -1 && dive->selected) { if (firstSelectedDive == -1 && dive->selected) {
firstSelectedDive = i; firstSelectedDive = i;
@ -263,11 +263,11 @@ void DiveListView::selectDives(const QList<int> &newDiveSelection)
} }
} }
select_dive(firstSelectedDive); select_dive(firstSelectedDive);
Q_FOREACH(int i, newDiveSelection) { Q_FOREACH (int i, newDiveSelection) {
diveList.append(m->match(m->index(0, 0), DiveTripModel::DIVE_IDX, diveList.append(m->match(m->index(0, 0), DiveTripModel::DIVE_IDX,
i, 2, Qt::MatchRecursive).first()); i, 2, Qt::MatchRecursive).first());
} }
Q_FOREACH(const QModelIndex & idx, diveList) { Q_FOREACH (const QModelIndex &idx, diveList) {
selectionModel()->select(idx, flags); selectionModel()->select(idx, flags);
if (idx.parent().isValid() && !isExpanded(idx.parent())) { if (idx.parent().isValid() && !isExpanded(idx.parent())) {
expand(idx.parent()); expand(idx.parent());
@ -401,7 +401,7 @@ void DiveListView::reloadHeaderActions()
QString settingName = QString("showColumn%1").arg(i); QString settingName = QString("showColumn%1").arg(i);
QAction *a = new QAction(title, header()); QAction *a = new QAction(title, header());
bool showHeaderFirstRun = !( 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(); bool shown = s.value(settingName, showHeaderFirstRun).toBool();
a->setCheckable(true); a->setCheckable(true);
a->setChecked(shown); 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(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(selectionChanged(QItemSelection, QItemSelection)));
disconnect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(currentChanged(QModelIndex, QModelIndex))); 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) if (index.column() != 0)
continue; continue;
const QAbstractItemModel *model = index.model(); const QAbstractItemModel *model = index.model();
@ -468,7 +468,7 @@ void DiveListView::selectionChanged(const QItemSelection &selected, const QItemS
deselect_dive(get_divenr(dive)); deselect_dive(get_divenr(dive));
} }
} }
Q_FOREACH(const QModelIndex & index, newSelected.indexes()) { Q_FOREACH (const QModelIndex &index, newSelected.indexes()) {
if (index.column() != 0) if (index.column() != 0)
continue; continue;
@ -517,7 +517,7 @@ void DiveListView::mergeDives()
int i; int i;
struct dive *dive, *maindive = NULL; struct dive *dive, *maindive = NULL;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (dive->selected) { if (dive->selected) {
if (!can_merge(maindive, dive)) { if (!can_merge(maindive, dive)) {
maindive = dive; maindive = dive;
@ -577,7 +577,7 @@ void DiveListView::removeFromTrip()
//TODO: move this to C-code. //TODO: move this to C-code.
int i; int i;
struct dive *d; struct dive *d;
for_each_dive(i, d) { for_each_dive (i, d) {
if (d->selected) if (d->selected)
remove_dive_from_trip(d, false); remove_dive_from_trip(d, false);
} }
@ -598,7 +598,7 @@ void DiveListView::newTripAbove()
int idx; int idx;
rememberSelection(); rememberSelection();
trip = create_and_hookup_trip_from_dive(d); trip = create_and_hookup_trip_from_dive(d);
for_each_dive(idx, d) { for_each_dive (idx, d) {
if (d->selected) if (d->selected)
add_dive_to_trip(d, trip); add_dive_to_trip(d, trip);
} }
@ -621,7 +621,7 @@ void DiveListView::addToTripAbove()
void DiveListView::addToTrip(bool below) 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 *>(); struct dive *d = (struct dive *)contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void *>();
rememberSelection(); 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) 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 // find the top selected dive, depending on the list order
if (delta == 1) { if (delta == 1) {
for_each_dive(idx, d) { for_each_dive (idx, d) {
if (d->selected) if (d->selected)
pd = d; pd = d;
} }
d = pd; // this way we have the chronologically last d = pd; // this way we have the chronologically last
} else { } else {
for_each_dive(idx, d) { for_each_dive (idx, d) {
if (d->selected) if (d->selected)
break; // now that's the chronologically first break; // now that's the chronologically first
} }
@ -656,7 +656,7 @@ void DiveListView::addToTrip(bool below)
return; return;
add_dive_to_trip(d, trip); add_dive_to_trip(d, trip);
if (d->selected) { // there are possibly other selected dives that we should add 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) if (d->selected)
add_dive_to_trip(d, trip); 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 *>(); struct dive *d = (struct dive *)contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void *>();
if (!d) if (!d)
return; return;
for_each_dive(i, d) { for_each_dive (i, d) {
if (!d->selected) if (!d->selected)
continue; continue;
//TODO: this should be done in the future //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 imagetime += shiftDialog.amount(); // TODO: this should be cached and passed to the C-function
int j = 0; int j = 0;
struct dive *dive; struct dive *dive;
for_each_dive(j, dive) { for_each_dive (j, dive) {
if (!dive->selected) if (!dive->selected)
continue; continue;
for_each_dc(dive, dc) { for_each_dc (dive, dc) {
when = dc->when ? dc->when : dive->when; when = dc->when ? dc->when : dive->when;
duration_s = dc->duration.seconds ? dc->duration.seconds : dive->duration.seconds; duration_s = dc->duration.seconds ? dc->duration.seconds : dive->duration.seconds;
if (when - 3600 < imagetime && when + duration_s + 3600 > imagetime) { if (when - 3600 < imagetime && when + duration_s + 3600 > imagetime) {

View file

@ -8,8 +8,7 @@
#include "subsurfacewebservices.h" #include "subsurfacewebservices.h"
#include "worldmap-save.h" #include "worldmap-save.h"
DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
QDialog(parent),
ui(new Ui::DiveLogExportDialog) ui(new Ui::DiveLogExportDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -43,7 +42,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
return; return;
} else if (ui->exportWorldMap->isChecked()) { } else if (ui->exportWorldMap->isChecked()) {
filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(), filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(),
tr("HTML files (*.html)")); tr("HTML files (*.html)"));
if (!filename.isNull() && !filename.isEmpty()) if (!filename.isNull() && !filename.isEmpty())
export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked()); export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked());
return; return;

View file

@ -4,18 +4,18 @@
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
class DiveLogExportDialog; class DiveLogExportDialog;
} }
class DiveLogExportDialog : public QDialog class DiveLogExportDialog : public QDialog {
{
Q_OBJECT Q_OBJECT
public: public:
explicit DiveLogExportDialog(QWidget *parent = 0); explicit DiveLogExportDialog(QWidget *parent = 0);
~DiveLogExportDialog(); ~DiveLogExportDialog();
private slots: private
slots:
void on_buttonBox_accepted(); void on_buttonBox_accepted();
private: private:

View file

@ -6,8 +6,7 @@
#include "../dive.h" #include "../dive.h"
#include "../divelist.h" #include "../divelist.h"
namespace Ui namespace Ui {
{
class DiveLogImportDialog; class DiveLogImportDialog;
} }

View file

@ -129,7 +129,7 @@ void DivePlannerGraphics::settingsChanged()
void DivePlannerGraphics::keyDownAction() void DivePlannerGraphics::keyDownAction()
{ {
#if 0 #if 0
Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handles.indexOf(handler); int row = handles.indexOf(handler);
divedatapoint dp = plannerModel->at(row); divedatapoint dp = plannerModel->at(row);
@ -146,7 +146,7 @@ void DivePlannerGraphics::keyDownAction()
void DivePlannerGraphics::keyUpAction() void DivePlannerGraphics::keyUpAction()
{ {
#if 0 #if 0
Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handles.indexOf(handler); int row = handles.indexOf(handler);
divedatapoint dp = plannerModel->at(row); divedatapoint dp = plannerModel->at(row);
@ -165,7 +165,7 @@ void DivePlannerGraphics::keyUpAction()
void DivePlannerGraphics::keyLeftAction() void DivePlannerGraphics::keyLeftAction()
{ {
#if 0 #if 0
Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handles.indexOf(handler); int row = handles.indexOf(handler);
divedatapoint dp = plannerModel->at(row); divedatapoint dp = plannerModel->at(row);
@ -177,7 +177,7 @@ void DivePlannerGraphics::keyLeftAction()
// maybe this is a good place for a 'goto'? // maybe this is a good place for a 'goto'?
double xpos = timeLine->posAtValue((dp.time - 60) / 60); double xpos = timeLine->posAtValue((dp.time - 60) / 60);
bool nextStep = false; bool nextStep = false;
Q_FOREACH(DiveHandler * h, handles) { Q_FOREACH (DiveHandler *h, handles) {
if (IS_FP_SAME(h->pos().x(), xpos)) { if (IS_FP_SAME(h->pos().x(), xpos)) {
nextStep = true; nextStep = true;
break; break;
@ -196,7 +196,7 @@ void DivePlannerGraphics::keyLeftAction()
void DivePlannerGraphics::keyRightAction() void DivePlannerGraphics::keyRightAction()
{ {
#if 0 #if 0
Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
int row = handles.indexOf(handler); int row = handles.indexOf(handler);
divedatapoint dp = plannerModel->at(row); divedatapoint dp = plannerModel->at(row);
@ -207,7 +207,7 @@ void DivePlannerGraphics::keyRightAction()
// maybe this is a good place for a 'goto'? // maybe this is a good place for a 'goto'?
double xpos = timeLine->posAtValue((dp.time + 60) / 60); double xpos = timeLine->posAtValue((dp.time + 60) / 60);
bool nextStep = false; bool nextStep = false;
Q_FOREACH(DiveHandler * h, handles) { Q_FOREACH (DiveHandler *h, handles) {
if (IS_FP_SAME(h->pos().x(), xpos)) { if (IS_FP_SAME(h->pos().x(), xpos)) {
nextStep = true; nextStep = true;
break; break;
@ -229,7 +229,7 @@ void DivePlannerGraphics::keyDeleteAction()
int selCount = scene()->selectedItems().count(); int selCount = scene()->selectedItems().count();
if (selCount) { if (selCount) {
QVector<int> selectedIndexes; QVector<int> selectedIndexes;
Q_FOREACH(QGraphicsItem * i, scene()->selectedItems()) { Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) { if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
selectedIndexes.push_back(handles.indexOf(handler)); selectedIndexes.push_back(handles.indexOf(handler));
} }
@ -301,7 +301,7 @@ void DivePlannerGraphics::decreaseDepth()
if (depthLine->maximum() - M_OR_FT(10, 30) < MIN_DEPTH) if (depthLine->maximum() - M_OR_FT(10, 30) < MIN_DEPTH)
return; return;
Q_FOREACH(DiveHandler * d, handles) { Q_FOREACH (DiveHandler *d, handles) {
if (depthLine->valueAt(d->pos()) > depthLine->maximum() - M_OR_FT(10, 30)) { if (depthLine->valueAt(d->pos()) > depthLine->maximum() - M_OR_FT(10, 30)) {
QMessageBox::warning(MainWindow::instance(), QMessageBox::warning(MainWindow::instance(),
tr("Handler Position Error"), tr("Handler Position Error"),
@ -519,7 +519,7 @@ void DivePlannerGraphics::mousePressEvent(QMouseEvent *event)
QPointF mappedPos = mapToScene(event->pos()); QPointF mappedPos = mapToScene(event->pos());
if (event->button() == Qt::LeftButton) { 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)) { if (DiveHandler *h = qgraphicsitem_cast<DiveHandler *>(item)) {
activeDraggedHandler = h; activeDraggedHandler = h;
activeDraggedHandler->setBrush(Qt::red); activeDraggedHandler->setBrush(Qt::red);
@ -1068,7 +1068,7 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
endRemoveRows(); endRemoveRows();
} }
struct diveplan& DivePlannerPointsModel::getDiveplan() struct diveplan &DivePlannerPointsModel::getDiveplan()
{ {
return diveplan; 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 //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. // the bottom of this item, so shift everything up.
QRectF r = childrenBoundingRect(); QRectF r = childrenBoundingRect();
Q_FOREACH(QGraphicsItem * i, childItems()) { Q_FOREACH (QGraphicsItem *i, childItems()) {
i->setPos(i->pos().x(), i->pos().y() - r.height()); i->setPos(i->pos().x(), i->pos().y() - r.height());
} }
setScale(0.7); setScale(0.7);

View file

@ -55,7 +55,7 @@ public:
void editStop(int row, divedatapoint newData); void editStop(int row, divedatapoint newData);
divedatapoint at(int row); divedatapoint at(int row);
int size(); int size();
struct diveplan& getDiveplan(); struct diveplan &getDiveplan();
QStringList &getGasList(); QStringList &getGasList();
QVector<QPair<int, int> > collectGases(dive *d); QVector<QPair<int, int> > collectGases(dive *d);
int lastEnteredPoint(); int lastEnteredPoint();

View file

@ -34,8 +34,7 @@ struct mydescriptor {
unsigned int model; unsigned int model;
}; };
namespace DownloadFromDcGlobal namespace DownloadFromDcGlobal {
{
const char *err_string; const char *err_string;
}; };
@ -395,7 +394,7 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
idx = get_idx_by_uniq_id(uniqId); idx = get_idx_by_uniq_id(uniqId);
MainWindow::instance()->dive_list()->selectDive(idx, true); MainWindow::instance()->dive_list()->selectDive(idx, true);
} }
} else if (currentState == CANCELLING || currentState == CANCELLED){ } else if (currentState == CANCELLING || currentState == CANCELLED) {
if (import_thread_cancelled) { if (import_thread_cancelled) {
// walk backwards so we don't keep moving the dives // walk backwards so we don't keep moving the dives
// down in the dive_table // down in the dive_table

View file

@ -34,8 +34,7 @@
using std::string; using std::string;
namespace namespace {
{
// IF Entry // IF Entry
struct IFEntry { struct IFEntry {
// Raw fields // Raw fields
@ -459,15 +458,15 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len)
// GPS latitude // GPS latitude
if (format == 5 && length == 3) { if (format == 5 && length == 3) {
this->GeoLocation.LatComponents.degrees = this->GeoLocation.LatComponents.degrees =
parseEXIFRational(buf + data + tiff_header_start, alignIntel); parseEXIFRational(buf + data + tiff_header_start, alignIntel);
this->GeoLocation.LatComponents.minutes = this->GeoLocation.LatComponents.minutes =
parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel);
this->GeoLocation.LatComponents.seconds = 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.Latitude =
this->GeoLocation.LatComponents.degrees + this->GeoLocation.LatComponents.degrees +
this->GeoLocation.LatComponents.minutes / 60 + this->GeoLocation.LatComponents.minutes / 60 +
this->GeoLocation.LatComponents.seconds / 3600; this->GeoLocation.LatComponents.seconds / 3600;
if ('S' == this->GeoLocation.LatComponents.direction) if ('S' == this->GeoLocation.LatComponents.direction)
this->GeoLocation.Latitude = -this->GeoLocation.Latitude; this->GeoLocation.Latitude = -this->GeoLocation.Latitude;
} }
@ -484,15 +483,15 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len)
// GPS longitude // GPS longitude
if (format == 5 && length == 3) { if (format == 5 && length == 3) {
this->GeoLocation.LonComponents.degrees = this->GeoLocation.LonComponents.degrees =
parseEXIFRational(buf + data + tiff_header_start, alignIntel); parseEXIFRational(buf + data + tiff_header_start, alignIntel);
this->GeoLocation.LonComponents.minutes = this->GeoLocation.LonComponents.minutes =
parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel); parseEXIFRational(buf + data + tiff_header_start + 8, alignIntel);
this->GeoLocation.LonComponents.seconds = 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.Longitude =
this->GeoLocation.LonComponents.degrees + this->GeoLocation.LonComponents.degrees +
this->GeoLocation.LonComponents.minutes / 60 + this->GeoLocation.LonComponents.minutes / 60 +
this->GeoLocation.LonComponents.seconds / 3600; this->GeoLocation.LonComponents.seconds / 3600;
if ('W' == this->GeoLocation.LonComponents.direction) if ('W' == this->GeoLocation.LonComponents.direction)
this->GeoLocation.Longitude = -this->GeoLocation.Longitude; this->GeoLocation.Longitude = -this->GeoLocation.Longitude;
} }
@ -509,7 +508,7 @@ int EXIFInfo::parseFromEXIFSegment(const unsigned char *buf, unsigned len)
// GPS altitude reference // GPS altitude reference
if (format == 5) { if (format == 5) {
this->GeoLocation.Altitude = this->GeoLocation.Altitude =
parseEXIFRational(buf + data + tiff_header_start, alignIntel); parseEXIFRational(buf + data + tiff_header_start, alignIntel);
if (1 == this->GeoLocation.AltitudeRef) if (1 == this->GeoLocation.AltitudeRef)
this->GeoLocation.Altitude = -this->GeoLocation.Altitude; this->GeoLocation.Altitude = -this->GeoLocation.Altitude;
} }

View file

@ -64,7 +64,7 @@ GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
setProjection(Marble::Spherical); setProjection(Marble::Spherical);
setAnimationsEnabled(true); setAnimationsEnabled(true);
Q_FOREACH(AbstractFloatItem * i, floatItems()) { Q_FOREACH (AbstractFloatItem *i, floatItems()) {
i->setVisible(false); i->setVisible(false);
} }
@ -142,7 +142,7 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
struct dive *dive; struct dive *dive;
bool clear = !(QApplication::keyboardModifiers() & Qt::ControlModifier); bool clear = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
QList<int> selectedDiveIds; QList<int> selectedDiveIds;
for_each_dive(idx, dive) { for_each_dive (idx, dive) {
long lat_diff, lon_diff; long lat_diff, lon_diff;
if (!dive_has_gps_location(dive)) if (!dive_has_gps_location(dive))
continue; continue;
@ -175,7 +175,7 @@ void GlobeGPS::repopulateLabels()
int idx = 0; int idx = 0;
struct dive *dive; struct dive *dive;
for_each_dive(idx, dive) { for_each_dive (idx, dive) {
if (dive_has_gps_location(dive)) { if (dive_has_gps_location(dive)) {
GeoDataPlacemark *place = new GeoDataPlacemark(dive->location); GeoDataPlacemark *place = new GeoDataPlacemark(dive->location);
place->setCoordinate(dive->longitude.udeg / 1000000.0, dive->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree); 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; struct dive *dive = current_dive;
// dive has changed, if we had the 'editingDive', hide it. // dive has changed, if we had the 'editingDive', hide it.
if (messageWidget->isVisible() if (messageWidget->isVisible() && (!dive || dive_has_gps_location(dive) || amount_selected != 1))
&& (!dive || dive_has_gps_location(dive) || amount_selected != 1 ))
messageWidget->hide(); messageWidget->hide();
editingDiveLocation = false; editingDiveLocation = false;
@ -222,8 +221,7 @@ void GlobeGPS::centerOnCurrentDive()
qreal longitude = dive->longitude.udeg / 1000000.0; qreal longitude = dive->longitude.udeg / 1000000.0;
qreal latitude = dive->latitude.udeg / 1000000.0; qreal latitude = dive->latitude.udeg / 1000000.0;
if ((!dive_has_gps_location(dive) || MainWindow::instance()->information()->isEditing()) if ((!dive_has_gps_location(dive) || MainWindow::instance()->information()->isEditing()) && amount_selected == 1) {
&& amount_selected == 1) {
prepareForGetDiveCoordinates(); prepareForGetDiveCoordinates();
return; return;
} }
@ -261,7 +259,7 @@ void GlobeGPS::zoomOutForNoGPS()
// this is called if the dive has no GPS location. // 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 // 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 // we show a dive with GPS location we need to zoom in again
if(fixZoomTimer->isActive()) if (fixZoomTimer->isActive())
fixZoomTimer->stop(); fixZoomTimer->stop();
setZoom(1200, Marble::Automatic); setZoom(1200, Marble::Automatic);
if (!needResetZoom) { 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 // but we keep the code here that changes the coordinates for each selected dive
int i; int i;
struct dive *dive; struct dive *dive;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (!dive->selected) if (!dive->selected)
continue; continue;
dive->latitude.udeg = lrint(lat * 1000000.0); dive->latitude.udeg = lrint(lat * 1000000.0);
@ -341,10 +339,23 @@ void GlobeGPS::resizeEvent(QResizeEvent *event)
} }
#else #else
GlobeGPS::GlobeGPS(QWidget* parent) { setText("MARBLE DISABLED AT BUILD TIME"); } GlobeGPS::GlobeGPS(QWidget *parent)
void GlobeGPS::repopulateLabels() {} {
void GlobeGPS::centerOnCurrentDive() {} setText("MARBLE DISABLED AT BUILD TIME");
bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) {} }
void GlobeGPS::prepareForGetDiveCoordinates() {} void GlobeGPS::repopulateLabels()
void GlobeGPS::reload() {} {
}
void GlobeGPS::centerOnCurrentDive()
{
}
bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev)
{
}
void GlobeGPS::prepareForGetDiveCoordinates()
{
}
void GlobeGPS::reload()
{
}
#endif #endif

View file

@ -55,8 +55,9 @@ public:
void reload(); void reload();
void repopulateLabels(); void repopulateLabels();
void centerOnCurrentDive(); void centerOnCurrentDive();
bool eventFilter(QObject*, QEvent*); bool eventFilter(QObject *, QEvent *);
public slots: public
slots:
void prepareForGetDiveCoordinates(); void prepareForGetDiveCoordinates();
}; };

View file

@ -108,7 +108,7 @@ QStringList GroupedLineEdit::getBlockStringList()
{ {
QStringList retList; QStringList retList;
Private::Block block; Private::Block block;
foreach(block, d->blocks) foreach (block, d->blocks)
retList.append(block.text); retList.append(block.text);
return retList; return retList;
} }
@ -149,10 +149,10 @@ void GroupedLineEdit::removeAllBlocks()
QSize GroupedLineEdit::sizeHint() const QSize GroupedLineEdit::sizeHint() const
{ {
QSize rs( QSize rs(
40, 40,
document()->findBlock(0).layout()->lineAt(0).height() + document()->findBlock(0).layout()->lineAt(0).height() +
document()->documentMargin() * 2 + document()->documentMargin() * 2 +
frameWidth() * 2); frameWidth() * 2);
return rs; return rs;
} }
@ -189,15 +189,15 @@ void GroupedLineEdit::paintEvent(QPaintEvent *e)
QVectorIterator<QColor> i(d->colors); QVectorIterator<QColor> i(d->colors);
i.toFront(); 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 start_x = line.cursorToX(block.start, QTextLine::Trailing);
qreal end_x = line.cursorToX(block.end + 1, QTextLine::Leading); qreal end_x = line.cursorToX(block.end + 1, QTextLine::Leading);
QPainterPath path; QPainterPath path;
QRectF rectangle( QRectF rectangle(
start_x - 1.0 - double(horizontalScrollBar()->value()), start_x - 1.0 - double(horizontalScrollBar()->value()),
1.0, 1.0,
end_x - start_x + 2.0, end_x - start_x + 2.0,
double(viewport()->height() - 2)); double(viewport()->height() - 2));
if (!i.hasNext()) if (!i.hasNext())
i.toFront(); i.toFront();
path.addRoundedRect(rectangle, 5.0, 5.0); path.addRoundedRect(rectangle, 5.0, 5.0);

View file

@ -74,7 +74,7 @@ void KMessageWidgetPrivate::createLayout()
qDeleteAll(buttons); qDeleteAll(buttons);
buttons.clear(); buttons.clear();
Q_FOREACH(QAction * action, q->actions()) { Q_FOREACH (QAction *action, q->actions()) {
QToolButton *button = new QToolButton(content); QToolButton *button = new QToolButton(content);
button->setDefaultAction(action); button->setDefaultAction(action);
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@ -94,7 +94,7 @@ void KMessageWidgetPrivate::createLayout()
QHBoxLayout *buttonLayout = new QHBoxLayout; QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(); buttonLayout->addStretch();
Q_FOREACH(QToolButton * button, buttons) { Q_FOREACH (QToolButton *button, buttons) {
// For some reason, calling show() is necessary if wordwrap is true, // For some reason, calling show() is necessary if wordwrap is true,
// otherwise the buttons do not show up. It is not needed if // otherwise the buttons do not show up. It is not needed if
// wordwrap is false. // wordwrap is false.
@ -108,7 +108,7 @@ void KMessageWidgetPrivate::createLayout()
layout->addWidget(iconLabel); layout->addWidget(iconLabel);
layout->addWidget(textLabel); layout->addWidget(textLabel);
Q_FOREACH(QToolButton * button, buttons) { Q_FOREACH (QToolButton *button, buttons) {
layout->addWidget(button); layout->addWidget(button);
} }
@ -238,7 +238,7 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
bg2 = bg1.darker(110); bg2 = bg1.darker(110);
border = bg2.darker(110); border = bg2.darker(110);
d->content->setStyleSheet( d->content->setStyleSheet(
QString(".QFrame {" QString(".QFrame {"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
" stop: 0 %1," " stop: 0 %1,"
" stop: 0.1 %2," " stop: 0.1 %2,"
@ -248,16 +248,16 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
"margin: %5px;" "margin: %5px;"
"}" "}"
".QLabel { color: %6; }").arg(bg0.name()) ".QLabel { color: %6; }").arg(bg0.name())
.arg(bg1.name()) .arg(bg1.name())
.arg(bg2.name()) .arg(bg2.name())
.arg(border.name()) .arg(border.name())
/* /*
DefaultFrameWidth returns the size of the external margin + border width. DefaultFrameWidth returns the size of the external margin + border width.
We know our border is 1px, so we subtract this from the frame We know our border is 1px, so we subtract this from the frame
normal QStyle FrameWidth to get our margin normal QStyle FrameWidth to get our margin
*/ */
.arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this) - 1) .arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this) - 1)
.arg(fg.name())); .arg(fg.name()));
} }
QSize KMessageWidget::sizeHint() const QSize KMessageWidget::sizeHint() const

View file

@ -70,7 +70,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.tagWidget->installEventFilter(this); ui.tagWidget->installEventFilter(this);
QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children(); QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children();
Q_FOREACH(QObject * obj, statisticsTabWidgets) { Q_FOREACH (QObject *obj, statisticsTabWidgets) {
QLabel *label = qobject_cast<QLabel *>(obj); QLabel *label = qobject_cast<QLabel *>(obj);
if (label) if (label)
label->setAlignment(Qt::AlignHCenter); 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," " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
" stop: 0 #E0E0E0, stop: 1 #FFFFFF);" " stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
"}"); "}");
Q_FOREACH(QGroupBox * box, findChildren<QGroupBox *>()) { Q_FOREACH (QGroupBox *box, findChildren<QGroupBox *>()) {
box->setStyleSheet(gnomeCss); box->setStyleSheet(gnomeCss);
} }
} }
@ -271,7 +271,7 @@ void MainTab::enableEdition(EditMode newEditMode)
// We may be editing one or more dives here. backup everything. // We may be editing one or more dives here. backup everything.
struct dive *mydive; struct dive *mydive;
int i; int i;
for_each_dive(i, mydive) { for_each_dive (i, mydive) {
if (!mydive->selected) if (!mydive->selected)
continue; continue;
@ -667,7 +667,7 @@ void MainTab::acceptChanges()
ui.coordinates->text().trimmed().isEmpty())) { ui.coordinates->text().trimmed().isEmpty())) {
struct dive *dive; struct dive *dive;
int i = 0; int i = 0;
for_each_dive(i, dive) { for_each_dive (i, dive) {
QString location(dive->location); QString location(dive->location);
if (location == ui.location->text() && if (location == ui.location->text() &&
(dive->latitude.udeg || dive->longitude.udeg)) { (dive->latitude.udeg || dive->longitude.udeg)) {
@ -691,7 +691,7 @@ void MainTab::acceptChanges()
DivePlannerPointsModel::instance()->copyCylinders(curr); DivePlannerPointsModel::instance()->copyCylinders(curr);
} else if (editMode != ADD && cylindersModel->changed) { } else if (editMode != ADD && cylindersModel->changed) {
mark_divelist_changed(true); mark_divelist_changed(true);
Q_FOREACH(dive * d, notesBackup.keys()) { Q_FOREACH (dive *d, notesBackup.keys()) {
for (int i = 0; i < MAX_CYLINDERS; i++) { for (int i = 0; i < MAX_CYLINDERS; i++) {
if (notesBackup.keys().count() > 1) if (notesBackup.keys().count() > 1)
// only copy the cylinder type, none of the other values // only copy the cylinder type, none of the other values
@ -705,7 +705,7 @@ void MainTab::acceptChanges()
if (weightModel->changed) { if (weightModel->changed) {
mark_divelist_changed(true); mark_divelist_changed(true);
Q_FOREACH(dive * d, notesBackup.keys()) { Q_FOREACH (dive *d, notesBackup.keys()) {
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
d->weightsystem[i] = multiEditEquipmentPlaceholder.weightsystem[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 // 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 // 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) if (d)
fixup_dive(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() // and then clear that flag out on the other side of the sort_table()
d->selected = true; d->selected = true;
sort_table(&dive_table); sort_table(&dive_table);
for_each_dive(rememberSelected, d) { for_each_dive (rememberSelected, d) {
if (d->selected) { if (d->selected) {
d->selected = false; d->selected = false;
break; break;
@ -939,7 +939,7 @@ void MainTab::on_watertemp_textChanged(const QString &text)
validate_temp_field(ui.watertemp, 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_unit = false;
static bool missing_precision = false; static bool missing_precision = false;
@ -981,11 +981,11 @@ void MainTab::on_dateTimeEdit_dateTimeChanged(const QDateTime &datetime)
void MainTab::saveTags() void MainTab::saveTags()
{ {
EDIT_SELECTED_DIVES( EDIT_SELECTED_DIVES(
QString tag; QString tag;
taglist_free(mydive->tag_list); taglist_free(mydive->tag_list);
mydive->tag_list = NULL; mydive->tag_list = NULL;
foreach(tag, ui.tagWidget->getBlockStringList()) foreach (tag, ui.tagWidget->getBlockStringList())
taglist_add_tag(&mydive->tag_list, tag.toUtf8().data());); taglist_add_tag(&mydive->tag_list, tag.toUtf8().data()););
} }
void MainTab::on_tagWidget_textChanged() void MainTab::on_tagWidget_textChanged()

View file

@ -85,7 +85,7 @@ slots:
void on_notes_textChanged(); void on_notes_textChanged();
void on_airtemp_textChanged(const QString &text); void on_airtemp_textChanged(const QString &text);
void on_watertemp_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_dateTimeEdit_dateTimeChanged(const QDateTime &datetime);
void on_rating_valueChanged(int value); void on_rating_valueChanged(int value);
void on_visibility_valueChanged(int value); void on_visibility_valueChanged(int value);

View file

@ -196,7 +196,7 @@ void MainWindow::on_actionSaveAs_triggered()
file_save_as(); file_save_as();
} }
ProfileWidget2* MainWindow::graphics() const ProfileWidget2 *MainWindow::graphics() const
{ {
return ui.newProfile; return ui.newProfile;
} }
@ -314,8 +314,8 @@ void MainWindow::on_actionDivePlanner_triggered()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
DivePlannerPointsModel::instance()->clear(); DivePlannerPointsModel::instance()->clear();
CylindersModel::instance()->clear(); CylindersModel::instance()->clear();
for_each_dive(i,dive) { for_each_dive (i, dive) {
if(dive->selected){ if (dive->selected) {
DivePlannerPointsModel::instance()->copyCylindersFrom(dive); DivePlannerPointsModel::instance()->copyCylindersFrom(dive);
CylindersModel::instance()->copyFromDive(dive); CylindersModel::instance()->copyFromDive(dive);
break; break;
@ -443,11 +443,11 @@ void MainWindow::on_actionYearlyStatistics_triggered()
yearlyStats->setMinimumWidth(600); yearlyStats->setMinimumWidth(600);
yearlyStats->setWindowTitle(tr("Yearly Statistics")); yearlyStats->setWindowTitle(tr("Yearly Statistics"));
yearlyStats->setWindowIcon(QIcon(":subsurface-icon")); 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())); connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close()));
closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), yearlyStats); closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), yearlyStats);
connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close())); 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())); connect(quitKey, SIGNAL(activated()), this, SLOT(close()));
} }
/* problem here is that without more MainWindow variables or a separate YearlyStatistics /* 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); int index = files.indexOf(file);
if (index >= 0) { 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)) { if (QFile::exists(file)) {
files.prepend(file); files.prepend(file);
} }
@ -910,7 +910,7 @@ void MainWindow::removeRecentFile(QStringList failedFiles)
} }
} }
foreach(QString file, failedFiles) foreach (QString file, failedFiles)
files.removeAll(file); files.removeAll(file);
for (int c = 1; c <= 4; c++) { for (int c = 1; c <= 4; c++) {

View file

@ -171,7 +171,7 @@ bool ComboBoxDelegate::eventFilter(QObject *object, QEvent *event)
QKeyEvent *ev = static_cast<QKeyEvent *>(event); QKeyEvent *ev = static_cast<QKeyEvent *>(event);
if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) { if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) {
currCombo.ignoreSelection = true; currCombo.ignoreSelection = true;
if (!currCombo.comboEditor->completer()->popup()->isVisible()){ if (!currCombo.comboEditor->completer()->popup()->isVisible()) {
currCombo.comboEditor->showPopup(); currCombo.comboEditor->showPopup();
return true; return true;
} }

View file

@ -68,7 +68,7 @@ CylindersModel::CylindersModel(QObject *parent) : current(0), rows(0)
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH}; // 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%") setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%")
#ifdef ENABLE_PLANNER #ifdef ENABLE_PLANNER
<< tr("Switch at") << tr("Switch at")
#endif #endif
); );
} }
@ -364,11 +364,10 @@ void CylindersModel::remove(const QModelIndex &index)
cylinder_t *cyl = &current->cylinder[index.row()]; cylinder_t *cyl = &current->cylinder[index.row()];
if ((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING && if ((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
DivePlannerPointsModel::instance()->tankInUse(cyl->gasmix.o2.permille, cyl->gasmix.he.permille)) || 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( QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(
tr("Cylinder cannot be removed"), tr("Cylinder cannot be removed"),
tr("This gas in use. Only cylinders that are not used in the dive can be removed.")), tr("This gas in use. Only cylinders that are not used in the dive can be removed.")),
QMessageBox::Ok); QMessageBox::Ok);
return; return;
} }
@ -1199,7 +1198,7 @@ bool DiveItem::setData(const QModelIndex &index, const QVariant &value, int role
int i; int i;
struct dive *d; struct dive *d;
for_each_dive(i, d) { for_each_dive (i, d) {
if (d->number == v) if (d->number == v)
return false; return false;
} }
@ -2056,7 +2055,7 @@ LanguageModel::LanguageModel(QObject *parent) : QAbstractListModel(parent)
QSettings s; QSettings s;
QDir d(getSubsurfaceDataPath("translations")); QDir d(getSubsurfaceDataPath("translations"));
QStringList result = d.entryList(); QStringList result = d.entryList();
Q_FOREACH(const QString & s, result) { Q_FOREACH (const QString &s, result) {
if (s.startsWith("subsurface_") && s.endsWith(".qm")) { if (s.startsWith("subsurface_") && s.endsWith(".qm")) {
languages.push_back((s == "subsurface_source.qm") ? "English" : s); languages.push_back((s == "subsurface_source.qm") ? "English" : s);
} }

View file

@ -236,7 +236,7 @@ void PreferencesDialog::syncSettings()
// Animation // Animation
s.beginGroup("Animations"); s.beginGroup("Animations");
s.setValue("animation_speed",ui.velocitySlider->value()); s.setValue("animation_speed", ui.velocitySlider->value());
s.endGroup(); s.endGroup();
loadSettings(); loadSettings();

View file

@ -98,7 +98,7 @@ int PrintLayout::estimateTotalDives() const
{ {
int total = 0, i = 0; int total = 0, i = 0;
struct dive *dive; struct dive *dive;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (!dive->selected && printOptions->print_selected) if (!dive->selected && printOptions->print_selected)
continue; continue;
total++; total++;
@ -168,7 +168,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
yOffsetTable = scaledH - tableH; yOffsetTable = scaledH - tableH;
// plot the dives at specific rows and columns on the page // 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) if (!dive->selected && printOptions->print_selected)
continue; continue;
if (col == divesPerColumn) { if (col == divesPerColumn) {
@ -183,7 +183,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
// draw a profile // draw a profile
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile); 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)); profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
painter.setTransform(origTransform); painter.setTransform(origTransform);
@ -202,7 +202,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
profile->setFrameStyle(profileFrameStyle); profile->setFrameStyle(profileFrameStyle);
profile->setPrintMode(false); profile->setPrintMode(false);
profile->resize(originalSize); 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 */ /* 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 addTablePrintHeadingRow(&model, row); // add one heading row
row++; row++;
progress = 0; progress = 0;
for_each_dive(i, dive) { for_each_dive (i, dive) {
if (!dive->selected && printOptions->print_selected) if (!dive->selected && printOptions->print_selected)
continue; continue;
addTablePrintDataRow(&model, row, dive); addTablePrintDataRow(&model, row, dive);

View file

@ -4,8 +4,7 @@
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QPointF> #include <QPointF>
namespace Animations namespace Animations {
{
void hide(QObject *obj) void hide(QObject *obj)
{ {
@ -26,15 +25,14 @@ namespace Animations
void moveTo(QObject *obj, qreal x, qreal y) void moveTo(QObject *obj, qreal x, qreal y)
{ {
if (prefs.animation != 0){ if (prefs.animation != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos"); QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
animation->setDuration(prefs.animation); animation->setDuration(prefs.animation);
animation->setStartValue(obj->property("pos").toPointF()); animation->setStartValue(obj->property("pos").toPointF());
animation->setEndValue(QPointF(x, y)); animation->setEndValue(QPointF(x, y));
animation->start(QAbstractAnimation::DeleteWhenStopped); animation->start(QAbstractAnimation::DeleteWhenStopped);
} } else {
else{ obj->setProperty("pos", QPointF(x, y));
obj->setProperty("pos", QPointF(x,y));
} }
} }

View file

@ -6,8 +6,7 @@
class QObject; class QObject;
namespace Animations namespace Animations {
{
void hide(QObject *obj); void hide(QObject *obj);
void moveTo(QObject *obj, qreal x, qreal y); void moveTo(QObject *obj, qreal x, qreal y);
void moveTo(QObject *obj, const QPointF &pos); void moveTo(QObject *obj, const QPointF &pos);

View file

@ -97,7 +97,7 @@ void DiveCartesianAxis::setTextVisible(bool arg1)
return; return;
} }
textVisibility = arg1; textVisibility = arg1;
Q_FOREACH(DiveTextItem * item, labels) { Q_FOREACH (DiveTextItem *item, labels) {
item->setVisible(textVisibility); item->setVisible(textVisibility);
} }
} }
@ -108,7 +108,7 @@ void DiveCartesianAxis::setLinesVisible(bool arg1)
return; return;
} }
lineVisibility = arg1; lineVisibility = arg1;
Q_FOREACH(DiveLineItem * item, lines) { Q_FOREACH (DiveLineItem *item, lines) {
item->setVisible(lineVisibility); 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) { for (int i = 0, count = labels.size(); i < count; i++, currValueText += interval) {
qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ? qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
begin + i * stepSize : begin + i * stepSize :
begin - i * stepSize; begin - i * stepSize;
labels[i]->setText(textForValue(currValueText)); labels[i]->setText(textForValue(currValueText));
if (orientation == LeftToRight || orientation == RightToLeft) { 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) { for (int i = 0, count = lines.size(); i < count; i++, currValueLine += interval) {
qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ? qreal childPos = (orientation == TopToBottom || orientation == LeftToRight) ?
begin + i * stepSize : begin + i * stepSize :
begin - i * stepSize; begin - i * stepSize;
if (orientation == LeftToRight || orientation == RightToLeft) { if (orientation == LeftToRight || orientation == RightToLeft) {
lines[i]->animateMoveTo(childPos, m.y1()); 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); item->setVisible(textVisibility);
Q_FOREACH(DiveLineItem * item, lines) Q_FOREACH (DiveLineItem *item, lines)
item->setVisible(lineVisibility); 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 relativePosition -= pos(); // normalize p based on the axis' offset on screen
double retValue = (orientation == LeftToRight || orientation == RightToLeft) ? double retValue = (orientation == LeftToRight || orientation == RightToLeft) ?
max * (relativePosition.x() - m.x1()) / (m.x2() - m.x1()) : max * (relativePosition.x() - m.x1()) / (m.x2() - m.x1()) :
max * (relativePosition.y() - m.y1()) / (m.y2() - m.y1()); max * (relativePosition.y() - m.y1()) / (m.y2() - m.y1());
return retValue; return retValue;
} }
@ -289,8 +289,8 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
double realSize = orientation == LeftToRight || orientation == RightToLeft ? double realSize = orientation == LeftToRight || orientation == RightToLeft ?
m.x2() - m.x1() : m.x2() - m.x1() :
m.y2() - m.y1(); m.y2() - m.y1();
// Inverted axis, just invert the percentage. // Inverted axis, just invert the percentage.
if (orientation == RightToLeft || orientation == BottomToTop) if (orientation == RightToLeft || orientation == BottomToTop)
@ -298,10 +298,10 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
double retValue = realSize * percent; double retValue = realSize * percent;
double adjusted = double adjusted =
orientation == LeftToRight ? retValue + m.x1() + p.x() : orientation == LeftToRight ? retValue + m.x1() + p.x() :
orientation == RightToLeft ? retValue + m.x1() + p.x() : orientation == RightToLeft ? retValue + m.x1() + p.x() :
orientation == TopToBottom ? retValue + m.y1() + p.y() : orientation == TopToBottom ? retValue + m.y1() + p.y() :
/* entation == BottomToTop */ retValue + m.y1() + p.y(); /* entation == BottomToTop */ retValue + m.y1() + p.y();
return adjusted; return adjusted;
} }

View file

@ -156,7 +156,7 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
if (!entry->in_deco) { if (!entry->in_deco) {
/* not in deco implies this is a safety stop, no ceiling */ /* not in deco implies this is a safety stop, no ceiling */
p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0))); 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)))); 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); pen.setWidth(2);
struct dive *d = get_dive_by_uniq_id(dataModel->id()); struct dive *d = get_dive_by_uniq_id(dataModel->id());
struct plot_data *entry = dataModel->data().entry; 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++) { for (int i = 1, count = poly.count(); i < count; i++, entry++) {
pen.setBrush(getSacColor(entry->sac, d->sac)); pen.setBrush(getSacColor(entry->sac, d->sac));
painter->setPen(pen); painter->setPen(pen);
@ -682,9 +682,8 @@ void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphics
QPolygonF poly; QPolygonF poly;
painter->setPen(QPen(alertColor, pWidth)); painter->setPen(QPen(alertColor, pWidth));
Q_FOREACH(const QPolygonF & poly, alertPolygons) Q_FOREACH (const QPolygonF &poly, alertPolygons)
painter->drawPolyline(poly); painter->drawPolyline(poly);
} }
void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey) void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey)

View file

@ -21,7 +21,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
{ {
QGraphicsPixmapItem *iconItem = 0; QGraphicsPixmapItem *iconItem = 0;
double yValue = title->boundingRect().height() + SPACING; double yValue = title->boundingRect().height() + SPACING;
Q_FOREACH(ToolTip t, toolTips) { Q_FOREACH (ToolTip t, toolTips) {
yValue += t.second->boundingRect().height(); yValue += t.second->boundingRect().height();
} }
if (!icon.isNull()) { if (!icon.isNull()) {
@ -39,7 +39,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
void ToolTipItem::clear() void ToolTipItem::clear()
{ {
Q_FOREACH(ToolTip t, toolTips) { Q_FOREACH (ToolTip t, toolTips) {
delete t.first; delete t.first;
delete t.second; delete t.second;
} }
@ -96,7 +96,7 @@ void ToolTipItem::expand()
return; return;
double width = 0, height = title->boundingRect().height() + SPACING; double width = 0, height = title->boundingRect().height() + SPACING;
Q_FOREACH(ToolTip t, toolTips) { Q_FOREACH (ToolTip t, toolTips) {
if (t.second->boundingRect().width() > width) if (t.second->boundingRect().width() > width)
width = t.second->boundingRect().width(); width = t.second->boundingRect().width();
height += t.second->boundingRect().height(); height += t.second->boundingRect().height();
@ -226,7 +226,7 @@ void ToolTipItem::refresh(const QPointF &pos)
free_buffer(&mb); free_buffer(&mb);
QList<QGraphicsItem *> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, scene()->views().first()->transform()); 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()) if (!item->toolTip().isEmpty())
addToolTip(item->toolTip()); addToolTip(item->toolTip());
} }

View file

@ -138,7 +138,7 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(rulerItem); scene()->addItem(rulerItem);
scene()->addItem(rulerItem->sourceNode()); scene()->addItem(rulerItem->sourceNode());
scene()->addItem(rulerItem->destNode()); scene()->addItem(rulerItem->destNode());
Q_FOREACH (DiveCalculatedTissue * tissue, allTissues) { Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
scene()->addItem(tissue); scene()->addItem(tissue);
} }
} }
@ -211,7 +211,7 @@ void ProfileWidget2::setupItemOnScene()
ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS); \ ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS); \
ITEM->setVisibilitySettingsKey(VISIBILITY_SETTINGS); \ ITEM->setVisibilitySettingsKey(VISIBILITY_SETTINGS); \
ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale)); \ ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale)); \
ITEM->settingsChanged(); \ ITEM->settingsChanged(); \
ITEM->setZValue(99); ITEM->setZValue(99);
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, "pn2threshold", "pn2graph"); CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, "pn2threshold", "pn2graph");
@ -479,7 +479,7 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
event = event->next; event = event->next;
} }
// Only set visible the events that should be visible // Only set visible the events that should be visible
Q_FOREACH(DiveEventItem * event, eventItems) { Q_FOREACH (DiveEventItem *event, eventItems) {
event->setVisible(!event->shouldBeHidden()); event->setVisible(!event->shouldBeHidden());
// qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds << "is hidden:" << event->isHidden(); // qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds << "is hidden:" << event->isHidden();
} }
@ -649,10 +649,10 @@ void ProfileWidget2::setEmptyState()
pn2GasItem->setVisible(false); pn2GasItem->setVisible(false);
po2GasItem->setVisible(false); po2GasItem->setVisible(false);
pheGasItem->setVisible(false); pheGasItem->setVisible(false);
Q_FOREACH(DiveCalculatedTissue * tissue, allTissues) { Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
tissue->setVisible(false); tissue->setVisible(false);
} }
Q_FOREACH(DiveEventItem * event, eventItems) { Q_FOREACH (DiveEventItem *event, eventItems) {
event->setVisible(false); event->setVisible(false);
} }
} }
@ -711,7 +711,7 @@ void ProfileWidget2::setProfileState()
reportedCeiling->setVisible(prefs.dcceiling); reportedCeiling->setVisible(prefs.dcceiling);
if (prefs.calcalltissues) { if (prefs.calcalltissues) {
Q_FOREACH(DiveCalculatedTissue * tissue, allTissues) { Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
tissue->setVisible(true); tissue->setVisible(true);
} }
} }
@ -855,7 +855,7 @@ void ProfileWidget2::hideEvents()
} }
} }
Q_FOREACH (DiveEventItem *evItem, eventItems) { Q_FOREACH (DiveEventItem *evItem, eventItems) {
if(same_string(evItem->getEvent()->name, event->name)) if (same_string(evItem->getEvent()->name, event->name))
evItem->hide(); evItem->hide();
} }
} else { } else {
@ -880,8 +880,8 @@ void ProfileWidget2::removeEvent()
struct event *event = item->getEvent(); struct event *event = item->getEvent();
if (QMessageBox::question(MainWindow::instance(), TITLE_OR_TEXT( if (QMessageBox::question(MainWindow::instance(), TITLE_OR_TEXT(
tr("Remove the selected event?"), 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("%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) { QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
remove_event(event); remove_event(event);
mark_divelist_changed(true); mark_divelist_changed(true);
@ -953,9 +953,9 @@ void ProfileWidget2::disconnectTemporaryConnections()
disconnect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot())); disconnect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
disconnect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), 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)), 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) void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)

View file

@ -70,7 +70,7 @@ public:
virtual bool eventFilter(QObject *, QEvent *); virtual bool eventFilter(QObject *, QEvent *);
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue); void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
void setPrintMode(bool mode, bool grayscale = false); void setPrintMode(bool mode, bool grayscale = false);
bool isPointOutOfBoundaries(const QPointF& point) const; bool isPointOutOfBoundaries(const QPointF &point) const;
State currentState; State currentState;
public public

View file

@ -26,7 +26,7 @@ RulerNodeItem2::RulerNodeItem2() : entry(NULL), ruler(NULL)
setFlag(ItemIgnoresTransformations); setFlag(ItemIgnoresTransformations);
} }
void RulerNodeItem2::setPlotInfo(plot_info& info) void RulerNodeItem2::setPlotInfo(plot_info &info)
{ {
pInfo = info; pInfo = info;
entry = pInfo.entry; entry = pInfo.entry;
@ -87,8 +87,8 @@ RulerItem2::RulerItem2() : source(new RulerNodeItem2()),
void RulerItem2::settingsChanged() void RulerItem2::settingsChanged()
{ {
ProfileWidget2 *profWidget = NULL; ProfileWidget2 *profWidget = NULL;
if(scene() && scene()->views().count()) if (scene() && scene()->views().count())
profWidget = qobject_cast<ProfileWidget2*>(scene()->views().first()); profWidget = qobject_cast<ProfileWidget2 *>(scene()->views().first());
setVisible(profWidget->currentState == ProfileWidget2::PROFILE ? prefs.rulergraph : false); setVisible(profWidget->currentState == ProfileWidget2::PROFILE ? prefs.rulergraph : false);
} }

View file

@ -17,7 +17,7 @@ class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem {
public: public:
explicit RulerNodeItem2(); explicit RulerNodeItem2();
void setRuler(RulerItem2 *r); void setRuler(RulerItem2 *r);
void setPlotInfo(struct plot_info& info); void setPlotInfo(struct plot_info &info);
void recalculate(); void recalculate();
protected: protected:
@ -31,7 +31,7 @@ private:
DiveCartesianAxis *depthAxis; DiveCartesianAxis *depthAxis;
}; };
class RulerItem2 :public QObject, public QGraphicsLineItem { class RulerItem2 : public QObject, public QGraphicsLineItem {
Q_OBJECT Q_OBJECT
public: public:
explicit RulerItem2(); explicit RulerItem2();
@ -43,7 +43,8 @@ public:
void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth); void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth);
void setVisible(bool visible); void setVisible(bool visible);
public slots: public
slots:
void settingsChanged(); void settingsChanged();
private: private:

View file

@ -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)); 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.currentTime->setText(get_dive_date_string(when));
ui.shiftedTime->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()) if (ui.backwards->isChecked())
amount *= -1; 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) ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent)

View file

@ -55,11 +55,11 @@ class ShiftTimesDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
static ShiftTimesDialog *instance(); static ShiftTimesDialog *instance();
void showEvent ( QShowEvent * event ); void showEvent(QShowEvent *event);
private private
slots: slots:
void buttonClicked(QAbstractButton *button); void buttonClicked(QAbstractButton *button);
void changeTime (); void changeTime();
private: private:
explicit ShiftTimesDialog(QWidget *parent); explicit ShiftTimesDialog(QWidget *parent);

View file

@ -49,7 +49,7 @@ static bool merge_locations_into_dives(void)
sort_table(&gps_location_table); sort_table(&gps_location_table);
for_each_gps_location(i, gpsfix) { for_each_gps_location (i, gpsfix) {
if (is_automatic_fix(gpsfix)) { if (is_automatic_fix(gpsfix)) {
dive = find_dive_including(gpsfix->when); dive = find_dive_including(gpsfix->when);
if (dive && !dive_has_gps_location(dive)) { 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 */ /* walk the dive list in chronological order */
int i; int i;
struct dive *dive; struct dive *dive;
for_each_dive(i, dive) { for_each_dive (i, dive) {
FILE *f; FILE *f;
char filename[PATH_MAX]; char filename[PATH_MAX];
int streamsize; int streamsize;
@ -526,8 +526,8 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { if (reader.readNextStartElement() && reader.name() != "DiveDateReader") {
result.errorCondition = invalidXmlError; result.errorCondition = invalidXmlError;
result.errorDetails = result.errorDetails =
DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1")
.arg(reader.name().toString()); .arg(reader.name().toString());
goto out; goto out;
} }
@ -580,8 +580,8 @@ out:
// if there was an XML error, overwrite the result or other error conditions // if there was an XML error, overwrite the result or other error conditions
result.errorCondition = invalidXmlError; result.errorCondition = invalidXmlError;
result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2") result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2")
.arg(reader.lineNumber()) .arg(reader.lineNumber())
.arg(reader.errorString()); .arg(reader.errorString());
} }
return result; return result;
} }

View file

@ -138,13 +138,13 @@ void TagWidget::reparse()
} }
} }
void TagWidget::completionSelected(const QString& completion) void TagWidget::completionSelected(const QString &completion)
{ {
completionHighlighted(completion); completionHighlighted(completion);
emit textChanged(); emit textChanged();
} }
void TagWidget::completionHighlighted(const QString& completion) void TagWidget::completionHighlighted(const QString &completion)
{ {
QPair<int, int> pos = getCursorTagPosition(); QPair<int, int> pos = getCursorTagPosition();
setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion)); setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
@ -158,7 +158,7 @@ void TagWidget::setCursorPosition(int position)
blockSignals(false); blockSignals(false);
} }
void TagWidget::setText(const QString& text) void TagWidget::setText(const QString &text)
{ {
blockSignals(true); blockSignals(true);
GroupedLineEdit::setText(text); GroupedLineEdit::setText(text);
@ -185,7 +185,7 @@ void TagWidget::keyPressEvent(QKeyEvent *e)
setText(text().remove(pos.first, pos.second - pos.first)); setText(text().remove(pos.first, pos.second - pos.first));
setCursorPosition(pos.first); setCursorPosition(pos.first);
} }
popup= m_completer->popup(); popup = m_completer->popup();
if (popup) if (popup)
popup->hide(); popup->hide();
return; return;
@ -203,8 +203,8 @@ void TagWidget::keyPressEvent(QKeyEvent *e)
} }
finishedTag = true; finishedTag = true;
} }
if (e->key() == Qt::Key_Tab && lastFinishedTag) { // if we already end in comma, go to next/prev field 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 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 } 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(",")); QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
GroupedLineEdit::keyPressEvent(&fakeEvent); GroupedLineEdit::keyPressEvent(&fakeEvent);

View file

@ -12,15 +12,15 @@ public:
void setCompleter(QCompleter *completer); void setCompleter(QCompleter *completer);
QPair<int, int> getCursorTagPosition(); QPair<int, int> getCursorTagPosition();
void highlight(); void highlight();
void setText(const QString& text); void setText(const QString &text);
void clear(); void clear();
void setCursorPosition(int position); void setCursorPosition(int position);
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
public public
slots: slots:
void reparse(); void reparse();
void completionSelected(const QString& text); void completionSelected(const QString &text);
void completionHighlighted(const QString& text); void completionHighlighted(const QString &text);
protected: protected:
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);

View file

@ -4,11 +4,10 @@
#include "subsurfacewebservices.h" #include "subsurfacewebservices.h"
#include "ssrf-version.h" #include "ssrf-version.h"
UpdateManager::UpdateManager(QObject *parent) : UpdateManager::UpdateManager(QObject *parent) : QObject(parent)
QObject(parent)
{ {
manager = SubsurfaceWebServices::manager(); manager = SubsurfaceWebServices::manager();
connect (manager, SIGNAL(finished(QNetworkReply*)), SLOT(requestReceived(QNetworkReply*))); connect(manager, SIGNAL(finished(QNetworkReply *)), SLOT(requestReceived(QNetworkReply *)));
} }
void UpdateManager::checkForUpdates() void UpdateManager::checkForUpdates()

View file

@ -6,16 +6,17 @@
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class UpdateManager : public QObject class UpdateManager : public QObject {
{
Q_OBJECT Q_OBJECT
public: public:
explicit UpdateManager(QObject *parent = 0); explicit UpdateManager(QObject *parent = 0);
void checkForUpdates(); void checkForUpdates();
private: private:
QNetworkAccessManager *manager; QNetworkAccessManager *manager;
public slots: public
void requestReceived(QNetworkReply* reply); slots:
void requestReceived(QNetworkReply *reply);
}; };
#endif // UPDATEMANAGER_H #endif // UPDATEMANAGER_H

View file

@ -11,9 +11,9 @@ UserManual::UserManual(QWidget *parent) : QMainWindow(parent),
{ {
ui->setupUi(this); 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())); 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())); connect(quitKey, SIGNAL(activated()), parent, SLOT(close()));
QAction *actionShowSearch = new QAction(this); QAction *actionShowSearch = new QAction(this);

View file

@ -4,8 +4,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QWebPage> #include <QWebPage>
namespace Ui namespace Ui {
{
class UserManual; class UserManual;
} }

View file

@ -10,7 +10,6 @@
#define tr(_arg) QObject::tr(_arg) #define tr(_arg) QObject::tr(_arg)
QString weight_string(int weight_in_grams) QString weight_string(int weight_in_grams)
{ {
QString str; QString str;
@ -87,39 +86,39 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude)
gpsStyle = ISO6709D; gpsStyle = ISO6709D;
regExp = QString("(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([NS%1%2])" 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])") "\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])")
.arg(trHemisphere[0]) .arg(trHemisphere[0])
.arg(trHemisphere[1]) .arg(trHemisphere[1])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]); .arg(trHemisphere[3]);
} else if (gps_text.count(QChar('"')) == 2) { } else if (gps_text.count(QChar('"')) == 2) {
gpsStyle = SECONDS; gpsStyle = SECONDS;
regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*" 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+))?") "([EW%5%6])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)[\'\\s]+(\\d+)([,\\.](\\d+))?")
.arg(trHemisphere[0]) .arg(trHemisphere[0])
.arg(trHemisphere[1]) .arg(trHemisphere[1])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]) .arg(trHemisphere[3])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]); .arg(trHemisphere[3]);
} else if (gps_text.count(QChar('\'')) == 2) { } else if (gps_text.count(QChar('\'')) == 2) {
gpsStyle = MINUTES; gpsStyle = MINUTES;
regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?[^EW%3%4]*" 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+))?") "([EW%5%6])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)([,\\.](\\d+))?")
.arg(trHemisphere[0]) .arg(trHemisphere[0])
.arg(trHemisphere[1]) .arg(trHemisphere[1])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]) .arg(trHemisphere[3])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]); .arg(trHemisphere[3]);
} else { } else {
gpsStyle = DECIMAL; gpsStyle = DECIMAL;
regExp = QString("\\s*([-NS%1%2]?)\\s*(\\d+)[,\\.](\\d+)[^-EW%3%4\\d]*([-EW%5%6]?)\\s*(\\d+)[,\\.](\\d+)") regExp = QString("\\s*([-NS%1%2]?)\\s*(\\d+)[,\\.](\\d+)[^-EW%3%4\\d]*([-EW%5%6]?)\\s*(\\d+)[,\\.](\\d+)")
.arg(trHemisphere[0]) .arg(trHemisphere[0])
.arg(trHemisphere[1]) .arg(trHemisphere[1])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]) .arg(trHemisphere[3])
.arg(trHemisphere[2]) .arg(trHemisphere[2])
.arg(trHemisphere[3]); .arg(trHemisphere[3]);
} }
QRegExp r(regExp); QRegExp r(regExp);
if (r.indexIn(gps_text) != -1) { if (r.indexIn(gps_text) != -1) {

View file

@ -1,7 +1,7 @@
#ifndef WORLDMAP_OPTIONS_H #ifndef WORLDMAP_OPTIONS_H
#define 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 *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 *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

View file

@ -5,7 +5,7 @@
extern "C" { extern "C" {
#endif #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 #ifdef __cplusplus