- added verification of already downloaded files

This commit is contained in:
Daniel Tartavel 2023-02-11 01:14:14 +01:00
parent a3933ee1c9
commit d52a0663e5
4 changed files with 72 additions and 55 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-02-10T23:24:32. -->
<!-- Written by QtCreator 4.14.2, 2023-02-11T01:13:28. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -168,27 +168,27 @@
<translation>Paramètres</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="86"/>
<location filename="mainwindow.cpp" line="90"/>
<source>KB</source>
<translation>Ko</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="86"/>
<location filename="mainwindow.cpp" line="90"/>
<source>MB</source>
<translation>Mo</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="86"/>
<location filename="mainwindow.cpp" line="90"/>
<source>GB</source>
<translation>Go</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="86"/>
<location filename="mainwindow.cpp" line="90"/>
<source>TB</source>
<translation>To</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="86"/>
<location filename="mainwindow.cpp" line="90"/>
<source>PB</source>
<translation>Po</translation>
</message>
@ -217,95 +217,93 @@ Cliquez sur un fichier pour l&apos;ajouter dans la file de téléchargement</tra
<translation>Type</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="92"/>
<location filename="mainwindow.cpp" line="97"/>
<source>A list of interrupted downloads exists, do you want to continue downloading ? if not the list will be cleared</source>
<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="393"/>
<location filename="mainwindow.cpp" line="138"/>
<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="143"/>
<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="425"/>
<source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="421"/>
<location filename="mainwindow.cpp" line="441"/>
<location filename="mainwindow.cpp" line="452"/>
<location filename="mainwindow.cpp" line="472"/>
<source>Dir</source>
<translation>dossier</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="424"/>
<location filename="mainwindow.cpp" line="487"/>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="553"/>
<source>File</source>
<translation>Doc</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="561"/>
<location filename="mainwindow.cpp" line="534"/>
<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="615"/>
<source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="699"/>
<location filename="mainwindow.cpp" line="770"/>
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="700"/>
<location filename="mainwindow.cpp" line="771"/>
<source>Licence</source>
<translation>License</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="701"/>
<location filename="mainwindow.cpp" line="772"/>
<source>Author</source>
<translation>Auteur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="702"/>
<location filename="mainwindow.cpp" line="773"/>
<source>EMail</source>
<translation>Courriel</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="703"/>
<location filename="mainwindow.cpp" line="774"/>
<source>Source code</source>
<translation>Code source</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="725"/>
<location filename="mainwindow.cpp" line="797"/>
<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="728"/>
<location filename="mainwindow.cpp" line="802"/>
<source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation>
</message>
<message>
<source>Choose directory to save file</source>
<translation type="vanished">Choisissez le dossier enregistrer</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="620"/>
<location filename="mainwindow.cpp" line="688"/>
<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>
<source>A list of interrupted downloads exists, do you want to continue downloading ? or you can delete the list</source>
<translation type="vanished">Voulez-vous reprendre les téléchargements interrompus la fois précédente? ou vous pouvez supprimer la liste</translation>
</message>
<message>
<source>Remove</source>
<translation type="vanished">Supprimer</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="135"/>
<source>Exiting will stop downloading, and will clear the download queue.
You can save the list of downloads
Do you want to exit ?</source>
<translatorcomment>i</translatorcomment>
<translation>Si vous sortez, les téléchargements seront arrêter, mais vous pouvez enregistrer la liste pour la prochaine fois.
Voulez-vous vraiment sortir ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="632"/>
<location filename="mainwindow.cpp" line="702"/>
<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>

Binary file not shown.

View File

@ -507,11 +507,42 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
QTreeWidgetItem * itemR;
QString path;
QString str;
QMessageBox::StandardButton reply;
itemR = item;
// assembling path from treewidget
path = item->text(0);
// exists saving path in settings ?
str = "Folder/" + this->connexion.server + "/" + this->connexion.service;
if(!this->settings.contains(str))
{
// saving path do not exists, asking for it
if(!on_DefaultSaveFolder_triggered())
{
cout << "no directory selectioned, ignoring download request";
return;
}
}
if (QFile::exists(this->downloading.savePath + "/" + path))
{
reply = QMessageBox::question(
this,
"RsyncUI",
tr("File is already downloaded. Do you want to reload it ? The old file will be deleted"),
QMessageBox::Yes|QMessageBox::No,
QMessageBox::No);
if (reply == QMessageBox::No)
{
return;
}else
{
QFile::remove(this->downloading.savePath + "/" + path);
}
}
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
@ -524,18 +555,6 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
// Item is a file
if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty())
{
// exists saving path in settings ?
str = "Folder/" + this->connexion.server + "/" + this->downloading.service;
if(!this->settings.contains(str))
{
// saving path do not exists, asking for it
if(!on_DefaultSaveFolder_triggered())
{
cout << "no directory selectioned, ignoring download request";
return;
}
}
// is there a downloading process ?
if (this->downloading.process == nullptr)
{