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

View File

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>300</height> <height>127</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -22,12 +22,18 @@
<x>9</x> <x>9</x>
<y>9</y> <y>9</y>
<width>381</width> <width>381</width>
<height>251</height> <height>61</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox"> <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"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
@ -52,7 +58,10 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <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>
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
@ -71,7 +80,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>70</x>
<y>260</y> <y>80</y>
<width>321</width> <width>321</width>
<height>34</height> <height>34</height>
</rect> </rect>

View File

@ -9,11 +9,23 @@
<translation>Configuration</translation> <translation>Configuration</translation>
</message> </message>
<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> <source>Bandwidth limit</source>
<extracomment>Bandwidth limit</extracomment> <extracomment>Bandwidth limit</extracomment>
<translation>Limite de bande passante</translation> <translation>Limite de bande passante</translation>
</message> </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>
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
@ -29,40 +41,71 @@
<translation>Serveur</translation> <translation>Serveur</translation>
</message> </message>
<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> <source>Port</source>
<translation>Port</translation> <translation>Port</translation>
</message> </message>
<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> <source>Connection</source>
<translation>Connexion</translation> <translation>Connexion</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="171"/> <location filename="../../mainwindow.ui" line="186"/>
<source>Return</source> <source>Return</source>
<translation>Retour</translation> <translation>Retour</translation>
</message> </message>
<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> <source>%p%</source>
<extracomment>Downloading</extracomment> <extracomment>Downloading</extracomment>
<translation>Téléchargement</translation> <translation>Téléchargement</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="311"/> <location filename="../../mainwindow.ui" line="344"/>
<location filename="../../mainwindow.ui" line="329"/> <location filename="../../mainwindow.ui" line="362"/>
<source>Menu</source> <source>Menu</source>
<translation>Menu</translation> <translation>Menu</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="318"/> <location filename="../../mainwindow.ui" line="351"/>
<source>help</source> <source>help</source>
<translation>Aide</translation> <translation>Aide</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="334"/> <location filename="../../mainwindow.ui" line="367"/>
<location filename="../../mainwindow.ui" line="337"/> <location filename="../../mainwindow.ui" line="370"/>
<source>Change save folder</source> <source>Change save folder</source>
<translation>Changer le dossier de destination</translation> <translation>Changer le dossier de destination</translation>
</message> </message>
@ -71,22 +114,22 @@
<translation type="vanished">Dossier d&apos;enregistrement</translation> <translation type="vanished">Dossier d&apos;enregistrement</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="342"/> <location filename="../../mainwindow.ui" line="375"/>
<source>Bandwidth limit</source> <source>Bandwidth limit</source>
<translation>Limite de bande passante</translation> <translation>Limite de bande passante</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="347"/> <location filename="../../mainwindow.ui" line="380"/>
<source>About</source> <source>About</source>
<translation>À propos</translation> <translation>À propos</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="352"/> <location filename="../../mainwindow.ui" line="385"/>
<source>About Qt</source> <source>About Qt</source>
<translation>À propos de Qt</translation> <translation>À propos de Qt</translation>
</message> </message>
<message> <message>
<location filename="../../mainwindow.ui" line="357"/> <location filename="../../mainwindow.ui" line="390"/>
<source>Settings</source> <source>Settings</source>
<translation>Paramètres</translation> <translation>Paramètres</translation>
</message> </message>

View File

@ -1,11 +1,6 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication>
#include <QSettings>
#include <KAboutData>
#include <KDBusService>
#include <QCommandLineParser>
#include <QTranslator> #include <QTranslator>
#include <QDialog>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -14,14 +9,13 @@ int main(int argc, char *argv[])
QTranslator myappTranslator; QTranslator myappTranslator;
QLocale localeName = QLocale::system(); 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)) if (myappTranslator.load(localeFile))
{ {
a.installTranslator(&myappTranslator); a.installTranslator(&myappTranslator);
} }
MainWindow w; MainWindow w;
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@ -62,7 +62,7 @@ class About
QString title = "RsyncUI"; QString title = "RsyncUI";
QString author = "Daniel TARTAVEL-JEANNOT"; QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3"; 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 email = "dtux@free.fr";
QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues"; QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues";
}; };

View File

@ -98,6 +98,12 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Enter server's URL</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -133,6 +139,12 @@
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Enter rsync port on server</string>
</property>
<property name="toolTipDuration">
<number>5000</number>
</property>
<property name="inputMethodHints"> <property name="inputMethodHints">
<set>Qt::ImhPreferNumbers</set> <set>Qt::ImhPreferNumbers</set>
</property> </property>
@ -162,7 +174,10 @@
<item> <item>
<widget class="QPushButton" name="connectButton"> <widget class="QPushButton" name="connectButton">
<property name="toolTip"> <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>
<property name="text"> <property name="text">
<string>Connection</string> <string>Connection</string>
@ -190,6 +205,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </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"> <property name="editTriggers">
<set>QAbstractItemView::SelectedClicked</set> <set>QAbstractItemView::SelectedClicked</set>
</property> </property>
@ -211,7 +232,16 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="contextMenuPolicy"> <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>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
@ -273,6 +303,9 @@
</widget> </widget>
</widget> </widget>
<widget class="QListWidget" name="listDownload"> <widget class="QListWidget" name="listDownload">
<property name="toolTip">
<string>Click on file to stop downloading</string>
</property>
<property name="dragEnabled"> <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

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

View File

@ -9,7 +9,7 @@ using namespace std;
const vector<string> explode(const string& s, const char& c, int n); 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); int pclose2(FILE * fp, pid_t pid);