Compare commits

..

7 Commits
2.10 ... 2.11

7 changed files with 64 additions and 27 deletions

View File

@ -22,6 +22,7 @@ Un clic gauche sur un fichier l'ajoute à la file des téléchargements, sur un
Un clic droit sur un dossier ouvre un menu contextuel permettant de télécharger le dossier entier.
Une notification s'affiche lors du début, de la fin, et lorsque l'on stoppe un téléchargement.
Le gadget de fermeture ferme la fenêtre mais ne quitte pas l'application, pour afficher à nouveau la fenêtre, cliquez sur l'icône dans la boite à miniatures.
Un identifiant et un mot de passe lorsqu'un service est protégé par mot de passe, celui-ci est enregistré dans le portefeuille système(gome-keyring ou kwallet)
## File de téléchargement
@ -30,7 +31,7 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat
## Barre d'outils
1er icône: Changer le dossier de destination
Permet de changer le dossier de téléchargement par défaut pour chaque service de chaque serveur.
- Permet de changer le dossier de téléchargement par défaut pour chaque service de chaque serveur.
2ème icône: Paramètres de l'application
- Limite de bande passante
@ -41,7 +42,7 @@ Cliquez sur un fichier pour le supprimer de la file et une fenêtre de confirmat
- Enregistrement automatique
Enregistre automatiquement la liste des téléchargements en cours.(activé par défaut)
3ème icône: À propos
Affiche les propriétés de l'application.
- Affiche les propriétés de l'application.
4ème icône: À propos de QT
5 ème icône: Quitter
5ème icône: Quitter
Permet de quitter le programme.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-03-09T18:12:22. -->
<!-- Written by QtCreator 4.14.2, 2023-03-11T18:47:01. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -2,7 +2,7 @@
Name: rsyncui
Summary: Client for rsync server
Version: 2.10
Version: 2.11
Release: %mkrel 1
License: GPLv3
Group: Networking/Remote access

View File

@ -1,5 +1,6 @@
#include "mainwindow.h"
#include <QComboBox>
#include <QTextBlock>
using namespace std;
@ -288,8 +289,11 @@ void MainWindow::populateTree()
{
// server is validated, scanning directory
path = this->connexion.service + "/";
while (this->rescan)
{
scanDir(this->connexion.server, this->connexion.port, nullptr, path);
}
}
// Restoring cursor
QGuiApplication::restoreOverrideCursor();
}
@ -352,16 +356,19 @@ void MainWindow::populateList(int item)
this->settings.endGroup();
this->settings.beginGroup("Hidden/" + server);
hidden = this->settings.allKeys();
this->settings.endGroup();
if (hidden.count() > 0)
{
for (i = 0; i < hidden.size(); i++)
{
service = hidden.at(i);
service = hidden[i];
//TODO detect if service is already present
if (testServicePresence(service, false))
{
ui->listWidget->addItem(service + "\n\t");
}
}
}
this->settings.endGroup();
QGuiApplication::restoreOverrideCursor(); //setting cursor to default
}
}
@ -559,10 +566,11 @@ bool MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
addTreeItem(filename, size, fullsize, fileType, date, isDir, parent);
if (passwdOk == false and !this->connexion.password.isEmpty())
{
this->settings.setValue("Passwords/" + this->connexion.server + "/" + this->connexion.service + "/", this->connexion.user);
this->settings.setValue("Passwords/" + this->connexion.server + "/" + this->connexion.service + "/" + this->connexion.user, true);
setPassword(this->connexion.user, this->connexion.password);
this->settings.sync();
}
this->rescan = false;
}
}
flag = false;
@ -684,6 +692,8 @@ void MainWindow::on_connectButton_clicked()
// add parent in treeview
void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, QString type, QString date, bool isDir=false, QTreeWidgetItem *parent=nullptr)
{
QFont * font = new QFont();
QTreeWidgetItem *treeItem;
if (parent != nullptr)
{
@ -700,6 +710,22 @@ void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, Q
}else
{
// item is a file
if (QFile::exists(this->downloading.savePath + "/" + name))
{
QBrush b (Qt::red);
treeItem->setForeground(0, b);
treeItem->setFont(0, *font);
}else
{
this->settings.beginGroup("Downloaded/");
if (this->settings.contains(name))
{
QBrush b (Qt::red);
treeItem->setForeground(0, b);
treeItem->setFont(0, *font);
}
this->settings.endGroup();
}
treeItem->setText(1,type);
}
treeItem->setText(0, name);
@ -740,7 +766,7 @@ void MainWindow::preparePopulateTree()
this->downloading.savePath = this->settings.value(str).toString();
}
getUserPassword(&this->connexion);
//getUserPassword(&this->connexion);
populateTree();
}
@ -755,6 +781,7 @@ bool MainWindow::getUserPassword(Connexion * object)
QString password;
QString server;
QString service;
int c;
bool returnValue = false;
bool ok = false;
@ -767,7 +794,8 @@ bool MainWindow::getUserPassword(Connexion * object)
this->settings.beginGroup("Passwords/" + server + "/" + service);
logins = this->settings.allKeys();
if (logins.count() != 1)
c = logins.count();
if ( c != 1)
{
//choose login in case of multiples logins
login = QInputDialog::getItem(this,
@ -813,7 +841,6 @@ bool MainWindow::getUserPassword(Connexion * object)
//Slot activated when a file is clicked in the treeview
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir)
{
QFuture<void> future;
QFileDialog dialog;
QTreeWidgetItem * itemR;
QString path;
@ -923,9 +950,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
}else
{
//Item is a Directory
while (this->rescan)
{
scanDir(this->connexion.server, this->connexion.port, item, this->connexion.service + "/" + path +"/");
item->setExpanded(true);
}
}
if (config.autosaveCheckbox->checkState() == Qt::Checked)
{
saveDownloadList();
@ -970,7 +1001,7 @@ 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)
if (exitCode != 0 and this->stopDlAsked != true)
{
if (exitCode == 20)
{
@ -993,7 +1024,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
retry = true;
}
}
this->stopDlAsked = false;
this->trayIcon->showMessage(a.applicationName(), tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information);
// disconnecting signals to slots
@ -1005,6 +1036,10 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
if (retry == false)
{
QString filename = ui->listDownload->item(0)->text();
pos = filename.contains(" => ");
filename.resize(pos);
this->settings.setValue("Downloaded/" + ui->listDownload->item(0)->text(), true);
delete ui->listDownload->takeItem(0);
}
this->downloading.clear();
@ -1067,6 +1102,7 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
if (reply == QMessageBox::Yes)
{
// stopping download
this->stopDlAsked = true;
emit (stopDownloading(this->downloading.process));
}
}else
@ -1083,7 +1119,6 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
// removing line from download list
ui->listDownload->removeItemWidget(item);
delete item;
}
}
if (config.autosaveCheckbox->checkState() == Qt::Checked)
@ -1336,7 +1371,8 @@ void MainWindow::on_actionHiddenService_triggered()
if (ok && !text.isEmpty())
{
this->connexion.service = text;
this->settings.setValue("Hidden/" + this->connexion.server + "/" + text, true);
this->settings.setValue("Hidden/" + this->connexion.server + '/' + text, true);
ui->listWidget->addItem(text + "\n\t");
preparePopulateTree();
}
}

View File

@ -25,8 +25,6 @@
#include <cstdio>
#include <QMessageBox>
#include <boost/algorithm/string/replace.hpp>
#include <QFuture>
#include <qtconcurrentrun.h>
#include <QFileDialog>
#include <QThread>
#include <QProgressDialog>
@ -90,7 +88,7 @@ class Downloading
class About
{
public:
QString version = "2.10";
QString version = "2.11";
QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3";
QString description;
@ -120,6 +118,7 @@ class MainWindow : public QMainWindow
QSystemTrayIcon * trayIcon;
QString icon = "/usr/share/icons/RsyncUI.png";
bool rescan = false;
bool stopDlAsked;
QList<QString> UnitText {
tr("B"),

View File

@ -44,7 +44,7 @@ QString getPassword(const QString& name)
if(readPass.error())
{
qDebug()<<"KeyHandler~Error reading decrypt Pass. Error: " + readPass.errorString();
cout << "KeyHandler~Error reading decrypt Pass. Error: " + readPass.errorString() . toStdString() << endl;
return "";
}
else

View File

@ -48,7 +48,7 @@ const vector<string> explode(const string& s, const char& c, int n = 0)
// return true in case of error
bool testRsyncReturn(MainWindow * w, QProcess * myProcess)
{
if (myProcess->exitStatus() != 0)
if (myProcess->exitStatus() != 0 and w->stopDlAsked != true)
{
QMessageBox::warning(
w,
@ -58,6 +58,7 @@ bool testRsyncReturn(MainWindow * w, QProcess * myProcess)
QMessageBox::Ok);
return true;
}
w->stopDlAsked = false;
return false;
}