2017-04-27 18:30:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-07-17 16:09:42 +00:00
|
|
|
#ifndef QMLPROFILE_H
|
|
|
|
#define QMLPROFILE_H
|
|
|
|
|
2020-12-21 12:42:04 +00:00
|
|
|
#include "core/subsurface-qt/divelistnotifier.h"
|
2015-07-17 16:09:42 +00:00
|
|
|
#include <QQuickPaintedItem>
|
2021-08-04 05:27:41 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class ProfileScene;
|
2015-07-17 16:09:42 +00:00
|
|
|
|
|
|
|
class QMLProfile : public QQuickPaintedItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-12-23 19:52:41 +00:00
|
|
|
Q_PROPERTY(int diveId MEMBER m_diveId WRITE setDiveId)
|
2016-01-13 02:05:06 +00:00
|
|
|
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
|
2020-02-17 18:46:31 +00:00
|
|
|
Q_PROPERTY(qreal xOffset MEMBER m_xOffset WRITE setXOffset NOTIFY xOffsetChanged)
|
|
|
|
Q_PROPERTY(qreal yOffset MEMBER m_yOffset WRITE setYOffset NOTIFY yOffsetChanged)
|
2016-01-13 02:05:06 +00:00
|
|
|
|
2015-07-17 16:09:42 +00:00
|
|
|
public:
|
|
|
|
explicit QMLProfile(QQuickItem *parent = 0);
|
2021-08-04 05:27:41 +00:00
|
|
|
~QMLProfile();
|
2015-11-12 00:43:13 +00:00
|
|
|
|
2015-07-17 16:09:42 +00:00
|
|
|
void paint(QPainter *painter);
|
|
|
|
|
2019-12-23 19:52:41 +00:00
|
|
|
int diveId() const;
|
|
|
|
void setDiveId(int diveId);
|
2016-01-13 02:05:06 +00:00
|
|
|
qreal devicePixelRatio() const;
|
|
|
|
void setDevicePixelRatio(qreal dpr);
|
2020-02-17 18:42:56 +00:00
|
|
|
void setXOffset(qreal value);
|
|
|
|
void setYOffset(qreal value);
|
2016-01-13 02:05:06 +00:00
|
|
|
|
2015-12-29 17:50:47 +00:00
|
|
|
public slots:
|
|
|
|
void setMargin(int margin);
|
2016-03-09 03:33:19 +00:00
|
|
|
void screenChanged(QScreen *screen);
|
2020-03-24 22:02:17 +00:00
|
|
|
void triggerUpdate();
|
|
|
|
|
2015-07-17 16:09:42 +00:00
|
|
|
private:
|
2019-12-23 19:52:41 +00:00
|
|
|
int m_diveId;
|
2016-01-13 02:05:06 +00:00
|
|
|
qreal m_devicePixelRatio;
|
2015-12-29 17:50:47 +00:00
|
|
|
int m_margin;
|
2020-02-17 18:46:31 +00:00
|
|
|
qreal m_xOffset, m_yOffset;
|
2021-08-04 05:27:41 +00:00
|
|
|
std::unique_ptr<ProfileScene> m_profileWidget;
|
2021-05-31 19:44:37 +00:00
|
|
|
void createProfileView();
|
2016-03-09 03:33:19 +00:00
|
|
|
|
2020-12-21 12:42:04 +00:00
|
|
|
private slots:
|
|
|
|
void divesChanged(const QVector<dive *> &dives, DiveField);
|
|
|
|
|
2015-07-17 16:09:42 +00:00
|
|
|
signals:
|
|
|
|
void rightAlignedChanged();
|
2016-01-13 02:05:06 +00:00
|
|
|
void devicePixelRatioChanged();
|
2020-02-17 18:46:31 +00:00
|
|
|
void xOffsetChanged();
|
|
|
|
void yOffsetChanged();
|
2015-07-17 16:09:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QMLPROFILE_H
|