corrected regression: resuming downloadlist download did not start\n added downloading speed in progress bar

This commit is contained in:
2023-02-22 00:48:16 +01:00
parent e8743ff802
commit a8e888e20d
5 changed files with 95 additions and 63 deletions
+34 -16
View File
@@ -49,7 +49,7 @@ void MainWindow::download()
{
param << "--bwlimit=" + QString::number(this->connexion.bandwidthLimit) + bwUnitChar[this->connexion.bandwidthLimitUnit];
}
param << "--port=" + QString::number(this->connexion.port);
param << "--port=" + QString::number(this->downloading.port);
param << "-aXP";
param << this->downloading.server + "::" + this->downloading.service + "/" + this->downloading.path << this->downloading.savePath + "/";
@@ -69,32 +69,50 @@ void MainWindow::readRsyncOutput()
bool flag = false;
int value;
int pos;
static QString dlSpeed;
QStringList list;
static QString filename;
int i;
int listSize;
while(!flag)
{
list.clear();
line = QString::fromUtf8(this->downloading.process->readLine());
if (line.isEmpty())
{
flag = true;
break;
}
pos = line.indexOf("%");
if (pos != -1)
{
line.resize(pos);
pos = line.lastIndexOf(' ');
if (pos != -1)
{
line.remove(0, pos);
value = line.toInt();
// sending progress to Main window
emit progressSignal(value);
}
}else
{
if (!line.contains("receiving"))
pos = line.indexOf("%");
if (pos != -1)
{
emit fileName(line.remove(QChar('\n'), Qt::CaseInsensitive) + " %p%");
line = line.simplified();
list = line.split(" ");
listSize = list.count() / 4;
for (i = 0; i < listSize; i++)
{
value = list.at(i *4 + 1).chopped(1).toInt();
dlSpeed = list.at(i * 4 + 2);
/*line.resize(pos);
pos = line.lastIndexOf(' ');
if (pos != -1)
{
line.remove(0, pos);
value = line.toInt();*/
// sending progress to Main window
emit progressSignal(value);
emit fileName(filename + " %p%" + "\t " + dlSpeed);
}
}else
{
if (!line.contains("receiving"))
{
filename = line.remove(QChar('\n'), Qt::CaseInsensitive);
emit fileName(filename + " %p%\t " + dlSpeed);
}
}
}
}