mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: Allow cancel of ongoing download
This commit adds the capability to cancel a running download from DC. The actual cancel is fully handled in the underlying libdivecomputer code. As the user may be interested in the dives downloaded up to the moment of cancel, do not just close the download screen (as it was before this commit). Now, the <quit> button changes to <cancel> when the download is started, and pressing cancel, only cancels the download and does not close the download screen, but presents the so far downloaded data. When no download is running, the <quit> button just quits the screen as before. Fixes: #485 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
915b760d54
commit
619fbaf1e2
3 changed files with 10 additions and 2 deletions
|
@ -201,14 +201,16 @@ Kirigami.Page {
|
|||
antialiasing: true
|
||||
radius: Kirigami.Units.smallSpacing * 2
|
||||
}
|
||||
text: qsTr("Quit")
|
||||
text: progressBar.visible ? qsTr("Cancel") : qsTr("Quit")
|
||||
contentItem: Text {
|
||||
text: quitbutton.text
|
||||
color: subsurfaceTheme.darkerPrimaryTextColor
|
||||
}
|
||||
onClicked: {
|
||||
manager.cancelDownloadDC()
|
||||
if (!progressBar.visible)
|
||||
stackView.pop();
|
||||
manager.appendTextToLog("exit DCDownload screen")
|
||||
stackView.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1121,6 +1121,11 @@ void QMLManager::deleteDive(int id)
|
|||
changesNeedSaving();
|
||||
}
|
||||
|
||||
void QMLManager::cancelDownloadDC()
|
||||
{
|
||||
import_thread_cancelled = true;
|
||||
}
|
||||
|
||||
QString QMLManager::addDive()
|
||||
{
|
||||
appendTextToLog("Adding new dive.");
|
||||
|
|
|
@ -162,6 +162,7 @@ public slots:
|
|||
void sendGpsData();
|
||||
void downloadGpsData();
|
||||
void populateGpsData();
|
||||
void cancelDownloadDC();
|
||||
void clearGpsData();
|
||||
void finishSetup();
|
||||
void openLocalThenRemote(QString url);
|
||||
|
|
Loading…
Add table
Reference in a new issue