Compare commits

..

4 Commits
1.7 ... 1.8.3

12 changed files with 198 additions and 101 deletions

15
RsyncUI.desktop Normal file
View File

@ -0,0 +1,15 @@
[Desktop Entry]
Name=RsyncUI
GenericName=rsync client
Comment=Client for rsync servers
Comment[fr]=Client pour serveur rsync
Version=1.8.2
Exec=RsyncUI
Icon=
Type=Application
Terminal=false
StartupNotify=true
Categories=Networking;
Keywords=internet;

BIN
RsyncUI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -46,3 +46,6 @@ lang.files = languages/fr_FR/*
INSTALLS += lang
RESOURCES +=
DISTFILES += \
RsyncUI.desktop

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-01-26T22:45:50. -->
<!-- Written by QtCreator 4.14.2, 2023-01-31T13:04:06. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

Binary file not shown.

View File

@ -145,5 +145,22 @@
</widget>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Configuration</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel">
<x>220</x>
<y>126</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>81</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -59,7 +59,7 @@ void downloadFile::download(MainWindow *mw)
}
argv[2] = "--port=" + to_string(mw->connexion.port);
argv[3] = "-P";
argv[4] = mw->connexion.server + "::" + mw->downloading.service + "/" + mw->downloading.path;
argv[4] = mw->downloading.server + "::" + mw->downloading.service + "/" + mw->downloading.path;
argv[5] = mw->downloading.savePath + "/";
argv[6].clear();

Binary file not shown.

View File

@ -4,27 +4,57 @@
<context>
<name>Configuration</name>
<message>
<location filename="../../configuration.ui" line="17"/>
<location filename="../../configuration.ui" line="20"/>
<source>Configuration</source>
<translation>Configuration</translation>
</message>
<message>
<location filename="../../configuration.ui" line="32"/>
<source>Enter the bandwidth limit</source>
<translation>Entrez la limite de bande passante</translation>
<location filename="../../configuration.ui" line="38"/>
<source>Toolbar view</source>
<translation>Toolbar</translation>
</message>
<message>
<location filename="../../configuration.ui" line="48"/>
<location filename="../../configuration.ui" line="45"/>
<source>Bandwidth limit</source>
<extracomment>Bandwidth limit</extracomment>
<translation>Limite de bande passante</translation>
</message>
<message>
<location filename="../../configuration.ui" line="61"/>
<location filename="../../configuration.ui" line="52"/>
<source>Enter the bandwidth limit (0 to 1024)</source>
<translation>Entrez la limite de bande passante (0 à 1024)</translation>
</message>
<message>
<location filename="../../configuration.ui" line="74"/>
<source>Select th unit of bandwidth limit in Bytes, KiloBytes, MegaBytes, GigaBytes or PetaBytes</source>
<extracomment>Unit of bandwidth</extracomment>
<translation>Sélectionnez l&apos;unité de limite de bande passante en otctets, Ko, Mo, Go, Po</translation>
</message>
<message>
<location filename="../../configuration.ui" line="100"/>
<source>Icon only</source>
<translation>Icône seule</translation>
</message>
<message>
<location filename="../../configuration.ui" line="105"/>
<source>Text only</source>
<translation>Texte seul</translation>
</message>
<message>
<location filename="../../configuration.ui" line="110"/>
<source>Text beside icon</source>
<translation>Text à côté de l&apos;icône</translation>
</message>
<message>
<location filename="../../configuration.ui" line="115"/>
<source>Text under icon</source>
<translation>Texte sous l&apos;icöne</translation>
</message>
<message>
<location filename="../../configuration.ui" line="120"/>
<source>Text follow icon</source>
<translation>Texte suit l&apos;icône</translation>
</message>
</context>
<context>
<name>MainWindow</name>
@ -34,216 +64,210 @@
<translation>Fenêtre principale</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="80"/>
<location filename="../../mainwindow.ui" line="83"/>
<source>Server</source>
<oldsource>Serveur</oldsource>
<translation>Serveur</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="102"/>
<location filename="../../mainwindow.ui" line="105"/>
<source>Enter server&apos;s URL</source>
<translation>Entrez l&apos;adresse du serveur</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="118"/>
<location filename="../../mainwindow.ui" line="121"/>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="146"/>
<location filename="../../mainwindow.ui" line="149"/>
<source>Enter rsync port on server</source>
<translation>Entrez le port du servuer rsync</translation>
<translation>Entrez le port du serveur rsync</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="183"/>
<location filename="../../mainwindow.ui" line="186"/>
<source>Press button to connect to rsync server</source>
<extracomment>Connect to server</extracomment>
<translation>Cliquez pour se connecter au serveur rsync</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="189"/>
<location filename="../../mainwindow.ui" line="192"/>
<source>Connection</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="192"/>
<location filename="../../mainwindow.ui" line="195"/>
<source>Return</source>
<translation>Retour</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="218"/>
<location filename="../../mainwindow.ui" line="221"/>
<source>Click to view the list of files of this folder</source>
<translation>Cliquez pour afficher la liste des documents</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="253"/>
<location filename="../../mainwindow.ui" line="256"/>
<source>Click to add to download queue</source>
<translation>Cliquez pour ajouter à la file de téléchargement</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="331"/>
<location filename="../../mainwindow.ui" line="334"/>
<source>Click on file to stop downloading</source>
<translation>Cliquez sur le document pour arrêter le téléchargement et l&apos;enleveer de la file</translation>
<translation>Cliquez sur le document pour arrêter le téléchargement et l&apos;enlever de la file</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="354"/>
<location filename="../../mainwindow.ui" line="357"/>
<source>%p%</source>
<extracomment>Downloading</extracomment>
<translation>Téléchargement</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="371"/>
<location filename="../../mainwindow.ui" line="389"/>
<location filename="../../mainwindow.ui" line="368"/>
<source>toolBar</source>
<translation>Barre d&apos;outils</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="401"/>
<source>Menu</source>
<translation>Menu</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="378"/>
<source>help</source>
<translation>Aide</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="394"/>
<location filename="../../mainwindow.ui" line="397"/>
<location filename="../../mainwindow.ui" line="409"/>
<location filename="../../mainwindow.ui" line="412"/>
<source>Change save folder</source>
<translation>Changer le dossier de destination</translation>
</message>
<message>
<source>Default save folder</source>
<translation type="vanished">Dossier d&apos;enregistrement</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="402"/>
<source>Bandwidth limit</source>
<translation>Limite de bande passante</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="407"/>
<location filename="../../mainwindow.ui" line="420"/>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="412"/>
<location filename="../../mainwindow.ui" line="428"/>
<source>About Qt</source>
<translation>À propos de Qt</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="417"/>
<location filename="../../mainwindow.ui" line="436"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
<message>
<source>debug</source>
<translation type="vanished">debug</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="23"/>
<source>Byte</source>
<translation>Octet</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="23"/>
<source>KB</source>
<translation>Ko</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="23"/>
<source>MB</source>
<translation>Mo</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="23"/>
<source>GB</source>
<translation>Go</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="23"/>
<source>TB</source>
<translation>To</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="21"/>
<location filename="../../mainwindow.cpp" line="587"/>
<location filename="../../mainwindow.cpp" line="23"/>
<location filename="../../mainwindow.cpp" line="634"/>
<source>PB</source>
<translation>Po</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="24"/>
<location filename="../../mainwindow.cpp" line="26"/>
<source>Client for rsync server
You click on file to enqueue it, and RyncUI Download one file a time</source>
<translation>Client pour serveur rsync
Cliquez sur un fichier pour l&apos;ajouter dans la file de téléchargement.</translation>
Cliquez sur un fichier pour l&apos;ajouter dans la file de téléchargement</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="35"/>
<location filename="../../mainwindow.cpp" line="37"/>
<source>Path</source>
<translation>Chemin</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="35"/>
<location filename="../../mainwindow.cpp" line="37"/>
<source>Size</source>
<translation>Taille</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="35"/>
<location filename="../../mainwindow.cpp" line="37"/>
<source>Type</source>
<translation>Type</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="76"/>
<location filename="../../mainwindow.cpp" line="79"/>
<source>Exiting will stop downloading, and will clear the download queue.
Do you want to exit ?</source>
<translation>Soritr stoppera le téléchargement et effacera la file des téléchargements.
Voulez-vous vraiment sortir du programme ?</translation>
<translation>Cela stoppera le téléchargement et effacera la file des téléchargements.
Voulez-vous vraiment arrêter le programme ?</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="326"/>
<location filename="../../mainwindow.cpp" line="329"/>
<source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="545"/>
<location filename="../../mainwindow.cpp" line="356"/>
<location filename="../../mainwindow.cpp" line="376"/>
<source>Dir</source>
<translation>Dir</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="359"/>
<location filename="../../mainwindow.cpp" line="424"/>
<source>File</source>
<translation></translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="582"/>
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="546"/>
<location filename="../../mainwindow.cpp" line="583"/>
<source>Licence</source>
<translation>License</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="547"/>
<location filename="../../mainwindow.cpp" line="584"/>
<source>Author</source>
<translation>Auteur</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="548"/>
<location filename="../../mainwindow.cpp" line="585"/>
<source>EMail</source>
<translation>Courriel</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="549"/>
<location filename="../../mainwindow.cpp" line="586"/>
<source>Source code</source>
<translation>Code source</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="564"/>
<location filename="../../mainwindow.cpp" line="603"/>
<source>Choose directory to save file</source>
<translation>Choisissez le dossier enregistrer</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="477"/>
<location filename="../../mainwindow.cpp" line="512"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source>
<translation>Vouslez-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>
<source>Client for rsync server</source>
<translation type="vanished">Client pour serveur rsync</translation>
</message>
<message>
<location filename="../../mainwindow.cpp" line="489"/>
<location filename="../../mainwindow.cpp" line="524"/>
<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>

View File

@ -30,12 +30,11 @@ MainWindow::MainWindow(QWidget *parent)
connect(&downloadO, &downloadFile::finishedSignal, this, &MainWindow::downloadFinished);
connect(this, &MainWindow::stopDownloading, &downloadO, &downloadFile::cancelled);
connect(config.buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted()));
connect(config.comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &MainWindow::on_comboBox_currentIndexChanged);
// init of widgets
ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget);
ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive);
ui->treeWidget->setHeaderLabels({tr("Type"), tr("Path"), tr("Size")} );
ui->treeWidget->setHeaderLabels({tr("Path"), tr("Type"), tr("Size")} );
config.comboBox->setCurrentIndex(ui->toolBar->toolButtonStyle());
if (this->settings.contains("connexion/lastServer"))
{
@ -150,13 +149,13 @@ void MainWindow::populateList()
{
if (validateServer(server.toStdString()))
{
if (!this->settings.contains(server))
{
cout << server.toStdString() << endl;
// storing serverURL and port in settings
this->settings.setValue(server, port);
this->settings.sync();
this->downloading.server = server.toStdString();
// storing in history of combobox
ui->khistorycombobox->addToHistory(server);
@ -354,12 +353,12 @@ QTreeWidgetItem * MainWindow::addTreeRoot(QString name, QString fileSize, bool i
// QTreeWidgetItem::setText(int column, const QString & text)
if (isDir == true)
{
treeItem->setText(0, "Dir");
treeItem->setText(1, tr("Dir"));
}else
{
treeItem->setText(0,"File");
treeItem->setText(1,tr("File"));
}
treeItem->setText(1, name);
treeItem->setText(0, name);
treeItem->setText(2, fileSize);
return treeItem;
@ -374,12 +373,12 @@ QTreeWidgetItem * MainWindow::addTreeChild(QTreeWidgetItem *parent, QString name
// QTreeWidgetItem::setText(int column, const QString & text)
if (isDir == true)
{
treeItem->setText(0, "Dir");
treeItem->setText(1, tr("Dir"));
}else
{
treeItem->setText(0,"File");
treeItem->setText(1,("File"));
}
treeItem->setText(1, name);
treeItem->setText(0, name);
treeItem->setText(2, fileSize);
// QTreeWidgetItem::addChild(QTreeWidgetItem * child)
@ -391,8 +390,15 @@ QTreeWidgetItem * MainWindow::addTreeChild(QTreeWidgetItem *parent, QString name
void MainWindow::on_listWidget_clicked()
{
vector<string> v;
QString str;
v = explode(ui->listWidget->currentItem()->text().toStdString(), '\n', 2);
this->downloading.service = v[0];
str = QString::fromStdString("Folder/" + this->connexion.server + "/" + this->downloading.service);
if (this->settings.contains(str))
{
this->downloading.savePath = this->settings.value(str).toString().toStdString();
}
populateTree(NULL);
}
@ -403,18 +409,19 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item)
QFileDialog dialog;
QTreeWidgetItem * itemR;
string path;
QString str;
//item = ui->treeWidget->currentItem();
itemR = item;
path = item->text(1).toStdString();
path = item->text(0).toStdString();
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
path = itemR->text(1).toStdString() + "/" + path;
path = itemR->text(0).toStdString() + "/" + path;
};
if (item->text(0) == "File")
if (item->text(1) == tr("File"))
{
// Item is a file
this->downloading.path = path;
@ -423,11 +430,19 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item)
on_DefaultSaveFolder_triggered();
}else if (this->downloading.pid == 0)
{
str = QString::fromStdString("Folder/" + this->connexion.server + "/" + this->downloading.service);
if(this->settings.value(str).toString().isEmpty() and !this->downloading.savePath.empty())
{
this->settings.setValue(str, this->downloading.savePath.c_str());
this->settings.sync();
}
this->downloading.server = this->connexion.server;
startDownloading();
sleep(1);
}
ui->listDownload->addItem(QString::fromStdString(this->downloading.path));
str = QString::fromStdString(this->downloading.path + " => " + this->connexion.server + "/" + this->downloading.service);
ui->listDownload->addItem(str);
}else
{
//Item is a Directory
@ -456,12 +471,28 @@ void MainWindow::stoppingDownload()
// when download is finished, launch download of next file in queue
void MainWindow::downloadFinished()
{
string path;
int pos;
string str;
ui->progressBar->hide();
delete ui->listDownload->takeItem(0);
this->downloading.pid = 0;
if (ui->listDownload->count() != 0)
{
this->downloading.path = ui->listDownload->item(0)->text().toStdString();
path = ui->listDownload->item(0)->text().toStdString();
pos = path.rfind("/");
this->downloading.service = path.substr(pos+1);
path.resize(pos);
pos = path.rfind(" => ");
this->downloading.server = path.substr(pos+4);
path.resize(pos);
this->downloading.path = path;
str = "Folder/" + this->downloading.server + "/" + this->downloading.service;
if (this->settings.contains(str.c_str()))
{
this->downloading.savePath = this->settings.value(str.c_str()).toString().toStdString();
}
startDownloading();
}
}
@ -510,6 +541,7 @@ void MainWindow::loadSettings()
ui->treeWidget->header()->restoreState(settings.value("treeWidget/state").toByteArray());
ui->splitter->restoreState(settings.value("splitter/state").toByteArray());
ui->splitter_2->restoreState(settings.value("splitter2/state").toByteArray());
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)settings.value("toolbar/state").toInt());
// loading connexion settings
// loading servers history
@ -539,6 +571,7 @@ void MainWindow::saveSettings()
this->settings.setValue("splitter2/state", ui->splitter_2->saveState());
this->settings.setValue("connexion/lastServer", QString::fromStdString(this->connexion.server));
this->settings.setValue("connexion/lastPort", QString::number(this->connexion.port));
this->settings.setValue("toolbar/state", ui->toolBar->toolButtonStyle());
this->settings.sync();
}
@ -564,11 +597,21 @@ void MainWindow::on_actionAbout_Qt_triggered()
void MainWindow::on_DefaultSaveFolder_triggered()
{
QFileDialog dialog;
string folder;
string path;
this->downloading.savePath = dialog.getExistingDirectory(this, tr("Choose directory to save file"), QString::fromStdString(this->downloading.savePath), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toStdString();
this->settings.setValue("Folder/", this->downloading.savePath.c_str());
path = dialog.getExistingDirectory(this, tr("Choose directory to save file"), QString::fromStdString(this->downloading.savePath), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toStdString();
if (!path.empty())
{
this->downloading.savePath = path;
if (!this->downloading.service.empty() and !this->connexion.server.empty())
{
folder = "Folder/" + this->connexion.server + "/" + this->downloading.service;
this->settings.setValue(folder.c_str(), this->downloading.savePath.c_str());
this->settings.sync();
}
}
}
// Activated when menu "settings" is clicked
void MainWindow::on_action_Settings_triggered()
@ -599,8 +642,3 @@ void MainWindow::on_buttonBox_accepted()
this->settings.sync();
Configuration.hide();
}
void MainWindow::on_comboBox_currentIndexChanged(int index)
{
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)index);
}

View File

@ -50,9 +50,9 @@ class Connexion
class Downloading
{
public:
std::string server;
std::string service;
std::string path;
std::string defaultSavePath;
std::string savePath;
int pid = 0;
};
@ -132,8 +132,6 @@ class MainWindow : public QMainWindow
void on_action_Settings_triggered();
void on_comboBox_currentIndexChanged(int index);
public slots:
void on_buttonBox_accepted();

View File

@ -81,6 +81,8 @@ FILE * popen2(array<string,8> argv, string type, int & pid)
}
setpgid(child_pid, child_pid); //Needed so negative PIDs can kill children of /bin/sh
//TODO : change for execvp
if (execlp(argv[0].c_str(), argv[0].c_str(), argv[1].c_str(), argv[2].c_str(), argv[3].c_str(), argv[4].c_str(), argv[5].c_str(), NULL ) == -1)
exit (0);
}