summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-14 06:01:36 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-14 09:43:33 -0700
commit6e6cce770b671cea58251475546c77c5bc1468be (patch)
treecff3bd7b738bc9e08a0325d8d65bf7b08e4c502d /mobile-widgets/qmlmanager.h
parent5909e438c9394f7e831d7d9f912788ade87b6b1f (diff)
downloadsubsurface-6e6cce770b671cea58251475546c77c5bc1468be.tar.gz
QML UI: keep QML manager and the UI in sync about selected dive
The manager can now directly update the index of the selected dive, and the UI tells the manager the timestamp of the currently selected dive. This allows the manager to pick the best possible dive as selected dive if things change (for example if the dive list gets reloaded because it changed in cloud storage). Fixes #1009 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.h')
-rw-r--r--mobile-widgets/qmlmanager.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index d905fe236..5b8fb6848 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -26,6 +26,8 @@ class QMLManager : public QObject {
Q_PROPERTY(credentialStatus_t oldStatus READ oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
Q_PROPERTY(int accessingCloud READ accessingCloud WRITE setAccessingCloud NOTIFY accessingCloudChanged)
Q_PROPERTY(bool syncToCloud READ syncToCloud WRITE setSyncToCloud NOTIFY syncToCloudChanged)
+ Q_PROPERTY(int updateSelectedDive READ updateSelectedDive WRITE setUpdateSelectedDive NOTIFY updateSelectedDiveChanged)
+ Q_PROPERTY(int selectedDiveTimestamp READ selectedDiveTimestamp WRITE setSelectedDiveTimestamp NOTIFY selectedDiveTimestampChanged)
public:
QMLManager();
@@ -81,6 +83,12 @@ public:
bool syncToCloud() const;
void setSyncToCloud(bool status);
+ int updateSelectedDive() const;
+ void setUpdateSelectedDive(int idx);
+
+ int selectedDiveTimestamp() const;
+ void setSelectedDiveTimestamp(int when);
+
typedef void (QMLManager::*execute_function_type)();
DiveListSortModel *dlSortModel;
@@ -144,6 +152,8 @@ private:
struct dive_trip *deletedTrip;
int m_accessingCloud;
bool m_syncToCloud;
+ int m_updateSelectedDive;
+ int m_selectedDiveTimestamp;
credentialStatus_t m_credentialStatus;
credentialStatus_t m_oldStatus;
qreal m_lastDevicePixelRatio;
@@ -164,6 +174,8 @@ signals:
void oldStatusChanged();
void accessingCloudChanged();
void syncToCloudChanged();
+ void updateSelectedDiveChanged();
+ void selectedDiveTimestampChanged();
void sendScreenChanged(QScreen *screen);
};