diff options
| author | Al12rs <gabriel.cortesi@outlook.com> | 2018-07-17 13:32:53 +0200 |
|---|---|---|
| committer | Al12rs <gabriel.cortesi@outlook.com> | 2018-07-17 13:32:53 +0200 |
| commit | 75478f68a12c89af790ba2aae127d4834c6d44a5 (patch) | |
| tree | b1324288804e104f68d6067da167e929de89fac5 | |
| parent | 5a0b8b431c3ffd5de2f4359492854310da32405e (diff) | |
Avoid asking users if they are sure they want to close of all downlaods are paused.
| -rw-r--r-- | src/downloadmanager.cpp | 10 | ||||
| -rw-r--r-- | src/downloadmanager.h | 7 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 385d2246..beb498c1 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -230,6 +230,16 @@ bool DownloadManager::downloadsInProgress() return false;
}
+bool DownloadManager::downloadsInProgressNoPause()
+{
+ for (QVector<DownloadInfo*>::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end(); ++iter) {
+ if ((*iter)->m_State < STATE_READY && (*iter)->m_State != STATE_PAUSED) {
+ return true;
+ }
+ }
+ return false;
+}
+
void DownloadManager::pauseAll()
{
diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 514402ee..136ecf2a 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -139,6 +139,13 @@ public: bool downloadsInProgress();
/**
+ * @brief determine if a download is currently in progress, does not count paused ones.
+ *
+ * @return true if there is currently a download in progress (that is not paused already).
+ **/
+ bool downloadsInProgressNoPause();
+
+ /**
* @brief set the output directory to write to
*
* @param outputDirectory the new output directory
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f70e66a6..5999608c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -883,7 +883,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
m_closing = true;
- if (m_OrganizerCore.downloadManager()->downloadsInProgress()) {
+ if (m_OrganizerCore.downloadManager()->downloadsInProgressNoPause()) {
if (QMessageBox::question(this, tr("Downloads in progress"),
tr("There are still downloads in progress, do you really want to quit?"),
QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Cancel) {
|
