Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
ef977d96dd | |||
093462dcb0 | |||
d19879b82c | |||
46924e4e5b | |||
86773bf7a7 | |||
fcb5887368 | |||
867218786b | |||
513a73e69f | |||
b67891fc2f | |||
69f5a2a038 | |||
c42b1f0695 | |||
09a197d418 | |||
05b2af3854 | |||
198982f3e7 | |||
cbb09fe258 | |||
fa7f3a1ca8 | |||
c9f85354a6 | |||
ab91309abd | |||
7f767b0576 | |||
9229d3523e | |||
7770813647 | |||
4b434fc393 | |||
5804e43d1f | |||
d70d081139 | |||
9f9c5c19a3 | |||
4dbfa8fa97 | |||
fe74ab906f | |||
295c914b12 | |||
434b430869 |
5
README_FR.md
Normal file
5
README_FR.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# RsyncUI
|
||||||
|
|
||||||
|
client Rsync - QT5 - KDE
|
||||||
|
|
||||||
|
#Compilation:
|
15
RsyncUI.desktop
Normal file
15
RsyncUI.desktop
Normal 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.0
|
||||||
|
Exec=RsyncUI
|
||||||
|
Icon=
|
||||||
|
Type=Application
|
||||||
|
Terminal=false
|
||||||
|
StartupNotify=true
|
||||||
|
Categories=Network
|
||||||
|
Keywords=internet,rsync
|
||||||
|
|
BIN
RsyncUI.png
Normal file
BIN
RsyncUI.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
15
RsyncUI.pro
15
RsyncUI.pro
@ -44,3 +44,18 @@ else: unix:!android: target.path = /usr/bin/
|
|||||||
lang.path = /languages/fr_FR/
|
lang.path = /languages/fr_FR/
|
||||||
lang.files = languages/fr_FR/*
|
lang.files = languages/fr_FR/*
|
||||||
INSTALLS += lang
|
INSTALLS += lang
|
||||||
|
INSTALLS += documentation
|
||||||
|
INSTALLS += desktopfile
|
||||||
|
INSTALLS += icon
|
||||||
|
|
||||||
|
RESOURCES +=
|
||||||
|
|
||||||
|
DISTFILES += \
|
||||||
|
RsyncUI.desktop
|
||||||
|
|
||||||
|
documentation.path = /usr/share/doc/RsyncUI
|
||||||
|
documentation.files = README*
|
||||||
|
desktopfile.path = /usr/share/applications
|
||||||
|
desktopfile.files = RsyncUI.desktop
|
||||||
|
icon.path = /usr/share/icons/
|
||||||
|
icon.files = RsyncUI.png
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.14.2, 2023-01-26T11:46:40. -->
|
<!-- Written by QtCreator 4.14.2, 2023-02-02T16:28:47. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
72
RsyncUI.spec
Normal file
72
RsyncUI.spec
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
%define oname RsyncUI
|
||||||
|
|
||||||
|
Name: rsyncui
|
||||||
|
Summary: Client for rsync server
|
||||||
|
Version: 1.8.5
|
||||||
|
Release: %mkrel 1
|
||||||
|
License: GPLv3
|
||||||
|
Group: Networking/Remote access
|
||||||
|
Source0: %{oname}-%{version}.tar.gz
|
||||||
|
Packager: dtux@free.fr
|
||||||
|
Distribution: Mageia
|
||||||
|
Url: https://www.librepc.fr
|
||||||
|
Vendor: DTux
|
||||||
|
BuildRequires: qmake
|
||||||
|
BuildRequires: make
|
||||||
|
BuildRequires: pkgconfig(Qt5Core)
|
||||||
|
BuildRequires: pkgconfig(Qt5Gui)
|
||||||
|
BuildRequires: pkgconfig(Qt5Concurrent)
|
||||||
|
BuildRequires: pkgconfig(Qt5Widgets)
|
||||||
|
BuildRequires: pkgconfig(Qt5Xml)
|
||||||
|
BuildRequires: pkgconfig(libmagic)
|
||||||
|
BuildRequires: cmake(KF5Completion)
|
||||||
|
BuildRequires: cmake(KF5CoreAddons)
|
||||||
|
BuildRequires: cmake(KF5I18n)
|
||||||
|
BuildRequires: cmake(KF5DBusAddons)
|
||||||
|
BuildRequires: cmake(KF5Config)
|
||||||
|
BuildRequires: cmake(KF5ItemViews)
|
||||||
|
BuildRequires: pstreams-devel
|
||||||
|
BuildRequires: boost-devel
|
||||||
|
|
||||||
|
#Requires: kitemviews
|
||||||
|
#Requires: kcompletion
|
||||||
|
#Requires: kcoreaddons
|
||||||
|
#Requires: kdbusaddons
|
||||||
|
Requires: rsync
|
||||||
|
Requires: bind-utils
|
||||||
|
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
%description
|
||||||
|
RsyncUI can connect to an rsync server, get the list of services,
|
||||||
|
and download files.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %{oname}
|
||||||
|
|
||||||
|
%build
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
#INSTALL_ROOT=%{BUILDROOT} make install
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{_bindir}
|
||||||
|
mkdir -p %{buildroot}%{_datadir}/applications/
|
||||||
|
mkdir -p %{buildroot}%{_datadir}/icons/
|
||||||
|
install -p -m 755 %{oname} %{buildroot}%{_bindir}/%{oname}
|
||||||
|
install -p -m 644 %{oname}.desktop %{buildroot}%{_datadir}/applications/
|
||||||
|
install -p -m 644 %{oname}.png %{buildroot}%{_datadir}/icons/
|
||||||
|
|
||||||
|
pushd languages
|
||||||
|
for locale in *;
|
||||||
|
do
|
||||||
|
mkdir -p %{buildroot}%{_datadir}/locale/$locale/LC_MESSAGES
|
||||||
|
install -m 644 $locale/*.qm "%{buildroot}%{_datadir}/locale/$locale/LC_MESSAGES/"
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
%find_lang %{oname} --with-qt
|
||||||
|
|
||||||
|
%files -f %{oname}.lang
|
||||||
|
%{_bindir}/%{oname}
|
||||||
|
%{_datadir}/applications/%{oname}.desktop
|
||||||
|
%{_datadir}/icons/%{oname}.png
|
BIN
RsyncUI_fr_FR.qm
BIN
RsyncUI_fr_FR.qm
Binary file not shown.
101
configuration.ui
101
configuration.ui
@ -10,9 +10,12 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>127</height>
|
<height>163</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::DefaultContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Configuration</string>
|
<string>Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
@ -22,14 +25,31 @@
|
|||||||
<x>9</x>
|
<x>9</x>
|
||||||
<y>9</y>
|
<y>9</y>
|
||||||
<width>381</width>
|
<width>381</width>
|
||||||
<height>61</height>
|
<height>101</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Toolbar view</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label1">
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Bandwidth limit">Bandwidth limit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox">
|
<widget class="QSpinBox" name="spinBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter the bandwidth limit</string>
|
<string>Enter the bandwidth limit (0 to 1024)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTipDuration">
|
<property name="toolTipDuration">
|
||||||
<number>5000</number>
|
<number>5000</number>
|
||||||
@ -42,13 +62,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label1">
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Bandwidth limit">Bandwidth limit</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QComboBox" name="UnitCombobox">
|
<widget class="QComboBox" name="UnitCombobox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -74,17 +87,55 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<property name="maxVisibleItems">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="maxCount">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Icon only</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text only</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text beside icon</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text under icon</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text follow icon</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>70</x>
|
<x>60</x>
|
||||||
<y>80</y>
|
<y>110</y>
|
||||||
<width>321</width>
|
<width>321</width>
|
||||||
<height>34</height>
|
<height>34</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::NoContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -95,35 +146,19 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>Configuration</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>Configuration</receiver>
|
<receiver>Configuration</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>hide()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>220</x>
|
||||||
<y>260</y>
|
<y>126</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>199</x>
|
||||||
<y>274</y>
|
<y>81</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
@ -47,6 +47,9 @@ void downloadFile::download(MainWindow *mw)
|
|||||||
vector<string> v;
|
vector<string> v;
|
||||||
int value;
|
int value;
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
Downloading d;
|
||||||
|
|
||||||
|
d = mw->downloading;
|
||||||
|
|
||||||
// Populating array with command and parameters for popen2
|
// Populating array with command and parameters for popen2
|
||||||
argv[0] = "/usr/bin/rsync";
|
argv[0] = "/usr/bin/rsync";
|
||||||
@ -58,13 +61,13 @@ void downloadFile::download(MainWindow *mw)
|
|||||||
argv[1] = "--bwlimit=" + to_string(mw->connexion.bandwidthLimit) + mw->connexion.bandwidthLimitUnit;
|
argv[1] = "--bwlimit=" + to_string(mw->connexion.bandwidthLimit) + mw->connexion.bandwidthLimitUnit;
|
||||||
}
|
}
|
||||||
argv[2] = "--port=" + to_string(mw->connexion.port);
|
argv[2] = "--port=" + to_string(mw->connexion.port);
|
||||||
argv[3] = "-P";
|
argv[3] = "-aP";
|
||||||
argv[4] = mw->connexion.server + "::" + mw->downloading.service + "/" + mw->downloading.path;
|
argv[4] = d.server + "::" + d.service + "/" + d.path;
|
||||||
argv[5] = mw->downloading.savePath + "/";
|
argv[5] = d.savePath + "/";
|
||||||
argv[6].clear();
|
argv[6].clear();
|
||||||
|
|
||||||
//launching downloading thread
|
//launching downloading thread
|
||||||
FILE * fp = popen2(argv, "r", mw->downloading.pid);
|
FILE * fp = popen2(argv, "r", mw->pid);
|
||||||
if (fp <= (FILE *) 0)
|
if (fp <= (FILE *) 0)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "popen2() failed!: returning code:%d", fileno(fp));
|
sprintf(buffer, "popen2() failed!: returning code:%d", fileno(fp));
|
||||||
@ -98,7 +101,7 @@ void downloadFile::download(MainWindow *mw)
|
|||||||
}
|
}
|
||||||
// download ended
|
// download ended
|
||||||
}
|
}
|
||||||
pclose2(fp, mw->downloading.pid);
|
pclose2(fp, mw->pid);
|
||||||
|
|
||||||
// ProgressBar to 100% and emit signal finished to main application
|
// ProgressBar to 100% and emit signal finished to main application
|
||||||
emit progressSignal(100);
|
emit progressSignal(100);
|
||||||
|
Binary file not shown.
@ -1,251 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!DOCTYPE TS>
|
|
||||||
<TS version="2.1" language="fr_FR">
|
|
||||||
<context>
|
|
||||||
<name>Configuration</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../../configuration.ui" line="17"/>
|
|
||||||
<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>
|
|
||||||
</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'unité de limite de bande passante en otctets, Ko, Mo, Go, Po</translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
|
||||||
<name>MainWindow</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="21"/>
|
|
||||||
<source>MainWindow</source>
|
|
||||||
<translation>Fenêtre principale</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="80"/>
|
|
||||||
<source>Server</source>
|
|
||||||
<oldsource>Serveur</oldsource>
|
|
||||||
<translation>Serveur</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="102"/>
|
|
||||||
<source>Enter server's URL</source>
|
|
||||||
<translation>Entrez l'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="146"/>
|
|
||||||
<source>Enter rsync port on server</source>
|
|
||||||
<translation>Entrez le port du servuer rsync</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="183"/>
|
|
||||||
<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"/>
|
|
||||||
<source>Connection</source>
|
|
||||||
<translation>Connexion</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="192"/>
|
|
||||||
<source>Return</source>
|
|
||||||
<translation>Retour</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="218"/>
|
|
||||||
<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"/>
|
|
||||||
<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"/>
|
|
||||||
<source>Click on file to stop downloading</source>
|
|
||||||
<translation>Cliquez sur le document pour arrêter le téléchargement et l'enleveer de la file</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="354"/>
|
|
||||||
<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"/>
|
|
||||||
<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"/>
|
|
||||||
<source>Change save folder</source>
|
|
||||||
<translation>Changer le dossier de destination</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Default save folder</source>
|
|
||||||
<translation type="vanished">Dossier d'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"/>
|
|
||||||
<source>About</source>
|
|
||||||
<translation>À propos</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="412"/>
|
|
||||||
<source>About Qt</source>
|
|
||||||
<translation>À propos de Qt</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.ui" line="417"/>
|
|
||||||
<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"/>
|
|
||||||
<source>Byte</source>
|
|
||||||
<translation>Octet</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="21"/>
|
|
||||||
<source>KB</source>
|
|
||||||
<translation>Ko</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="21"/>
|
|
||||||
<source>MB</source>
|
|
||||||
<translation>Mo</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="21"/>
|
|
||||||
<source>GB</source>
|
|
||||||
<translation>Go</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="21"/>
|
|
||||||
<source>TB</source>
|
|
||||||
<translation>To</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="21"/>
|
|
||||||
<location filename="../../mainwindow.cpp" line="587"/>
|
|
||||||
<source>PB</source>
|
|
||||||
<translation>Po</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="24"/>
|
|
||||||
<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'ajouter dans la file de téléchargement.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="35"/>
|
|
||||||
<source>Path</source>
|
|
||||||
<translation>Chemin</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="35"/>
|
|
||||||
<source>Size</source>
|
|
||||||
<translation>Taille</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="35"/>
|
|
||||||
<source>Type</source>
|
|
||||||
<translation>Type</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="76"/>
|
|
||||||
<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>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="326"/>
|
|
||||||
<source>server does not exists</source>
|
|
||||||
<translation>Le serveur n'existe pas</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="545"/>
|
|
||||||
<source>Version</source>
|
|
||||||
<translation>Version</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="546"/>
|
|
||||||
<source>Licence</source>
|
|
||||||
<translation>License</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="547"/>
|
|
||||||
<source>Author</source>
|
|
||||||
<translation>Auteur</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="548"/>
|
|
||||||
<source>EMail</source>
|
|
||||||
<translation>Courriel</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="549"/>
|
|
||||||
<source>Source code</source>
|
|
||||||
<translation>Code source</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="564"/>
|
|
||||||
<source>Choose directory to save file</source>
|
|
||||||
<translation>Choisissez le dossier où enregistrer</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="477"/>
|
|
||||||
<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>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Client for rsync server</source>
|
|
||||||
<translation type="vanished">Client pour serveur rsync</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../../mainwindow.cpp" line="489"/>
|
|
||||||
<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>
|
|
||||||
</context>
|
|
||||||
</TS>
|
|
274
mainwindow.cpp
274
mainwindow.cpp
@ -1,20 +1,27 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
bool display = false;
|
bool display = false;
|
||||||
extern QDialog Configuration;
|
//extern QDialog Configuration;
|
||||||
extern Ui::Configuration config;
|
extern Ui::Configuration config;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
|
QAbstractButton * reply;
|
||||||
|
QMessageBox msgBox;
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName("RsyncUI");
|
QCoreApplication::setOrganizationName("RsyncUI");
|
||||||
QCoreApplication::setApplicationName("RsyncUI");
|
QCoreApplication::setApplicationName("RsyncUI");
|
||||||
|
|
||||||
|
// context menu for treewidget
|
||||||
|
ui->treeWidget->addAction(ui->actionDownload);
|
||||||
|
|
||||||
// init shortcut
|
// init shortcut
|
||||||
loadSettings();
|
loadSettings();
|
||||||
config.setupUi(&Configuration);
|
config.setupUi(&Configuration);
|
||||||
@ -32,7 +39,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
// init of widgets
|
// init of widgets
|
||||||
ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget);
|
ui->ktreewidgetsearchline->setTreeWidget(ui->treeWidget);
|
||||||
ui->ktreewidgetsearchline->setCaseSensitivity(Qt::CaseInsensitive);
|
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"))
|
if (this->settings.contains("connexion/lastServer"))
|
||||||
{
|
{
|
||||||
ui->portEdit->setText(this->settings.value("connexion/port").toString());
|
ui->portEdit->setText(this->settings.value("connexion/port").toString());
|
||||||
@ -51,6 +59,29 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
// Hiding progress bar
|
// Hiding progress bar
|
||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
|
|
||||||
|
if (this->settings.value("Downloads/rows").toInt() != 0)
|
||||||
|
{
|
||||||
|
this->settings.endArray();
|
||||||
|
msgBox.setWindowTitle("RsyncUI");
|
||||||
|
msgBox.setInformativeText(tr("A list of interrupted downloads exists, do you want to continue downloading ? or you can delete the list" ));
|
||||||
|
|
||||||
|
QPushButton *remove = msgBox.addButton(tr("Remove"), QMessageBox::ActionRole);
|
||||||
|
QPushButton *yes = msgBox.addButton(QMessageBox::Yes);
|
||||||
|
|
||||||
|
msgBox.addButton(QMessageBox::No);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
|
|
||||||
|
msgBox.exec();
|
||||||
|
reply = msgBox.clickedButton();
|
||||||
|
if(reply == yes)
|
||||||
|
{
|
||||||
|
loadDownloadList();
|
||||||
|
}else if (reply == remove)
|
||||||
|
{
|
||||||
|
this->settings.remove("Downloads");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
populateList();
|
populateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,19 +104,22 @@ void MainWindow::closeEvent (QCloseEvent *event)
|
|||||||
reply = QMessageBox::question(
|
reply = QMessageBox::question(
|
||||||
this,
|
this,
|
||||||
"RsyncUI",
|
"RsyncUI",
|
||||||
tr("Exiting will stop downloading, and will clear the download queue.\n Do you want to exit ?"),
|
tr("Exiting will stop downloading, and will clear the download queue.\nYou can save the list of downloads\nDo you want to exit ?"),
|
||||||
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes|QMessageBox::Save|QMessageBox::No,
|
||||||
QMessageBox::No);
|
QMessageBox::No);
|
||||||
if (reply == QMessageBox::No)
|
if (reply == QMessageBox::No)
|
||||||
{
|
{
|
||||||
// continuing
|
// continuing
|
||||||
event->ignore();
|
event->ignore();
|
||||||
return;
|
return;
|
||||||
}else
|
}else if(reply == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
// emission of signal to downloading thread and stopping
|
// emission of signal to downloading thread and stopping
|
||||||
emit (stopDownloading(this->downloading.pid));
|
emit (stopDownloading(this->pid));
|
||||||
waitpid(this->downloading.pid, NULL, WUNTRACED);
|
waitpid(this->pid, NULL, WUNTRACED);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
saveDownloadList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
@ -132,38 +166,39 @@ void MainWindow::populateList()
|
|||||||
this->connexion.server.assign(server.toStdString());
|
this->connexion.server.assign(server.toStdString());
|
||||||
this->connexion.port = port;
|
this->connexion.port = port;
|
||||||
|
|
||||||
|
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
// verify if server is in history
|
// verify if server is in history
|
||||||
this->settings.beginGroup("connexion/server");
|
this->settings.beginGroup("connexion/server");
|
||||||
if (this->settings.contains(server))
|
if (this->settings.contains(server))
|
||||||
{
|
{
|
||||||
// server is in history and completing port value
|
// server is in history => setting port value
|
||||||
port = this->settings.value(server).toUInt();
|
port = this->settings.value(server).toUInt();
|
||||||
ui->portEdit->setText(QString::number(port));
|
ui->portEdit->setText(QString::number(port));
|
||||||
this->connexion.port = port;
|
this->connexion.port = port;
|
||||||
}
|
listServices();
|
||||||
|
}else
|
||||||
|
{
|
||||||
if (!server.isEmpty() and (port > 0 and port < 65536))
|
if (!server.isEmpty() and (port > 0 and port < 65536))
|
||||||
{
|
{
|
||||||
if (validateServer(server.toStdString()))
|
if (validateServer(server.toStdString()))
|
||||||
{
|
|
||||||
|
|
||||||
if (!this->settings.contains(server))
|
|
||||||
{
|
{
|
||||||
cout << server.toStdString() << endl;
|
cout << server.toStdString() << endl;
|
||||||
// storing serverURL and port in settings
|
// storing serverURL and port in settings
|
||||||
this->settings.setValue(server, port);
|
this->settings.setValue(server, port);
|
||||||
this->settings.sync();
|
this->settings.sync();
|
||||||
|
this->downloading.server = server.toStdString();
|
||||||
|
|
||||||
// storing in history of combobox
|
// storing in history of combobox
|
||||||
ui->khistorycombobox->addToHistory(server);
|
ui->khistorycombobox->addToHistory(server);
|
||||||
}
|
|
||||||
// "waiting" cursor
|
// "waiting" cursor
|
||||||
// load and display rsync services of the rsync server
|
// load and display rsync services of the rsync server
|
||||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
|
||||||
listServices();
|
listServices();
|
||||||
QGuiApplication::restoreOverrideCursor(); //setOverrideCursor(Qt::ArrowCursor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
this->settings.endGroup();
|
this->settings.endGroup();
|
||||||
QGuiApplication::restoreOverrideCursor(); //setOverrideCursor(Qt::ArrowCursor);
|
QGuiApplication::restoreOverrideCursor(); //setOverrideCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
@ -350,12 +385,12 @@ QTreeWidgetItem * MainWindow::addTreeRoot(QString name, QString fileSize, bool i
|
|||||||
// QTreeWidgetItem::setText(int column, const QString & text)
|
// QTreeWidgetItem::setText(int column, const QString & text)
|
||||||
if (isDir == true)
|
if (isDir == true)
|
||||||
{
|
{
|
||||||
treeItem->setText(0, "Dir");
|
treeItem->setText(1, tr("Dir"));
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
treeItem->setText(0,"File");
|
treeItem->setText(1,tr("File"));
|
||||||
}
|
}
|
||||||
treeItem->setText(1, name);
|
treeItem->setText(0, name);
|
||||||
treeItem->setText(2, fileSize);
|
treeItem->setText(2, fileSize);
|
||||||
|
|
||||||
return treeItem;
|
return treeItem;
|
||||||
@ -370,12 +405,12 @@ QTreeWidgetItem * MainWindow::addTreeChild(QTreeWidgetItem *parent, QString name
|
|||||||
// QTreeWidgetItem::setText(int column, const QString & text)
|
// QTreeWidgetItem::setText(int column, const QString & text)
|
||||||
if (isDir == true)
|
if (isDir == true)
|
||||||
{
|
{
|
||||||
treeItem->setText(0, "Dir");
|
treeItem->setText(1, tr("Dir"));
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
treeItem->setText(0,"File");
|
treeItem->setText(1,("File"));
|
||||||
}
|
}
|
||||||
treeItem->setText(1, name);
|
treeItem->setText(0, name);
|
||||||
treeItem->setText(2, fileSize);
|
treeItem->setText(2, fileSize);
|
||||||
|
|
||||||
// QTreeWidgetItem::addChild(QTreeWidgetItem * child)
|
// QTreeWidgetItem::addChild(QTreeWidgetItem * child)
|
||||||
@ -387,47 +422,72 @@ QTreeWidgetItem * MainWindow::addTreeChild(QTreeWidgetItem *parent, QString name
|
|||||||
void MainWindow::on_listWidget_clicked()
|
void MainWindow::on_listWidget_clicked()
|
||||||
{
|
{
|
||||||
vector<string> v;
|
vector<string> v;
|
||||||
|
QString str;
|
||||||
|
|
||||||
v = explode(ui->listWidget->currentItem()->text().toStdString(), '\n', 2);
|
v = explode(ui->listWidget->currentItem()->text().toStdString(), '\n', 2);
|
||||||
this->downloading.service = v[0];
|
this->connexion.service = v[0];
|
||||||
|
str = QString::fromStdString("Folder/" + this->connexion.server + "/" + this->connexion.service);
|
||||||
|
if (this->settings.contains(str))
|
||||||
|
{
|
||||||
|
this->downloading.savePath = this->settings.value(str).toString().toStdString();
|
||||||
|
}
|
||||||
populateTree(NULL);
|
populateTree(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Slot activated when a file is clicked in the treeview
|
//Slot activated when a file is clicked in the treeview
|
||||||
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item)
|
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir)
|
||||||
{
|
{
|
||||||
QFuture<void> future;
|
QFuture<void> future;
|
||||||
QFileDialog dialog;
|
QFileDialog dialog;
|
||||||
QTreeWidgetItem * itemR;
|
QTreeWidgetItem * itemR;
|
||||||
string path;
|
string path;
|
||||||
|
QString str;
|
||||||
|
|
||||||
//item = ui->treeWidget->currentItem();
|
//item = ui->treeWidget->currentItem();
|
||||||
itemR = item;
|
itemR = item;
|
||||||
|
|
||||||
path = item->text(1).toStdString();
|
path = item->text(0).toStdString();
|
||||||
while(itemR->parent() != NULL)
|
while(itemR->parent() != NULL)
|
||||||
{
|
{
|
||||||
itemR = itemR->parent();
|
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") or downloadDir == true)
|
||||||
{
|
{
|
||||||
// Item is a file
|
// Item is a file
|
||||||
this->downloading.path = path;
|
this->downloading.path = path;
|
||||||
if (this->downloading.savePath.empty())
|
this->downloading.server = this->connexion.server;
|
||||||
{
|
this->downloading.service = this->connexion.service;
|
||||||
on_DefaultSaveFolder_triggered();
|
|
||||||
}else if (this->downloading.pid == 0)
|
|
||||||
{
|
|
||||||
startDownloading();
|
|
||||||
sleep(1);
|
|
||||||
|
|
||||||
|
// exists saving path in settings ?
|
||||||
|
str = QString::fromStdString("Folder/" + this->connexion.server + "/" + this->downloading.service);
|
||||||
|
if(!this->settings.contains(str))
|
||||||
|
{
|
||||||
|
// saving path do not exists, asking for it
|
||||||
|
if(!on_DefaultSaveFolder_triggered())
|
||||||
|
{
|
||||||
|
cout << "no directory selectioned, ignoring download request";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
ui->listDownload->addItem(QString::fromStdString(this->downloading.path));
|
}
|
||||||
|
|
||||||
|
// is there a downloading process ?
|
||||||
|
if (this->pid == 0)
|
||||||
|
{
|
||||||
|
// no downloading process launching it
|
||||||
|
startDownloading();
|
||||||
|
// wit 1 second to process start
|
||||||
|
//sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adding download in download list
|
||||||
|
str = QString::fromStdString(this->downloading.path + " => " + this->connexion.server + "/" + this->downloading.service);
|
||||||
|
ui->listDownload->addItem(str);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
//Item is a Directory
|
//Item is a Directory
|
||||||
scanDir(this->connexion.server, this->connexion.port, item, this->downloading.service + "/" + path +"/");
|
scanDir(this->connexion.server, this->connexion.port, item, this->connexion.service + "/" + path +"/");
|
||||||
item->setExpanded(true);
|
item->setExpanded(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,22 +506,48 @@ void MainWindow::startDownloading()
|
|||||||
// Slot stopping download
|
// Slot stopping download
|
||||||
void MainWindow::stoppingDownload()
|
void MainWindow::stoppingDownload()
|
||||||
{
|
{
|
||||||
emit (stopDownloading(this->downloading.pid));
|
emit (stopDownloading(this->pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
// when download is finished, launch download of next file in queue
|
// when download is finished, launch download of next file in queue
|
||||||
void MainWindow::downloadFinished()
|
void MainWindow::downloadFinished()
|
||||||
{
|
{
|
||||||
|
string path;
|
||||||
|
int pos;
|
||||||
|
string str;
|
||||||
|
|
||||||
|
this->pid = 0;
|
||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
delete ui->listDownload->takeItem(0);
|
delete ui->listDownload->takeItem(0);
|
||||||
this->downloading.pid = 0;
|
this->downloading.clear();
|
||||||
if (ui->listDownload->count() != 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(QString::fromStdString(str)))
|
||||||
|
{
|
||||||
|
this->downloading.savePath = this->settings.value(QString::fromStdString(str)).toString().toStdString();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if(!on_DefaultSaveFolder_triggered())
|
||||||
|
{
|
||||||
|
cout << "Error no save path so deleting download";
|
||||||
|
downloadFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
startDownloading();
|
startDownloading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Slot activated when a line is clicked in queue list
|
// Slot activated when a line is clicked in queue list
|
||||||
void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
|
void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
|
||||||
{
|
{
|
||||||
@ -479,7 +565,7 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
|
|||||||
QMessageBox::No);
|
QMessageBox::No);
|
||||||
if (reply == QMessageBox::Yes)
|
if (reply == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
emit (stopDownloading(this->downloading.pid));
|
emit (stopDownloading(this->pid));
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@ -501,11 +587,12 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
|
|||||||
void MainWindow::loadSettings()
|
void MainWindow::loadSettings()
|
||||||
{
|
{
|
||||||
// restoring geometry and state of window and widgets
|
// restoring geometry and state of window and widgets
|
||||||
this->restoreGeometry(settings.value("window/geometry").toByteArray());
|
this->restoreGeometry(this->settings.value("window/geometry").toByteArray());
|
||||||
this->restoreState(settings.value("window/state").toByteArray());
|
this->restoreState(this->settings.value("window/state").toByteArray());
|
||||||
ui->treeWidget->header()->restoreState(settings.value("treeWidget/state").toByteArray());
|
ui->treeWidget->header()->restoreState(this->settings.value("treeWidget/state").toByteArray());
|
||||||
ui->splitter->restoreState(settings.value("splitter/state").toByteArray());
|
ui->splitter->restoreState(this->settings.value("splitter/state").toByteArray());
|
||||||
ui->splitter_2->restoreState(settings.value("splitter2/state").toByteArray());
|
ui->splitter_2->restoreState(this->settings.value("splitter2/state").toByteArray());
|
||||||
|
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)this->settings.value("toolbar/state").toInt());
|
||||||
|
|
||||||
// loading connexion settings
|
// loading connexion settings
|
||||||
// loading servers history
|
// loading servers history
|
||||||
@ -535,12 +622,14 @@ void MainWindow::saveSettings()
|
|||||||
this->settings.setValue("splitter2/state", ui->splitter_2->saveState());
|
this->settings.setValue("splitter2/state", ui->splitter_2->saveState());
|
||||||
this->settings.setValue("connexion/lastServer", QString::fromStdString(this->connexion.server));
|
this->settings.setValue("connexion/lastServer", QString::fromStdString(this->connexion.server));
|
||||||
this->settings.setValue("connexion/lastPort", QString::number(this->connexion.port));
|
this->settings.setValue("connexion/lastPort", QString::number(this->connexion.port));
|
||||||
|
this->settings.setValue("toolbar/state", ui->toolBar->toolButtonStyle());
|
||||||
this->settings.sync();
|
this->settings.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// About
|
// About
|
||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::on_actionAbout_triggered()
|
||||||
{
|
{
|
||||||
|
//TODO => initialisation
|
||||||
QString text = this->about.description + "\n\n" +
|
QString text = this->about.description + "\n\n" +
|
||||||
tr("Version") + ": " + this->about.version + "\n" +
|
tr("Version") + ": " + this->about.version + "\n" +
|
||||||
tr("Licence") + ": " + this->about.licence + "\n" +
|
tr("Licence") + ": " + this->about.licence + "\n" +
|
||||||
@ -557,13 +646,35 @@ void MainWindow::on_actionAbout_Qt_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Activated when menu "change folder" is clicked
|
// Activated when menu "change folder" is clicked
|
||||||
void MainWindow::on_DefaultSaveFolder_triggered()
|
bool MainWindow::on_DefaultSaveFolder_triggered()
|
||||||
{
|
{
|
||||||
QFileDialog dialog;
|
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();
|
if (this->connexion.service.empty())
|
||||||
this->settings.setValue("Folder/", this->downloading.savePath.c_str());
|
{
|
||||||
|
QMessageBox::warning(
|
||||||
|
NULL,
|
||||||
|
"RsyncUI",
|
||||||
|
"Since the save path is linked to service, you need to select a service before you can select a folder");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
path = dialog.getExistingDirectory(this, tr("Choose directory to save file"), QString::fromStdString(getpwuid(getuid())->pw_dir), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toStdString();
|
||||||
|
if (!path.empty())
|
||||||
|
{
|
||||||
|
this->downloading.savePath = path;
|
||||||
|
if (!this->connexion.service.empty() and !this->connexion.server.empty())
|
||||||
|
{
|
||||||
|
folder = "Folder/" + this->connexion.server + "/" + this->connexion.service;
|
||||||
|
this->settings.setValue(folder.c_str(), this->downloading.savePath.c_str());
|
||||||
this->settings.sync();
|
this->settings.sync();
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activated when menu "settings" is clicked
|
// Activated when menu "settings" is clicked
|
||||||
@ -593,4 +704,71 @@ void MainWindow::on_buttonBox_accepted()
|
|||||||
this->settings.setValue("bandwidthlimit", this->connexion.bandwidthLimit);
|
this->settings.setValue("bandwidthlimit", this->connexion.bandwidthLimit);
|
||||||
this->settings.setValue("bandwidthlimitunit", this->connexion.bandwidthLimitUnit.c_str());
|
this->settings.setValue("bandwidthlimitunit", this->connexion.bandwidthLimitUnit.c_str());
|
||||||
this->settings.sync();
|
this->settings.sync();
|
||||||
|
Configuration.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Saving download list
|
||||||
|
void MainWindow::saveDownloadList()
|
||||||
|
{
|
||||||
|
int nRows;
|
||||||
|
|
||||||
|
nRows = ui->listDownload->count();
|
||||||
|
//this->settings.beginWriteArray("Downloads/");
|
||||||
|
this->settings.beginGroup("Downloads");
|
||||||
|
this->settings.setValue("rows", nRows);
|
||||||
|
for (int i = 0; i < nRows; i++)
|
||||||
|
{
|
||||||
|
this->settings.setValue(QString::number(i), ui->listDownload->item(i)->text());
|
||||||
|
}
|
||||||
|
this->settings.endGroup();
|
||||||
|
this->settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::loadDownloadList()
|
||||||
|
{
|
||||||
|
string path;
|
||||||
|
string str;
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
this->settings.beginGroup("Downloads");
|
||||||
|
int size = this->settings.value("rows").toInt();
|
||||||
|
for (int i = 0; i < size; ++i)
|
||||||
|
{
|
||||||
|
ui->listDownload->addItem(this->settings.value(QString::number(i)).toString());
|
||||||
|
}
|
||||||
|
this->settings.endGroup();
|
||||||
|
|
||||||
|
this->settings.remove("Downloads");
|
||||||
|
this->settings.sync();
|
||||||
|
|
||||||
|
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(QString::fromStdString(str)))
|
||||||
|
{
|
||||||
|
this->downloading.savePath = this->settings.value(QString::fromStdString(str)).toString().toStdString();
|
||||||
|
}
|
||||||
|
startDownloading();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Downloading::clear()
|
||||||
|
{
|
||||||
|
this->path.clear();
|
||||||
|
this->server.clear();
|
||||||
|
this->savePath.clear();
|
||||||
|
this->service.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionDownload_triggered()
|
||||||
|
{
|
||||||
|
// action made in qt-designer and added in init function.
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
item = ui->treeWidget->currentItem();
|
||||||
|
on_treeWidget_itemClicked(item, true);
|
||||||
}
|
}
|
||||||
|
54
mainwindow.h
54
mainwindow.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
#define QT_USE_FAST_CONCATENATION
|
||||||
|
#define QT_USE_FAST_OPERATOR_PLUS
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "ui_configuration.h"
|
#include "ui_configuration.h"
|
||||||
#include "downloadfile.h"
|
#include "downloadfile.h"
|
||||||
@ -32,6 +33,9 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <magic.h>
|
#include <magic.h>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QStringBuilder>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -43,24 +47,27 @@ class Connexion
|
|||||||
int bandwidthLimit = 0;
|
int bandwidthLimit = 0;
|
||||||
std::string bandwidthLimitUnit = "";
|
std::string bandwidthLimitUnit = "";
|
||||||
std::string server;
|
std::string server;
|
||||||
|
std::string service;
|
||||||
|
|
||||||
int port = 873;
|
int port = 873;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Downloading
|
class Downloading
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
std::string server;
|
||||||
std::string service;
|
std::string service;
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string defaultSavePath;
|
|
||||||
std::string savePath;
|
std::string savePath;
|
||||||
int pid = 0;
|
|
||||||
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
class About
|
class About
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString title = "RsyncUI";
|
QString title = "RsyncUI";
|
||||||
QString version = "1.6";
|
QString version = "1.9.1";
|
||||||
QString author = "Daniel TARTAVEL-JEANNOT";
|
QString author = "Daniel TARTAVEL-JEANNOT";
|
||||||
QString licence = "GPL_V3";
|
QString licence = "GPL_V3";
|
||||||
QString description;
|
QString description;
|
||||||
@ -77,20 +84,7 @@ class MainWindow : public QMainWindow
|
|||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
QProgressDialog *progress;
|
QProgressDialog *progress;
|
||||||
void displayTree();
|
int pid = 0;
|
||||||
void populateTree(QTreeWidgetItem * parent);
|
|
||||||
void populateList();
|
|
||||||
void listServices();
|
|
||||||
bool validateServer(std::string server);
|
|
||||||
bool isIpAddress(std::string server);
|
|
||||||
QTreeWidgetItem * addTreeRoot(QString name, QString description, bool isDir);
|
|
||||||
QTreeWidgetItem * addTreeChild(QTreeWidgetItem *parent, QString name, QString size, bool isDir);
|
|
||||||
void scanDir(std::string server, int portN, QTreeWidgetItem *parent = NULL, std::string path = "" );
|
|
||||||
void startDownloading();
|
|
||||||
void loadSettings();
|
|
||||||
void saveSettings();
|
|
||||||
void closeEvent (QCloseEvent *event);
|
|
||||||
|
|
||||||
Connexion connexion;
|
Connexion connexion;
|
||||||
Downloading downloading;
|
Downloading downloading;
|
||||||
downloadFile downloadO;
|
downloadFile downloadO;
|
||||||
@ -107,11 +101,27 @@ class MainWindow : public QMainWindow
|
|||||||
{'P', 4}
|
{'P', 4}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void displayTree();
|
||||||
|
void populateTree(QTreeWidgetItem * parent);
|
||||||
|
void populateList();
|
||||||
|
void listServices();
|
||||||
|
bool validateServer(std::string server);
|
||||||
|
bool isIpAddress(std::string server);
|
||||||
|
QTreeWidgetItem * addTreeRoot(QString name, QString description, bool isDir);
|
||||||
|
QTreeWidgetItem * addTreeChild(QTreeWidgetItem *parent, QString name, QString size, bool isDir);
|
||||||
|
void scanDir(std::string server, int portN, QTreeWidgetItem *parent = NULL, std::string path = "" );
|
||||||
|
void startDownloading();
|
||||||
|
void loadSettings();
|
||||||
|
void saveSettings();
|
||||||
|
void closeEvent (QCloseEvent *event);
|
||||||
|
void saveDownloadList();
|
||||||
|
void loadDownloadList();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_listWidget_clicked();
|
void on_listWidget_clicked();
|
||||||
|
|
||||||
void on_treeWidget_itemClicked(QTreeWidgetItem *item);
|
void on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir = false);
|
||||||
|
|
||||||
void downloadFinished();
|
void downloadFinished();
|
||||||
|
|
||||||
@ -125,19 +135,19 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
void on_khistorycombobox_currentIndexChanged(int);
|
void on_khistorycombobox_currentIndexChanged(int);
|
||||||
|
|
||||||
void on_DefaultSaveFolder_triggered();
|
bool on_DefaultSaveFolder_triggered();
|
||||||
|
|
||||||
void on_connectButton_clicked();
|
void on_connectButton_clicked();
|
||||||
|
|
||||||
void on_action_Settings_triggered();
|
void on_action_Settings_triggered();
|
||||||
|
|
||||||
|
void on_actionDownload_triggered();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stopDownloading(int);
|
void stopDownloading(int);
|
||||||
// void accepted();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||||
|
</property>
|
||||||
<property name="documentMode">
|
<property name="documentMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -247,7 +250,7 @@
|
|||||||
<enum>Qt::WheelFocus</enum>
|
<enum>Qt::WheelFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Click to add to download queue</string>
|
<string>Click to add to download queue</string>
|
||||||
@ -357,39 +360,47 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="geometry">
|
<property name="contextMenuPolicy">
|
||||||
<rect>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>500</width>
|
|
||||||
<height>30</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu">
|
<property name="windowTitle">
|
||||||
<property name="title">
|
<string>toolBar</string>
|
||||||
<string>Menu</string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="movable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::AllToolBarAreas</set>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||||
|
</property>
|
||||||
|
<property name="floatable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
<addaction name="DefaultSaveFolder"/>
|
<addaction name="DefaultSaveFolder"/>
|
||||||
<addaction name="action_Settings"/>
|
<addaction name="action_Settings"/>
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menuhelp">
|
|
||||||
<property name="title">
|
|
||||||
<string>help</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionAbout"/>
|
<addaction name="actionAbout"/>
|
||||||
<addaction name="actionAbout_Qt"/>
|
<addaction name="actionAbout_Qt"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu"/>
|
|
||||||
<addaction name="menuhelp"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
<action name="actionMenu">
|
|
||||||
<property name="text">
|
|
||||||
<string>Menu</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="DefaultSaveFolder">
|
<action name="DefaultSaveFolder">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="system-file-manager">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Change save folder</string>
|
<string>Change save folder</string>
|
||||||
</property>
|
</property>
|
||||||
@ -397,26 +408,41 @@
|
|||||||
<string>Change save folder</string>
|
<string>Change save folder</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionBandwidth_limit">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bandwidth limit</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAbout">
|
<action name="actionAbout">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-about">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>About</string>
|
<string>About</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAbout_Qt">
|
<action name="actionAbout_Qt">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-browser">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>About Qt</string>
|
<string>About Qt</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_Settings">
|
<action name="action_Settings">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="preferences-other">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionDownload">
|
||||||
|
<property name="text">
|
||||||
|
<string>Download</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Click on menu button to download the entire folder</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -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
|
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)
|
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);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user