From 32d84da35a19da5041bfec4b83b7c6fae0f52175 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Thu, 5 Jun 2014 11:20:43 +0200 Subject: [PATCH] I've added download(QString, QString) to save anything (URL in first QString) anywhere (filename in second QString) --- diary-mobile_en_EN.ts | 140 +++++++++++++++++++---------------- diary-mobile_fr_FR.ts | 166 ++++++++++++++++++++++-------------------- mainwindow.cpp | 22 +++++- mainwindow.h | 4 +- 4 files changed, 189 insertions(+), 143 deletions(-) diff --git a/diary-mobile_en_EN.ts b/diary-mobile_en_EN.ts index 0e1549b..cef814a 100644 --- a/diary-mobile_en_EN.ts +++ b/diary-mobile_en_EN.ts @@ -13,16 +13,6 @@ Enter the URL to download the first buttons file - - - choice - - - - - Please choose an action. - - get file @@ -46,296 +36,320 @@ - + &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 + + + + + File writen + pop-up text when file has been written + + diff --git a/diary-mobile_fr_FR.ts b/diary-mobile_fr_FR.ts index 31df93d..119b343 100644 --- a/diary-mobile_fr_FR.ts +++ b/diary-mobile_fr_FR.ts @@ -14,14 +14,12 @@ Entrez l'URL pour télécharger vos boutons - choice - Choix + Choix - Please choose an action. - choisissez une action + choisissez une action @@ -46,81 +44,82 @@ 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 boutons Ctrl+Z Buttons|ResetUi - Ctrl+Z + Ctrl+Z - + &Quit &Quitter - + Ctrl+Q File|Quit Ctrl+Q - + &Buttons Boutons A&dd buttons - A&jouter un boutons + A&jouter un boutons - + Ctrl+D Buttons|Add Ctrl+J @@ -130,7 +129,7 @@ Sauvegardez les boutons - + Ctrl+V Buttons|Save Ctrl+V @@ -140,234 +139,247 @@ &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 askkeyword Title of box where ask for keyword to getbuttons - mot-clé ? + 0 (non) ou 1 (oui)? - - Ctrl+T - File|View menu - Ctrl+C - - - + &Download - - - - - Ctrl+W - Buttons|Downlad - Ctrl+D + &Téléchargement - + A&dd - + Nouveau - + Sa&v - + Sauvegardez - + Reset - + Remise à zéro - + Ctrl+Z Buttons|Reset - Ctrl+Z + 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 + + + + File writen + pop-up text when file has been written + Fichier écrit + diff --git a/mainwindow.cpp b/mainwindow.cpp index f0fb0d4..55a3cc3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -187,7 +187,7 @@ void MainWindow::action(const QString &a){ } else if(b[0]==QString("a/b")){ bool ok; - QString e=QInputDialog::getItem(this, trUtf8("choice"), trUtf8("Please choose an action."), c.split(conf->value(QString("sepchc")).toString()), 0, 0, &ok); + QString e=QInputDialog::getItem(this, trUtf8("choice", "title of box who ask multiple choice"), trUtf8("Please choose an action.", "text to ask multiple choice"), c.split(conf->value(QString("sepchc")).toString()), 0, 0, &ok); if(ok)action(e); } else if(b[0]==QString("back")){ @@ -197,7 +197,7 @@ void MainWindow::action(const QString &a){ } } else if(b[0]==QString("setfile")){ - bool ok; + bool ok=0; QString e=QFileDialog::getSaveFileName(this, trUtf8("get file", "title to ask file"), conf->value(b[1]).toString()); if(ok)conf->setValue(b[1], e); } @@ -238,6 +238,9 @@ void MainWindow::action(const QString &a){ download(c); connect(m, SIGNAL(downloaded()), SLOT(writeUi())); } + else if(b[0]==QString("down")){ + download(b[1], b[2]); + } else { getButtons(a); @@ -646,6 +649,13 @@ void MainWindow::download(const QString & a){ QUrl url(a); m = new FileDownloader(url, this); } +void MainWindow::download(const QString & a, const QString & b){ + qDebug()<<"download("< ({conf->value(QString("selectbuttons")).toString()})); QFile a(conf->value(QString("buttonfile")).toString()); @@ -725,3 +735,11 @@ void MainWindow::writeTr(){ file.write(m->downloadedData()); file.close(); } +void MainWindow::writeFile(){ + QFile tmp(file); + tmp.open(QIODevice::WriteOnly); + 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")); +} diff --git a/mainwindow.h b/mainwindow.h index 84536b2..c6986e9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -155,6 +155,7 @@ private slots: void downloadUi(); void writeUi(); void writeTr(); + void writeFile(); void sendRAW(); void RAWsent(); void Uisent(); @@ -163,6 +164,7 @@ private slots: void resetUi(); void downloadDB(); void download(const QString &); + void download(const QString &,const QString &); public slots: signals: @@ -176,7 +178,7 @@ private: QGridLayout *grid; QLabel *label; QSettings *conf; - QString tmp;//host, user, tmp, password, servercert,database, file; + QString tmp, file;//host, user, tmp, password, servercert,database; QMenu *FileMenu, *EditMenu, *HelpMenu; //unsigned short int port;// j'ai lu les docs sur internet et 0<="unsigned short int"<65536 QSignalMapper *signalmap; -- 2.45.1