-corrected bug in localization

This commit is contained in:
Daniel Tartavel 2023-02-12 19:11:06 +01:00
parent 3e0bd57029
commit 65896b087f
5 changed files with 66 additions and 35 deletions

View File

@ -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-02-11T01:13:28. --> <!-- Written by QtCreator 4.14.2, 2023-02-12T17:55:57. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@ -141,7 +141,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></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"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
@ -183,7 +183,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></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"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">

View File

@ -256,114 +256,136 @@ Do you want to exit ?</source>
Voulez-vous vraiment sortir ?</translation> Voulez-vous vraiment sortir ?</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="216"/> <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> <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> <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>
<message> <message>
<location filename="mainwindow.cpp" line="502"/> <location filename="mainwindow.cpp" line="500"/>
<source>server does not exists</source> <source>server does not exists</source>
<translation>Le serveur n&apos;existe pas</translation> <translation>Le serveur n&apos;existe pas</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="529"/> <location filename="mainwindow.cpp" line="527"/>
<location filename="mainwindow.cpp" line="549"/> <location filename="mainwindow.cpp" line="547"/>
<source>Dir</source> <source>Dir</source>
<translation>dossier</translation> <translation>dossier</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="533"/> <location filename="mainwindow.cpp" line="531"/>
<location filename="mainwindow.cpp" line="617"/> <location filename="mainwindow.cpp" line="615"/>
<source>File</source> <source>File</source>
<translation>Doc</translation> <translation>Doc</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="626"/> <location filename="mainwindow.cpp" line="624"/>
<source>File is already downloaded. Do you want to reload it ? The old file will be deleted</source> <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> <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>
<message> <message>
<location filename="mainwindow.cpp" line="661"/> <location filename="mainwindow.cpp" line="659"/>
<source>File is already downloading</source> <source>File is already downloading</source>
<translation>Le document est déjà en téléchargement</translation> <translation>Le document est déjà en téléchargement</translation>
</message> </message>
<message>
<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> <message>
<location filename="mainwindow.cpp" line="705"/> <location filename="mainwindow.cpp" line="705"/>
<source>Rsync process crashed</source> <source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation> <translation>Le processus rsync à planté</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="861"/> <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> <source>Version</source>
<translation>Version</translation> <translation>Version</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="862"/> <location filename="mainwindow.cpp" line="868"/>
<source>Licence</source> <source>Licence</source>
<translation>License</translation> <translation>License</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="863"/> <location filename="mainwindow.cpp" line="869"/>
<source>Author</source> <source>Author</source>
<translation>Auteur</translation> <translation>Auteur</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="864"/> <location filename="mainwindow.cpp" line="870"/>
<source>EMail</source> <source>EMail</source>
<translation>Courriel</translation> <translation>Courriel</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="865"/> <location filename="mainwindow.cpp" line="871"/>
<source>Source code</source> <source>Source code</source>
<translation>Code source</translation> <translation>Code source</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="888"/> <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> <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> <translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="893"/> <location filename="mainwindow.cpp" line="899"/>
<source>Choose folder where to save file</source> <source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation> <translation>Choisissez un dossier enregistrer le document</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="779"/> <location filename="mainwindow.cpp" line="785"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source> <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> <translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="793"/> <location filename="mainwindow.cpp" line="799"/>
<source>Do you want to delete this file from download queue ?</source> <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> <translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.h" line="121"/> <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> <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> <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>
<message> <message>
<location filename="mainwindow.h" line="122"/> <location filename="mainwindow.h" line="123"/>
<source>The process crashed some time after starting successfully.</source> <source>The process crashed some time after starting successfully.</source>
<translation>Le processus à planté après avoir démarré avec succès.</translation> <translation>Le processus à planté après avoir démarré avec succès.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.h" line="123"/> <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> <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> <translation>La fonction waitFor...() a dépassé la limite de temps, you pouvez essayer de la relancer.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.h" line="124"/> <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> <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> <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>
<message> <message>
<location filename="mainwindow.h" line="125"/> <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> <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> <translation>Une erreur est survenue lors de la lecturee de données, le processus est probablement arrêté.</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.h" line="126"/> <location filename="mainwindow.h" line="127"/>
<source>An unknown error occurred. This is the default return value of error().</source> <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> <translation>Une erreur inconnue est survenue. C&apos;est la valeur de retour par défaut de error().</translation>
</message> </message>

View File

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

View File

@ -197,7 +197,7 @@ void MainWindow::quitApp()
saveDownloadList(); saveDownloadList();
} }
} }
delete ui; //delete ui;
QCoreApplication::quit(); QCoreApplication::quit();
} }
@ -206,7 +206,6 @@ void MainWindow::closeEvent (QCloseEvent *event)
{ {
QMessageBox msgBox; QMessageBox msgBox;
QCheckBox *cb = new QCheckBox("Don't show this again ?"); QCheckBox *cb = new QCheckBox("Don't show this again ?");
QAbstractButton * reply;
if (!event->spontaneous() || !isVisible()) if (!event->spontaneous() || !isVisible())
return; return;
@ -223,7 +222,7 @@ void MainWindow::closeEvent (QCloseEvent *event)
// msgBox.setDefaultButton(QMessageBox::Yes); // msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setCheckBox(cb); msgBox.setCheckBox(cb);
msgBox.exec(); msgBox.exec();
reply = msgBox.clickedButton(); msgBox.clickedButton();
// if response is yes then loading list // if response is yes then loading list
if (cb->isChecked()) if (cb->isChecked())
@ -372,7 +371,6 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
QString line; QString line;
QString size; QString size;
QString filename; QString filename;
QTreeWidgetItem * item;
QProcess * myProcess; QProcess * myProcess;
bool isDir = false; bool isDir = false;
bool flag = false; bool flag = false;
@ -383,7 +381,7 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
myProcess = new QProcess(this); myProcess = new QProcess(this);
myProcess->start(cmd, param); 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(myProcess->waitForReadyRead(100000))
{ {
while (!flag) while (!flag)
@ -411,11 +409,11 @@ void MainWindow::scanDir(QString server, int portN, QTreeWidgetItem *parent, QSt
if (parent != NULL) if (parent != NULL)
{ {
//adding item to tree //adding item to tree
item = addTreeChild(parent, filename, size, isDir); addTreeChild(parent, filename, size, isDir);
}else }else
{ {
//adding item to tree (as directory) //adding item to tree (as directory)
item = addTreeRoot(filename, size, isDir); addTreeRoot(filename, size, isDir);
} }
} }
} }
@ -681,6 +679,7 @@ void MainWindow::startDownloading()
//QtConcurrent::run(&this->downloadO, &downloadFile::download, this); //QtConcurrent::run(&this->downloadO, &downloadFile::download, this);
download(); download();
this->trayIcon->showMessage("RsyncUI", tr("Starting downloading\n") + this->downloading.path, QSystemTrayIcon::Information);
} }
// Slot stopping download // Slot stopping download
@ -695,6 +694,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
QString path; QString path;
QString str; QString str;
int pos; int pos;
QString aborted = tr("finished");
// test if process crashed // test if process crashed
if (exitStatus == QProcess::CrashExit) if (exitStatus == QProcess::CrashExit)
@ -712,8 +712,14 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
NULL, NULL,
"RsyncUI", "RsyncUI",
rsyncErrorStrings[exitCode]); 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 // disconnecting signals to slots
disconnect(this->downloading.process, 0, 0, 0); disconnect(this->downloading.process, 0, 0, 0);