start();
}
void MainWindow::start(){
- flush();
way.clear();
getButtons("begin");
}
void MainWindow::quit(){
qDebug()<<"quit()";
conf->setValue(QString("menu"), menuBar()->isVisible());
- conf->sync();
+ //conf->sync();
db.commit();
db.close();
qApp->quit();
}
void MainWindow::action(const QString &a){
qDebug()<<"action("<<a<<")";
-
- flush();
if (a.split(QString(" "))[0]==QString("set")){
conf->setValue(QString(a.split(QString(" "))[1]), a.split(QString(" "))[2]);
getButtons(way.last());
getButtons(way.last());
}
else if(a.split(QString(" "))[0]==QString("setint")){
- conf->setValue(a.split(QString(" "))[1], QInputDialog::getInt(this, "setInt", a.split(QString(" "))[2] , conf->value(QString(a.split(QString(" "))[3])).toInt()));
+ conf->setValue(a.split(QString(" "))[1], QInputDialog::getInt(this, "setInt", a.split(QString(" "))[2] , conf->value(QString(a.split(QString(" "))[1])).toInt()));
getButtons(way.last());
}
else if(a.split(QString(" "))[0]=="new"){
}
//widget.clear();
}
-CLabel::CLabel( const QString& text, QWidget * parent ) : QLabel(parent)
+CLabel::CLabel( const QString& text, const QString & style, QWidget * parent ) : QLabel(parent)
{
setText(text);
setWordWrap(true);
setLineWidth(5);
- setStyleSheet("background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;");
+ setStyleSheet(style);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setScaledContents(1);
}
}
void MainWindow::entry(const QString &a){
QString time=QDateTime::currentDateTime().toString(QString("yyyy-MM-dd hh:mm:ss")), entry="";
- entry=QInputDialog::getText(this, QString("nouvelle entrée"), time, QLineEdit::Normal, a);
- if(entry=="")
- getButtons(way.last());
+ bool ok=0;
+ entry=QInputDialog::getText(this, QString("nouvelle entrée"), time, QLineEdit::Normal, a, &ok);
+ if((entry=="")||(ok==0))getButtons(way.last());
QString c=time+" "+entry;
QFile fichier(conf->value(QString("file")).toString());
fichier.open(QIODevice::Append | QIODevice::Text);
QTextStream flux(&fichier);
flux << c << endl;
fichier.close();
- qDebug()<<"content added into file : "<<a;
QList<QString> d({"INSERT INTO raw (date, texte) VALUES (:date, :txt);"});
d.append(time);
d.append(entry);
cmd.append(view);
cmd.append(key);
cmd.append(action);
- flush();
- getButtons(way.last());
+ exec(cmd);
+ getButtons(way[way.size()-1]);
}
void MainWindow::getButtons(const QString &a){
- qDebug()<<"getButtons()";
- QList<QString> tmp({"select label,action from ui where keyword like :word;", a});;
+ qDebug()<<"getButtons("<<a<<")";
+ flush();
+ QList<QString> tmp({"select label,action from ui where keyword like :word;"});;
label->setText(QString::number(way.size()));
way.append(a);
+ tmp.append(a);
exec(tmp);
int labCol = 0;//r.indexOf("label");
int actCol = 1;//r.indexOf("action");
bool ok;
int a=QInputDialog::getInt(this, QString("back()"), QString("Quel page ?"), way.size()-2, 0, way.size()-2, 1, &ok);
if(ok){
- flush();
getButtons(way[a]);
qDebug()<<"retour : "<<a;
}else return;
return m_DownloadedData;
}
void MainWindow::writeUpdate(){
- qDebug()<<"downloaded :"<<m->downloadedData();
+ qDebug()<<"downloaded : "<<m->downloadedData().size()<<" byte";
/* put newly downloaded sql file into database */
-
+ //int nb=m->downloadedData().count(";");
+ int a=m->downloadedData().count(';');
+ for(int i=0; i<a; i++){
+ qDebug()<<"q->prepare("<<i<<") : "<< q->prepare(m->downloadedData().split(';').at(i));
+ q->exec();
+ }
}
INSERT INTO "ui" (keyword, label, action) VALUES('fill-aurelie','discours','f-a-discours');
INSERT INTO "ui" (keyword, label, action) VALUES('fill-aureli-discours','discours un peu plus long que la moyenne pour voir se qui va se passer','begin');
INSERT INTO "ui" (keyword, label, action) VALUES('fille','audrey','f-audrey');
-INSERT INTO "ui" (keyword, label, action) VALUES('fill-audrey','elle se moque de moi, méchante ;-)','begin');
+INSERT INTO "ui" (keyword, label, action) VALUES('fill-audrey','elle se moque de moi, méchante %-)','begin');
INSERT INTO "ui" (keyword, label, action) VALUES('begin','lieu','lieu');
INSERT INTO "ui" (keyword, label, action) VALUES('lieu','odysseum','lie-odysseum');
INSERT INTO "ui" (keyword, label, action) VALUES('lie-odysseum','subway','lieu-odysseu-subway');
INSERT INTO "ui" (keyword, label, action) VALUES('begi-olive-audre-perver','"On ne te prends pas pour un perver."','begi-olive-audre-perve-non');
INSERT INTO "ui" (keyword, label, action) VALUES('begi-olive-audre-perve-non','Pourquoi vous refusez qu''on se voit hors d''ici alors ?','begi-olive-audre-perve-non-hors');
INSERT INTO "ui" (keyword, label, action) VALUES('begin','config','config');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','max column','setint maxc maxcolumn 3');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','host','settext host 127.0.0.1');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','port','setint port port 5432');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','user','settext user root');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','max column','setint maxc');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','host','settext host ');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','port','setint port');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','user','settext user');
INSERT INTO "ui" (keyword, label, action) VALUES('config','password','settext pass');
INSERT INTO "ui" (keyword, label, action) VALUES('config','database','settext db');
INSERT INTO "ui" (keyword, label, action) VALUES('config','filesave','settext file');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','SQLsettings', 'settext SQLsettings requiressl=1 connect_timeout=10000');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','button', 'settext button background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 15px;padding: 6px;');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','fichier SQL', 'settext sqlfile ui.sql');
-INSERT INTO "ui" (keyword, label, action) VALUES('config','getSQL', 'settext getsql wget --no-check-certificate https://github.com/Nothing2Do/diary-mobile-android/raw/master/ui.sql');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','SQLsettings', 'settext SQLsettings');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','button', 'settext button');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','fichier SQL', 'settext sqlfile');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','getSQL', 'settext getsql');
+INSERT INTO "ui" (keyword, label, action) VALUES('config','update', 'settext update');
COMMIT;