}
void MainWindow::start(){
flush();
- QString t("begin");
- getButtons(t);
-
-
-
-
+ getButtons(QString("begin"));
}
MainWindow::~MainWindow()
{
}
void MainWindow::action(const QString & a){
qDebug()<<"action("<<a<<")";
- int b=0;
-
flush();
-
if (a=="host")choosehost();
else if (a=="port")chooseport();
else if (a=="user")chooseuser();
else if (a=="password")choosepass();
else if (a=="file")choosefile();
else getButtons(a);
-
-
- //qDebug()<<"action() end";
-
-
}
void MainWindow::createMenuBar(){
FileMenu=new QMenu(QString("&File"), this);
setStyleSheet("background-color: red;border-style: outset;border-width: 7px;border-radius: 10px;border-color: beige;font: bold 10px;padding: 6px;");
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-
}
CLabel::~CLabel()
{
void MainWindow::connectDB(){
db = QSqlDatabase::addDatabase("QSQLITE");
//db = QSqlDatabase::addDatabase("QPSQL");
- //db.setHostName(host); useless with SQLite
+ db.setHostName(host);
db.setDatabaseName(database);
- //db.setUserName(user); useless
- //db.setPassword(password); same
- //db.setConnectOptions(QString("requiressl=1 connect_timeout=10000"));//10sec, useless
- qDebug()<<"db.open() ? "<<db.open()<< ". sqlite file : "<<db.databaseName();
+ db.setUserName(user);
+ db.setPassword(password);
+ db.setConnectOptions(QString("requiressl=1 connect_timeout=10000"));//10sec,
+ qDebug()<<"db.open() ? "<<db.open()<< ". database : "<<db.databaseName();
q=new QSqlQuery(db);
return tmp;
}
int MainWindow::exec(const QString & a){
- qDebug()<<"exec("<<a<<")";
- q->prepare(a);// make it
- q->exec();// do it
+ //qDebug()<<"exec("<<a<<")";
+ q->prepare(a);
+ q->exec();
QSqlError b=q->lastError();
if (b.isValid())qDebug()<<"SQL error->exec() :"<<b.text();
return q->size();
-insert into ui (keyword, label, action) values ('begin', 'chat', 'select texte from raw')
+INSERT INTO ui VALUES('begin','fille','fille');
+INSERT INTO ui VALUES('fille','aurelie','f-aurelie');
+INSERT INTO ui VALUES('f-aurelie','discours','f-a-discours');
+INSERT INTO ui VALUES('f-a-discours','discours un peu plus long que la moyenne pour voir se qui va se passer','begin');
+INSERT INTO ui VALUES('fille','audrey','f-audrey');
+INSERT INTO ui VALUES('f-audrey','elle se moque de moi, méchante ;-)','begin');