mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: Unify desktop and mobile widgets
This breaks DPR handling, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
413b236867
commit
e3767976a3
9 changed files with 129 additions and 316 deletions
|
|
@ -11,6 +11,11 @@ class ProfileScene;
|
|||
|
||||
class ProfileView : public ChartView {
|
||||
Q_OBJECT
|
||||
|
||||
// Communication with the mobile interface is via properties. I hate it.
|
||||
Q_PROPERTY(int diveId READ getDiveId WRITE setDiveId)
|
||||
Q_PROPERTY(int numDC READ numDC NOTIFY numDCChanged)
|
||||
Q_PROPERTY(double zoomLevel MEMBER zoomLevel NOTIFY zoomLevelChanged)
|
||||
public:
|
||||
ProfileView();
|
||||
ProfileView(QQuickItem *parent);
|
||||
|
|
@ -28,10 +33,21 @@ public:
|
|||
void clear();
|
||||
void resetZoom();
|
||||
void anim(double fraction);
|
||||
|
||||
// For mobile
|
||||
Q_INVOKABLE void pinchStart();
|
||||
Q_INVOKABLE void pinch(double factor);
|
||||
Q_INVOKABLE void nextDC();
|
||||
Q_INVOKABLE void prevDC();
|
||||
Q_INVOKABLE void panStart(double x, double y);
|
||||
Q_INVOKABLE void pan(double x, double y);
|
||||
signals:
|
||||
void numDCChanged();
|
||||
void zoomLevelChanged();
|
||||
private:
|
||||
const struct dive *d;
|
||||
int dc;
|
||||
int zoomLevel;
|
||||
double zoomLevel, zoomLevelPinchStart;
|
||||
double zoomedPosition; // Position when zoomed: 0.0 = beginning, 1.0 = end.
|
||||
bool panning; // Currently panning.
|
||||
double panningOriginalMousePosition;
|
||||
|
|
@ -46,12 +62,18 @@ private:
|
|||
void plotAreaChanged(const QSizeF &size) override;
|
||||
void resetPointers() override;
|
||||
void replot();
|
||||
void setZoom(int level);
|
||||
void setZoom(double level);
|
||||
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
// For mobile
|
||||
int getDiveId() const;
|
||||
void setDiveId(int id);
|
||||
int numDC() const;
|
||||
void rotateDC(int dir);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue