This commit is contained in:
Daniel Tartavel 2023-01-23 10:04:54 +01:00
parent 7546aedec2
commit d1e45b8ba8
9 changed files with 116 additions and 46 deletions

View File

@ -31,7 +31,7 @@ FORMS += \
mainwindow.ui
TRANSLATIONS += \
languages/fr/RsyncUI_fr_FR.ts
languages/fr_FR/RsyncUI_fr_FR.ts
INCLUDEPATH += \
/usr/include/KF5
@ -41,6 +41,6 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /usr/bin/
!isEmpty(target.path): INSTALLS += target
lang.path = /languages
lang.files = languages/*
lang.path = /languages/fr_FR/
lang.files = languages/fr_FR/*
INSTALLS += lang

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>127</height>
</rect>
</property>
<property name="windowTitle">
@ -22,12 +22,18 @@
<x>9</x>
<y>9</y>
<width>381</width>
<height>251</height>
<height>61</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox">
<property name="toolTip">
<string>Enter the bandwidth limit</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
@ -52,7 +58,10 @@
</sizepolicy>
</property>
<property name="toolTip">
<string extracomment="Unit of bandwidth"/>
<string extracomment="Unit of bandwidth">Select th unit of bandwidth limit in Bytes, KiloBytes, MegaBytes, GigaBytes or PetaBytes</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="currentIndex">
<number>-1</number>
@ -71,7 +80,7 @@
<property name="geometry">
<rect>
<x>70</x>
<y>260</y>
<y>80</y>
<width>321</width>
<height>34</height>
</rect>

View File

@ -9,11 +9,23 @@
<translation>Configuration</translation>
</message>
<message>
<location filename="../../configuration.ui" line="42"/>
<location filename="../../configuration.ui" line="32"/>
<source>Enter the bandwidth limit</source>
<translation>Entrez la limite de bande passante
</translation>
</message>
<message>
<location filename="../../configuration.ui" line="48"/>
<source>Bandwidth limit</source>
<extracomment>Bandwidth limit</extracomment>
<translation>Limite de bande passante</translation>
</message>
<message>
<location filename="../../configuration.ui" line="61"/>
<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>
</context>
<context>
<name>MainWindow</name>
@ -29,40 +41,71 @@
<translation>Serveur</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="112"/>
<location filename="../../mainwindow.ui" line="102"/>
<source>Enter server&apos;s URL</source>
<translation>Entrez l&apos;adresse du serveur</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="118"/>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="168"/>
<location filename="../../mainwindow.ui" line="143"/>
<source>Enter rsync port on server</source>
<translation>Entrez le port du servuer rsync</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="177"/>
<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="183"/>
<source>Connection</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="171"/>
<location filename="../../mainwindow.ui" line="186"/>
<source>Return</source>
<translation>Retour</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="294"/>
<location filename="../../mainwindow.ui" line="209"/>
<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="238"/>
<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="307"/>
<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>
</message>
<message>
<location filename="../../mainwindow.ui" line="327"/>
<source>%p%</source>
<extracomment>Downloading</extracomment>
<translation>Téléchargement</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="311"/>
<location filename="../../mainwindow.ui" line="329"/>
<location filename="../../mainwindow.ui" line="344"/>
<location filename="../../mainwindow.ui" line="362"/>
<source>Menu</source>
<translation>Menu</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="318"/>
<location filename="../../mainwindow.ui" line="351"/>
<source>help</source>
<translation>Aide</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="334"/>
<location filename="../../mainwindow.ui" line="337"/>
<location filename="../../mainwindow.ui" line="367"/>
<location filename="../../mainwindow.ui" line="370"/>
<source>Change save folder</source>
<translation>Changer le dossier de destination</translation>
</message>
@ -71,22 +114,22 @@
<translation type="vanished">Dossier d&apos;enregistrement</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="342"/>
<location filename="../../mainwindow.ui" line="375"/>
<source>Bandwidth limit</source>
<translation>Limite de bande passante</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="347"/>
<location filename="../../mainwindow.ui" line="380"/>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="352"/>
<location filename="../../mainwindow.ui" line="385"/>
<source>About Qt</source>
<translation>À propos de Qt</translation>
</message>
<message>
<location filename="../../mainwindow.ui" line="357"/>
<location filename="../../mainwindow.ui" line="390"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>

View File

@ -1,11 +1,6 @@
#include "mainwindow.h"
#include <QApplication>
#include <QSettings>
#include <KAboutData>
#include <KDBusService>
#include <QCommandLineParser>
#include <QTranslator>
#include <QDialog>
int main(int argc, char *argv[])
@ -14,14 +9,13 @@ int main(int argc, char *argv[])
QTranslator myappTranslator;
QLocale localeName = QLocale::system();
QString localeFile = "usr/share/locale/" + localeName.name() + "LC_MESSAGES/RsyncUI_" + localeName.name() + ".qm";
QString localeFile = "/usr/share/locale/" + localeName.name() + "/LC_MESSAGES/RsyncUI_" + localeName.name() + ".qm";
if (myappTranslator.load(localeFile))
{
a.installTranslator(&myappTranslator);
}
MainWindow w;
w.show();
return a.exec();
}

View File

@ -62,7 +62,7 @@ class About
QString title = "RsyncUI";
QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3";
QString description = "Client for rsync server";
QString description = "Client for rsync server\n\nYou click on file to enqueue it, and RyncUI Download one file a time";
QString email = "dtux@free.fr";
QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues";
};

View File

@ -98,6 +98,12 @@
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Enter server's URL</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
</widget>
</item>
<item>
@ -133,6 +139,12 @@
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Enter rsync port on server</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="inputMethodHints">
<set>Qt::ImhPreferNumbers</set>
</property>
@ -162,7 +174,10 @@
<item>
<widget class="QPushButton" name="connectButton">
<property name="toolTip">
<string extracomment="Connect to server"/>
<string extracomment="Connect to server">Press button to connect to rsync server</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="text">
<string>Connection</string>
@ -190,6 +205,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Click to view the list of files of this folder</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::SelectedClicked</set>
</property>
@ -211,7 +232,16 @@
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::NoContextMenu</enum>
</property>
<property name="toolTip">
<string>Click to add to download queue</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="whatsThis">
<string extracomment="Click to add to download queue"/>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
@ -273,6 +303,9 @@
</widget>
</widget>
<widget class="QListWidget" name="listDownload">
<property name="toolTip">
<string>Click on file to stop downloading</string>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>

View File

@ -1,11 +1,4 @@
#include "mainwindow.h"
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <pstreams/pstream.h>
#include <QMessageBox>
#include <ctype.h>
using namespace std;
@ -44,11 +37,12 @@ const vector<string> explode(const string& s, const char& c, int n = 0)
return v;
}
FILE * popen2(array<string, 7> argv, string type, int & pid)
FILE * popen2(char * const argv, string type, int & pid)
{
pid_t child_pid;
int fd[2];
QString message;
string command;
if (pipe(fd) == -1)
{
@ -80,7 +74,8 @@ FILE * popen2(array<string, 7> argv, string type, int & pid)
}
setpgid(child_pid, child_pid); //Needed so negative PIDs can kill children of /bin/sh
if (execl(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)
//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)
if (execvp(command.c_str(), &argv))
{
perror("execl error => ");
}
@ -98,14 +93,11 @@ FILE * popen2(array<string, 7> argv, string type, int & pid)
}
}
pid = child_pid;
if (type == "r")
{
return fdopen(fd[READ], "r");
}
return fdopen(fd[WRITE], "w");
}
return 0;
@ -124,7 +116,6 @@ int pclose2(FILE * fp, pid_t pid)
break;
}
}
return stat;
}

View File

@ -9,7 +9,7 @@ using namespace std;
const vector<string> explode(const string& s, const char& c, int n);
FILE * popen2(array<string, 7> argv, string type, int & pid);
FILE * popen2(char * const argv, string type, int & pid);
int pclose2(FILE * fp, pid_t pid);