summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-05-31 16:09:14 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-06-19 13:11:10 -0700
commit7f4d9db962e73aa5d5089c43c99b78b3690ffb87 (patch)
tree87e143b80ed394fc321765885a75cac229bf9f18 /desktop-widgets
parentf1c2cd375e295730d92e23093e44777baf838f1d (diff)
downloadsubsurface-7f4d9db962e73aa5d5089c43c99b78b3690ffb87.tar.gz
Cleanup: move trip-related functions into own translation unit
These functions were spread out over dive.c and divelist.c. Move them into their own file to make all this a bit less monolithic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/command_base.h1
-rw-r--r--desktop-widgets/divelistview.cpp1
-rw-r--r--desktop-widgets/divelistview.h6
-rw-r--r--desktop-widgets/divelogimportdialog.cpp1
-rw-r--r--desktop-widgets/mainwindow.cpp1
-rw-r--r--desktop-widgets/mapwidget.cpp1
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp2
-rw-r--r--desktop-widgets/tab-widgets/TabDiveInformation.cpp1
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp1
-rw-r--r--desktop-widgets/tab-widgets/maintab.h2
10 files changed, 12 insertions, 5 deletions
diff --git a/desktop-widgets/command_base.h b/desktop-widgets/command_base.h
index 85ca6f8de..9a2f6cf34 100644
--- a/desktop-widgets/command_base.h
+++ b/desktop-widgets/command_base.h
@@ -5,6 +5,7 @@
#define COMMAND_BASE_H
#include "core/divesite.h"
+#include "core/trip.h"
#include <QUndoCommand>
#include <QCoreApplication> // For Q_DECLARE_TR_FUNCTIONS
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index c98338061..055737252 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -20,6 +20,7 @@
#include <QMessageBox>
#include <QHeaderView>
#include "core/qthelper.h"
+#include "core/trip.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/divelistview.h"
#include "qt-models/divepicturemodel.h"
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index 35e985633..7a3757adb 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -39,7 +39,7 @@ public:
void rememberSelection();
void restoreSelection();
void contextMenuEvent(QContextMenuEvent *event);
- QList<dive_trip_t *> selectedTrips();
+ QList<dive_trip *> selectedTrips();
static QString lastUsedImageDir();
static void updateLastUsedImageDir(const QString &s);
public
@@ -78,7 +78,7 @@ private:
QVector<int> initialColumnWidths;
/* if dive_trip_t is null, there's no problem. */
- QMultiHash<dive_trip_t *, int> selectedDives;
+ QMultiHash<dive_trip *, int> selectedDives;
void resetModel(); // Call after model changed
void merge_trip(const QModelIndex &a, const int offset);
void setColumnWidths();
@@ -86,7 +86,7 @@ private:
void backupExpandedRows();
void restoreExpandedRows();
int lastVisibleColumn();
- void selectTrip(dive_trip_t *trip);
+ void selectTrip(dive_trip *trip);
void updateLastImageTimeOffset(int offset);
int lastImageTimeOffset();
void addToTrip(int delta);
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index d7922907b..96058283c 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -12,6 +12,7 @@
#include <QPainter>
#include "core/qthelper.h"
#include "core/divesite.h"
+#include "core/trip.h"
#include "core/import-csv.h"
static QString subsurface_mimedata = "subsurface/csvcolumns";
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 38314f06c..b558ded99 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -27,6 +27,7 @@
#include "core/planner.h"
#include "core/qthelper.h"
#include "core/subsurface-string.h"
+#include "core/trip.h"
#include "core/version.h"
#include "core/windowtitleupdate.h"
diff --git a/desktop-widgets/mapwidget.cpp b/desktop-widgets/mapwidget.cpp
index 113283fc6..86ffaeabe 100644
--- a/desktop-widgets/mapwidget.cpp
+++ b/desktop-widgets/mapwidget.cpp
@@ -12,6 +12,7 @@
#include "mainwindow.h"
#include "divelistview.h"
#include "command.h"
+#include "core/trip.h" // TODO: Needed because divesChanged uses a trip parameter -> remove that!
static const QUrl urlMapWidget = QUrl(QStringLiteral("qrc:/qml/MapWidget.qml"));
static const QUrl urlMapWidgetError = QUrl(QStringLiteral("qrc:/qml/MapWidgetError.qml"));
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index 36037f511..2a42c0f2b 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -6,7 +6,7 @@
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/command.h"
#include "desktop-widgets/usersurvey.h"
-#include "core/divelist.h"
+#include "core/trip.h"
#include "core/file.h"
#include "desktop-widgets/mapwidget.h"
#include "desktop-widgets/tab-widgets/maintab.h"
diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
index d55cb48b6..ee56fde67 100644
--- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp
@@ -5,6 +5,7 @@
#include "core/units.h"
#include "core/dive.h"
#include "desktop-widgets/command.h"
+#include "core/trip.h" // TODO: Needed because divesChanged uses a trip parameter -> remove that!
#include <core/qthelper.h>
#include <core/statistics.h>
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index ad39c433e..e263874da 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -10,6 +10,7 @@
#include "desktop-widgets/mapwidget.h"
#include "core/qthelper.h"
#include "core/statistics.h"
+#include "core/trip.h"
#include "qt-models/diveplannermodel.h"
#include "desktop-widgets/divelistview.h"
#include "core/display.h"
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 70cabf343..5968c7d31 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -91,7 +91,7 @@ private:
bool lastSelectedDive;
int lastTabSelectedDive;
int lastTabSelectedDiveTrip;
- dive_trip_t *currentTrip;
+ dive_trip *currentTrip;
QList<TabBase*> extraWidgets;
void divesEdited(int num); // Opens a warning window if more than one dive was edited
};