added 'suspend' button

This commit is contained in:
Daniel Tartavel 2024-10-19 12:29:49 +02:00
parent 200006e50f
commit a766bffd85

View File

@ -1633,7 +1633,14 @@ void MainWindow::on_actionPause_downloads_triggered()
{ {
quint64 processID = this->downloading.process->processId(); quint64 processID = this->downloading.process->processId();
QString fileStr = "/proc/" + QString::number(processID) + "/task/" + QString::number(processID) + "/children"; QString fileStr = "/proc/" + QString::number(processID) + "/task/" + QString::number(processID) + "/children";
static QMessageBox *msgBox; static QMessageBox msgBox;
//msgBox = new QMessageBox(this);
msgBox.setIcon( QMessageBox::Warning );
msgBox.setText("Download suspended");
//QPushButton *btnCancel = msgBox->addButton( "Cancel", QMessageBox::RejectRole );
//msgBox.setAttribute(Qt::WA_DeleteOnClose); // delete pointer after close
msgBox.setModal(false);
info (DEBUGMACRO, "downloading state : " + QString::fromUtf8((this->downloading.paused==0)?"running":"paused")); info (DEBUGMACRO, "downloading state : " + QString::fromUtf8((this->downloading.paused==0)?"running":"paused"));
info (DEBUGMACRO, "Downloading process ID : " + QString::number(processID)); info (DEBUGMACRO, "Downloading process ID : " + QString::number(processID));
@ -1656,7 +1663,10 @@ void MainWindow::on_actionPause_downloads_triggered()
info(DEBUGMACRO, "resuming failed : " + QString::number(errno)); info(DEBUGMACRO, "resuming failed : " + QString::number(errno));
} }
msgBox->close(); if (msgBox.isVisible())
{
msgBox.close();
}
this->downloading.paused = false; this->downloading.paused = false;
}else }else
{ {
@ -1665,13 +1675,8 @@ void MainWindow::on_actionPause_downloads_triggered()
{ {
info(DEBUGMACRO, "resuming failed : " + QString::number(errno)); info(DEBUGMACRO, "resuming failed : " + QString::number(errno));
} }
msgBox = new QMessageBox(this);
msgBox->setIcon( QMessageBox::Warning ); msgBox.show();
msgBox->setText("Download suspended");
//QPushButton *btnCancel = msgBox->addButton( "Cancel", QMessageBox::RejectRole );
msgBox->setAttribute(Qt::WA_DeleteOnClose); // delete pointer after close
msgBox->setModal(false);
msgBox->show();
this->downloading.paused = true; this->downloading.paused = true;
} }