mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:43:25 +00:00
mobile/dive-list: add indicator that dive list is being processed
This should deal with the rather confusing 'No dive in dive list' shown while loading and processing the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4cd7767bec
commit
2e07e9345f
3 changed files with 24 additions and 2 deletions
|
@ -346,11 +346,15 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
property bool showProcessingText: manager.diveListProcessing
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: diveListModel ? qsTr("No dives in dive list") : qsTr("Please wait, updating the dive list")
|
text: diveListModel && !showProcessingText ? qsTr("No dives in dive list") : qsTr("Please wait, updating the dive list")
|
||||||
visible: diveListView.visible && diveListView.count === 0
|
visible: diveListView.visible && diveListView.count === 0
|
||||||
|
onShowProcessingTextChanged: {
|
||||||
|
manager.appendTextToLog("============diveListProcessing is " + showProcessingText)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -164,6 +164,7 @@ void QMLManager::usbRescan()
|
||||||
|
|
||||||
QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
||||||
m_verboseEnabled(false),
|
m_verboseEnabled(false),
|
||||||
|
m_diveListProcessing(false),
|
||||||
m_pluggedInDeviceName(""),
|
m_pluggedInDeviceName(""),
|
||||||
m_showNonDiveComputers(false),
|
m_showNonDiveComputers(false),
|
||||||
undoAction(Command::undoAction(this)),
|
undoAction(Command::undoAction(this)),
|
||||||
|
@ -324,6 +325,7 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
{
|
{
|
||||||
// clear out the models and the fulltext index
|
// clear out the models and the fulltext index
|
||||||
MobileModels::instance()->clear();
|
MobileModels::instance()->clear();
|
||||||
|
setDiveListProcessing(true);
|
||||||
setNotificationText(tr("Open local dive data file"));
|
setNotificationText(tr("Open local dive data file"));
|
||||||
appendTextToLog(QString("Open dive data file %1 - git_local only is %2").arg(url).arg(git_local_only));
|
appendTextToLog(QString("Open dive data file %1 - git_local only is %2").arg(url).arg(git_local_only));
|
||||||
QByteArray encodedFilename = QFile::encodeName(url);
|
QByteArray encodedFilename = QFile::encodeName(url);
|
||||||
|
@ -385,6 +387,7 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
appendTextToLog(QStringLiteral("have cloud credentials, but user asked not to connect to network"));
|
appendTextToLog(QStringLiteral("have cloud credentials, but user asked not to connect to network"));
|
||||||
|
|
||||||
updateAllGlobalLists();
|
updateAllGlobalLists();
|
||||||
|
setDiveListProcessing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience function to accesss dive directly via its row.
|
// Convenience function to accesss dive directly via its row.
|
||||||
|
@ -664,7 +667,7 @@ void QMLManager::loadDivesWithValidCredentials()
|
||||||
appendTextToLog("Cloud sync shows local cache was current");
|
appendTextToLog("Cloud sync shows local cache was current");
|
||||||
} else {
|
} else {
|
||||||
appendTextToLog("Cloud sync brought newer data, reloading the dive list");
|
appendTextToLog("Cloud sync brought newer data, reloading the dive list");
|
||||||
|
setDiveListProcessing(true);
|
||||||
// if we aren't switching from no-cloud mode, let's clear the dive data
|
// if we aren't switching from no-cloud mode, let's clear the dive data
|
||||||
if (!noCloudToCloud) {
|
if (!noCloudToCloud) {
|
||||||
appendTextToLog("Clear out in memory dive data");
|
appendTextToLog("Clear out in memory dive data");
|
||||||
|
@ -684,6 +687,7 @@ void QMLManager::loadDivesWithValidCredentials()
|
||||||
error = parse_file(fileNamePrt.data(), &dive_table, &trip_table, &dive_site_table);
|
error = parse_file(fileNamePrt.data(), &dive_table, &trip_table, &dive_site_table);
|
||||||
}
|
}
|
||||||
lockAlreadySaving.unlock();
|
lockAlreadySaving.unlock();
|
||||||
|
setDiveListProcessing(false);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
report_error("filename is now %s", fileNamePrt.data());
|
report_error("filename is now %s", fileNamePrt.data());
|
||||||
set_filename(fileNamePrt.data());
|
set_filename(fileNamePrt.data());
|
||||||
|
@ -2172,3 +2176,12 @@ QString QMLManager::getRedoText() const
|
||||||
QString redoText = Command::getUndoStack()->redoText();
|
QString redoText = Command::getUndoStack()->redoText();
|
||||||
return redoText;
|
return redoText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLManager::setDiveListProcessing(bool value)
|
||||||
|
{
|
||||||
|
if (m_diveListProcessing != value) {
|
||||||
|
m_diveListProcessing = value;
|
||||||
|
emit diveListProcessingChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ class QMLManager : public QObject {
|
||||||
Q_PROPERTY(qPrefCloudStorage::cloud_status oldStatus MEMBER m_oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
|
Q_PROPERTY(qPrefCloudStorage::cloud_status oldStatus MEMBER m_oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
|
||||||
Q_PROPERTY(QString undoText READ getUndoText NOTIFY undoTextChanged) // this is a read-only property
|
Q_PROPERTY(QString undoText READ getUndoText NOTIFY undoTextChanged) // this is a read-only property
|
||||||
Q_PROPERTY(QString redoText READ getRedoText NOTIFY redoTextChanged) // this is a read-only property
|
Q_PROPERTY(QString redoText READ getRedoText NOTIFY redoTextChanged) // this is a read-only property
|
||||||
|
Q_PROPERTY(bool diveListProcessing MEMBER m_diveListProcessing WRITE setDiveListProcessing NOTIFY diveListProcessingChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QMLManager();
|
QMLManager();
|
||||||
|
@ -152,6 +153,8 @@ public:
|
||||||
|
|
||||||
void setShowNonDiveComputers(bool show);
|
void setShowNonDiveComputers(bool show);
|
||||||
|
|
||||||
|
void setDiveListProcessing(bool value);
|
||||||
|
|
||||||
QStringList suitList() const;
|
QStringList suitList() const;
|
||||||
QStringList buddyList() const;
|
QStringList buddyList() const;
|
||||||
QStringList divemasterList() const;
|
QStringList divemasterList() const;
|
||||||
|
@ -250,6 +253,7 @@ private:
|
||||||
bool m_locationServiceEnabled;
|
bool m_locationServiceEnabled;
|
||||||
bool m_locationServiceAvailable;
|
bool m_locationServiceAvailable;
|
||||||
bool m_verboseEnabled;
|
bool m_verboseEnabled;
|
||||||
|
bool m_diveListProcessing;
|
||||||
GpsLocation *locationProvider;
|
GpsLocation *locationProvider;
|
||||||
bool m_loadFromCloud;
|
bool m_loadFromCloud;
|
||||||
static QMLManager *m_instance;
|
static QMLManager *m_instance;
|
||||||
|
@ -288,6 +292,7 @@ signals:
|
||||||
void locationServiceEnabledChanged();
|
void locationServiceEnabledChanged();
|
||||||
void locationServiceAvailableChanged();
|
void locationServiceAvailableChanged();
|
||||||
void verboseEnabledChanged();
|
void verboseEnabledChanged();
|
||||||
|
void diveListProcessingChanged();
|
||||||
void logTextChanged();
|
void logTextChanged();
|
||||||
void loadFromCloudChanged();
|
void loadFromCloudChanged();
|
||||||
void startPageTextChanged();
|
void startPageTextChanged();
|
||||||
|
|
Loading…
Add table
Reference in a new issue