- 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"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -168,27 +168,27 @@
<translation>Paramètres</translation> <translation>Paramètres</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="86"/> <location filename="mainwindow.cpp" line="90"/>
<source>KB</source> <source>KB</source>
<translation>Ko</translation> <translation>Ko</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="86"/> <location filename="mainwindow.cpp" line="90"/>
<source>MB</source> <source>MB</source>
<translation>Mo</translation> <translation>Mo</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="86"/> <location filename="mainwindow.cpp" line="90"/>
<source>GB</source> <source>GB</source>
<translation>Go</translation> <translation>Go</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="86"/> <location filename="mainwindow.cpp" line="90"/>
<source>TB</source> <source>TB</source>
<translation>To</translation> <translation>To</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="86"/> <location filename="mainwindow.cpp" line="90"/>
<source>PB</source> <source>PB</source>
<translation>Po</translation> <translation>Po</translation>
</message> </message>
@ -217,95 +217,93 @@ Cliquez sur un fichier pour l&apos;ajouter dans la file de téléchargement</tra
<translation>Type</translation> <translation>Type</translation>
</message> </message>
<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> <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> <translation>Une liste de téléchargement existe, voulez-vous utiliser cette liste ? si non, elle sera effacée</translation>
</message> </message>
<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> <source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation> <translation>Le serveur n&apos;existe pas</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="421"/> <location filename="mainwindow.cpp" line="452"/>
<location filename="mainwindow.cpp" line="441"/> <location filename="mainwindow.cpp" line="472"/>
<source>Dir</source> <source>Dir</source>
<translation>dossier</translation> <translation>dossier</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="424"/> <location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="487"/> <location filename="mainwindow.cpp" line="553"/>
<source>File</source> <source>File</source>
<translation>Doc</translation> <translation>Doc</translation>
</message> </message>
<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> <source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation> <translation>Le processus rsync à planté</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="699"/> <location filename="mainwindow.cpp" line="770"/>
<source>Version</source> <source>Version</source>
<translation>Version</translation> <translation>Version</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="700"/> <location filename="mainwindow.cpp" line="771"/>
<source>Licence</source> <source>Licence</source>
<translation>License</translation> <translation>License</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="701"/> <location filename="mainwindow.cpp" line="772"/>
<source>Author</source> <source>Author</source>
<translation>Auteur</translation> <translation>Auteur</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="702"/> <location filename="mainwindow.cpp" line="773"/>
<source>EMail</source> <source>EMail</source>
<translation>Courriel</translation> <translation>Courriel</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="703"/> <location filename="mainwindow.cpp" line="774"/>
<source>Source code</source> <source>Source code</source>
<translation>Code source</translation> <translation>Code source</translation>
</message> </message>
<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> <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> <translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="728"/> <location filename="mainwindow.cpp" line="802"/>
<source>Choose folder where to save file</source> <source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation> <translation>Choisissez un dossier enregistrer le document</translation>
</message> </message>
<message> <message>
<source>Choose directory to save file</source> <location filename="mainwindow.cpp" line="688"/>
<translation type="vanished">Choisissez le dossier enregistrer</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="620"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source> <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> <translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message> </message>
<message> <message>
<source>A list of interrupted downloads exists, do you want to continue downloading ? or you can delete the list</source> <location filename="mainwindow.cpp" line="702"/>
<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"/>
<source>Do you want to delete this file from download queue ?</source> <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> <translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message> </message>

Binary file not shown.

View File

@ -507,11 +507,42 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
QTreeWidgetItem * itemR; QTreeWidgetItem * itemR;
QString path; QString path;
QString str; QString str;
QMessageBox::StandardButton reply;
itemR = item; itemR = item;
// assembling path from treewidget // assembling path from treewidget
path = item->text(0); 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) while(itemR->parent() != NULL)
{ {
itemR = itemR->parent(); itemR = itemR->parent();
@ -524,18 +555,6 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
// Item is a file // Item is a file
if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty()) 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 ? // is there a downloading process ?
if (this->downloading.process == nullptr) if (this->downloading.process == nullptr)
{ {