From: Norbert Moutarde Date: Thu, 5 Jun 2014 19:10:36 +0000 (+0200) Subject: added a QMutex to download file one by one (cause QString file unicity X-Git-Url: https://git.nothing2do.fr/?a=commitdiff_plain;h=9e9fefec2bfc25e9db8cbd3803dc9c4a64bfc210;p=diary-mobile.git added a QMutex to download file one by one (cause QString file unicity !) --- diff --git a/diary-mobile_en_EN.ts b/diary-mobile_en_EN.ts index cef814a..365e75e 100644 --- a/diary-mobile_en_EN.ts +++ b/diary-mobile_en_EN.ts @@ -4,351 +4,350 @@ MainWindow - + first button file - + Enter the URL to download the first buttons file - + get file title to ask file - + box box title to show a text - + set - + Enter ID of button to edit - + &File - + &Start - + Ctrl+S File|Start - + &Back - + Ctrl+B File|Back - + sendRAW - + Ctrl+L File|Upload - + Reset RAW Reset Ui - + &Quit - + Ctrl+Q File|Quit - + &Buttons - + Ctrl+D Buttons|Add - + Ctrl+V Buttons|Save - + Ctrl+E Buttons|&Edit - + &View/Hide menu - + &Help - - + + New entry - + getButtons - + About Qt - + ctrl+H Help|About Qt - + C&reate Database - + Ctrl+R Help|CreateDB - + label Title of box where ask for new button's label - + Enter his label his/her/?they? I've forget my school lesson - + keyword Title of box where ask for new button's keyword - + Enter they keyword (no limit !) - + action Title of box where ask for new button's action - + Enter his action - + Ctrl+T File|View menu - + choice title of box who ask multiple choice - + Please choose an action. text to ask multiple choice - + &Download - + Ctrl+W Buttons|Downlad - + A&dd - + Sa&v - + Reset - + Ctrl+Z Buttons|Reset - + &Edit - + chooseButtonDB - + Enter the keyword : - + keyword Title of box where ask for button's keyword - + new keyword question to get new button's keyword - + label Title of box where ask for button's label - + new label question to get new button's label - + action Title of box where ask for button's action - + new action question to get new button's action - + RAWsent message title when data has been send - + sendRAW finish message text when data has been send - + Upload finish : pop-up when data has been sent - + uploadDB pop-up title when data has been sent - + Uisent pop-up title when buttons has been sent - + savbuttons finish pop-up text when buttons has been sent - + Enter the keyword : ask keyword to get buttons - + getButtons title to ask keyword fot getbuttons - + writeFile - pop-up title when file has been write + pop-up title when file has been written - - File writen - pop-up text when file has been written + + File written : diff --git a/diary-mobile_fr_FR.ts b/diary-mobile_fr_FR.ts index 119b343..caa978e 100644 --- a/diary-mobile_fr_FR.ts +++ b/diary-mobile_fr_FR.ts @@ -4,12 +4,12 @@ MainWindow - + first button file Premier fichier de bouton - + Enter the URL to download the first buttons file Entrez l'URL pour télécharger vos boutons @@ -22,76 +22,76 @@ choisissez une action - + get file title to ask file choisissez un fichier - + box box title to show a text info - + set définir - + Enter ID of button to edit Entrez l'ID du bouton à éditer - + &File &Fichier - + &Start &Départ - + Ctrl+S File|Start Ctrl+D - + &Back &Retour - + Ctrl+B File|Back Ctrl+R - + Ctrl+W Buttons|Downlad Ctrl+D - + sendRAW Envoyer les données - + Ctrl+L File|Upload Ctrl+L - + Reset RAW Reset Ui - Réinitialiser les boutons + Réinitialiser les donnés Ctrl+Z @@ -99,18 +99,18 @@ Ctrl+Z - + &Quit &Quitter - + Ctrl+Q File|Quit Ctrl+Q - + &Buttons Boutons @@ -119,17 +119,17 @@ A&jouter un boutons - + Ctrl+D Buttons|Add - Ctrl+J + Ctrl+D Sa&v buttons Sauvegardez les boutons - + Ctrl+V Buttons|Save Ctrl+V @@ -139,103 +139,103 @@ &Editer les boutons - + Ctrl+E Buttons|&Edit Ctrl+E - + &View/Hide menu Voir/Cacher le menu - + choice title of box who ask multiple choice Choix - + Please choose an action. text to ask multiple choice Choisissez une action - + Ctrl+T File|View menu Ctrl+C - + &Help Aide - - + + New entry Nouvelle entré - + getButtons getButtons - + About Qt A propos de Qt - + ctrl+H Help|About Qt Ctrl+A - + C&reate Database C&réer une base de donné - + Ctrl+R Help|CreateDB Ctrl+R - + label Title of box where ask for new button's label Etiquette - + Enter his label his/her/?they? I've forget my school lesson Entrez son étiquette - + keyword Title of box where ask for new button's keyword mot-clé - + Enter they keyword (no limit !) Entrez les mots clé (no limit !) - + action Title of box where ask for new button's action action - + Enter his action Entrez son action @@ -245,141 +245,140 @@ 0 (non) ou 1 (oui)? - + &Download &Téléchargement - + A&dd Nouveau - + Sa&v Sauvegardez - + Reset Remise à zéro - + Ctrl+Z Buttons|Reset Ctrl+Z - + &Edit Editez - + chooseButtonDB chooseButtonDB - + Enter the keyword : Entrez le mot-clé : - + keyword Title of box where ask for button's keyword mot-clé - + new keyword question to get new button's keyword nouveau mot-clé - + label Title of box where ask for button's label étiquette - + new label question to get new button's label nouvel étiquette - + action Title of box where ask for button's action action - + new action question to get new button's action nouvelle action - + RAWsent message title when data has been send RAWsent - + sendRAW finish message text when data has been send données envoyées - + Upload finish : pop-up when data has been sent Upload finit : - + uploadDB pop-up title when data has been sent uploadDB - + Uisent pop-up title when buttons has been sent Envoyé - + savbuttons finish pop-up text when buttons has been sent boutons sauvegardés sur le serveur - + Enter the keyword : ask keyword to get buttons Entrez le mot-clé : - + getButtons title to ask keyword fot getbuttons getBoutons - + writeFile - pop-up title when file has been write - writeFile + pop-up title when file has been written + fichier - - File writen - pop-up text when file has been written - Fichier écrit + + File written : + Fichier écrit : diff --git a/main.cpp b/main.cpp index 71d04de..35bfe7c 100644 --- a/main.cpp +++ b/main.cpp @@ -28,15 +28,15 @@ int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QApplication app(argc, argv); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); QString locale = QLocale::system().name();//.section('_', 0, 0) qDebug()<<"local="<allKeys().size()==0){ qDebug()<<"first"; firstrun(); download(QString("http://www.nothing2do.eu/diary-mobile_")+ QLocale::system().name()+ QString(".qm")); connect(m, SIGNAL(downloaded()), SLOT(writeTr())); + conf->setValue(QString("first"), 1); }; screen=new QWidget(this); @@ -259,7 +261,7 @@ void MainWindow::createMenuBar(){ EditMenu->addAction(trUtf8("&Download"), this, SLOT(downloadUi()),QKeySequence(trUtf8("Ctrl+W", "Buttons|Downlad"))); EditMenu->addAction(trUtf8("A&dd"), this, SLOT(addButtonDB()), QKeySequence(trUtf8("Ctrl+D", "Buttons|Add"))); EditMenu->addAction(trUtf8("Sa&v"), this, SLOT(savButtons()), QKeySequence(trUtf8("Ctrl+V", "Buttons|Save"))); - FileMenu->addAction(trUtf8("Reset"), this, SLOT(resetUi()), QKeySequence(trUtf8("Ctrl+Z", "Buttons|Reset"))); + EditMenu->addAction(trUtf8("Reset"), this, SLOT(resetUi()), QKeySequence(trUtf8("Ctrl+Z", "Buttons|Reset"))); EditMenu->addAction(trUtf8("&Edit"), this, SLOT(chooseButtonDB()), QKeySequence(trUtf8("Ctrl+E", "Buttons|&Edit"))); menuBar()->addMenu(EditMenu); HelpMenu=new QMenu(trUtf8("&Help")); @@ -651,6 +653,7 @@ void MainWindow::download(const QString & a){ } void MainWindow::download(const QString & a, const QString & b){ qDebug()<<"download("<a="<downloadedData()); @@ -741,5 +744,6 @@ void MainWindow::writeFile(){ QDataStream str(&tmp); str<downloadedData(); m->disconnect(); - QMessageBox::information(this, trUtf8("writeFile", "pop-up title when file has been write"), trUtf8("File writen", "pop-up text when file has been written")); + d.unlock(); + QMessageBox::information(this, trUtf8("writeFile", "pop-up title when file has been written"), trUtf8("File written : "+file.toLocal8Bit(), "pop-up text when file has been written")); } diff --git a/mainwindow.h b/mainwindow.h index c6986e9..f1108d6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -45,9 +45,6 @@ //#include #include //#include -#ifndef FILEDOWNLOADER_H -#define FILEDOWNLOADER_H - #include #include #include @@ -58,6 +55,10 @@ #include #include +#ifndef FILEDOWNLOADER_H +#define FILEDOWNLOADER_H + + class FileDownloader : public QObject { Q_OBJECT @@ -173,7 +174,8 @@ private: //sax2 xml; //QsKineticScroller * ks; //QScrollArea * scroll; - QMutex sql,updatelocker; + + QMutex sql,updatelocker,d; QWidget *screen; QGridLayout *grid; QLabel *label;