added icon in system tray
This commit is contained in:
parent
4ead825bad
commit
a2d9f93ace
113
RsyncUI_fr_FR.ts
113
RsyncUI_fr_FR.ts
@ -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's URL</source>
|
||||
<translation>Entrez l'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'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'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,133 @@ Cliquez sur un fichier pour l'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>&Quit</source>
|
||||
<translation>&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 "enregister"
|
||||
</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="216"/>
|
||||
<source>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.</source>
|
||||
<translation>Le programme continue dans la boîte à miniatures. Pour quitter le programme cliquez sur l'icône <b>Quitter</b> ou dans les menu contextuel.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="502"/>
|
||||
<source>server does not exists</source>
|
||||
<translation>Le serveur n'existe pas</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="452"/>
|
||||
<location filename="mainwindow.cpp" line="472"/>
|
||||
<location filename="mainwindow.cpp" line="529"/>
|
||||
<location filename="mainwindow.cpp" line="549"/>
|
||||
<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="533"/>
|
||||
<location filename="mainwindow.cpp" line="617"/>
|
||||
<source>File</source>
|
||||
<translation>Doc</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="549"/>
|
||||
<location filename="mainwindow.cpp" line="626"/>
|
||||
<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'ancien fichier sera effacé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="584"/>
|
||||
<location filename="mainwindow.cpp" line="661"/>
|
||||
<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="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="861"/>
|
||||
<source>Version</source>
|
||||
<translation>Version</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="785"/>
|
||||
<location filename="mainwindow.cpp" line="862"/>
|
||||
<source>Licence</source>
|
||||
<translation>License</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="786"/>
|
||||
<location filename="mainwindow.cpp" line="863"/>
|
||||
<source>Author</source>
|
||||
<translation>Auteur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="787"/>
|
||||
<location filename="mainwindow.cpp" line="864"/>
|
||||
<source>EMail</source>
|
||||
<translation>Courriel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="788"/>
|
||||
<location filename="mainwindow.cpp" line="865"/>
|
||||
<source>Source code</source>
|
||||
<translation>Code source</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="811"/>
|
||||
<location filename="mainwindow.cpp" line="888"/>
|
||||
<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="893"/>
|
||||
<source>Choose folder where to save file</source>
|
||||
<translation>Choisissez un dossier où enregistrer le document</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="702"/>
|
||||
<location filename="mainwindow.cpp" line="779"/>
|
||||
<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="793"/>
|
||||
<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="121"/>
|
||||
<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'avez pas l'autorisation de l'exécuter.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.h" line="119"/>
|
||||
<location filename="mainwindow.h" line="122"/>
|
||||
<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="123"/>
|
||||
<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="124"/>
|
||||
<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'envoi des données vers le processus. Le processus est peut être arrté ou il a fermé son canal d'entrée.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.h" line="122"/>
|
||||
<location filename="mainwindow.h" line="125"/>
|
||||
<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="126"/>
|
||||
<source>An unknown error occurred. This is the default return value of error().</source>
|
||||
<translation>Une erreur inconnue est survenue. C'est la valeur de retour par défaut de error().</translation>
|
||||
</message>
|
||||
|
Binary file not shown.
102
mainwindow.cpp
102
mainwindow.cpp
@ -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,45 @@ 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 ?");
|
||||
QAbstractButton * reply;
|
||||
|
||||
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();
|
||||
reply = 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
|
||||
@ -569,7 +646,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);
|
||||
}
|
||||
|
||||
@ -951,3 +1028,8 @@ void MainWindow::on_comboBox_currentIndexChanged(int index)
|
||||
{
|
||||
ui->toolBar->setToolButtonStyle((Qt::ToolButtonStyle)index);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExit_triggered()
|
||||
{
|
||||
quitApp();
|
||||
}
|
||||
|
12
mainwindow.h
12
mainwindow.h
@ -39,6 +39,8 @@
|
||||
#include <QProcess>
|
||||
#include <QToolBar>
|
||||
#include <QDir>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
@ -98,6 +100,7 @@ class MainWindow : public QMainWindow
|
||||
QDialog Configuration;
|
||||
Ui::Configuration config;
|
||||
std::vector <QString> serversList;
|
||||
QSystemTrayIcon * trayIcon;
|
||||
QList<QString> bwUnitText {
|
||||
"KB",
|
||||
"MB",
|
||||
@ -139,6 +142,9 @@ class MainWindow : public QMainWindow
|
||||
void saveDownloadList();
|
||||
void loadDownloadList();
|
||||
void download();
|
||||
void initSystemTrayIcon();
|
||||
void hideWindow();
|
||||
void showWindow();
|
||||
|
||||
private slots:
|
||||
|
||||
@ -180,6 +186,12 @@ class MainWindow : public QMainWindow
|
||||
|
||||
void cancelled(QProcess *);
|
||||
|
||||
void on_trayIcon_clicked(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
void quitApp();
|
||||
|
||||
void on_actionExit_triggered();
|
||||
|
||||
signals:
|
||||
void stopDownloading(QProcess *);
|
||||
void progressSignal(int);
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user