mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Merge remote-tracking branch 'origin/bstoeger-mobile-dc'
This commit is contained in:
commit
f2a96db687
5 changed files with 82 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
mobile: implement paging through dive computers
|
||||||
desktop: remove divesite list from tab-widgets
|
desktop: remove divesite list from tab-widgets
|
||||||
infobox: show an icon for warnings
|
infobox: show an icon for warnings
|
||||||
import: allow import of divesites without UUID
|
import: allow import of divesites without UUID
|
||||||
|
|
|
@ -210,7 +210,6 @@ Item {
|
||||||
color: subsurfaceTheme.textColor
|
color: subsurfaceTheme.textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: bottomLayout
|
id: bottomLayout
|
||||||
|
@ -362,7 +361,44 @@ Item {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: qsTr("No profile to show")
|
text: qsTr("No profile to show")
|
||||||
}
|
}
|
||||||
|
// under the profile
|
||||||
|
// -----------------
|
||||||
|
Row {
|
||||||
|
TemplateButton {
|
||||||
|
id: prevDC
|
||||||
|
visible: qmlProfile.numDC > 1
|
||||||
|
text: qsTr("prev.DC")
|
||||||
|
font.pointSize: subsurfaceTheme.smallPointSize
|
||||||
|
onClicked: {
|
||||||
|
qmlProfile.prevDC()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TemplateLabel {
|
||||||
|
text: " "
|
||||||
|
width: Kirigami.Units.largeSpacing
|
||||||
|
visible: qmlProfile.numDC > 1
|
||||||
|
}
|
||||||
|
TemplateButton {
|
||||||
|
id: nextDC
|
||||||
|
visible: qmlProfile.numDC > 1
|
||||||
|
text: qsTr("next DC")
|
||||||
|
font.pointSize: subsurfaceTheme.smallPointSize
|
||||||
|
onClicked: {
|
||||||
|
qmlProfile.nextDC()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// two empty entries
|
||||||
|
TemplateLabel {
|
||||||
|
text: " "
|
||||||
|
width: Kirigami.Units.largeSpacing
|
||||||
|
visible: qmlProfile.numDC > 1
|
||||||
|
}
|
||||||
|
TemplateLabel {
|
||||||
|
text: " "
|
||||||
|
width: Kirigami.Units.largeSpacing
|
||||||
|
visible: qmlProfile.numDC > 1
|
||||||
|
}
|
||||||
// first row
|
// first row
|
||||||
//-----------
|
//-----------
|
||||||
TemplateLabelSmall {
|
TemplateLabelSmall {
|
||||||
|
|
|
@ -576,11 +576,9 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
||||||
dcText = tr("Manually added dive");
|
dcText = tr("Manually added dive");
|
||||||
else if (dcText.isEmpty())
|
else if (dcText.isEmpty())
|
||||||
dcText = tr("Unknown dive computer");
|
dcText = tr("Unknown dive computer");
|
||||||
#ifndef SUBSURFACE_MOBILE
|
int nr = number_of_computers(d);
|
||||||
int nr;
|
if (nr > 1)
|
||||||
if ((nr = number_of_computers(d)) > 1)
|
|
||||||
dcText += tr(" (#%1 of %2)").arg(dc + 1).arg(nr);
|
dcText += tr(" (#%1 of %2)").arg(dc + 1).arg(nr);
|
||||||
#endif
|
|
||||||
diveComputerText->set(dcText, getColor(TIME_TEXT, isGrayscale));
|
diveComputerText->set(dcText, getColor(TIME_TEXT, isGrayscale));
|
||||||
|
|
||||||
// Reset animation.
|
// Reset animation.
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
QMLProfile::QMLProfile(QQuickItem *parent) :
|
QMLProfile::QMLProfile(QQuickItem *parent) :
|
||||||
QQuickPaintedItem(parent),
|
QQuickPaintedItem(parent),
|
||||||
|
m_diveId(0),
|
||||||
|
m_dc(0),
|
||||||
m_devicePixelRatio(1.0),
|
m_devicePixelRatio(1.0),
|
||||||
m_margin(0),
|
m_margin(0),
|
||||||
m_xOffset(0.0),
|
m_xOffset(0.0),
|
||||||
|
@ -60,7 +62,7 @@ void QMLProfile::paint(QPainter *painter)
|
||||||
struct dive *d = get_dive_by_uniq_id(m_diveId);
|
struct dive *d = get_dive_by_uniq_id(m_diveId);
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
m_profileWidget->draw(painter, painterRect, d, dc_number, nullptr, false);
|
m_profileWidget->draw(painter, painterRect, d, m_dc, nullptr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLProfile::setMargin(int margin)
|
void QMLProfile::setMargin(int margin)
|
||||||
|
@ -76,6 +78,7 @@ int QMLProfile::diveId() const
|
||||||
void QMLProfile::setDiveId(int diveId)
|
void QMLProfile::setDiveId(int diveId)
|
||||||
{
|
{
|
||||||
m_diveId = diveId;
|
m_diveId = diveId;
|
||||||
|
emit numDCChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QMLProfile::devicePixelRatio() const
|
qreal QMLProfile::devicePixelRatio() const
|
||||||
|
@ -126,3 +129,33 @@ void QMLProfile::divesChanged(const QVector<dive *> &dives, DiveField)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLProfile::nextDC()
|
||||||
|
{
|
||||||
|
rotateDC(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QMLProfile::prevDC()
|
||||||
|
{
|
||||||
|
rotateDC(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QMLProfile::rotateDC(int dir)
|
||||||
|
{
|
||||||
|
struct dive *d = get_dive_by_uniq_id(m_diveId);
|
||||||
|
if (!d)
|
||||||
|
return;
|
||||||
|
int numDC = number_of_computers(d);
|
||||||
|
if (numDC == 1)
|
||||||
|
return;
|
||||||
|
m_dc = (m_dc + dir) % numDC;
|
||||||
|
if (m_dc < 0)
|
||||||
|
m_dc += numDC;
|
||||||
|
triggerUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
int QMLProfile::numDC() const
|
||||||
|
{
|
||||||
|
struct dive *d = get_dive_by_uniq_id(m_diveId);
|
||||||
|
return d ? number_of_computers(d) : 0;
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ class QMLProfile : public QQuickPaintedItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int diveId MEMBER m_diveId WRITE setDiveId)
|
Q_PROPERTY(int diveId MEMBER m_diveId WRITE setDiveId)
|
||||||
|
Q_PROPERTY(int numDC READ numDC NOTIFY numDCChanged)
|
||||||
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
|
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
|
||||||
Q_PROPERTY(qreal xOffset MEMBER m_xOffset WRITE setXOffset NOTIFY xOffsetChanged)
|
Q_PROPERTY(qreal xOffset MEMBER m_xOffset WRITE setXOffset NOTIFY xOffsetChanged)
|
||||||
Q_PROPERTY(qreal yOffset MEMBER m_yOffset WRITE setYOffset NOTIFY yOffsetChanged)
|
Q_PROPERTY(qreal yOffset MEMBER m_yOffset WRITE setYOffset NOTIFY yOffsetChanged)
|
||||||
|
@ -28,6 +29,8 @@ public:
|
||||||
void setDevicePixelRatio(qreal dpr);
|
void setDevicePixelRatio(qreal dpr);
|
||||||
void setXOffset(qreal value);
|
void setXOffset(qreal value);
|
||||||
void setYOffset(qreal value);
|
void setYOffset(qreal value);
|
||||||
|
Q_INVOKABLE void nextDC();
|
||||||
|
Q_INVOKABLE void prevDC();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setMargin(int margin);
|
void setMargin(int margin);
|
||||||
|
@ -36,11 +39,14 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_diveId;
|
int m_diveId;
|
||||||
|
int m_dc;
|
||||||
qreal m_devicePixelRatio;
|
qreal m_devicePixelRatio;
|
||||||
int m_margin;
|
int m_margin;
|
||||||
qreal m_xOffset, m_yOffset;
|
qreal m_xOffset, m_yOffset;
|
||||||
std::unique_ptr<ProfileScene> m_profileWidget;
|
std::unique_ptr<ProfileScene> m_profileWidget;
|
||||||
void createProfileView();
|
void createProfileView();
|
||||||
|
void rotateDC(int dir);
|
||||||
|
int numDC() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void divesChanged(const QVector<dive *> &dives, DiveField);
|
void divesChanged(const QVector<dive *> &dives, DiveField);
|
||||||
|
@ -50,6 +56,7 @@ signals:
|
||||||
void devicePixelRatioChanged();
|
void devicePixelRatioChanged();
|
||||||
void xOffsetChanged();
|
void xOffsetChanged();
|
||||||
void yOffsetChanged();
|
void yOffsetChanged();
|
||||||
|
void numDCChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QMLPROFILE_H
|
#endif // QMLPROFILE_H
|
||||||
|
|
Loading…
Reference in a new issue