mobile: remove updateSelectedDive logic

Selection is now be handled by the core.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-01-10 08:39:24 +08:00 committed by Dirk Hohndel
parent 57b96490b2
commit e700920e8e
3 changed files with 4 additions and 21 deletions

View file

@ -42,7 +42,6 @@ Kirigami.Page {
property alias cylinderIndex4: detailsEdit.cylinderIndex4 property alias cylinderIndex4: detailsEdit.cylinderIndex4
property alias usedGas: detailsEdit.usedGas property alias usedGas: detailsEdit.usedGas
property alias gpsCheckbox: detailsEdit.gpsCheckbox property alias gpsCheckbox: detailsEdit.gpsCheckbox
property int updateCurrentIdx: manager.updateSelectedDive
property alias rating: detailsEdit.rating property alias rating: detailsEdit.rating
property alias visibility: detailsEdit.visibility property alias visibility: detailsEdit.visibility
property alias usedCyl: detailsEdit.usedCyl property alias usedCyl: detailsEdit.usedCyl

View file

@ -149,7 +149,6 @@ void QMLManager::btRescan()
QMLManager::QMLManager() : m_locationServiceEnabled(false), QMLManager::QMLManager() : m_locationServiceEnabled(false),
m_verboseEnabled(false), m_verboseEnabled(false),
m_updateSelectedDive(-1),
m_selectedDiveTimestamp(0), m_selectedDiveTimestamp(0),
alreadySaving(false), alreadySaving(false),
m_pluggedInDeviceName(""), m_pluggedInDeviceName(""),
@ -492,7 +491,7 @@ void QMLManager::finishSetup()
set_filename(NULL); set_filename(NULL);
} else { } else {
// successfully opened the local file, now add thigs to the dive list // successfully opened the local file, now add thigs to the dive list
consumeFinishedLoad(0); consumeFinishedLoad();
appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename)); appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename));
} }
} else { } else {
@ -748,7 +747,6 @@ void QMLManager::retrieveUserid()
void QMLManager::loadDivesWithValidCredentials() void QMLManager::loadDivesWithValidCredentials()
{ {
QString url; QString url;
timestamp_t currentDiveTimestamp = m_selectedDiveTimestamp;
if (getCloudURL(url)) { if (getCloudURL(url)) {
setStartPageText(RED_FONT + tr("Cloud storage error: %1").arg(consumeError()) + END_FONT); setStartPageText(RED_FONT + tr("Cloud storage error: %1").arg(consumeError()) + END_FONT);
revertToNoCloudIfNeeded(); revertToNoCloudIfNeeded();
@ -788,7 +786,7 @@ void QMLManager::loadDivesWithValidCredentials()
set_filename(NULL); set_filename(NULL);
return; return;
} }
consumeFinishedLoad(currentDiveTimestamp); consumeFinishedLoad();
successful_exit: successful_exit:
alreadySaving = false; alreadySaving = false;
@ -847,7 +845,7 @@ void QMLManager::revertToNoCloudIfNeeded()
alreadySaving = false; alreadySaving = false;
} }
void QMLManager::consumeFinishedLoad(timestamp_t currentDiveTimestamp) void QMLManager::consumeFinishedLoad()
{ {
prefs.unit_system = git_prefs.unit_system; prefs.unit_system = git_prefs.unit_system;
if (git_prefs.unit_system == IMPERIAL) if (git_prefs.unit_system == IMPERIAL)
@ -862,8 +860,6 @@ void QMLManager::consumeFinishedLoad(timestamp_t currentDiveTimestamp)
prefs.pp_graphs.po2 = git_prefs.pp_graphs.po2; prefs.pp_graphs.po2 = git_prefs.pp_graphs.po2;
process_loaded_dives(); process_loaded_dives();
MobileModels::instance()->reset(); MobileModels::instance()->reset();
if (currentDiveTimestamp)
setUpdateSelectedDive(DiveListSortModel::instance()->getIdxForId(get_dive_id_closest_to(currentDiveTimestamp)));
appendTextToLog(QStringLiteral("%1 dives loaded").arg(dive_table.nr)); appendTextToLog(QStringLiteral("%1 dives loaded").arg(dive_table.nr));
if (dive_table.nr == 0) if (dive_table.nr == 0)
setStartPageText(tr("Cloud storage open successfully. No dives in dive list.")); setStartPageText(tr("Cloud storage open successfully. No dives in dive list."));
@ -1715,12 +1711,6 @@ void QMLManager::setNotificationText(QString text)
emit notificationTextChanged(); emit notificationTextChanged();
} }
void QMLManager::setUpdateSelectedDive(int idx)
{
m_updateSelectedDive = idx;
emit updateSelectedDiveChanged();
}
void QMLManager::setSelectedDiveTimestamp(int when) void QMLManager::setSelectedDiveTimestamp(int when)
{ {
m_selectedDiveTimestamp = when; m_selectedDiveTimestamp = when;

View file

@ -32,7 +32,6 @@ class QMLManager : public QObject {
Q_PROPERTY(QString startPageText MEMBER m_startPageText WRITE setStartPageText NOTIFY startPageTextChanged) Q_PROPERTY(QString startPageText MEMBER m_startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
Q_PROPERTY(bool verboseEnabled MEMBER m_verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged) Q_PROPERTY(bool verboseEnabled MEMBER m_verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
Q_PROPERTY(QString notificationText MEMBER m_notificationText WRITE setNotificationText NOTIFY notificationTextChanged) Q_PROPERTY(QString notificationText MEMBER m_notificationText WRITE setNotificationText NOTIFY notificationTextChanged)
Q_PROPERTY(int updateSelectedDive MEMBER m_updateSelectedDive WRITE setUpdateSelectedDive NOTIFY updateSelectedDiveChanged)
Q_PROPERTY(int selectedDiveTimestamp MEMBER m_selectedDiveTimestamp WRITE setSelectedDiveTimestamp NOTIFY selectedDiveTimestampChanged) Q_PROPERTY(int selectedDiveTimestamp MEMBER m_selectedDiveTimestamp WRITE setSelectedDiveTimestamp NOTIFY selectedDiveTimestampChanged)
Q_PROPERTY(QStringList suitList READ suitList NOTIFY suitListChanged) Q_PROPERTY(QStringList suitList READ suitList NOTIFY suitListChanged)
Q_PROPERTY(QStringList buddyList READ buddyList NOTIFY buddyListChanged) Q_PROPERTY(QStringList buddyList READ buddyList NOTIFY buddyListChanged)
@ -137,9 +136,6 @@ public:
QString notificationText() const; QString notificationText() const;
void setNotificationText(QString text); void setNotificationText(QString text);
int updateSelectedDive() const;
void setUpdateSelectedDive(int idx);
int selectedDiveTimestamp() const; int selectedDiveTimestamp() const;
void setSelectedDiveTimestamp(int when); void setSelectedDiveTimestamp(int when);
@ -220,7 +216,7 @@ public slots:
QString getVersion() const; QString getVersion() const;
void deleteGpsFix(quint64 when); void deleteGpsFix(quint64 when);
void revertToNoCloudIfNeeded(); void revertToNoCloudIfNeeded();
void consumeFinishedLoad(timestamp_t currentDiveTimestamp); void consumeFinishedLoad();
void refreshDiveList(); void refreshDiveList();
void screenChanged(QScreen *screen); void screenChanged(QScreen *screen);
qreal lastDevicePixelRatio(); qreal lastDevicePixelRatio();
@ -247,7 +243,6 @@ private:
bool m_loadFromCloud; bool m_loadFromCloud;
static QMLManager *m_instance; static QMLManager *m_instance;
QString m_notificationText; QString m_notificationText;
int m_updateSelectedDive;
int m_selectedDiveTimestamp; int m_selectedDiveTimestamp;
qreal m_lastDevicePixelRatio; qreal m_lastDevicePixelRatio;
QElapsedTimer timer; QElapsedTimer timer;
@ -287,7 +282,6 @@ signals:
void loadFromCloudChanged(); void loadFromCloudChanged();
void startPageTextChanged(); void startPageTextChanged();
void notificationTextChanged(); void notificationTextChanged();
void updateSelectedDiveChanged();
void selectedDiveTimestampChanged(); void selectedDiveTimestampChanged();
void sendScreenChanged(QScreen *screen); void sendScreenChanged(QScreen *screen);
void progressMessageChanged(); void progressMessageChanged();