From 9697d30dcc085e2b70a17573d9713688e0133a04 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Wed, 18 Jun 2014 17:26:48 +0200 Subject: [PATCH] I've made deb (know as debug var) usefull when on the road ! --- diary-mobile_en_EN.ts | 321 ++++++++++++++++++++++-------------------- diary-mobile_fr_FR.ts | 288 +++++++++++++++++++++++-------------- mainwindow.cpp | 65 +++++---- mainwindow.h | 4 +- 4 files changed, 388 insertions(+), 290 deletions(-) diff --git a/diary-mobile_en_EN.ts b/diary-mobile_en_EN.ts index f461889..f6985ca 100644 --- a/diary-mobile_en_EN.ts +++ b/diary-mobile_en_EN.ts @@ -4,513 +4,532 @@ MainWindow - - first button file - - - - + get file title to ask file - + box box title to show a text - + set - + Enter ID of button to edit - + Ctrl+S File|Start - + Ctrl+B File|Back - + Ctrl+L File|Upload - + Ctrl+Q File|Quit - + New entry - + ctrl+H Help|About Qt - + &View/Hide menu File|View/Hide menu - - &Data - top menu - - - - - &Download - Data|Downlad - - - - - Ctrl+W - Data|Downlad - - - - - A&dd - Data|Add - - - - - Ctrl+D - Data|Add - - - - - Sa&v - Data|Sav - - - - - Ctrl+V - Data|Save - - - - - Reset - Data|Reset - - - - - Ctrl+Z - Data|Reset - - - - - &Edit - Data|Edit - - - - - Ctrl+E - Data|&Edit - - - - + Ctrl+R Help|CreateDB - + C&reate Database Hack|Create - + Download sql Hack|download sql - + 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 - + Enter the URL to download the init file - + + init file + + + + + action + box title to debug action + + + + Variable's name ? text to ask value's name before changing it (set) - - + + Error title if action("set") has too much value - - + + Too much value in button's action text if action("set") has too much value - + variable text change title to warn about variable content change - - + + value of - - + + Variable's name ? text to ask value's name before changing it (setint) - + variable integer change title to warn about variable content change - + Value of - + choice title of box who ask multiple choice - + Please choose an action. text to ask multiple choice - + variable file change title to warn about variable content change - + Error title if action("edit") has too much value - + Too much value in button's action text if action("edit") has too much value - + URL title to download a custom file from URL - + Enter the URL of the file label to download a custom file - - + + File title to write a file downloaded from URL - - + + Enter the name of the file label to write the downloaded data - + Error title of box if action("read" has too much (or too "less") value - + Bad number of value text of box if action("read") has too much (or too "less") value - + &File top menu - + &Start File|Start - + &Back File|Back - + sendRAW File|SendRAW - + Reset RAW File|resetRAW - + Ctrl+E File|Reset - + &Quit File|Quit + + + &Button + top menu + + + + + &Download + Button|Downlad + + + + + Ctrl+W + Button|Downlad + + + A&dd + Button|Add + + + + + Ctrl+D + Button|Add + + + + + Sa&v + Button|Sav + + + + + Ctrl+V + Button|Save + + + + + Reset + Button|Reset + + + + + Ctrl+Z + Button|Reset + + + + + &Edit + Button|Edit + + + + + Ctrl+E + Button|&Edit + + + + &Hack top menu - + New entry Hack|Entry - + Action Hack|Action - + About Qt Hack|About Qt - + upload pop-up title when data has been sent - + + action + box title to debug insert + + + + + key + box title to debug remove + + + + tmp URL Title of box where ask for button file's URL - + Enter URL Label of box where ask for button file's URL - + action Title of box where ask for a custom action - + Enter your action Label of box where ask for custom action - + Enter the keyword : - + chooseDB - + 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 - + Uisent pop-up title when buttons has been sent - - savbuttons finish + + sav finish + 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 written - + File written : diff --git a/diary-mobile_fr_FR.ts b/diary-mobile_fr_FR.ts index 9c46d5a..f5bdf94 100644 --- a/diary-mobile_fr_FR.ts +++ b/diary-mobile_fr_FR.ts @@ -4,9 +4,8 @@ MainWindow - first button file - Premier fichier de bouton + Premier fichier de bouton Enter the URL to download the first buttons file @@ -21,25 +20,25 @@ 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 @@ -52,7 +51,7 @@ &Départ - + Ctrl+S File|Start Ctrl+D @@ -62,7 +61,7 @@ &Retour - + Ctrl+B File|Back Ctrl+R @@ -73,25 +72,25 @@ Voir/Cacher le menu - + sendRAW File|SendRAW Envoyer les données - + Reset RAW File|resetRAW Réinitialiser les donnés - + Ctrl+E File|Reset Ctrl+E - + &Quit File|Quit &Quitter @@ -111,7 +110,7 @@ Envoyer les données - + Ctrl+L File|Upload Ctrl+L @@ -131,7 +130,7 @@ &Quitter - + Ctrl+Q File|Quit Ctrl+Q @@ -172,223 +171,289 @@ Voir/Cacher le menu - + Enter the URL to download the init file Entrez l'URL pour téléchargez le fichier d'initialisation - + + init file + fichier d'initialisation + + + + action + box title to debug action + action + + + Variable's name ? text to ask value's name before changing it (set) Nom de la variable - - + + Error title if action("set") has too much value Erreur - - + + Too much value in button's action text if action("set") has too much value Trop de mots dans l'action du bouton - + variable text change title to warn about variable content change changement du contenu de la variable - - + + value of Valeur de - - + + Variable's name ? text to ask value's name before changing it (setint) Nom de la variable ? - + variable integer change title to warn about variable content change changement de valeur - + Value of Valeur de - + choice title of box who ask multiple choice Choix - + Please choose an action. text to ask multiple choice Choisissez une action - + variable file change title to warn about variable content change changement de valeur - + Error title if action("edit") has too much value Erreur - + Too much value in button's action text if action("edit") has too much value Trop de mots dans l'action du bouton - + URL title to download a custom file from URL Source - + Enter the URL of the file label to download a custom file Entrez l'URL des données - - + + File title to write a file downloaded from URL Fichier - - + + Enter the name of the file label to write the downloaded data Entrez le nom du fichier - + Error title of box if action("read" has too much (or too "less") value Erreur - + Bad number of value text of box if action("read") has too much (or too "less") value Mauvais "nombre" de mot - + &File top menu &Fichier - + &Start File|Start &Départ - + &Back File|Back &Retour - + Ctrl+T File|View menu Ctrl+M - + &View/Hide menu File|View/Hide menu Voir/Cacher le menu - + + &Button + top menu + Boutons + + + + &Download + Button|Downlad + &Téléchargement + + + + Ctrl+W + Button|Downlad + Ctrl+D + + + + A&dd + Button|Add + Nouveau + + + + Ctrl+D + Button|Add + Ctrl+J + + + + Sa&v + Button|Sav + Sauvegardez + + + + Ctrl+V + Button|Save + Ctrl+V + + + + Reset + Button|Reset + Remise à zéro + + + + Ctrl+Z + Button|Reset + Ctrl+Z + + + + &Edit + Button|Edit + Edition + + + + Ctrl+E + Button|&Edit + Ctrl+E + + &Data top menu - Données + Données - &Download Data|Downlad - &Téléchargement + &Téléchargement - Ctrl+W Data|Downlad - Ctrl+T + Ctrl+T - A&dd Data|Add - Nouveau + Nouveau - Ctrl+D Data|Add - Nouveau + Nouveau - Sa&v Data|Sav - Sauvegardez + Sauvegardez - Ctrl+V Data|Save - Ctrl+V + Ctrl+V - Reset Data|Reset - Remise à zéro + Remise à zéro - Ctrl+Z Data|Reset - Ctrl+Z + Ctrl+Z - &Edit Data|Edit - Edition + Edition - Ctrl+E Data|&Edit - Ctrl+E + Ctrl+E &Download @@ -416,55 +481,67 @@ Editer - + &Hack top menu &Hack - + New entry Hack|Entry Nouvelle entrée - + Action Hack|Action Action - + About Qt Hack|About Qt A propos de Qt - + upload pop-up title when data has been sent Envoie - + + action + box title to debug insert + action + + + + key + box title to debug remove + clé + + + tmp URL Title of box where ask for button file's URL URL temporaire - + Enter URL Label of box where ask for button file's URL Entrez l'URL - + action Title of box where ask for a custom action action - + Enter your action Label of box where ask for custom action Entrez votre action @@ -474,7 +551,7 @@ Aide - + New entry Nouvelle entrée @@ -487,7 +564,7 @@ A propos de Qt - + ctrl+H Help|About Qt Ctrl+A @@ -497,54 +574,54 @@ C&réer une base de donné - + Ctrl+R Help|CreateDB Ctrl+R - + C&reate Database Hack|Create C&réer une base de donné - + Download sql Hack|download sql Télécharger un fichier sql - + 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 @@ -591,65 +668,65 @@ chooseButtonDB - + Enter the keyword : Entrez le mot-clé : - + chooseDB choisirBD - + 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 : @@ -660,37 +737,38 @@ uploadDB - + Uisent pop-up title when buttons has been sent Envoyé - - savbuttons finish + + sav finish + 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 written fichier - + File written : Fichier écrit : diff --git a/mainwindow.cpp b/mainwindow.cpp index 1be1a52..ebacc37 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -68,8 +68,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) qDebug()<<"second"; bool ok; QString ser=QInputDialog::getText(this, trUtf8("init file"), trUtf8("Enter the URL to download the init file"), QLineEdit::Normal, conf->value(QString("init")).toString(), &ok); - if((ok)&&(ser!=""))conf->setValue(QString("init"), ser); - else qApp->quit(); + conf->setValue(QString("init"), ser); downSQL(ser); conf->setValue(QString("first"), 2); }; @@ -232,7 +231,7 @@ void MainWindow::action(const QString &a){ int e; if(bs>1)e=b[2].toInt(&ok); else e=1; - for(int bcl=0;bcladdAction(trUtf8("Reset RAW", "File|resetRAW"), this, SLOT(resetRAW()), QKeySequence(trUtf8("Ctrl+E", "File|Reset"))); FileMenu->addAction(trUtf8("&Quit", "File|Quit"), this, SLOT(quit()),QKeySequence(trUtf8("Ctrl+Q", "File|Quit"))); menuBar()->addMenu(FileMenu); - EditMenu=new QMenu(trUtf8("&Data", "top menu")); - EditMenu->addAction(trUtf8("&Download", "Data|Downlad"), this, SLOT(downloadData()),QKeySequence(trUtf8("Ctrl+W", "Data|Downlad"))); - EditMenu->addAction(trUtf8("A&dd", "Data|Add"), this, SLOT(addDB()), QKeySequence(trUtf8("Ctrl+D", "Data|Add"))); - EditMenu->addAction(trUtf8("Sa&v", "Data|Sav"), this, SLOT(savData()), QKeySequence(trUtf8("Ctrl+V", "Data|Save"))); - EditMenu->addAction(trUtf8("Reset", "Data|Reset"), this, SLOT(reset()), QKeySequence(trUtf8("Ctrl+Z", "Data|Reset"))); - EditMenu->addAction(trUtf8("&Edit", "Data|Edit"), this, SLOT(chooseDB()), QKeySequence(trUtf8("Ctrl+E", "Data|&Edit"))); + EditMenu=new QMenu(trUtf8("&Button", "top menu")); + EditMenu->addAction(trUtf8("&Download", "Button|Downlad"), this, SLOT(downloadData()),QKeySequence(trUtf8("Ctrl+W", "Button|Downlad"))); + EditMenu->addAction(trUtf8("A&dd", "Button|Add"), this, SLOT(addDB()), QKeySequence(trUtf8("Ctrl+D", "Button|Add"))); + EditMenu->addAction(trUtf8("Sa&v", "Button|Sav"), this, SLOT(savData()), QKeySequence(trUtf8("Ctrl+V", "Button|Save"))); + EditMenu->addAction(trUtf8("Reset", "Button|Reset"), this, SLOT(reset()), QKeySequence(trUtf8("Ctrl+Z", "Button|Reset"))); + EditMenu->addAction(trUtf8("&Edit", "Button|Edit"), this, SLOT(chooseDB()), QKeySequence(trUtf8("Ctrl+E", "Button|&Edit"))); menuBar()->addMenu(EditMenu); HackMenu=new QMenu(trUtf8("&Hack", "top menu")); HackMenu->addAction(trUtf8("New entry", "Hack|Entry"), this, SLOT(entry())); @@ -470,8 +469,8 @@ void MainWindow::firstrun(){ conf->setValue(QString("maxline"), QVariant(3)); conf->setValue(QString("SQLsettings"), QVariant("connect_timeout=10000")); conf->setValue(QString("button"), QVariant("background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;")); - conf->setValue(QString("buttonbefore"), QVariant("border-style: outset")); - conf->setValue(QString("buttonafter"), QVariant("border-style: inset")); + conf->setValue(QString("buttonbefore"), QVariant("outset")); + conf->setValue(QString("buttonafter"), QVariant("inset")); conf->setValue(QString("menu"), QVariant(0)); conf->setValue(QString("download"), QVariant("http://www.nothing2do.eu/"+conf->value(QString("filebuttons")).toString())); conf->setValue(QString("init"), QVariant("http://www.nothing2do.eu/init")); @@ -486,7 +485,7 @@ void MainWindow::firstrun(){ conf->setValue(QString("selectraw"), QVariant("select date,texte from raw order by date;")); conf->setValue(QString("menuback"), QVariant("-menuback")); conf->setValue(QString("choosebuttons"), QVariant("select id,label from ui where keyword like ? order by label;")); - conf->setValue(QString("addbuttons"), QVariant("insert into ui (label, keyword, action) values (:label, :keyword, :action)")); + conf->setValue(QString("addbuttons"), QVariant("insert into ui (keyword, label, action) values (:keyword, :label, :action)")); conf->setValue(QString("getbuttons"), QVariant("select label,action from ui where keyword like ? order by label;")); conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from ui where id=?;")); conf->setValue(QString("updatebuttons"), QVariant("update ui set keyword=?, label=?, action=? where id=?;")); @@ -499,7 +498,7 @@ void MainWindow::firstrun(){ conf->setValue(QString("saychange"), QVariant(0)); conf->setValue(QString("sepcmd"), QVariant("!@!")); conf->setValue(QString("sepchc"), QVariant("!#!")); - conf->setValue(QString("sepraw"), QVariant(" ")); + conf->setValue(QString("sepcolraw"), QVariant(" ")); conf->setValue(QString("sepcolbuttons"), QVariant("$")); conf->setValue(QString("sqlval"), QVariant("?")); conf->setValue(QString("always"), QVariant("+always")); @@ -670,12 +669,13 @@ void MainWindow::writeData(){ conf->setValue(QString("lastdownload"), QDateTime::currentDateTime().toString(Qt::ISODate)); } void MainWindow::sendRAW(){ - //send(QString("raw")) + //sav(QString("raw")) exec(QList ({conf->value(QString("selectraw")).toString()})); QFile a(conf->value(QString("fileraw")).toString()); a.open(QIODevice::WriteOnly|QIODevice::Text); QTextStream b(&a); - int c=conf->value(QString("columnraw")).toInt()-1; + //int c=conf->value(QString("columnraw")).toInt()-1; + int c=q->record().count()-1; QString sep=conf->value(QString("sepraw")).toString(); while (q->next()) { for (int i=0; i({"delete from "+a+";"})); @@ -854,39 +854,42 @@ void MainWindow::insert(const QString & a, const QString & keyword, const QStrin tmp.append(action); exec(tmp); q->first(); - int count=0; - QString key=keyword, id=q->value(0).toString(); + //int count=0; + QString key=q->value(1).toString(); + QVariant id=q->value(0); while(q->next()){ - count++; - key=q->value(1).toString()+" "+key; + //count++; + key+=" "+q->value(1).toString(); } - if(count==0)exec(QList({conf->value(QString("add")+a).toString(), label, key, action})); - else{exec(QList({conf->value(QString("update")+a).toString(), key, label, action, id})); + if(!key.contains(keyword))key+=keyword;// it is possible to have 2 buttons with same label and action ? I've sayd "no" + if(deb)QMessageBox::information(this, trUtf8("action", "box title to debug insert"), QString("insert : key="+key+" label="+label+" action="+action)); + if(!id.isValid())exec(QList({conf->value(QString("add")+a).toString(), key, label, action})); + else{exec(QList({conf->value(QString("update")+a).toString(), key, label, action, id.toString()})); + }; - } } void MainWindow::remove(const QString & a, const QString & keyword, const QString & label, const QString & action){ - qDebug()<<"remove : a="<({conf->value(QString("delete")+a).toString(), id})); + if(deb)QMessageBox::information(this, trUtf8("key", "box title to debug remove"), QString("remove : id="+id.toString()+" key="+key+" label="+label+" action="+action)); + if(key==QString(" ").repeated(key.size()))exec(QList({conf->value(QString("delete")+a).toString(), id.toString()})); else{ - exec(QList({conf->value(QString("updatebuttons")).toString(), key, label, action, id})); + exec(QList({conf->value(QString("update")+a).toString(), key, label, action, id.toString()})); } } void MainWindow::writeTr(){ diff --git a/mainwindow.h b/mainwindow.h index 8e2afd6..d2c95e9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -204,9 +204,7 @@ private: QSettings *conf; QString tmp, tmp2, file, lastprint;//host, user, tmp, password, servercert,database; QMenu *FileMenu, *EditMenu, *HackMenu; - //unsigned short int port;// j'ai lu les docs sur internet et 0<="unsigned short int"<65536 QSignalMapper *signalmap; - //QMap widget; QList way; QSqlDatabase db; QSqlQuery *q, *qq; @@ -215,7 +213,7 @@ private: QNetworkAccessManager *net; QNetworkReply * rep; bool orientation;//0=portrait 1=paysage (size.width() > size.height()) - bool deb; + unsigned short int deb; QVideoWidget * videoWidget; }; -- 2.45.1