]> git.nothing2do.fr Git - diary-mobile.git/commitdiff
Qt 5.13 has some cosmetic change
authorNothing2Do.fr <norbert.moutarde@nothing2do.fr>
Wed, 14 Aug 2019 23:07:32 +0000 (01:07 +0200)
committerNothing2Do.fr <norbert.moutarde@nothing2do.eu>
Wed, 14 Aug 2019 23:07:32 +0000 (01:07 +0200)
mainwindow.cpp
mainwindow.h

index 6cb158db595314bafa2d03cb525f11b89c82ba42..029fe46a8b0be87d8fb1b79b00ac96fb6d8b6741 100644 (file)
@@ -239,7 +239,7 @@ void MainWindow::action(const QString &a){
         if(bs==1){
             d=QInputDialog::getText(this, "setInt", tr("Variable's name ?", "text to ask value's name before changing it (setint)"), QLineEdit::Normal, QString(""), &ok);
             if(!ok)return;
-            e=QInputDialog::getInt(this, "setInt", d, QLineEdit::Normal, conf->value(d).toInt(), &ok);
+            e=QInputDialog::getInt(this, "setInt", d, QLineEdit::Normal, conf->value(d).toInt(), *&ok);
             if(!ok)return;
         }else if(bs==2){
             d=b[1];
@@ -299,7 +299,7 @@ void MainWindow::action(const QString &a){
         int max=conf->value(QString("maxcolumn")).toInt()*conf->value(QString("maxline")).toInt();
         if(!page)tmp=q->seek(0);
         else tmp=q->seek(page*(max-2));
-        if(deb)QMessageBox::information(this, tr("result", "box title to debug prevpage"), int(tmp));
+        //if(deb)QMessageBox::information(this, tr("result", "box title to debug prevpage"), int(tmp));
         printItem(*q);
 
     }
@@ -411,7 +411,8 @@ void MainWindow::action(const QString &a){
         for(int i=0; i<way.size(); i++){
             wi=way[i];
             addWidget(wi, new CLabel(wi, *conf));
-            addWidget(QString("rm %1").arg(i), new CLabel(QString("del"), *conf));
+            QString tmp(i);
+            addWidget(tmp, new CLabel(QString("del"), *conf));
 
         }
     }
@@ -468,13 +469,15 @@ void MainWindow::action(const QString &a){
             if(b[1]==QString("list")){
                 flush(); 
                 for(int a=0;a<valeur->size();a++){
-                    addWidget(QString("box "+tmpvalues[a]+"#"), new CLabel(tmpkeys[a], *conf));
+                    QString tmp("box "+tmpvalues[a]+"#");
+                    addWidget(tmp, new CLabel(tmpkeys[a], *conf));
                     //if(deb)QMessageBox::information(this, QString("val"), QString(tmpkeys[a]+"=="+tmpvalues[a]));
                 }
             }else if(b[1]==QString("edit")){
                 flush();
                 for(int a=0;a<valeur->size();a++){
-                    addWidget(QString("val "+tmpkeys[a]+"#"), new CLabel(tmpkeys[a], *conf));
+                    QString tmp("val "+tmpkeys[a]+"#");
+                    addWidget(tmp, new CLabel(tmpkeys[a], *conf));
                     //if(deb)QMessageBox::information(this, QString("val"), QString(tmpkeys[a]+"=="+tmpvalues[a]));
                 }
             }else if(bs==2){
@@ -672,19 +675,19 @@ void MainWindow::firstrun(){
     conf->setValue(QString("start"), QVariant("begin"));
     conf->setValue(QString("restore"), QVariant("http://www.abc.de/db"));
     conf->setValue(QString("db"), QVariant("/data/data/fr.nothing2do.diarymobile/files/db"));
-    conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from buttons order by id;"));
-    conf->setValue(QString("sqlbuttons"), QVariant("INSERT INTO buttons (keyword,label,action) VALUES(?,?,?);"));
-    conf->setValue(QString("selectraw"), QVariant("select date,texte from raw order by date;"));
+    conf->setValue(QString("selectbuttons"), QVariant("select keyword,label,action from buttons order by id"));
+    conf->setValue(QString("sqlbuttons"), QVariant("INSERT INTO buttons (keyword,label,action) VALUES(?,?,?)"));
+    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 buttons where keyword like ? order by label;"));
+    conf->setValue(QString("choosebuttons"), QVariant("select id,label from buttons where keyword like ? order by label"));
     conf->setValue(QString("addbuttons"), QVariant("insert into buttons (keyword, label, action) values (:keyword, :label, :action)"));
-    conf->setValue(QString("addraw"), QVariant("INSERT INTO raw (date, texte) VALUES (:date, :txt);"));
-    conf->setValue(QString("getbuttons"), QVariant("select label,action,id from buttons where keyword like ? order by label;"));
-    conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from buttons where id=?;"));
-    conf->setValue(QString("updatebuttons"), QVariant("update buttons set keyword=?, label=?, action=? where id=?;"));
+    conf->setValue(QString("addraw"), QVariant("INSERT INTO raw (date, texte) VALUES (:date, :txt)"));
+    conf->setValue(QString("getbuttons"), QVariant("select label,action,id from buttons where keyword like ? order by label"));
+    conf->setValue(QString("editbuttons"), QVariant("select id,keyword,label,action from buttons where id=?"));
+    conf->setValue(QString("updatebuttons"), QVariant("update buttons set keyword=?, label=?, action=? where id=?"));
     conf->setValue(QString("deletebuttons"), QVariant("delete from buttons where id=?"));
-    conf->setValue(QString("testbuttons"), QVariant("select id,keyword from buttons where label=? and action=?;"));
-    conf->setValue(QString("changekeyword"), QVariant("select keyword,label,action,id from buttons where keyword like ?;"));
+    conf->setValue(QString("testbuttons"), QVariant("select id,keyword from buttons where label=? and action=?"));
+    conf->setValue(QString("changekeyword"), QVariant("select keyword,label,action,id from buttons where keyword like ?"));
     conf->setValue(QString("volumdown"), QVariant("back"));
     conf->setValue(QString("volumup"), QVariant("begin"));
     conf->setValue(QString("askkeyword"), QVariant(0));
@@ -710,10 +713,10 @@ QString MainWindow::get2(int column){
     return qq->value(column).toString();
 }
 int MainWindow::exec(const QList<QString> & a){
-    qDebug()<<"exec("<<a[0]<<") size="<<a.size()<<", q->prepare: "<<q->prepare(a[0]);
+    qDebug()<<"exec("<<a[0]<<") size="<<a.size()<<", q->prepare: "<<q->prepare(a.at(0));
     for (int j=1; j<a.size(); j++){
-        q->bindValue(j-1, a[j]);
-        qDebug()<<"bind "<<j-1<<" and"<<a[j];
+        q->bindValue(j-1, a.at(j));
+        qDebug()<<"bind "<<j-1<<" and "<<a.at(j);
     }
     qDebug()<<"exec():"<<q->exec();
     QSqlError b=q->lastError();
@@ -825,7 +828,7 @@ void MainWindow::chooseDB(const QString & b){
     QString c="%"+b+"%", a="buttons";
     qDebug()<<"exec()="<<exec(QList<QString>({conf->value(QString("choose"+a)).toString(), c}));
     while (q->next()) {
-        const QString action="edit "+q->value(0).toString();
+        QString action="edit "+q->value(0).toString();
         addWidget(action, new CLabel(q->value(1).toString(), *conf));
     }
 }
@@ -835,7 +838,7 @@ void MainWindow::chooseDB(const QString & a,const QString & b){
     qDebug()<<"exec()="<<exec(QList<QString>({conf->value(QString("choose"+a)).toString(), c}));
 
     while (q->next()) {
-        const QString action="edit "+q->value(0).toString();
+        QString action="edit "+q->value(0).toString();
         addWidget(action, new CLabel(q->value(1).toString(), *conf));
     }
 }
@@ -1304,25 +1307,30 @@ void MainWindow::reset(){
     QList<QString> b({"delete from buttons;"});
     exec(b);
 }
-bool MainWindow::printItem(const QSqlQuery & a){
+bool MainWindow::printItem(QSqlQuery & a){
     int labCol = 0;//r.indexOf("label");
     int actCol = 1;//r.indexOf("action");
     int idcol = 2;//r.indexOf("id");
     int i=0;
     qDebug()<<"printItem()";
     if(page){
-        addWidget(QString("prevpage"), new CLabel(tr("Prev"), *conf));
+        QString tmp("prevpage");
+        addWidget(tmp, new CLabel(tr("Prev"), *conf));
 
     };
+    bool t;
     do{
         int tmp=0;
-        if(a.isValid())tmp=addWidget(a.value(actCol).toString(), new CLabel(a.value(labCol).toString(), *conf, a.value(idcol).toInt()));
+        QString tmp4=a.value(actCol).toString();
+        if(a.isValid())tmp=addWidget(tmp4, new CLabel(a.value(labCol).toString(), *conf, a.value(idcol).toInt()));
         if(tmp==1){
-            addWidget(QString("nextpage"), new CLabel(tr("Next"), *conf));
+            QString tmp3("nextpage");
+            addWidget(tmp3, new CLabel(tr("Next"), *conf));
             return 1;
         };
         i++;
-    }while(a.next());
+        t=a.next();
+    }while(t);
     qDebug()<<"end printItem : "<<i<<" button(s) way.size()"<<way.size()<<" page : "<<page;
     //showExpanded();
     return 0;
index b281cb4e6e83e636264ff831a13193cd5533b600..7e9487d166c261afbcb74fdb171886ddddb77686 100644 (file)
@@ -181,7 +181,7 @@ private slots:
     void download(const QString &);
     void download(const QString &,const QString &);
     void use(const QString &);
-    bool printItem(const QSqlQuery &);
+    bool printItem(QSqlQuery &);
     //void shellReady();a desperated attempt to get the output of my cmd, i've try Qprocess (but don't get it)
 public slots:
 signals: