summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-06-20 19:33:56 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-06-20 19:33:56 +0200
commitb7d6bbb4513028340a2720070c7a7a968ded1681 (patch)
tree5e1408fc91c3667ad9f916c99c1d51f451b99f06 /src
parentb6aa12b323a81f4ac8e1bb76c2fea780a1698d97 (diff)
Fix for downloads getting stuck after pausing them.
Disabled timer check as it appeared to terminate some downloads early.
Diffstat (limited to 'src')
-rw-r--r--src/downloadlistwidget.cpp6
-rw-r--r--src/downloadlistwidgetcompact.cpp6
-rw-r--r--src/downloadmanager.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp
index 75470056..5ab5d397 100644
--- a/src/downloadlistwidget.cpp
+++ b/src/downloadlistwidget.cpp
@@ -127,7 +127,7 @@ void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const
m_NameLabel->setText(name);
m_SizeLabel->setText(sizeFormat(m_Manager->getFileSize(downloadIndex) ));
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
- if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
+ if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
QPalette labelPalette;
m_InstallLabel->setVisible(true);
m_Progress->setVisible(false);
@@ -332,7 +332,7 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
QModelIndex sourceIndex = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index);
if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) {
emit installDownload(sourceIndex.row());
- } else if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) {
+ } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) {
emit resumeDownload(sourceIndex.row());
}
return true;
@@ -364,7 +364,7 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
} else if (state == DownloadManager::STATE_DOWNLOADING){
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
- } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
+ } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
}
diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp
index cdce8d7f..99cbd7cb 100644
--- a/src/downloadlistwidgetcompact.cpp
+++ b/src/downloadlistwidgetcompact.cpp
@@ -114,7 +114,7 @@ void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex)
m_SizeLabel->setText(QString::number(m_Manager->getFileSize(downloadIndex) / 1048576));
}
- if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
+ if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
m_DoneLabel->setVisible(true);
m_Progress->setVisible(false);
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/inactive\">").arg(tr("Paused")));
@@ -297,7 +297,7 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
QModelIndex sourceIndex = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index);
if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) {
emit installDownload(sourceIndex.row());
- } else if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) {
+ } else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) {
emit resumeDownload(sourceIndex.row());
}
return true;
@@ -327,7 +327,7 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
} else if (state == DownloadManager::STATE_DOWNLOADING){
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
- } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
+ } else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
}
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 6ed93ec1..ecbcc03b 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -206,7 +206,7 @@ DownloadManager::DownloadManager(NexusInterface *nexusInterface, QObject *parent
{
connect(&m_DirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString)));
m_TimeoutTimer.setSingleShot(false);
- connect(&m_TimeoutTimer, SIGNAL(timeout()), this, SLOT(checkDownloadTimeout()));
+ //connect(&m_TimeoutTimer, SIGNAL(timeout()), this, SLOT(checkDownloadTimeout()));
m_TimeoutTimer.start(5 * 1000);
}
@@ -1668,8 +1668,8 @@ void DownloadManager::downloadFinished(int index)
} else if (info->m_State == STATE_PAUSING) {
if (info->m_Output.isOpen()) {
info->m_Output.write(info->m_Reply->readAll());
- setState(info, STATE_PAUSED);
}
+ setState(info, STATE_PAUSED);
}
if (info->m_State == STATE_CANCELED || (info->m_Tries == 0 && error)) {