diff --git a/RsyncUI.pro.user b/RsyncUI.pro.user index 9024951..ac7c24f 100644 --- a/RsyncUI.pro.user +++ b/RsyncUI.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/RsyncUI_fr_FR.ts b/RsyncUI_fr_FR.ts index d26bde9..bffdbc0 100644 --- a/RsyncUI_fr_FR.ts +++ b/RsyncUI_fr_FR.ts @@ -149,96 +149,99 @@ Cliquez pour ajouter à la file de téléchargement - + + Filter... + Filtrer... + + + Click on file to stop downloading Cliquez sur le document pour arrêter le téléchargement et l'enlever de la file - + %p% Downloading Téléchargement - + toolBar Barre d'outils - + Download Télécharger - + Click on menu button to download the entire folder Cliquer sur le bouton droit de la souris pour télécharger le dossier entier - + Exit Quitter - + Terminate the program Terminer le programme - + Ctrl+Q Ctrl+Q - + hidden service - entre - -Service caché + Service caché - + Change save folder Changer le dossier de destination - + About À propos - + About Qt À propos de Qt - + Settings Paramètres - + KB Ko - + MB Mo - + GB Go - + TB To - + PB Po @@ -275,10 +278,6 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat <b>5ème icône: Quitter</b><br> Permet de quitter le programme - - <h2>Client for rsync server<2><br><br> - <h2>Client pour serveur rsync<2><br><br>éaa - Path @@ -295,106 +294,140 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat Type - + + Date + Date + + + + KB/s + Ko/s + + + + MB/s + Mo/s + + + + GB/s + Go/s + + + + TB/s + To/s + + + + PB/s + Po/s + + + A list of interrupted downloads exists, do you want to continue downloading ? if not the list will be cleared Une liste de téléchargement existe, voulez-vous utiliser cette liste ? si non, elle sera effacée - + &Quit &Quitter - + Clicking Save button, You can save the list of downloads Vous pouvez enregistrer la liste des téléchargements en cliquant sur "enregister" - + Exiting will stop downloading, and will clear the download queue. Do you want to exit ? Si vous sortez, les téléchargements seront arrêter. Voulez-vous vraiment sortir ? - + 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. 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. - + The processus does'nt respond: Le processus ne répond pas: - + server does not exists Le serveur n'existe pas - - + + Dir dossier - - - File - Doc + Doc - + File is partially downloaded. Do you want to resume download ? if no, the file will be deleted from destination directory 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 - + File is already downloaded. Do you want to reload it ? The old file will be deleted Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L'ancien fichier sera effacé - + File is already downloading Le document est déjà en téléchargement - + Starting downloading Démarrage du téléchargement - + finished Terminé - + Rsync process crashed Le processus rsync à planté - + stopped by user stoppé par l'utilisateur - + + +Do you want to retry? + +Voulez-vous ré-essayer? + + + Download Téléchargement - + RsyncUI Request Requête RsyncUI - + Hidden service name Nom du servcice caché @@ -429,52 +462,57 @@ Voulez-vous vraiment sortir ? Code source - + Since the save path is linked to service, you need to select a service before you can select a folder Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut - + Choose folder where to save file Choisissez un dossier où enregistrer le document - + Do you want to stop downloading and delete this file from download queue ? Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ? - + Do you want to delete this file from download queue ? Voulez-vous enlever ce fichier de la file de téléchargement ? - + + B + o + + + The process failed to start. Either the invoked program is missing, or you may have insufficient permissions or resources to invoke the program. Le processus échoué, soit le programme est manquant, soit vous n'avez pas l'autorisation de l'exécuter. - + The process crashed some time after starting successfully. Le processus à planté après avoir démarré avec succès. - + The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again. La fonction waitFor...() a dépassé la limite de temps, you pouvez essayer de la relancer. - + 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. 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. - + An error occurred when attempting to read from the process. For example, the process may not be running. Une erreur est survenue lors de la lecturee de données, le processus est probablement arrêté. - + An unknown error occurred. This is the default return value of error(). Une erreur inconnue est survenue. C'est la valeur de retour par défaut de error(). diff --git a/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm b/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm index e9af2ed..6dcffe0 100644 Binary files a/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm and b/languages/fr_FR/LC_MESSAGES/RsyncUI_fr_FR.qm differ diff --git a/mainwindow.cpp b/mainwindow.cpp index 0cfd658..ddf819a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -70,11 +70,13 @@ MainWindow::MainWindow(QWidget *parent) connect(config.comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::on_comboBox_currentIndexChanged); connect(loginD.loginBox, SIGNAL(accepted()), this, SLOT(on_loginBox_accepted())); + loadSettings(); + // init of widgets ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget); // attach search widget to treewidget ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive); // and set it case insensitive - ui->treeWidget->setHeaderLabels({tr("Path"), tr("Type"), tr("Size"), "fullSize"} ); // set header of columns of tree widget - + ui->treeWidget->setHeaderLabels({tr("Path"), tr("Type"), tr("Size"), tr("Date"), "fullSize"} ); // set header of columns of tree widget + //ui->treeWidget->header()->setContextMenuPolicy(); // setting arrowcursor for treeWidget, listWidget and listDownload to arrow ui->treeWidget->setCursor(Qt::ArrowCursor); ui->listWidget->setCursor(Qt::ArrowCursor); @@ -83,7 +85,6 @@ MainWindow::MainWindow(QWidget *parent) // Hiding progress bar ui->progressBar->hide(); - loadSettings(); // if last server exists in settings if (this->settings.contains("connexion/lastServer")) @@ -104,7 +105,7 @@ MainWindow::MainWindow(QWidget *parent) config.UnitCombobox->addItems({tr("KB/s"), tr("MB/s"), tr("GB/s"), tr("TB/s"), tr("PB/s")}); // hide fullsize column of treeview - ui->treeWidget->setColumnHidden(3, true); + ui->treeWidget->setColumnHidden(4, true); initSystemTrayIcon(); } @@ -377,7 +378,7 @@ void MainWindow::listServices() bool flag = false; cmd = "/usr/bin/rsync"; - param << "--contimeout=10" << "--port=" + QString::number(this->connexion.port) << this->connexion.server + "::"; + param << "--contimeout=20" << "--port=" + QString::number(this->connexion.port) << this->connexion.server + "::"; myProcess = new QProcess(this); myProcess->start(cmd, param); @@ -422,6 +423,7 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt QString fullsize; QString filename; QString fileType; + QString date; QProcess * myProcess; bool isDir = false; bool flag = false; @@ -448,7 +450,7 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt } myProcess->setProcessEnvironment(env); cmd = "rsync"; - param << "--contimeout=10" << "--port=" + QString::number(portN) << server + "::" + path; + param << "--contimeout=20" << "--port=" + QString::number(portN) << server + "::" + path; myProcess->start(cmd, param); @@ -493,9 +495,9 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt { isDir = false; } - + date = line.section(' ', 2, 2); fileType = getFileType(filename); - addTreeItem(filename, size, fullsize, fileType, isDir, parent); + addTreeItem(filename, size, fullsize, fileType, date, isDir, parent); } } flag = false; @@ -615,7 +617,7 @@ void MainWindow::on_connectButton_clicked() } // add parent in treeview -void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, QString type, bool isDir=false, QTreeWidgetItem *parent=nullptr) +void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, QString type, QString date, bool isDir=false, QTreeWidgetItem *parent=nullptr) { QTreeWidgetItem *treeItem; if (parent != nullptr) @@ -637,7 +639,9 @@ void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, Q } treeItem->setText(0, name); treeItem->setText(2, fileSize); - treeItem->setText(3, fullsize); + treeItem->setText(3, date); + treeItem->setText(4, fullsize); + treeItem->setTextAlignment(2, Qt::AlignRight); if (parent != nullptr) @@ -728,7 +732,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD // assembling path from treewidget path = item->text(0); - sizeFromRsync = item->text(3).toUInt(); + sizeFromRsync = item->text(4).toUInt(); while(itemR->parent() != NULL) { @@ -738,7 +742,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD }; cout << item->text(1).toStdString() <text(1) == tr("File") or downloadDir == true) + if (item->text(1) != tr("Dir") or downloadDir == true) { // exists saving path in settings ? str = "Folder/" + this->connexion.server + "/" + this->connexion.service; @@ -861,6 +865,8 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) QString str; int pos; QString aborted = tr("finished"); + QMessageBox::StandardButton reply; + bool retry = false; // test if process crashed if (exitStatus == QProcess::CrashExit) @@ -871,19 +877,28 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) tr("Rsync process crashed")); } //test result code of command (if 20 then command stopped by user) - if (exitCode != 0 and exitCode != 20) + if (exitCode != 0) { + if (exitCode == 20) + { + aborted = tr("stopped by user"); + }else if (exitCode == 5) // password asked + { + loginDialog.show(); + retry = true; + } + // displaying warning with exit code - QMessageBox::warning( - NULL, + reply = QMessageBox::warning( + this, "RsyncUI", - rsyncErrorStrings[exitCode]); - }else if (exitCode == 20) - { - aborted = tr("stopped by user"); - }else if (exitCode == 5) // password asked - { - loginDialog.show(); + rsyncErrorStrings[exitCode] + tr("\nDo you want to retry?"), + QMessageBox::Yes|QMessageBox::No, + QMessageBox::Yes); + if (reply == QMessageBox::Yes) + { + retry = true; + } } this->trayIcon->showMessage("RsyncUI", tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information); @@ -894,7 +909,11 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) // reset variables and window this->downloading.process->close(); ui->progressBar->hide(); - delete ui->listDownload->takeItem(0); + + if (retry == false) + { + delete ui->listDownload->takeItem(0); + } this->downloading.clear(); // Some downloads staying in queue diff --git a/mainwindow.h b/mainwindow.h index 00e6352..265214d 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -58,6 +58,7 @@ class Connexion public: int bandwidthLimit = 0; int bandwidthLimitUnit; + int contimeout = 20; QString server; QString service; QString user; @@ -149,8 +150,7 @@ class MainWindow : public QMainWindow void listServices(); bool validateServer(QString server); bool isIpAddress(QString server); - void addTreeItem(QString name, QString fileSize, QString fullsize, QString type, bool isDir, QTreeWidgetItem *parent); - + void addTreeItem(QString name, QString fileSize, QString fullsize, QString type, QString date, bool isDir, QTreeWidgetItem *parent); //QTreeWidgetItem * addTreeRoot(QString name, QString size, QString fullsize, bool isDir); //QTreeWidgetItem * addTreeChild(QTreeWidgetItem *parent, QString name, QString size, QString fullsize, bool isDir); bool scanDir(QString server, int portN, QTreeWidgetItem *parent = NULL, QString path = "" ); @@ -220,7 +220,7 @@ class MainWindow : public QMainWindow void on_actionHiddenService_triggered(); -signals: + signals: void stopDownloading(QProcess *); void progressSignal(int); void speed(QString); diff --git a/tools.cpp b/tools.cpp index 04bb91f..8777029 100644 --- a/tools.cpp +++ b/tools.cpp @@ -75,6 +75,6 @@ QString getFileType(QString filename) { QMimeDatabase db; QMimeType mime = db.mimeTypeForFile(filename); - QString returnValue = mime.name().section('/',1 ,1); + QString returnValue = mime.name().section('/',0 ,0); return returnValue; }