From b30278b7d9e3a0a872cc2206ffbefe2cc63cc9b0 Mon Sep 17 00:00:00 2001 From: Norbert Moutarde Date: Tue, 10 Jun 2014 23:39:22 +0200 Subject: [PATCH] sav(qstring) is finish (i think) ! --- mainwindow.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 73edc18..24636b0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -221,8 +221,8 @@ void MainWindow::action(const QString &a){ 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("send")){ - if(bs==2)send(b[1]); + else if(b[0]==QString("sav")){ + if(bs==2)send(c); } else if(b[0]==QString("back")){ if(way.size()>=2){ @@ -260,14 +260,14 @@ void MainWindow::action(const QString &a){ else if(b[0]==QString("sql")){ int value=c.count(conf->value(QString("sqlval")).toString()); QList cmd({c}); - if (value){ + //if (value){ for(int d=1; d<=value; d++){ bool ok; QString e=QInputDialog::getText(this, trUtf8("set"), c+" : "+d, QLineEdit::Normal, QString(""), &ok); if(ok)cmd.append(e); else break;// in case of break, exec complain about cmd size } - } + //} exec(cmd); } else if(b[0]==QString("edit")){ @@ -323,7 +323,7 @@ void MainWindow::action(const QString &a){ lastprint=QString("hist"); for(int i=0; ivalue(QString("button")).toString())); + addWidget(wi, new CLabel(wi, conf->value(QString("button")).toString())); addWidget(QString("rm %1").arg(i), new CLabel(QString("del"), conf->value(QString("button")).toString())); } @@ -424,11 +424,11 @@ void MainWindow::debug(int col){ void MainWindow::connectDB(){ db = QSqlDatabase::addDatabase("QSQLITE"); //db = QSqlDatabase::addDatabase("QPSQL"); - db.setHostName(conf->value(QString("host"), QVariant("127.0.0.1")).toString()); - db.setDatabaseName(conf->value(QString("database"), QVariant("db")).toString()); - db.setUserName(conf->value(QString("user"), QVariant("user")).toString()); - db.setPassword(conf->value(QString("password"), QVariant("pass")).toString()); - db.setConnectOptions(conf->value(QString("SQLsettings"), QVariant("connect_timeout=10000")).toString());//10sec, + db.setHostName(conf->value(QString("host")).toString()); + db.setDatabaseName(conf->value(QString("database")).toString()); + db.setUserName(conf->value(QString("user")).toString()); + db.setPassword(conf->value(QString("password")).toString()); + db.setConnectOptions(conf->value(QString("SQLsettings")).toString());//10sec, qDebug()<<"db.open() ? "<setValue(QString("saychange"), QVariant(0)); conf->setValue(QString("sepcmd"), QVariant("!@!")); conf->setValue(QString("sepchc"), QVariant("!#!")); + conf->setValue(QString("sepraw"), QVariant(" ")); + conf->setValue(QString("sepbuttons"), QVariant("$")); conf->setValue(QString("sqlval"), QVariant("?")); conf->setValue(QString("always"), QVariant("+always")); qDebug()<<"firstrun() finished"; @@ -625,11 +627,12 @@ void MainWindow::sendRAW(){ a.open(QIODevice::WriteOnly|QIODevice::Text); QTextStream b(&a); int c=conf->value(QString("columnraw")).toInt()-1; + QString sep=conf->value(QString("sepraw")).toString(); while (q->next()) { for (int i=0; ivalue(i).toString()<<" "; + b<value(i).toString()<value(1).toString()<<"\n"; + b<value(c).toString()<<"\n"; } a.close(); qDebug()<<"a.open()="<value(QString("columnbuttons")).toInt()-1; + QString sep=conf->value(QString("sepbuttons")).toString(); qDebug()<<"c="<value("firstline").toString()<<"\n"; while (q->next()) { for (int i=0; ivalue(i).toString()<<"$"; + b<value(i).toString()<value(2).toString()<<"\n"; } @@ -891,7 +895,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) conf->setValue(QString("maxline"), a); orientation=isLandscape; flush(); - action(lastprint); + action("-"+lastprint); } } @@ -915,10 +919,11 @@ void MainWindow::send(const QString & a){ QTextStream b(&tmp); t="column"+a; int c=conf->value(t).toInt()-1; - + t="sep"+a; + QString sep=conf->value(t).toString(); while (q->next()) { for (int i=0; ivalue(i).toString()<<" "; + b<value(i).toString()<value(1).toString()<<"\n"; } -- 2.45.1