Compare commits

...

5 Commits
2.1.1 ... 2.2

Author SHA1 Message Date
d681d65d9c version 2.2 2023-02-12 19:11:26 +01:00
65896b087f -corrected bug in localization 2023-02-12 19:11:06 +01:00
3e0bd57029 version 2.1.3 2023-02-12 17:56:12 +01:00
65c0318449 version 2.1.2 2023-02-12 17:50:13 +01:00
a2d9f93ace added icon in system tray 2023-02-12 00:37:50 +01:00
8 changed files with 235 additions and 66 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.14.2, 2023-02-11T01:13:28. -->
<!-- Written by QtCreator 4.14.2, 2023-02-12T17:55:57. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -141,7 +141,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
@ -183,7 +183,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">

View File

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

View File

@ -74,96 +74,111 @@
<translation>Fenêtre principale</translation>
</message>
<message>
<location filename="mainwindow.ui" line="83"/>
<location filename="mainwindow.ui" line="86"/>
<source>Server</source>
<oldsource>Serveur</oldsource>
<translation>Serveur</translation>
</message>
<message>
<location filename="mainwindow.ui" line="105"/>
<location filename="mainwindow.ui" line="108"/>
<source>Enter server&apos;s URL</source>
<translation>Entrez l&apos;adresse du serveur</translation>
</message>
<message>
<location filename="mainwindow.ui" line="121"/>
<location filename="mainwindow.ui" line="124"/>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<location filename="mainwindow.ui" line="149"/>
<location filename="mainwindow.ui" line="152"/>
<source>Enter rsync port on server</source>
<translation>Entrez le port du serveur rsync</translation>
</message>
<message>
<location filename="mainwindow.ui" line="186"/>
<location filename="mainwindow.ui" line="189"/>
<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="192"/>
<location filename="mainwindow.ui" line="195"/>
<source>Connection</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="mainwindow.ui" line="195"/>
<location filename="mainwindow.ui" line="198"/>
<source>Return</source>
<translation>Retour</translation>
</message>
<message>
<location filename="mainwindow.ui" line="221"/>
<location filename="mainwindow.ui" line="224"/>
<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="256"/>
<location filename="mainwindow.ui" line="259"/>
<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="334"/>
<location filename="mainwindow.ui" line="337"/>
<source>Click on file to stop downloading</source>
<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="357"/>
<location filename="mainwindow.ui" line="360"/>
<source>%p%</source>
<extracomment>Downloading</extracomment>
<translation>Téléchargement</translation>
</message>
<message>
<location filename="mainwindow.ui" line="368"/>
<location filename="mainwindow.ui" line="371"/>
<source>toolBar</source>
<translation>Barre d&apos;outils</translation>
</message>
<message>
<location filename="mainwindow.ui" line="440"/>
<location filename="mainwindow.ui" line="444"/>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="mainwindow.ui" line="443"/>
<location filename="mainwindow.ui" line="447"/>
<source>Click on menu button to download the entire folder</source>
<translation>Cliquer sur le bouton droit de la souris pour télécharger le dossier entier</translation>
</message>
<message>
<location filename="mainwindow.ui" line="405"/>
<location filename="mainwindow.ui" line="408"/>
<location filename="mainwindow.ui" line="455"/>
<source>Exit</source>
<translation>Quitter</translation>
</message>
<message>
<location filename="mainwindow.ui" line="458"/>
<source>Terminate the program</source>
<translation>Terminer le programme</translation>
</message>
<message>
<location filename="mainwindow.ui" line="461"/>
<source>Ctrl+Q</source>
<translation>Ctrl+Q</translation>
</message>
<message>
<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>
<location filename="mainwindow.ui" line="417"/>
<location filename="mainwindow.ui" line="421"/>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<location filename="mainwindow.ui" line="426"/>
<location filename="mainwindow.ui" line="430"/>
<source>About Qt</source>
<translation>À propos de Qt</translation>
</message>
<message>
<location filename="mainwindow.ui" line="435"/>
<location filename="mainwindow.ui" line="439"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
@ -222,123 +237,155 @@ Cliquez sur un fichier pour l&apos;ajouter dans la file de téléchargement</tra
<translation>Une liste de téléchargement existe, voulez-vous utiliser cette liste ? si non, elle sera effacée</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="138"/>
<location filename="mainwindow.cpp" line="125"/>
<source>&amp;Quit</source>
<translation>&amp;Quitter</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="182"/>
<source>Clicking Save button, You can save the list of downloads
</source>
<translation>Vous pouvez enregistrer la liste des téléchargements en cliquant sur &quot;enregister&quot;
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="143"/>
<location filename="mainwindow.cpp" line="187"/>
<source>Exiting will stop downloading, and will clear the download queue.
Do you want to exit ?</source>
<translation>Si vous sortez, les téléchargements seront arrêter.
Voulez-vous vraiment sortir ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="425"/>
<location filename="mainwindow.cpp" line="215"/>
<source>The program will keep running in the system tray. To terminate the program, choose &lt;b&gt;Quit&lt;/b&gt; in the context menu of the system tray entry.</source>
<translation>Le programme continue dans la boîte à miniatures. Pour quitter le programme cliquez sur l&apos;icône &lt;b&gt;Quitter&lt;/b&gt; ou dans les menu contextuel.</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="500"/>
<source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="452"/>
<location filename="mainwindow.cpp" line="472"/>
<location filename="mainwindow.cpp" line="527"/>
<location filename="mainwindow.cpp" line="547"/>
<source>Dir</source>
<translation>dossier</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="540"/>
<location filename="mainwindow.cpp" line="531"/>
<location filename="mainwindow.cpp" line="615"/>
<source>File</source>
<translation>Doc</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="549"/>
<location filename="mainwindow.cpp" line="624"/>
<source>File is already downloaded. Do you want to reload it ? The old file will be deleted</source>
<translation>Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L&apos;ancien fichier sera effacé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="584"/>
<location filename="mainwindow.cpp" line="659"/>
<source>File is already downloading</source>
<translation>Le document est déjà en téléchargement</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="628"/>
<location filename="mainwindow.cpp" line="682"/>
<source>Starting downloading
</source>
<translation>Démarrage du téléchargement
</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="697"/>
<source>finished</source>
<translation>Terminé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="705"/>
<source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="784"/>
<location filename="mainwindow.cpp" line="717"/>
<source>stopped by user</source>
<translation>stoppé par l&apos;utilisateur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="721"/>
<source>Download </source>
<translation>Téléchargement </translation>
</message>
<message>
<location filename="mainwindow.cpp" line="867"/>
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="785"/>
<location filename="mainwindow.cpp" line="868"/>
<source>Licence</source>
<translation>License</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="786"/>
<location filename="mainwindow.cpp" line="869"/>
<source>Author</source>
<translation>Auteur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="787"/>
<location filename="mainwindow.cpp" line="870"/>
<source>EMail</source>
<translation>Courriel</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="788"/>
<location filename="mainwindow.cpp" line="871"/>
<source>Source code</source>
<translation>Code source</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="811"/>
<location filename="mainwindow.cpp" line="894"/>
<source>Since the save path is linked to service, you need to select a service before you can select a folder</source>
<translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="816"/>
<location filename="mainwindow.cpp" line="899"/>
<source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="702"/>
<location filename="mainwindow.cpp" line="785"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source>
<translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="716"/>
<location filename="mainwindow.cpp" line="799"/>
<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>
<message>
<location filename="mainwindow.h" line="118"/>
<location filename="mainwindow.h" line="122"/>
<source>The process failed to start. Either the invoked program is missing, or you may have insufficient permissions or resources to invoke the program.</source>
<translation>Le processus échoué, soit le programme est manquant, soit vous n&apos;avez pas l&apos;autorisation de l&apos;exécuter.</translation>
</message>
<message>
<location filename="mainwindow.h" line="119"/>
<location filename="mainwindow.h" line="123"/>
<source>The process crashed some time after starting successfully.</source>
<translation>Le processus à planté après avoir démarré avec succès.</translation>
</message>
<message>
<location filename="mainwindow.h" line="120"/>
<location filename="mainwindow.h" line="124"/>
<source>The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.</source>
<translation>La fonction waitFor...() a dépassé la limite de temps, you pouvez essayer de la relancer.</translation>
</message>
<message>
<location filename="mainwindow.h" line="121"/>
<location filename="mainwindow.h" line="125"/>
<source>An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.</source>
<translation>Une erreur est survenue lors de l&apos;envoi des données vers le processus. Le processus est peut être arrté ou il a fermé son canal d&apos;entrée.</translation>
</message>
<message>
<location filename="mainwindow.h" line="122"/>
<location filename="mainwindow.h" line="126"/>
<source>An error occurred when attempting to read from the process. For example, the process may not be running.</source>
<translation>Une erreur est survenue lors de la lecturee de données, le processus est probablement arrêté.</translation>
</message>
<message>
<location filename="mainwindow.h" line="123"/>
<location filename="mainwindow.h" line="127"/>
<source>An unknown error occurred. This is the default return value of error().</source>
<translation>Une erreur inconnue est survenue. C&apos;est la valeur de retour par défaut de error().</translation>
</message>

View File

@ -12,8 +12,11 @@ int main(int argc, char *argv[])
// Initialization of localization
QLocale localeName = QLocale::system();
QString localeFile = "/usr/share/locale/" + localeName.name() + "/LC_MESSAGES/RsyncUI_" + localeName.name() + ".qm";
if (myappTranslator.load(localeFile))
QString localeDir = "/usr/share/locale/" + localeName.name() + "/LC_MESSAGES/"; //RsyncUI_" + localeName.name() + ".qm";
QString localeFilename = QCoreApplication::applicationName() + "_" + localeName.name();
QLocale locale = QLocale();
if (myappTranslator.load(localeFilename, localeDir))
{
a.installTranslator(&myappTranslator);
}

View File

@ -111,15 +111,59 @@ MainWindow::MainWindow(QWidget *parent)
}
// load list of services
populateList();
initSystemTrayIcon();
}
void MainWindow::initSystemTrayIcon()
{
QMenu *trayIconMenu;
QAction * quitAction;
this->trayIcon = new QSystemTrayIcon;
this->trayIcon->setIcon(this->windowIcon());
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, &QAction::triggered, this, &MainWindow::quitApp);
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(quitAction);
trayIcon->setContextMenu(trayIconMenu);
connect(this->trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_trayIcon_clicked(QSystemTrayIcon::ActivationReason)));
this->trayIcon->show();
}
void MainWindow::on_trayIcon_clicked(QSystemTrayIcon::ActivationReason reason)
{
if (reason == QSystemTrayIcon::Trigger)
{
if (this->isHidden())
{
this->show();
}else
{
this->hide();
}
}
}
void MainWindow::hideWindow()
{
this->hide();
}
void MainWindow::showWindow()
{
this->show();
}
MainWindow::~MainWindow()
{
delete ui;
QCoreApplication::quit();
}
// Close window has been clicked
void MainWindow::closeEvent (QCloseEvent *event)
void MainWindow::quitApp()
{
QMessageBox::StandardButton reply;
QMessageBox::StandardButtons param;
@ -144,12 +188,7 @@ void MainWindow::closeEvent (QCloseEvent *event)
param,
QMessageBox::No);
if (reply == QMessageBox::No)
{
// continuing
event->ignore();
return;
}else if(reply == QMessageBox::Yes)
if(reply == QMessageBox::Yes)
{
// emission of signal to downloading thread and stopping
emit (stopDownloading(this->downloading.process));
@ -158,7 +197,44 @@ void MainWindow::closeEvent (QCloseEvent *event)
saveDownloadList();
}
}
event->accept();
//delete ui;
QCoreApplication::quit();
}
// Close window has been clicked
void MainWindow::closeEvent (QCloseEvent *event)
{
QMessageBox msgBox;
QCheckBox *cb = new QCheckBox("Don't show this again ?");
if (!event->spontaneous() || !isVisible())
return;
if (trayIcon->isVisible() and this->settings.value("CloseCheckbox").toBool() == false)
{
msgBox.setWindowTitle("RsyncUI");
msgBox.setInformativeText(tr("The program will keep running in the "
"system tray. To terminate the program, "
"choose <b>Quit</b> in the context menu "
"of the system tray entry."));
msgBox.addButton(QMessageBox::Ok);
//msgBox.addButton(QMessageBox::No);
// msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setCheckBox(cb);
msgBox.exec();
msgBox.clickedButton();
// if response is yes then loading list
if (cb->isChecked())
{
this->settings.setValue("CloseCheckbox", true);
}
hide();
//event->accept();
event->ignore();
}
}
// Populate treeview with list of files
@ -295,7 +371,6 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
QString line;
QString size;
QString filename;
QTreeWidgetItem * item;
QProcess * myProcess;
bool isDir = false;
bool flag = false;
@ -306,7 +381,7 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
myProcess = new QProcess(this);
myProcess->start(cmd, param);
// waiting for response of the server with a timeout of 10 seconds
// waiting for responsiteme of the server with a timeout of 10 seconds
while(myProcess->waitForReadyRead(100000))
{
while (!flag)
@ -334,11 +409,11 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
if (parent != NULL)
{
//adding item to tree
item = addTreeChild(parent, filename, size, isDir);
addTreeChild(parent, filename, size, isDir);
}else
{
//adding item to tree (as directory)
item = addTreeRoot(filename, size, isDir);
addTreeRoot(filename, size, isDir);
}
}
}
@ -569,7 +644,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
this->downloading.server = this->connexion.server;
this->downloading.service = this->connexion.service;
startDownloading();
// wit 1 second to process start
// wait 1 second to process start
//sleep(1);
}
@ -604,6 +679,7 @@ void MainWindow::startDownloading()
//QtConcurrent::run(&this->downloadO, &downloadFile::download, this);
download();
this->trayIcon->showMessage("RsyncUI", tr("Starting downloading\n") + this->downloading.path, QSystemTrayIcon::Information);
}
// Slot stopping download
@ -618,6 +694,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
QString path;
QString str;
int pos;
QString aborted = tr("finished");
// test if process crashed
if (exitStatus == QProcess::CrashExit)
@ -635,8 +712,14 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
NULL,
"RsyncUI",
rsyncErrorStrings[exitCode]);
}else if (exitCode == 20)
{
aborted = tr("stopped by user");
}
this->trayIcon->showMessage("RsyncUI", tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information);
// disconnecting signals to slots
disconnect(this->downloading.process, 0, 0, 0);
@ -951,3 +1034,8 @@ void MainWindow::on_comboBox_currentIndexChanged(int index)
{
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)index);
}
void MainWindow::on_actionExit_triggered()
{
quitApp();
}

View File

@ -39,6 +39,9 @@
#include <QProcess>
#include <QToolBar>
#include <QDir>
#include <QSystemTrayIcon>
#include <QMenu>
#include<QTranslator>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@ -73,7 +76,7 @@ class About
{
public:
QString title = "RsyncUI";
QString version = "2.1.1";
QString version = "2.2";
QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3";
QString description;
@ -98,6 +101,7 @@ class MainWindow : public QMainWindow
QDialog Configuration;
Ui::Configuration config;
std::vector <QString> serversList;
QSystemTrayIcon * trayIcon;
QList<QString> bwUnitText {
"KB",
"MB",
@ -139,6 +143,9 @@ class MainWindow : public QMainWindow
void saveDownloadList();
void loadDownloadList();
void download();
void initSystemTrayIcon();
void hideWindow();
void showWindow();
private slots:
@ -180,7 +187,13 @@ class MainWindow : public QMainWindow
void cancelled(QProcess *);
signals:
void on_trayIcon_clicked(QSystemTrayIcon::ActivationReason reason);
void quitApp();
void on_actionExit_triggered();
signals:
void stopDownloading(QProcess *);
void progressSignal(int);
void finishedSignal(bool = true);

View File

@ -20,6 +20,9 @@
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset theme="/usr/share/icons/RsyncUI.png"/>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
@ -395,6 +398,7 @@
<addaction name="action_Settings"/>
<addaction name="actionAbout"/>
<addaction name="actionAbout_Qt"/>
<addaction name="actionExit"/>
</widget>
<action name="DefaultSaveFolder">
<property name="icon">
@ -443,6 +447,20 @@
<string>Click on menu button to download the entire folder</string>
</property>
</action>
<action name="actionExit">
<property name="icon">
<iconset theme="application-exit"/>
</property>
<property name="text">
<string>Exit</string>
</property>
<property name="toolTip">
<string>Terminate the program</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>