Pictures tied to profile are not supported on mobile

Move divepicturemodel.cpp to the desktop only category and deal
with the (limited) fallout. We, currently, do not support dive
pictures tied to the profile on mobile, so there is no use
including this code.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-01-10 13:55:29 +01:00
parent 9c01315d31
commit 34bc4fc0af
5 changed files with 12 additions and 4 deletions

View file

@ -135,7 +135,9 @@ void DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
} }
} }
#ifndef SUBSURFACE_MOBILE
void DivePictureItem::removePicture() void DivePictureItem::removePicture()
{ {
DivePictureModel::instance()->removePicture(fileUrl, true); DivePictureModel::instance()->removePicture(fileUrl, true);
} }
#endif

View file

@ -24,7 +24,9 @@ public:
void setPixmap(const QPixmap& pix); void setPixmap(const QPixmap& pix);
public slots: public slots:
void settingsChanged(); void settingsChanged();
#ifndef SUBSURFACE_MOBILE
void removePicture(); void removePicture();
#endif
void setFileUrl(const QString& s); void setFileUrl(const QString& s);
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);

View file

@ -764,8 +764,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
DivePlannerPointsModel *model = DivePlannerPointsModel::instance(); DivePlannerPointsModel *model = DivePlannerPointsModel::instance();
model->deleteTemporaryPlan(); model->deleteTemporaryPlan();
} }
#endif
plotPictures(); plotPictures();
#endif
// OK, how long did this take us? Anything above the second is way too long, // OK, how long did this take us? Anything above the second is way too long,
// so if we are calculation TTS / NDL then let's force that off. // so if we are calculation TTS / NDL then let's force that off.
@ -1081,9 +1081,11 @@ void ProfileWidget2::setProfileState()
return; return;
disconnectTemporaryConnections(); disconnectTemporaryConnections();
#ifndef SUBSURFACE_MOBILE
connect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures())); connect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures()));
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures())); connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(plotPictures())); connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
#endif
/* show the same stuff that the profile shows. */ /* show the same stuff that the profile shows. */
emit enableShortcuts(); emit enableShortcuts();
@ -1950,7 +1952,6 @@ void ProfileWidget2::keyEscAction()
if (plannerModel->isPlanner()) if (plannerModel->isPlanner())
plannerModel->cancelPlan(); plannerModel->cancelPlan();
} }
#endif
void ProfileWidget2::plotPictures() void ProfileWidget2::plotPictures()
{ {
@ -1990,6 +1991,7 @@ void ProfileWidget2::plotPictures()
pictures.push_back(item); pictures.push_back(item);
} }
} }
#endif
void ProfileWidget2::dropEvent(QDropEvent *event) void ProfileWidget2::dropEvent(QDropEvent *event)
{ {
@ -2011,7 +2013,9 @@ void ProfileWidget2::dropEvent(QDropEvent *event)
} }
} }
copy_dive(current_dive, &displayed_dive); copy_dive(current_dive, &displayed_dive);
#ifndef SUBSURFACE_MOBILE
DivePictureModel::instance()->updateDivePictures(); DivePictureModel::instance()->updateDivePictures();
#endif
if (event->source() == this) { if (event->source() == this) {

View file

@ -104,10 +104,10 @@ slots: // Necessary to call from QAction's signals.
void actionRequestedReplot(bool triggered); void actionRequestedReplot(bool triggered);
void setEmptyState(); void setEmptyState();
void setProfileState(); void setProfileState();
void plotPictures();
void setReplot(bool state); void setReplot(bool state);
void replot(dive *d = 0); void replot(dive *d = 0);
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
void plotPictures();
void setPlanState(); void setPlanState();
void setAddState(); void setAddState();
void changeGas(); void changeGas();

View file

@ -3,13 +3,13 @@
# models used both mobile and desktop builds # models used both mobile and desktop builds
set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
divepicturemodel.cpp
diveplotdatamodel.cpp diveplotdatamodel.cpp
diveimportedmodel.cpp diveimportedmodel.cpp
) )
# models exclusively used in desktop builds # models exclusively used in desktop builds
set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS
divepicturemodel.cpp
cleanertablemodel.cpp cleanertablemodel.cpp
models.cpp models.cpp
tankinfomodel.cpp tankinfomodel.cpp