summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-05 16:05:44 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-05 16:05:44 -0800
commitf3232b1a6f7ae6ade64071f2166597cb7f04951a (patch)
tree06a3994c8c06e61133b4b0f0705258c61975d7ea /profile-widget
parent662e2a0ff3856982e98281de309c5a06b789f4df (diff)
downloadsubsurface-f3232b1a6f7ae6ade64071f2166597cb7f04951a.tar.gz
Profile: don't compile the desktop specific parts on mobile
When building subsurface-mobile we won't be using all these UI elements, so let's not build them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp21
-rw-r--r--profile-widget/profilewidget2.h19
2 files changed, 35 insertions, 5 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 028562f79..d485d4d79 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -14,8 +14,10 @@
#include "diveplannermodel.h"
#include "models.h"
#include "divepicturemodel.h"
+#ifndef SUBSURFACE_MOBILE
#include "diveplanner.h"
#include "simplewidgets.h"
+#endif
#include <libdivecomputer/parser.h>
#include <QScrollBar>
@@ -680,11 +682,13 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
prefs.animation_speed = animSpeedBackup;
}
+#ifndef SUBSURFACE_MOBILE
if (currentState == ADD || currentState == PLAN) { // TODO: figure a way to move this from here.
repositionDiveHandlers();
DivePlannerPointsModel *model = DivePlannerPointsModel::instance();
model->deleteTemporaryPlan();
}
+#endif
plotPictures();
// OK, how long did this take us? Anything above the second is way too long,
@@ -785,6 +789,7 @@ void ProfileWidget2::mousePressEvent(QMouseEvent *event)
shouldCalculateMaxTime = false;
}
+#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::divePlannerHandlerClicked()
{
if (zoomLevel)
@@ -800,6 +805,7 @@ void ProfileWidget2::divePlannerHandlerReleased()
shouldCalculateMaxDepth = true;
replot();
}
+#endif
void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
{
@@ -958,7 +964,9 @@ void ProfileWidget2::setEmptyState()
HIDE_ALL(DiveCalculatedTissue, allTissues);
HIDE_ALL(DivePercentageItem, allPercentages);
HIDE_ALL(DiveEventItem, eventItems);
+#ifndef SUBSURFACE_MOBILE
HIDE_ALL(DiveHandler, handles);
+#endif
HIDE_ALL(QGraphicsSimpleTextItem, gases);
#undef HIDE_ALL
}
@@ -1087,13 +1095,17 @@ void ProfileWidget2::setProfileState()
#define HIDE_ALL(TYPE, CONTAINER) \
Q_FOREACH (TYPE *item, CONTAINER) item->setVisible(false);
+
+#ifndef SUBSURFACE_MOBILE
HIDE_ALL(DiveHandler, handles);
+#endif
HIDE_ALL(QGraphicsSimpleTextItem, gases);
#undef HIDE_ALL
mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(false);
}
+#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::clearHandlers()
{
if (handles.count()) {
@@ -1104,6 +1116,7 @@ void ProfileWidget2::clearHandlers()
handles.clear();
}
}
+#endif
void ProfileWidget2::setToolTipVisibile(bool visible)
{
@@ -1115,7 +1128,9 @@ void ProfileWidget2::setAddState()
if (currentState == ADD)
return;
+#ifndef SUBSURFACE_MOBILE
clearHandlers();
+#endif
setProfileState();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);
@@ -1210,6 +1225,7 @@ void ProfileWidget2::setReplot(bool state)
replotEnabled = state;
}
+#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
{
if (currentState == ADD || currentState == PLAN) {
@@ -1478,6 +1494,7 @@ void ProfileWidget2::changeGas()
mark_divelist_changed(true);
replot();
}
+#endif
bool ProfileWidget2::getPrintMode()
{
@@ -1517,6 +1534,7 @@ double ProfileWidget2::getFontPrintScale()
return 1.0;
}
+#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::editName()
{
QAction *action = qobject_cast<QAction *>(sender());
@@ -1542,6 +1560,7 @@ void ProfileWidget2::editName()
replot();
}
}
+#endif
void ProfileWidget2::disconnectTemporaryConnections()
{
@@ -1560,6 +1579,7 @@ void ProfileWidget2::disconnectTemporaryConnections()
}
}
+#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
{
DiveHandler *item = new DiveHandler();
@@ -1804,6 +1824,7 @@ void ProfileWidget2::keyEscAction()
if (plannerModel->isPlanner())
plannerModel->cancelPlan();
}
+#endif
void ProfileWidget2::plotPictures()
{
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index dcfc72c17..7b7030a7f 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -81,7 +81,9 @@ public:
bool isAddOrPlanner();
double getFontPrintScale();
void setFontPrintScale(double scale);
+#ifndef SUBSURFACE_MOBILE
void clearHandlers();
+#endif
void recalcCeiling();
void setToolTipVisibile(bool visible);
State currentState;
@@ -103,6 +105,10 @@ slots: // Necessary to call from QAction's signals.
void setProfileState();
void setPlanState();
void setAddState();
+ void plotPictures();
+ void setReplot(bool state);
+ void replot(dive *d = 0);
+#ifndef SUBSURFACE_MOBILE
void changeGas();
void addSetpointChange();
void addBookmark();
@@ -114,9 +120,6 @@ slots: // Necessary to call from QAction's signals.
void deleteCurrentDC();
void pointInserted(const QModelIndex &parent, int start, int end);
void pointsRemoved(const QModelIndex &, int start, int end);
- void plotPictures();
- void setReplot(bool state);
- void replot(dive *d = 0);
/* this is called for every move on the handlers. maybe we can speed up this a bit? */
void recreatePlannedDive();
@@ -131,13 +134,16 @@ slots: // Necessary to call from QAction's signals.
void divePlannerHandlerClicked();
void divePlannerHandlerReleased();
+#endif
protected:
virtual ~ProfileWidget2();
virtual void resizeEvent(QResizeEvent *event);
virtual void wheelEvent(QWheelEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
+#ifndef SUBSURFACE_MOBILE
virtual void contextMenuEvent(QContextMenuEvent *event);
+#endif
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
@@ -200,13 +206,16 @@ private:
bool isGrayscale;
bool printMode;
- //specifics for ADD and PLAN
- QList<DiveHandler *> handles;
QList<QGraphicsSimpleTextItem *> gases;
QList<DivePictureItem *> pictures;
+
+ //specifics for ADD and PLAN
+#ifndef SUBSURFACE_MOBILE
+ QList<DiveHandler *> handles;
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
friend class DiveHandler;
+#endif
QHash<Qt::Key, QAction *> actionsForKeys;
bool shouldCalculateMaxTime;
bool shouldCalculateMaxDepth;