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

This commit is contained in:
Daniel Tartavel 2023-02-22 00:48:16 +01:00
parent e8743ff802
commit f3c361f155
4 changed files with 75 additions and 52 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-02-16T21:27:43. -->
<!-- Written by QtCreator 4.14.2, 2023-02-22T00:23:04. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -183,27 +183,27 @@
<translation>Paramètres</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="100"/>
<location filename="mainwindow.cpp" line="102"/>
<source>KB</source>
<translation>Ko</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="100"/>
<location filename="mainwindow.cpp" line="102"/>
<source>MB</source>
<translation>Mo</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="100"/>
<location filename="mainwindow.cpp" line="102"/>
<source>GB</source>
<translation>Go</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="100"/>
<location filename="mainwindow.cpp" line="102"/>
<source>TB</source>
<translation>To</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="100"/>
<location filename="mainwindow.cpp" line="102"/>
<source>PB</source>
<translation>Po</translation>
</message>
@ -245,17 +245,17 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat
<translation type="vanished">&lt;h2&gt;Client pour serveur rsync&lt;2&gt;&lt;br&gt;&lt;br&gt;éaa</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="72"/>
<location filename="mainwindow.cpp" line="73"/>
<source>Path</source>
<translation>Chemin</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="72"/>
<location filename="mainwindow.cpp" line="73"/>
<source>Size</source>
<translation>Taille</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="72"/>
<location filename="mainwindow.cpp" line="73"/>
<source>Type</source>
<translation>Type</translation>
</message>
@ -265,85 +265,85 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat
<translation>Une liste de téléchargement existe, voulez-vous utiliser cette liste ? si non, elle sera effacée</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="144"/>
<location filename="mainwindow.cpp" line="146"/>
<source>&amp;Quit</source>
<translation>&amp;Quitter</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="201"/>
<location filename="mainwindow.cpp" line="203"/>
<source>Clicking Save button, You can save the list of downloads
</source>
<translation>Vous pouvez enregistrer la liste des téléchargements en cliquant sur &quot;enregister&quot;
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="207"/>
<location filename="mainwindow.cpp" line="209"/>
<source>Exiting will stop downloading, and will clear the download queue.
Do you want to exit ?</source>
<translation>Si vous sortez, les téléchargements seront arrêter.
Voulez-vous vraiment sortir ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="245"/>
<location filename="mainwindow.cpp" line="247"/>
<source>The program will keep running in the system tray. To terminate the program, choose &lt;b&gt;Quit&lt;/b&gt; in the context menu of the system tray entry.</source>
<translation>Le programme continue dans la boîte à miniatures. Pour quitter le programme cliquez sur l&apos;icône &lt;b&gt;Quitter&lt;/b&gt; ou dans les menu contextuel.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="538"/>
<location filename="mainwindow.cpp" line="540"/>
<source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="565"/>
<location filename="mainwindow.cpp" line="585"/>
<location filename="mainwindow.cpp" line="567"/>
<location filename="mainwindow.cpp" line="587"/>
<source>Dir</source>
<translation>dossier</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="569"/>
<location filename="mainwindow.cpp" line="655"/>
<location filename="mainwindow.cpp" line="571"/>
<location filename="mainwindow.cpp" line="657"/>
<source>File</source>
<translation>Doc</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="666"/>
<location filename="mainwindow.cpp" line="668"/>
<source>File is partially downloaded. Do you want to resume download ? if no, the file will be deleted from destination directory</source>
<translation>Le document est déjà partiellement téléchargé. Voulez vous continuer le téléchargemnt ? Si non, il sera supprimer du dossier de destination</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="683"/>
<location filename="mainwindow.cpp" line="685"/>
<source>File is already downloaded. Do you want to reload it ? The old file will be deleted</source>
<translation>Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L&apos;ancien fichier sera effacé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="719"/>
<location filename="mainwindow.cpp" line="722"/>
<source>File is already downloading</source>
<translation>Le document est déjà en téléchargement</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="742"/>
<location filename="mainwindow.cpp" line="745"/>
<source>Starting downloading
</source>
<translation>Démarrage du téléchargement
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="757"/>
<location filename="mainwindow.cpp" line="760"/>
<source>finished</source>
<translation>Terminé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="765"/>
<location filename="mainwindow.cpp" line="768"/>
<source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="777"/>
<location filename="mainwindow.cpp" line="780"/>
<source>stopped by user</source>
<translation>stoppé par l&apos;utilisateur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="781"/>
<location filename="mainwindow.cpp" line="784"/>
<source>Download </source>
<translation>Téléchargement </translation>
</message>
@ -378,52 +378,52 @@ Voulez-vous vraiment sortir ?</translation>
<translation>Code source</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="952"/>
<location filename="mainwindow.cpp" line="955"/>
<source>Since the save path is linked to service, you need to select a service before you can select a folder</source>
<translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="957"/>
<location filename="mainwindow.cpp" line="960"/>
<source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="848"/>
<location filename="mainwindow.cpp" line="851"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source>
<translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="862"/>
<location filename="mainwindow.cpp" line="865"/>
<source>Do you want to delete this file from download queue ?</source>
<translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message>
<message>
<location filename="mainwindow.h" line="125"/>
<location filename="mainwindow.h" line="128"/>
<source>The process failed to start. Either the invoked program is missing, or you may have insufficient permissions or resources to invoke the program.</source>
<translation>Le processus échoué, soit le programme est manquant, soit vous n&apos;avez pas l&apos;autorisation de l&apos;exécuter.</translation>
</message>
<message>
<location filename="mainwindow.h" line="126"/>
<location filename="mainwindow.h" line="129"/>
<source>The process crashed some time after starting successfully.</source>
<translation>Le processus à planté après avoir démarré avec succès.</translation>
</message>
<message>
<location filename="mainwindow.h" line="127"/>
<location filename="mainwindow.h" line="130"/>
<source>The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.</source>
<translation>La fonction waitFor...() a dépassé la limite de temps, you pouvez essayer de la relancer.</translation>
</message>
<message>
<location filename="mainwindow.h" line="128"/>
<location filename="mainwindow.h" line="131"/>
<source>An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.</source>
<translation>Une erreur est survenue lors de l&apos;envoi des données vers le processus. Le processus est peut être arrté ou il a fermé son canal d&apos;entrée.</translation>
</message>
<message>
<location filename="mainwindow.h" line="129"/>
<location filename="mainwindow.h" line="132"/>
<source>An error occurred when attempting to read from the process. For example, the process may not be running.</source>
<translation>Une erreur est survenue lors de la lecturee de données, le processus est probablement arrêté.</translation>
</message>
<message>
<location filename="mainwindow.h" line="130"/>
<location filename="mainwindow.h" line="133"/>
<source>An unknown error occurred. This is the default return value of error().</source>
<translation>Une erreur inconnue est survenue. C&apos;est la valeur de retour par défaut de error().</translation>
</message>

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);
}
}
}
}

View File

@ -10,6 +10,7 @@
#include <QMainWindow>
#include <string>
#include <QTreeWidgetItem>
#include <QList>
#include <QListWidgetItem>
#include <QProgressDialog>
#include <QSettings>
@ -68,6 +69,7 @@ class Downloading
QString service;
QString path;
QString savePath;
int port;
QProcess * process = nullptr;
bool quit = false;
void clear();
@ -198,9 +200,12 @@ class MainWindow : public QMainWindow
void on_actionExit_triggered();
void setDlSpeed(QString speed);
signals:
void stopDownloading(QProcess *);
void progressSignal(int);
void speed(QString);
void finishedSignal(bool = true);
void fileName(QString);
//void errorSignal(QString);