corrected regression: resuming downloadlist download did not start\n added downloading speed in progress bar
This commit is contained in:
parent
e8743ff802
commit
a8e888e20d
@ -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>
|
||||
|
@ -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"><h2>Client pour serveur rsync<2><br><br>é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>&Quit</source>
|
||||
<translation>&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 "enregister"
|
||||
</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 <b>Quit</b> 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'icône <b>Quitter</b> 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'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'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'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 où 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'avez pas l'autorisation de l'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'envoi des données vers le processus. Le processus est peut être arrté ou il a fermé son canal d'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'est la valeur de retour par défaut de error().</translation>
|
||||
</message>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
// connectors
|
||||
connect(this, &MainWindow::fileName, ui->progressBar, &QProgressBar::setFormat);
|
||||
connect(this, &MainWindow::progressSignal, ui->progressBar, &QProgressBar::setValue);
|
||||
//connect(this, &MainWindow::speed, ui->progressBar, &MainWindow::setDlSpeed);
|
||||
//connect(this, &MainWindow::errorSignal, this, &MainWindow::downloadingErrorSlot);
|
||||
connect(this, &MainWindow::stopDownloading, this, &MainWindow::cancelled);
|
||||
connect(config.buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
|
||||
@ -71,17 +72,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive); // and set it case insensitive
|
||||
ui->treeWidget->setHeaderLabels({tr("Path"), tr("Type"), tr("Size")} ); // set header of columns of tree widget
|
||||
|
||||
// if last server exists in settings
|
||||
if (this->settings.contains("connexion/lastServer"))
|
||||
{
|
||||
// set window to precedent server/port configuration
|
||||
ui->portEdit->setText(this->settings.value("connexion/port").toString());
|
||||
ui->khistorycombobox->setCurrentText(this->settings.value("connexion/lastServer").toString());
|
||||
}else
|
||||
{
|
||||
ui->portEdit->text() = QString::number(this->connexion.port);
|
||||
ui->khistorycombobox->clear();
|
||||
}
|
||||
|
||||
// setting arrowcursor for treeWidget, listWidget and listDownload to arrow
|
||||
ui->treeWidget->setCursor(Qt::ArrowCursor);
|
||||
@ -93,6 +83,18 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
loadSettings();
|
||||
|
||||
// if last server exists in settings
|
||||
if (this->settings.contains("connexion/lastServer"))
|
||||
{
|
||||
// set window to precedent server/port configuration
|
||||
ui->portEdit->setText(this->settings.value("connexion/port").toString());
|
||||
ui->khistorycombobox->setCurrentText(this->settings.value("connexion/lastServer").toString());
|
||||
}else
|
||||
{
|
||||
ui->portEdit->setText(QString::number(this->connexion.port));
|
||||
ui->khistorycombobox->clear();
|
||||
}
|
||||
|
||||
//setting configuration window
|
||||
config.comboBox->setCurrentIndex(ui->toolBar->toolButtonStyle()); // setting combobox to saved settings
|
||||
|
||||
@ -702,6 +704,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
|
||||
// no downloading process launching it
|
||||
this->downloading.path = path;
|
||||
this->downloading.server = this->connexion.server;
|
||||
this->downloading.port = this->connexion.port;
|
||||
this->downloading.service = this->connexion.service;
|
||||
startDownloading();
|
||||
// wait 1 second to process start
|
||||
@ -1048,6 +1051,7 @@ void MainWindow::loadDownloadList()
|
||||
path.resize(pos);
|
||||
pos = path.lastIndexOf(" => ");
|
||||
this->downloading.server = path.midRef(pos+4).toString();
|
||||
this->downloading.port = this->settings.value("connexion/server/" + this->downloading.server).toInt();
|
||||
path.resize(pos);
|
||||
this->downloading.path = path;
|
||||
str = "Folder/" + this->downloading.server + "/" + this->downloading.service;
|
||||
@ -1097,3 +1101,8 @@ void MainWindow::on_actionExit_triggered()
|
||||
{
|
||||
quitApp();
|
||||
}
|
||||
|
||||
void MainWindow::setDlSpeed(QString speed)
|
||||
{
|
||||
speed.squeeze();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user